Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
File Class Reference
Inheritance diagram for File:
Asset MySource_Object CSS_File Excel_Doc FLV_File Image JS_File MP3_File PDF_File Powerpoint_Doc Rtf_File Text_File Video_File Word_Doc Xml_File Xsl_File

Public Member Functions

 File ($assetid=0)
 
 create (Array &$link, $info=Array())
 
 createAdditional (Array &$link)
 
 cloneComponents (Asset $clone, Array $components, $override=FALSE)
 
 lockTypes ()
 
 saveSystemVersion ()
 
 revertToSystemVersion ()
 
 clearSystemVersion ()
 
 morph ($new_type_code)
 
 processStatusChange ($new_status, $update_parents=TRUE, $run_updated=TRUE)
 
 _getAllowedLinks ()
 
 _updated ($update_parents=TRUE)
 
 permissionsUpdated ()
 
 usePublicPath ()
 
 updateLookups ($auto_add_remaps=TRUE)
 
 processBackend (Backend_Outputter $o, Array &$link)
 
 saveAttributes ($dont_run_updated=FALSE)
 
 setAttrValue ($name, $value)
 
 validFile (Array $info)
 
 printFrontend ()
 
 getURL ($base_url=NULL, $ignore_rollback=FALSE)
 
 getHref ($base_url=NULL, $ignore_rollback=FALSE)
 
 getExistingFile ()
 
 _getName ($short_name=FALSE, $contextid=NULL)
 
 getAvailableKeywords ()
 
 getAssetFileSizeInBytesKeywordReplacement ()
 
 getAssetFileSizeReadableKeywordReplacement ()
 
 getAssetFileContentsKeywordReplacement ()
 
 delete ($release_lock=TRUE)
 
 scanFile ($path='')
 
 getFileTypeKeywordReplacement ()
 
 getAssetSummary ()
 
 getOriginalURL ($data_url, $site_url)
 
- Public Member Functions inherited from Asset
 Asset ($assetid=0)
 
 create (Array &$link)
 
 load ($assetid)
 
 _loadDataPaths ()
 
 reload ()
 
 canDelete ()
 
 delete ($release_lock=TRUE, $check_locked=TRUE)
 
 useSystemVersion ()
 
 loadSystemVersion ()
 
 saveSystemVersion ()
 
 clearSystemVersion ()
 
 revertToSystemVersion ()
 
 revertNoticeLinksToSystemVersion ()
 
 _updated ($update_parents=TRUE)
 
 type ()
 
 getTypeAncestors ($include_asset=TRUE)
 
 incrementVersion ($number='micro', $update_parents=TRUE)
 
 getLanguages ()
 
 setLanguages (Array $languages)
 
 setCharset ($charset)
 
 setForceSecure ($force_secure)
 
 remapAssetids (Array $map)
 
 morph ($new_type_code)
 
 _morphCleanup ($new_type_code)
 
 onRequestKeywords (Asset $broadcaster, Array $vars=Array())
 
 canClone ()
 
 cloneComponents (Asset $clone, Array $components, $override=FALSE)
 
 cloneComponentsAdditional (Asset $clone, Array $components)
 
 cloneLinks (Asset $clone)
 
 getStatus ()
 
 getAvailableStatii ()
 
 getStatusDescription ()
 
 processStatusChange ($new_status, $update_parents=TRUE, $run_updated=TRUE)
 
 setDate ($date_type, $time=NULL, $userid=NULL)
 
 lockTypes ()
 
 canForceablyAcquireLock ($lock_type)
 
 getEditingLocks ($keywords)
 
 _getAllowedLinks ()
 
 createLink (Asset $minor, $link_type, $value='', $sort_order=NULL, $dependant='0', $exclusive='0', $moving=FALSE, $locked=0)
 
 prepareLink (Asset $asset, $side_of_link, &$link_type, &$value, &$sort_order, &$dependant, &$exclusive)
 
 canCreateLink (Asset $minor, $link_type, $exclusive)
 
 canMoveLink (Asset $minor, Asset $old_major, $link_type)
 
 describeLink ($linkid)
 
 isDeletableLink ($linkid)
 
 canDeleteLink ($linkid)
 
 deleteLink ($linkid, $check_locked=TRUE)
 
 linksUpdated ()
 
 canCloneLink ()
 
 saveAttributes ($dont_run_updated=FALSE, $log_message=TRUE)
 
 setAttrValue ($name, $value)
 
 attr ($name)
 
