Class \Scrivo\File
Extends
\Scrivo\Asset .
Defined in:
File.php.
Attr. | Name / Description |
---|---|
public |
File($context) Create an empty asset object. |
Name | Description |
---|---|
TYPE_FILE | Value indicating that the asset is a file. |
TYPE_FOLDER | Value indicating that the asset is a folder. |
Attr. | Type | Name | Description |
---|---|---|---|
protected | \..\AssetSet | $children | The child assets of this asset. |
protected | \..\Context | $context | A Scrivo context. |
protected | DateTime | $dateCreated | The date/time that this asset was created. |
protected | DateTime | $dateModified | The last date/time that this asset was modified. |
private | DateTime | $dateOffline | The date/time this asset need to go offline. |
private | DateTime | $dateOnline | The date/time this asset need to go online. |
protected | int | $id | The asset id (DB key). |
private | \..\String | $location | The asset location. |
private | \..\String | $mimeType | The asset mimeType. |
protected | int | $parentId | The id of the parent asset. |
protected | \..\AssetSet | $path | The parent assets of this asset. |
protected | \..\RoleSet | $roles | The attached roles. |
private | int | $size | The size in bytes of the asset. |
protected | \..\String | $title | The asset title. |
protected | int | $type | The asset type: one out of the Asset::TYPE_* constant values. |
Attr. | Type | Name / Description |
---|---|---|
public | mixed |
__get($name) Implementation of the readable properties using the PHP magic method __get(). |
public |
__set($name, $value) Implementation of the writable properties using the PHP magic method __set(). |
|
private | boolean |
Test if the asset title is unique within the scope of the directory. |
public static |
delete($context, $id) Delete an existing asset from the database. |
|
public static |
fetch($context, $id) Retrieve a asset from the database or cache. |
|
private | \..\AssetSet |
Get the child assets of this asset. |
private | \..\AssetSet |
getPath() Get the child assets of this asset. |
private |
Get a unique filename within the scope of the selected directory. |
|
public |
insert() Insert a new asset into the database. |
|
public |
move($dir) Move a asset one position up or down amongst its siblings. |
|
private static | \..\AssetSet |
selectChildren($asset) Select child assets from the database. |
protected static | \..\AssetSet |
selectPath($asset) Select the asset path. |
private static |
selectRoles($context, $assets) Select the roles for this asset. |
|
private |
setContext($context) Set the asset context. |
|
private |
setDateOffline($dateOffline) Set the date/time this asset need to go offline. |
|
private |
setDateOnline($dateOnline) Set the date/time this asset needs to go online. |
|
protected |
setFields($context, $rd) Convenience method to set the fields of a asset definition object from an array (result set row). |
|
private |
setLocation($location) Set the asset location (<location>). |
|
private |
setMimeType($mimeType) Set the mimeType for this asset (<mimeType>). |
|
private |
setParentId($parentId) Set the id of the parent asset. |
|
private |
setSize($size) Set the id of the asset template. |
|
private |
setTitle($title) Set The asset title (<title>). |
|
private |
setType($type) Set the asset type: one out of the Asset::TYPE_* constant values. |
|
public |
update() Update an existing asset in the database. |
|
protected static |
validateDelete($context, $id) Check if deletion of asset object data does not violate any business rules. |
|
private |
Check if the asset data can be inserted into the database. |
|
private |
Check if this the asset data can be updated in the database. |
Constructor
- public File(\Scrivo\Context $context=null)
-
Create an empty asset object.
Parameters:
Type Name Def. Description \Scrivo\Context $context null A Scrivo context.
View source: File.php line 77.
Constants
- TYPE_FILE
-
Value indicating that the asset is a file.
Inherited from \Scrivo\Asset
Value: 1
View source: Asset.php line 50.
- TYPE_FOLDER
-
Value indicating that the asset is a folder.
Inherited from \Scrivo\Asset
Value: 0
View source: Asset.php line 45.
Members
- protected \Scrivo\AssetSet $children
-
The child assets of this asset.
Inherited from \Scrivo\Asset
Inital value: null
View source: Asset.php line 92.
- protected \Scrivo\Context $context
-
A Scrivo context.
Inherited from \Scrivo\Asset
Inital value: null
View source: Asset.php line 110.
- protected \DateTime $dateCreated
-
The date/time that this asset was created.
Inherited from \Scrivo\Asset
Inital value: null
View source: Asset.php line 80.
- protected \DateTime $dateModified
-
The last date/time that this asset was modified.
Inherited from \Scrivo\Asset
Inital value: null
View source: Asset.php line 86.
- private \DateTime $dateOffline
-
The date/time this asset need to go offline.
Inital value: null
View source: File.php line 70.
- private \DateTime $dateOnline
-
The date/time this asset need to go online.
Inital value: null
View source: File.php line 64.
- protected int $id
-
The asset id (DB key).
Inherited from \Scrivo\Asset
Inital value: 0
View source: Asset.php line 56.
- private \Scrivo\String $location
-
The asset location.
Inital value: null
View source: File.php line 52.
- private \Scrivo\String $mimeType
-
The asset mimeType.
Inital value: null
View source: File.php line 58.
- protected int $parentId
-
The id of the parent asset.
Inherited from \Scrivo\Asset
Inital value: 0
View source: Asset.php line 62.
- protected \Scrivo\AssetSet $path
-
The parent assets of this asset.
Inherited from \Scrivo\Asset
Inital value: null
View source: Asset.php line 98.
- protected \Scrivo\RoleSet $roles
-
The attached roles.
Inherited from \Scrivo\Asset
Inital value: null
View source: Asset.php line 104.
- private int $size
-
The size in bytes of the asset.
Inital value: 0
View source: File.php line 46.
- protected \Scrivo\String $title
-
The asset title.
Inherited from \Scrivo\Asset
Inital value: null
View source: Asset.php line 74.
- protected int $type
-
The asset type: one out of the Asset::TYPE_* constant values.
Inherited from \Scrivo\Asset
Inital value: 0
View source: Asset.php line 68.
Methods
- public mixed __get(string $name)
-
Implementation of the readable properties using the PHP magic method __get().
Parameters:
Type Name Def. Description string $name The name of the property to get.
Returns:
mixed Implementation of the readable properties using the PHP magic method __get().
View source: File.php line 100.
- public __set(string $name, mixed $value)
-
Implementation of the writable properties using the PHP magic method __set().
Parameters:
Type Name Def. Description string $name The name of the property to set.
mixed $value The value of the property to set.
View source: File.php line 118.
- private boolean checkUnique()
-
Test if the asset title is unique within the scope of the directory.
Returns:
boolean Test if the asset title is unique within the scope of the directory.
View source: File.php line 228.
- public static delete(\Scrivo\Context $context, int $id)
-
Delete an existing asset from the database.
First it is is checked if it's possible to delete this asset then the asset data including its dependecies is deleted from the database.
Inherited from \Scrivo\Asset
Parameters:
Type Name Def. Description \Scrivo\Context $context A Scrivo context.
int $id The id of the asset to delete.
Throws:
Exception Type Description \Scrivo\ApplicationException If it is not possible to delete this asset. View source: Asset.php line 323.
- public static fetch(\Scrivo\Context $context, int $id=null)
-
Retrieve a asset from the database or cache.
Inherited from \Scrivo\Asset
Parameters:
Type Name Def. Description \Scrivo\Context $context A Scrivo context.
int $id null An object id of a asset.
Throws:
Exception Type Description \Scrivo\ApplicationException if the asset was not readable for the user defined in the context. View source: Asset.php line 364.
- private \Scrivo\AssetSet getChildren()
-
Get the child assets of this asset.
Inherited from \Scrivo\Asset
Returns:
\Scrivo\AssetSet Get the child assets of this asset.
View source: Asset.php line 200.
- private \Scrivo\AssetSet getPath()
-
Get the child assets of this asset.
Inherited from \Scrivo\Asset
Returns:
\Scrivo\AssetSet Get the child assets of this asset.
View source: Asset.php line 213.
- private getUniqueName()
-
Get a unique filename within the scope of the selected directory.
View source: File.php line 202.
- public insert()
-
Insert a new asset into the database.
First the data fields of this asset will be validated. If no id is set a new object id is generated. Then the data is inserted into to database.
Throws:
Exception Type Description \Scrivo\ApplicationException If one or more of the fields contain invalid data. View source: File.php line 277.
- public move(int $dir=\Scrivo\SequenceNo::MOVE_DOWN)
-
Move a asset one position up or down amongst its siblings.
Inherited from \Scrivo\Asset
Parameters:
Type Name Def. Description int $dir \Scrivo\SequenceNo::MOVE_DOWN Direction of the move, see \Scrivo\SequenceNo:::MOVE_*
View source: Asset.php line 297.
- private static \Scrivo\AssetSet selectChildren(\Scrivo\Asset $asset)
-
Select child assets from the database.
Inherited from \Scrivo\Asset
Parameters:
Type Name Def. Description \Scrivo\Asset $asset A Scrivo asset.
Returns:
\Scrivo\AssetSet Select child assets from the database.
View source: Asset.php line 422.
- protected static \Scrivo\AssetSet selectPath(\Scrivo\Asset $asset)
-
Select the asset path.
Inherited from \Scrivo\Asset
Parameters:
Type Name Def. Description \Scrivo\Asset $asset A Scrivo asset.
Returns:
\Scrivo\AssetSet Select the asset path.
View source: Asset.php line 485.
- private static selectRoles(\Scrivo\Context $context, array $assets)
-
Select the roles for this asset.
Inherited from \Scrivo\Asset
Parameters:
Type Name Def. Description \Scrivo\Context $context A valid Scrivo context.
array $assets the set of assets for which to retrieve the properties.
View source: Asset.php line 272.
- private setContext(\Scrivo\Context $context)
-
Set the asset context.
Inherited from \Scrivo\Asset
Parameters:
Type Name Def. Description \Scrivo\Context $context A Scrivo context.
View source: Asset.php line 261.
- private setDateOffline(\DateTime $dateOffline=null)
-
Set the date/time this asset need to go offline.
Parameters:
Type Name Def. Description \DateTime $dateOffline null The date/time this asset need to go offline.
View source: File.php line 195.
- private setDateOnline(\DateTime $dateOnline)
-
Set the date/time this asset needs to go online.
Parameters:
Type Name Def. Description \DateTime $dateOnline The date/time this asset needs to go online.
View source: File.php line 186.
- protected setFields(\Scrivo\Context $context, array $rd)
-
Convenience method to set the fields of a asset definition object from an array (result set row).
Parameters:
Type Name Def. Description \Scrivo\Context $context A Scrivo context.
array $rd An array containing the field data using the database field names as keys.
View source: File.php line 137.
- private setLocation(\Scrivo\String $location)
-
Set the asset location (<location>).
Parameters:
Type Name Def. Description \Scrivo\String $location The asset location (<location>).
View source: File.php line 167.
- private setMimeType(\Scrivo\String $mimeType)
-
Set the mimeType for this asset (<mimeType>).
Parameters:
Type Name Def. Description \Scrivo\String $mimeType The mimeType for this asset (<mimeType>).
View source: File.php line 177.
- private setParentId(int $parentId)
-
Set the id of the parent asset.
Inherited from \Scrivo\Asset
Parameters:
Type Name Def. Description int $parentId The id of the parent asset.
View source: Asset.php line 226.
- private setSize(int $size)
-
Set the id of the asset template.
Parameters:
Type Name Def. Description int $size The id ot the asset template.
View source: File.php line 154.
- private setTitle(\Scrivo\String $title)
-
Set The asset title (<title>).
Inherited from \Scrivo\Asset
Parameters:
Type Name Def. Description \Scrivo\String $title The asset title (<title>).
View source: Asset.php line 252.
- private setType(int $type)
-
Set the asset type: one out of the Asset::TYPE_* constant values.
Inherited from \Scrivo\Asset
Parameters:
Type Name Def. Description int $type The asset type: one out of the Asset::TYPE_* constant values.
View source: Asset.php line 239.
- public update()
-
Update an existing asset in the database.
First the data fields of this user will be validated, then the data is updated in to database.
Throws:
Exception Type Description \Scrivo\ApplicationException If one or more of the fields contain invalid data. View source: File.php line 349.
- protected static validateDelete(\Scrivo\Context $context, int $id)
-
Check if deletion of asset object data does not violate any business rules.
Parameters:
Type Name Def. Description \Scrivo\Context $context A Scrivo context.
int $id The object id of the asset definition to select.
Throws:
Exception Type Description \Scrivo\ApplicationException If the data is not accessible or if it is not possible to delete the language data. View source: File.php line 405.
- private validateInsert()
-
Check if the asset data can be inserted into the database.
Throws:
Exception Type Description \Scrivo\ApplicationException If the data is not accessible, one or more of the fields contain invalid data or some other business rule is not met. View source: File.php line 254.
- private validateUpdate()
-
Check if this the asset data can be updated in the database.
Throws:
Exception Type Description \Scrivo\ApplicationException If the data is not accessible, one or more of the fields contain invalid data or some other business rule is not met. View source: File.php line 325.
Documentation generated by phpDocumentor 2.0.0a12 and ScrivoDocumentor on August 29, 2013