PHP Class ProtectedFile

The followings are the available columns in table 'protected_file':
Inheritance: extends BaseActiveRecordVersioned
Afficher le fichier Open project: openeyes/openeyes Class Usage Examples

Protected Properties

Свойство Type Description
$_source_path used in model creation
$_stored_path used in model delete
$_thumbnail

Méthodes publiques

Méthode Description
afterDelete ( ) ensures file is removed from filesystem when deleting.
beforeDelete ( ) : boolean ensure we keep track of path to file before deleting from database.
beforeSave ( ) (non-PHPdoc).
beforeValidate ( ) ensures that mimetype and size are set based on the file that's been stored (unless the file is being copied from elsewhere, in which case this should have been taken care of).
createForWriting ( string $name ) : ProtectedFile create a new protected file object which has properties that can be used for writing an actual file to.
createFromFile ( string $path ) : ProtectedFile Create a new protected file from an existing file.
generateUID ( ) generate the UID for the file from the file name.
getBasePath ( ) : string Path to protected file storage.
getDownloadURL ( ) : string get URL for downloading this file.
getFilePath ( ) : string Path to file without filename.
getPath ( ) : string Path to file.
getThumbnail ( string $dimensions, $regenerate = false ) : boolean | array: Get thumbnail of image (generated automatically if not already created).
hasThumbnail ( ) : boolean Has the file got a thumbnail.
model ( $className = __CLASS__ ) : ProtectedFile Returns the static model of the specified AR class.
relations ( ) : array
rules ( ) : array
setSource ( string $path ) Initialise protected file from a source file.
tableName ( ) : string

Méthodes protégées

Méthode Description
generateThumbnail ( string $dimensions ) : boolean Generate a thumbnail.
getThumbnailPath ( string $dimensions ) : string Get the path for a thumbnail.
lookupMimetype ( string $path ) : string Get the mime type of the file.

Method Details

afterDelete() public méthode

ensures file is removed from filesystem when deleting.
public afterDelete ( )

beforeDelete() public méthode

ensure we keep track of path to file before deleting from database.
See also: BaseActiveRecord::beforeDelete()
public beforeDelete ( ) : boolean
Résultat boolean (non-PHPdoc)

beforeSave() public méthode

(non-PHPdoc).
See also: BaseActiveRecord::beforeSave()
public beforeSave ( )

beforeValidate() public méthode

(non-PHPdoc)
See also: BaseActiveRecord::beforeSave()
public beforeValidate ( )

createForWriting() public static méthode

create a new protected file object which has properties that can be used for writing an actual file to.
public static createForWriting ( string $name ) : ProtectedFile
$name string
Résultat ProtectedFile

createFromFile() public static méthode

Create a new protected file from an existing file.
public static createFromFile ( string $path ) : ProtectedFile
$path string Path to file
Résultat ProtectedFile

generateThumbnail() protected méthode

Generate a thumbnail.
protected generateThumbnail ( string $dimensions ) : boolean
$dimensions string
Résultat boolean

generateUID() public méthode

generate the UID for the file from the file name.
public generateUID ( )

getBasePath() public static méthode

Path to protected file storage.
public static getBasePath ( ) : string
Résultat string

getDownloadURL() public méthode

get URL for downloading this file.
See also: ProtectedFileController::actionDownload
public getDownloadURL ( ) : string
Résultat string

getFilePath() public méthode

Path to file without filename.
public getFilePath ( ) : string
Résultat string

getPath() public méthode

Path to file.
public getPath ( ) : string
Résultat string

getThumbnail() public méthode

Get thumbnail of image (generated automatically if not already created).
public getThumbnail ( string $dimensions, $regenerate = false ) : boolean | array:
$dimensions string
Résultat boolean | array:

getThumbnailPath() protected méthode

Get the path for a thumbnail.
protected getThumbnailPath ( string $dimensions ) : string
$dimensions string
Résultat string

hasThumbnail() public méthode

Has the file got a thumbnail.
public hasThumbnail ( ) : boolean
Résultat boolean

lookupMimetype() protected méthode

Get the mime type of the file.
protected lookupMimetype ( string $path ) : string
$path string
Résultat string

model() public static méthode

Returns the static model of the specified AR class.
public static model ( $className = __CLASS__ ) : ProtectedFile
Résultat ProtectedFile the static model class

relations() public méthode

public relations ( ) : array
Résultat array relational rules.

rules() public méthode

public rules ( ) : array
Résultat array validation rules for model attributes.

setSource() public méthode

Initialise protected file from a source file.
public setSource ( string $path )
$path string

tableName() public méthode

public tableName ( ) : string
Résultat string the associated database table name

Property Details

$_source_path protected_oe property

used in model creation
protected $_source_path

$_stored_path protected_oe property

used in model delete
protected $_stored_path

$_thumbnail protected_oe property

protected $_thumbnail