attrByRef ($name)
 
 getAttribute ($name, $mute_errors=FALSE)
 
 getAssetKeywords ($descriptions=FALSE)
 
 getAvailableKeywords ()
 
 getKeywordReplacement ($keyword)
 
 getAssetWebPathKeywordReplacement ()
 
 getCustomKeywordReplacements ($keywords=Array(), $invoke_backend=FALSE)
 
 processCustomKeywords ($keywords=Array())
 
 getContent ()
 
 setContent ()
 
 getEffectiveLastUpdatedTime ($assetids)
 
 readAccess (Array $assetids=Array())
 
 writeAccess ($lock_type='', Array $assetids=Array(), $only_workflow=TRUE)
 
 adminAccess ($lock_type='', Array $assetids=Array())
 
 backendAccess ()
 
 liveEditAccess ($lock_type)
 
 canliveEdit ($lock_type)
 
 effectiveUnrestricted ()
 
 checkAccess ($perm, $lock_type, Array $assetids=Array(), $only_workflow=TRUE)
 
 accessEffective ()
 
 permissionsUpdated ()
 
 printFrontend ()
 
 printFrontendAsset (Asset $asset, $design=NULL)
 
 getValidProtocols ()
 
 printHead ()
 
 printBody ()
 
 getCurrentPaintLayoutName ()
 
 getCurrentDesignName ()
 
 printBodyWithPaintLayout ($layout_id='')
 
 initLimbo ()
 
 printLimbo ()
 
 paintBackend (Backend_Outputter $o)
 
 getPrefix ()
 
 processBackend (Backend_Outputter $o, Array &$link)
 
 getEI ()
 
 getEditFns ()
 
 getBackendHref ($screen='', $backend_page=TRUE)
 
 getURL ($base_url=NULL, $ignore_rollback=FALSE, $base_contextid=NULL)
 
 getURLs ()
 
 getHref ($base_url=NULL, $ignore_rollback=FALSE)
 
 getWebDataPath ()
 
 getWebPaths ()
 
 saveWebPaths ($paths, $auto_add_remaps=TRUE)
 
 getLookups ($field='')
 
 getDesignLookups ()
 
 getLookupValues ($inherited=NULL, $prefix='', $like_search=TRUE, $ignore_override=FALSE)
 
 deleteLookupValue ($layout_name, $layout_value)
 
 setPaintLayouts ($layouts)
 
 updateLookups ($auto_add_remaps=TRUE)
 
 setLookupValues (Array $values)
 
 getAssetStatusDescriptionKeywordReplacement ()
 
 getAssetStatusColourKeywordReplacement ()
 
 replaceKeywordsInString ($string)
 
 fastTrack ($tasks)
 
 unFastTrack ($tasks)
 
 shouldFastTrack ($task, $assetid=NULL)
 
 getFaskTrackedTaskAssetids ($task)
 
 getDependantParentsURL ()
 
- Public Member Functions inherited from MySource_Object
 MySource_Object ()
 
 __sleep ()
 
 __wakeup ()
 

Data Fields

 $allowed_extensions = Array()
 
 $ignore_update = FALSE
 
- Data Fields inherited from Asset
 $id = 0
 
 $version = ''
 
 $name = ''
 
 $short_name = ''
 
 $status
 
 $languages = ''
 
 $charset = ''
 
 $force_secure = '0'
 
 $created
 
 $created_userid
 
 $updated
 
 $updated_userid
 
 $published
 
 $published_userid
 
 $status_changed
 
 $status_changed_userid
 
 $_is_cacheable = FALSE
 
 $vars = Array()
 
 $_available_keywords = Array()
 
 $data_path_suffix = ''
 
 $data_path = ''
 
 $data_path_public = ''
 
 $_ser_attrs = FALSE
 
- Data Fields inherited from MySource_Object
 $_tmp
 

Protected Member Functions

 _preCreateCheck (Array &$link)
 
 _createAdditional (Array &$link)
 
 _checkFileState ()
 
 _removePublicFile ()
 
 _updatePublicFile ()
 
 insertDataLookup ()
 
 _renameFile ($data_path, $old_filename, $new_filename)
 
 _validFileSize (Array &$info, $pre_uploaded=FALSE)
 
 _validFileExtension (Array &$info, $pre_uploaded=FALSE)
 
- Protected Member Functions inherited from Asset
 _preCreateCheck (Array &$link)
 
 _createAdditional (Array &$link)
 
 _abortCreate ($trigger_level_changed=FALSE, $linkid=0)
 
 _loadVars ()
 
 _getName ($short_name=FALSE, $contextid=NULL)
 
 _getKeywordReplacement ($keyword)
 
 _checkPermissionAccess ($perm, $assetids=Array(), $only_workflow=TRUE)
 
 makeAndSaveInitialWebPath ($path, $parent_link=NULL)
 

Detailed Description

Definition at line 32 of file file.inc.

Member Function Documentation

_checkFileState ( )
protected

Look's after the placing and removing of out files in the public directory

Returns
boolean private

Definition at line 622 of file file.inc.

_createAdditional ( Array &  $link)
protected

Perform any additional processing required during the creation of this asset

File assets commit their uploaded file to the file system

