ActiveRecord for table "file"
- Full name: \rkit\filemanager\models\File
- Parent class:
Set a storage
File::setStorage( \rkit\filemanager\Storage $storage ): string
Parameters:
Parameter | Type | Description |
---|---|---|
$storage |
\rkit\filemanager\Storage | The Strorage for the file |
Get a storage
File::getStorage( ): string
Generate a name
File::generateName( ): string
Checks whether the file is protected
File::isProtected( ): boolean
Checks whether the file is unprotected
File::isUnprotected( ): boolean
Checks whether the file is temp
File::isTmp( ): boolean
Get date create of file in format Ym
File::getDateOfFile( ): string
Checks whether the owner of the file
File::isOwner( integer $ownerId, integer $ownerType ): boolean
Parameters:
Parameter | Type | Description |
---|---|---|
$ownerId |
integer | The id of the owner |
$ownerType |
integer | The type of the owner |
Find all by owner
File::findAllByOwner( integer $ownerId, integer $ownerType ): array
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$ownerId |
integer | The id of the owner |
$ownerType |
integer | The type of the owner |
Find one by owner
File::findOneByOwner( integer $ownerId, integer $ownerType ): \rkit\filemanager\models\File|null
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$ownerId |
integer | The id of the owner |
$ownerType |
integer | The type of the owner |
Delete by owner
File::deleteByOwner( \rkit\filemanager\Storage $storage, integer $ownerId, integer $ownerType )
Parameters:
Parameter | Type | Description |
---|---|---|
$storage |
\rkit\filemanager\Storage | The storage of the file |
$ownerId |
integer | The id of the owner |
$ownerType |
integer | The type of the owner |
- Full name: \rkit\filemanager\behaviors\FileBehavior
- Parent class:
Get the path to the upload directory
FileBehavior::uploadDir( string $attribute ): string
Parameters:
Parameter | Type | Description |
---|---|---|
$attribute |
string | Attribute of a model |
Get the type of the owner
FileBehavior::getFileOwnerType( string $attribute ): integer
Parameters:
Parameter | Type | Description |
---|---|---|
$attribute |
string | Attribute of a model |
Get files
FileBehavior::getFiles( string $attribute ): array
Parameters:
Parameter | Type | Description |
---|---|---|
$attribute |
string | Attribute of a model |
Get the file
FileBehavior::getFile( string $attribute ): \rkit\filemanager\models\File|null
Parameters:
Parameter | Type | Description |
---|---|---|
$attribute |
string | Attribute of a model |
Check whether the upload of multiple files
FileBehavior::isMultiple( string $attribute ): boolean
Parameters:
Parameter | Type | Description |
---|---|---|
$attribute |
string | Attribute of a model |
Checks whether the file is protected
FileBehavior::isFileProtected( string $attribute ): boolean
Parameters:
Parameter | Type | Description |
---|---|---|
$attribute |
string | Attribute of a model |
Get rules
FileBehavior::getFileRules( string $attribute ): array
Parameters:
Parameter | Type | Description |
---|---|---|
$attribute |
string | Attribute of a model |
Get the presets of the file
FileBehavior::getFilePreset( string $attribute ): array
Parameters:
Parameter | Type | Description |
---|---|---|
$attribute |
string | Attribute of a model |
Get the presets of the file for apply after upload
FileBehavior::getFilePresetAfterUpload( string $attribute ): array
Parameters:
Parameter | Type | Description |
---|---|---|
$attribute |
string | Attribute of a model |
Get the storage of the file
FileBehavior::getFileStorage( string $attribute ): \rkit\filemanager\behaviors\Storage
Parameters:
Parameter | Type | Description |
---|---|---|
$attribute |
string | Attribute of a model |
Generate a thumb name
FileBehavior::generateThumbName( string $path, string $prefix ): string
Parameters:
Parameter | Type | Description |
---|---|---|
$path |
string | The path of the file |
$prefix |
string | Prefix for name of the file |
Resize image
FileBehavior::thumb( string $attribute, string $preset, string $pathToFile = null, boolean $returnRealPath = false ): string
Parameters:
Parameter | Type | Description |
---|---|---|
$attribute |
string | Attribute of a model |
$preset |
string | The name of the preset |
$pathToFile |
string | Use this path to the file |
$returnRealPath |
boolean | Return the real path to the file |
Create a file
FileBehavior::createFile( string $attribute, string $path, string $title, boolean $temporary ): \rkit\filemanager\behaviors\rkit\filemanager\models\File
Parameters:
Parameter | Type | Description |
---|---|---|
$attribute |
string | Attribute of a model |
$path |
string | The path of the file |
$title |
string | The title of file |
$temporary |
boolean | The file is temporary |
Get a description of the validation rules in as text
FileBehavior::getFileRulesDescription( string $attribute ): string
Example
$form->field($model, $attribute)->hint($model->getFileRulesDescription($attribute)
Output
Min. size of image: 300x300px
File types: JPG, JPEG, PNG
Max. file size: 1.049 MB
Parameters:
Parameter | Type | Description |
---|---|---|
$attribute |
string | Attribute of a model |
The bind class for FileBehavior
- Full name: \rkit\filemanager\behaviors\FileBind
Bind files to the with owner
FileBind::bindMultiple( \rkit\filemanager\behaviors\Storage $storage, integer $ownerId, integer $ownerType, array $files ): array<mixed,\rkit\filemanager\behaviors\rkit\filemanager\models\File>|boolean
Parameters:
Parameter | Type | Description |
---|---|---|
$storage |
\rkit\filemanager\behaviors\Storage | The storage for the files |
$ownerId |
integer | The id of the owner |
$ownerType |
integer | The type of the owner |
$files |
array | Array of ids |
Component of FileManager
- Full name: \rkit\filemanager\FileManager
- Parent class:
Get owner type
FileManager::getOwnerType( string $ownerType ): void
Parameters:
Parameter | Type | Description |
---|---|---|
$ownerType |
string | The type of the owner |
Formatting of validation rules
- Full name: \rkit\filemanager\helpers\FormatValidation
Get a description of the validation rules in as text
FormatValidation::getDescription( array $rules ): string
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$rules |
array | Validation rules |
The local storage for files
- Full name: \rkit\filemanager\storages\LocalStorage
- Parent class: \rkit\filemanager\Storage
Set a file
LocalStorage::setFile( \rkit\filemanager\File $file ): string
Parameters:
Parameter | Type | Description |
---|---|---|
$file |
\rkit\filemanager\File | File |
Get a file
LocalStorage::getFile( ): \rkit\filemanager\File
Path to the file
LocalStorage::path( boolean $realPath = false ): string
Parameters:
Parameter | Type | Description |
---|---|---|
$realPath |
boolean | The real path of the file |
Save the file to the storage If the file is temporary, then in the temporary directory
LocalStorage::save( string $path ): \rkit\filemanager\models\File|boolean
Parameters:
Parameter | Type | Description |
---|---|---|
$path |
string | The path of the file |
Save the temporary file to the storage
LocalStorage::saveTemporaryFileToStorage( ): boolean
LocalStorage::delete( )
This document was automatically generated from source code comments on 2016-03-10 using phpDocumentor and cvuorinen/phpdoc-markdown-public