Parameters
array&$linkinformation used to create the initial link
Returns
boolean private

Definition at line 168 of file file.inc.

_getAllowedLinks ( )

Returns an array of all the permitted link type, the type asset and the cardinality

Returns
void private
See Also
Asset::_getAllowLinks()

Definition at line 549 of file file.inc.

_getName (   $short_name = FALSE,
  $contextid = NULL 
)

Returns name of the asset

Parameters
boolean$short_namewhether or not we are after the short name or the full name
int$contextidWhat context to return the name from
Returns
string private
See Also
Asset::_getName()

Definition at line 1475 of file file.inc.

_preCreateCheck ( Array &  $link)
protected

Perform any pre-validation required during the creation of this asset

Folders ensure a name has been set before they are created

Parameters
array&$linkinformation used to create the initial link
Returns
boolean private

Definition at line 73 of file file.inc.

_removePublicFile ( )
protected

Look's after the removing of files in the public directory

Returns
boolean private

Definition at line 689 of file file.inc.

_renameFile (   $data_path,
  $old_filename,
  $new_filename 
)
protected

Rename a file in file versioning (copy, create new FV entry and then delete old FV entry)

Parameters
string$data_pathdata path of the asset
string$old_filenameold filename
string$new_filenamefile to rename to
Returns
boolean private

Definition at line 1041 of file file.inc.

_updated (   $update_parents = TRUE)

Set the last updated info for this asset

Call this function when the asset has been changed in some way so we can indicated in the asset table when the asset was last changed and who by. This function will also increment the micro version number for the asset.

Parameters
boolean$update_parentsshould we go through an update all our dependant parents as well ? NOTE: this is passed to incrementVersion to let it know that the parents should have their versions updated as well.
Returns
boolean private

Definition at line 580 of file file.inc.

_updatePublicFile ( )
protected

Look's after the updating of files in the public directory. Only call if File::usePublicPath() returns TRUE;

Returns
boolean private

Definition at line 717 of file file.inc.

_validFileExtension ( Array &  $info,
  $pre_uploaded = FALSE 
)
protected

Checks a file type which is valid according to Global and User group settings

Parameters
array&$infoan array of information about the uploaded file
boolean$pre_uploadedTRUE if the pre-uploaded file info is passed
Returns
boolean public

Definition at line 1222 of file file.inc.

_validFileSize ( Array &  $info,
  $pre_uploaded = FALSE 
)
protected

Checks a file size which is valid according to Global and User group settings

Parameters
array&$infoan array of information about the uploaded file
boolean$pre_uploadedTRUE if the pre-uploaded file info is passed
Returns
boolean public

Definition at line 1174 of file file.inc.

clearSystemVersion ( )

Clear the directory for saving the system version

Returns
boolean public

Definition at line 435 of file file.inc.

cloneComponents ( Asset  $clone,
Array  $components,
  $override = FALSE 
)

Processes the file upload from the source file so that file versioning cloned properly

Parameters
Asset$clonethe clone asset shell
array$componentsthe wanted components to clone eg.
                        Array(
                            'attributes',
                            'metadata_schemas',
                            'metadata',
                            'workflow',
                            'permissions',
                            'data',
                            'content_tags',
                            'roles',
                        );
                        or alternately
                        Array('all');
boolean$overridewhether or not to override the existing permission, metadata schemas, workflow schemas with the new ones.
Returns
boolean public
See Also
asset::cloneComponents()

Definition at line 242 of file file.inc.

create ( Array &  $link,
  $info = Array() 
)

Create this asset

Parameters
array&$linkinformation used to create the initial link
array$infoinfo about the uploaded file
Returns
mixed int|boolean public
See Also
Asset::create()

Definition at line 98 of file file.inc.

createAdditional ( Array &  $link)

A public interface for _createAdditional.

Parameters
array&$linkinformation used to create the initial link
Returns
boolean public

Definition at line 210 of file file.inc.

delete (   $release_lock = TRUE)

Delete this asset from the trash

Note that the asset MUST be in the trash to delete it FROM the trash.

Parameters
boolean$release_lockshould we release the lock after deleting
Returns
boolean public

Definition at line 1578 of file file.inc.

File (   $assetid = 0)

Constructor

Parameters
int$assetidthe asset id to be loaded

Definition at line 56 of file file.inc.

getAssetFileContentsKeywordReplacement ( )

Get asset_file_contents% keyword replacement

Returns
string public

Definition at line 1560 of file file.inc.

getAssetFileSizeInBytesKeywordReplacement ( )

Get keyword replacement

Returns
string public

Definition at line 1531 of file file.inc.

getAssetFileSizeReadableKeywordReplacement ( )

Get keyword replacement

Returns
string public

Definition at line 1546 of file file.inc.

getAssetSummary ( )

Returns the user customized summary for this asset

Returns
string public

Definition at line 1653 of file file.inc.

getAvailableKeywords ( )

Return the keywords for this asset type. This function is called in asset-listing situations like the asset listing, search page etc

The return value is in the form:

Array(
  'name' => 'description' => 'the asset name',
);
Returns
array public

Definition at line 1511 of file file.inc.

getExistingFile ( )

Get an array of some useful data about the existing uploaded file

Returns
array public

Definition at line 1423 of file file.inc.

getFileTypeKeywordReplacement ( )

Get keyword replacement

Returns
string public

Definition at line 1635 of file file.inc.

getHref (   $base_url = NULL,
  $ignore_rollback = FALSE 
)

Returns the href for this asset closest to the $base_url, but relative to the current url

Parameters
string$base_urlthe url that we are want to match closest to
boolean$ignore_rollbackignore rollback checks in asset manager? this should only get set by the asset manager itself
Returns
string public

Definition at line 1406 of file file.inc.

getOriginalURL (   $data_url,
  $site_url 
)

Returns original URL for a __data type url for file type assets

Parameters
stringdata_url asset's __data url out of which we get the original URL
stringsite_url url of site under which we have our asset
Returns
array public

Definition at line 1688 of file file.inc.

getURL (   $base_url = NULL,
  $ignore_rollback = FALSE 
)

Returns the URL for this asset, closest to the $base_url

Parameters
string$base_urlthe url that we are want to match closest to
boolean$ignore_rollbackignore rollback checks in asset manager? this should only get set by the asset manager itself
Returns
string public

Definition at line 1383 of file file.inc.

insertDataLookup ( )
protected

Called to insert a __data url

Returns
int | bool protected

Definition at line 844 of file file.inc.

lockTypes ( )

Returns a list of lock types available for this asset type

Returns
array public

Definition at line 266 of file file.inc.

morph (   $new_type_code)

Morph's this asset to either one of it's parent type or one of it's children types Only succeeds if $type_code asset's is allowed to link to all children that this asset has

Parameters
string$new_type_codethe new type_code to attempt to cast this asset to
Returns
boolean public

Definition at line 466 of file file.inc.

permissionsUpdated ( )

Called when the any permission is updated for this asset Returns TRUE if everything is OK

Returns
boolean public

Definition at line 605 of file file.inc.

printFrontend ( )

Prints out the frontend for this file with no design

This function only prints out the header information according to the permission and file type

Returns
void public

Definition at line 1285 of file file.inc.

processBackend ( Backend_Outputter  $o,
Array &  $link 
)

Processes a backend submission from this asset, returns TRUE if all OK

Parameters
Backend_Outputter$oBackend Outputter
array&$linkinformation used to create the initial link
Returns
boolean public

Definition at line 946 of file file.inc.

processStatusChange (   $new_status,
  $update_parents = TRUE,
  $run_updated = TRUE 
)

Processes the changes required when a new status is set

Parameters
int$new_statusthe new status to set for this asset
boolean$update_parentsSpecify if we want to update the parent as well
boolean$run_updatedspecify it we want to run _upated
Returns
boolean public

Definition at line 505 of file file.inc.

revertToSystemVersion ( )

Replaces the editing version with the system (live) version

Returns
boolean public

Definition at line 364 of file file.inc.

saveAttributes (   $dont_run_updated = FALSE)

Set the value of an attribute

Parameters
boolean$dont_run_updatedif TRUE this->_updated() won't be run (THIS IS ONLY EVER CALLED FROM Asset::create())
Returns
boolean public

Definition at line 976 of file file.inc.

saveSystemVersion ( )

Saves a copy of this asset at this point in time This copy gets used when the asset is live and the user does not have write access

Returns
boolean public

Definition at line 282 of file file.inc.

scanFile (   $path = '')

Scan this asset using the external tools virus checker

Parameters
string$pathIf no path set, check the current file
Returns
boolean public

Definition at line 1607 of file file.inc.

setAttrValue (   $name,
  $value 
)

Set the value for the passed variable to the passed value If the user changes the name of this file, we also need to update the file system

Parameters
string$namethe name of the attribute
string$valuethe new value of the attribute
Returns
boolean public

Definition at line 1089 of file file.inc.

updateLookups (   $auto_add_remaps = TRUE)

Called to force an update of this assets lookup information

Returns
boolean public
See Also
Asset::updateLookups(), Asset::saveWebPaths()

Definition at line 773 of file file.inc.

usePublicPath ( )

Returns whether to use the public path or not for this file

Returns
boolean public
See Also
File::updateLookups()

Definition at line 759 of file file.inc.

validFile ( Array  $info)

Checks a file on the file system to see if it can be used as a file

Parameters
array$infoan array of information about the uploaded file
Returns
boolean public

Definition at line 1137 of file file.inc.


The documentation for this class was generated from the following file: