Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
Asset Class Reference
Inheritance diagram for Asset:
MySource_Object Authentication Bodycopy Bodycopy_Container Bulkmail_Post_Office Bulkmail_User Cache_Manager Cache_Storage Calendar_Event Calendar_Event_Multi_Date Checkout_Action CMIS_Bridge Condition Content_Type Cron_Job Cron_Manager Data_Record Data_Source Data_Source_Record_Set Db_Connector Decision_Tree_Question Design_Area Ecommerce_Delivery_Method Ecommerce_Order File File_Bridge Folder Form Form_Action Form_Question Form_Question_Rule Form_Section Form_Section_Action Form_Submission Funnelback_Manager Google_Map_Location Image_Variety Import_Tool_Converter Import_Tools_Manager Inbox IPB_Bridge Ipb_Forum Ipb_Poll Layout_Manager LDAP_Bridge Link Locking_Method Log_Manager Lookup_Value Metadata_Field ExpandingNode.ExpandingAsset Online_Quiz_Question Online_Quiz_Submission Order_Line Page Paypal_Business_Account Paypal_Configuration Paypal_Order Physical_File Physical_Folder Poll_Question Promotional_Code Promotional_Rule Remap_Manager REST_Manager Saml2_ACS Saml2_SLS Search_Folder Search_Manager Session_Handler Sharepoint_Connector Simple_Form Simple_Report SOAP_Api Squiz_Suite_System Tag_Manager Thesaurus Thesaurus_Term Tool Trigger Trigger_Action Trigger_Condition Trigger_Event Trigger_Manager Trim_Connector User Workflow_Bundle Workflow_Step_Condition Workflow_Stream XML_User_Bridge

Public Member Functions

 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

 $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)
 
 _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 28 of file asset.inc.

Member Function Documentation

_abortCreate (   $trigger_level_changed = FALSE,
  $linkid = 0 
)
protected

Abort the creation of this asset

The create log and DB transaction will also be aborted

Parameters
boolean$trigger_level_changedif it's FALSE, restore runlevel
Returns
boolean private

Definition at line 598 of file asset.inc.

_checkPermissionAccess (   $perm,
  $assetids = Array(),
  $only_workflow = TRUE 
)
protected

Returns TRUE if at least one of the passed assetids has the passed permission Does not check current status of lock

Parameters
int$permthe permission to check access for
array$assetidsAn array of user_group and/or user ids to check for permission If the array is empty, the current user will be checked
boolean$only_workflowcheck only workflow
Returns
boolean public

Definition at line 4653 of file asset.inc.

_createAdditional ( Array &  $link)
protected

Perform any additional processing required during the creation of this asset

For example, creating other child assets should be performed in this method

Parameters
array&$linkinformation used to create the initial link
Array (
  'asset'        => [ref major asset to create link under],
  'link_type'    => SQ_LINK_?,
  'value'        => [link value],
  'sort_order'   => [link sort order],
  'is_dependant' => [0|1],
  'is_exclusive' => [0|1],
)
Returns
boolean private

Definition at line 581 of file asset.inc.

_getAllowedLinks ( )

Returns an array of all the permitted links type, the type asset and the cardinality In the form

Array('[link_type]' => Array('[type_code]' => Array('card' => [cardinality], 'exclusive' => [exclusive]))); Where: link_type = SQ_LINK_TYPE_1|SQ_LINK_TYPE_2|SQ_LINK_TYPE_3|SQ_LINK_NOTICE cardinality = [max number of links]|'M' exclusive = TRUE|FALSE

Returns
array private

Definition at line 2887 of file asset.inc.

_getKeywordReplacement (   $keyword)
protected

Get bodycopy keyword replacement Provides a mechanism for providing keyword replacement functions by looking up the function named 'getKeywordNameKeywordReplacement' so an asset wishing to add support for 'best_ever' custom keyword should implement a function getBestEverKeywordReplacement() which returns a replacement string

Note that this function returns NULL for any keywords it doesn't recognise, unless the keyword begins with globals_

Parameters
string$keywordKeyword to find a replacement for
Returns
string private

Definition at line 3860 of file asset.inc.

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

Return a name to use to describe this instance of the asset

This function should be overridden by children as it is used to set the name and short_name values for this asset when updating.

Parameters
boolean$short_namewhether or not we are after the shortname or the full name
int$contextidwhat context to get the name in (override in kiddies)
Returns
string private
See Also
_updated

Definition at line 1546 of file asset.inc.

_loadDataPaths ( )

Setup the data paths for the asset

Also takes into account if we are using a system version

Returns
void private

Definition at line 748 of file asset.inc.

_loadVars ( )
protected

Load the vars for this asset/ asset type into the vars array

If the asset has no asset ID, this function just loads the default values for the asset type.

Returns
void private

Definition at line 768 of file asset.inc.

_morphCleanup (   $new_type_code)

Clean up any sloppy seconds that are left over before we cast this asset for good

Parameters
string$new_type_codethe new type_code that this asset is being cast to
Returns
boolean private

Definition at line 2073 of file asset.inc.

_preCreateCheck ( Array &  $link)
protected

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

For example, checking that attributes are set should bee performed in this method

Parameters
array&$linkinformation used to create the initial link
Array (
  'asset'        => [ref major asset to create link under],
  'link_type'    => SQ_LINK_?,
  'value'        => [link value],
  'sort_order'   => [link sort order],
  'is_dependant' => [0|1],
  'is_exclusive' => [0|1],
)
Returns
boolean private

Definition at line 554 of file asset.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 indicate 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 1426 of file asset.inc.

accessEffective ( )

Returns true if permissions on this asset equal effective access

NB this function doesn't actually check permissions, but indicates whether having write or admin permissions actually allows you to edit the asset (which it doesn't if the status is all-approved or archived)

Returns
boolean public

Definition at line 4625 of file asset.inc.

adminAccess (   $lock_type = '',
Array  $assetids = Array() 
)

Returns TRUE if at least one of the passed assetids has admin access to this asset

Parameters
string$lock_typethe type of write access required - if blank returns a plain check against permissions set for this asset, otherwise returns effective access based on locking and status
array$assetidsan array of user_group and/or user ids to check for write access If the array is empty, the current user will be checked
Returns
boolean public

Definition at line 4444 of file asset.inc.

Asset (   $assetid = 0)

Constructor

Parameters
int$assetidthe asset id to be loaded
Returns
object public

Definition at line 190 of file asset.inc.

attr (   $name)

Get the value of an attribute

Parameters
string$namethe name of the attribute whose value you want to get
Returns
mixed string|NULL public

Definition at line 3508 of file asset.inc.

& attrByRef (   $name)

Get the value of an attribute by reference

Parameters
string$namethe name of the attribute whose value you want to get
Returns
mixed object|NULL public

Definition at line 3527 of file asset.inc.

backendAccess ( )

Determine if the current user is allowed into this asset's backend interface

Returns
boolean public

Definition at line 4470 of file asset.inc.

canClone ( )

Returns TRUE if this type of asset can be cloned

Override this function if you do not want a particular type of asset to be cloned

Returns
boolean public

Definition at line 2112 of file asset.inc.

canCloneLink ( )

Return TRUE if this link can be cloned

Returns
boolean public

Definition at line 3102 of file asset.inc.

canCreateLink ( Asset  $minor,
  $link_type,
  $exclusive 
)

Returns TRUE if the passed minor asset can be linked to this asset, or a string with the error msg

Parameters
Asset$minorthe minor asset that we are linking to
string$link_typethe type of link this is
int$exclusivethe exclusive status of the link (gets passed to canLinkToType)
Returns
mixed boolean|string public

Definition at line 2968 of file asset.inc.

canDelete ( )

Determine whether this asset can have its last significant link removed

This function is most commonly called when moving the asset to the trash.

Returns
boolean public

Definition at line 853 of file asset.inc.

canDeleteLink (   $linkid)

Determine if we can delete the passed link

This function ignores locks, and returns TRUE or error message

Parameters
int$linkidthe link id of the link to remove
Returns
mixed boolean|string public

Definition at line 3041 of file asset.inc.

canForceablyAcquireLock (   $lock_type)

Can the current user forceably acquire the current lock on this asset?

Parameters
string$lock_typeany valid lock type for this asset's type, plus 'all' which will attempt to acquire all locks that this asset has
Returns
boolean public

Definition at line 2818 of file asset.inc.

canliveEdit (   $lock_type)

Returns TRUE if the current user could live edit this asset if they had the lock

Live edit means the asset is currently SQ_STATUS_LIVE but this user can edit the asset without going through a safe edit NOTE: will return FALSE if asset is not currently live

Parameters
int$lock_typethe type of lock
Returns
boolean public

Definition at line 4511 of file asset.inc.

canMoveLink ( Asset  $minor,
Asset  $old_major,
  $link_type 
)

Returns TRUE if the passed minor asset can be move-linked to this asset, or a string with the error msg

By default, use the same tests as being newly linked with a non-exclusive link (as all moved links are non-exclusive by moveLink() specification) - that is, call canCreateLink(). However this may not be appropriate for moves in some circumstances (cf. Sites within a Site Network) so this can be used to provide a different check for them. Remember that this is called for the asset we are moving TO - as it would have with canCreateLink().

Parameters
Asset$minorthe minor asset that we are linking to
Asset$old_majorthe major asset that we are being moved from
string$link_typethe type of link this is
Returns
mixed boolean|string public

Definition at line 2994 of file asset.inc.

checkAccess (   $perm,
  $lock_type,
Array  $assetids = Array(),
  $only_workflow = TRUE 
)

Returns TRUE if at least one of the passed assetids has the passed permission

Can perform effective access check based on current status, lock, workflow, and metadata NOTE: Only for write and above access

Parameters
int$permthe permission to check access for
string$lock_typethe type of write access required - if blank returns a plain check against permissions set for this asset, otherwise returns effective access based on locking and status
array$assetidsAn array of user_group and/or user ids to check for permission If the array is empty, the current user will be checked
boolean$only_workflowcheck only workflow
Returns
boolean public

Definition at line 4577 of file asset.inc.

clearSystemVersion ( )

Clear the directory for saving the system version

Returns
boolean public

Definition at line 1158 of file asset.inc.

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

Takes a clone shell and clones the sources required components to the clone shell (if the current user has the permissions on the clone shell to do so)

If $fail_on_error is TRUE, then cloneComponents will bail on the first error (default behaviour) - if not, however, cloneComponents will report the error and attempt to continue (returning FALSE in exceptional circumstances only)

Parameters
Asset$clonethe asset object that we are turning into a clone of this one
array$componentsthe wanted components to clone eg.
                        Array(
                            'attributes',
                            'metadata_schemas',
                            'metadata',
                            'workflow',
                            'permissions',
                            'data',
                            'content_tags',
                            'roles',
                        );
                        or alternately
                        Array('all');
boolean$overrideif TRUE, $this' permissions, metadata schemas, workflow schemas will override any existing ones already set on $clone
Returns
boolean public

ATTRIBUTES /// ///////////////

PERMISSIONS /// ////////////////

ROLES /// //////////

METADATA /// /////////////

WORKFLOW /// /////////////

DATA DIR /// /////////////

CONTENT TAGS /// /////////////////

Definition at line 2148 of file asset.inc.

cloneComponentsAdditional ( Asset  $clone,
Array  $components 
)

Perform any additional processing required during the cloning of this asset

This function is being called by asset_manager after the dependants of asset have been cloned.

Parameters
Asset$clonethe clone asset shell
array$componentsthe wanted components to clone eg. Array( 'attributes', 'metadata_schemas', 'metadata', 'workflow', 'permissions', 'data', ); or alternately Array('all');
Returns
boolean public

Definition at line 2438 of file asset.inc.

cloneLinks ( Asset  $clone)

Link the assets that are linked under this asset under the supplied clone shell too

Under the default cloning policy, this is done for notice and type 3 links only. Notice that the linked assets are not cloned - they end up linked to both this asset and the clone.

Parameters
Asset:OO$cloneThe asset object that we are turning into a clone of this one
Returns
boolean public

Definition at line 2456 of file asset.inc.

create ( Array &  $link)

Create this asset

The return value will be:

  • FALSE if the asset was not created
  • the ID of the newly created link if the asset and intital link were created
Parameters
array&$linkinformation used to create the initial link
Array ('asset'         => [ref major asset to create link under],
       'link_type'     => SQ_LINK_?,
       'value'         => [link value],
       'sort_order'    => [link sort order],
       'is_dependant'  => [0|1],
       'is_exclusive'  => [0|1],
     'is_locked'     => [0|1]
       )
Returns
mixed int|boolean public

Definition at line 227 of file asset.inc.

createLink ( Asset  $minor,
  $link_type,
  $value = '',
  $sort_order = NULL,
  $dependant = '0',
  $exclusive = '0',
  $moving = FALSE,
  $locked = 0 
)

Creates a link between this asset and the passed asset, of a certain type and returns the linkid of the created link

Parameters
Asset$minorthe minor asset that we are linking to
string$link_typethe type of link this is
string$valuethe value that is to be associated with this link
string$sort_orderthe position in the links list that this link should take, if NULL or less than zero places at end of list
string$dependant'0' / '1' on whether the this asset is dependant on the asset that will be linked by this new link
string$exclusive'0' / '1' on whether the this asset is linked exclusivly to the asset that will be linked by this new link
boolean$movingmoving
string$lockedwhether or not this asset's link is locked
Returns
int public
See Also
Asset_Manager::createAssetLink()

Definition at line 2923 of file asset.inc.

delete (   $release_lock = TRUE,
  $check_locked = 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 realease the lock after deleting
boolean$check_lockedCheck if the link is locked or not
Returns
boolean public

Definition at line 871 of file asset.inc.

deleteLink (   $linkid,
  $check_locked = TRUE 
)

Remove a link where this asset is the major player

Parameters
int$linkidthe link id of the link to remove
boolean$check_lockedCheck if the link is locked or not
Returns
boolean public
See Also
Asset_Manager::deleteAssetLink()

Definition at line 3066 of file asset.inc.

deleteLookupValue (   $layout_name,
  $layout_value 
)

Removes a lookup value from this asset and returns the list of values after modification

Parameters
string$layout_nameThe name of the layout, can also be in notice link style, e.g. override::paint_layout::system::frontend
string$layout_valueThe value that the layout has in the sq_lookup_values table
Returns
mixed array|boolean public

Definition at line 5625 of file asset.inc.

describeLink (   $linkid)

Return a human readable description of the passed link

Parameters
int$linkidthe link ID of the link to describe
Returns
string public

Definition at line 3009 of file asset.inc.

effectiveUnrestricted ( )

Returns TRUE if this asset is effectivly readable by everyone

Returns
boolean public

Definition at line 4551 of file asset.inc.

fastTrack (   $tasks)

Fast Track is way of flagging on this asset, "it's currently safe to skip certain expensive tasks". This is useful when trying to avoid things like search reindexing from happening multiple times when it only needs to happen once (during asset creation for example).

As such, it's a less than ideal yet pragmatic way to find a "fast path" for the spaghetti that is asset builder / applying schemas / regenerating metadata / reindexing search in multiple context sauce.

e.g.

$asset->fastTrack(Array( 'metadata_manager_generate_content_file', 'search_manager_reindex_metadata', 'trigger_event_metadata_updated'));

// Do stuff that may trigger events in loops for those tasks..

$asset->unFastTrack(Array( 'metadata_manager_generate_content_file', 'search_manager_reindex_metadata', 'trigger_event_metadata_updated'));

// Now do those tasks once.

See Also
CMS::Page_Asset_Builder
Metadata_Manager
Parameters
Mixed$tasksIdentifiers to be fast tracked.
Returns
void public

Definition at line 6482 of file asset.inc.

getAssetKeywords (   $descriptions = FALSE)

Return the keywords for this asset type with their replacements for this asset instance

This function is called in asset-listing situations like the asset listing, search page etc The return value is in the form:

Array(
  'name' => Array (
              'value'       => 'page',
              'description' => 'the asset name',
            ),
);
Parameters
boolean$descriptionsif TRUE descriptions will be included in the array
Deprecated:
Returns
array public

Definition at line 3598 of file asset.inc.

getAssetStatusColourKeywordReplacement ( )

Returns a replacement for the asset_status_colour keyword Returns it in '#RRGGBB' Hex form, and the colour corresponds to that seen in the asset map for statuses.

Returns
string public

Definition at line 6414 of file asset.inc.

getAssetStatusDescriptionKeywordReplacement ( )

Returns a replacement for the asset_status_description keyword Will return 'Live', 'Under Construction' etc

Returns
boolean public

Definition at line 6399 of file asset.inc.

getAssetWebPathKeywordReplacement ( )

Gets replacements for asset_web_path keyword this asset If the asset has multiple webpath, shortest one (alphabetically) is returned

Returns
null|string public

Definition at line 4215 of file asset.inc.

getAttribute (   $name,
  $mute_errors = FALSE 
)

Returns a reference to the actual attribute object, used for manipulating the object

Parameters
string$namethe name of the attribute
boolean$mute_errorsstops the outputting of errors in this fn, needed because you can't use the '@' operator when returning by reference
Returns
mixed object|NULL public

Definition at line 3549 of file asset.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 3740 of file asset.inc.

getAvailableStatii ( )

Returns an array of statii that the current user can set for this asset Value returned is a key => value array for a drop down

Returns
array public

Definition at line 2505 of file asset.inc.

getBackendHref (   $screen = '',
  $backend_page = TRUE 
)

Returns the href for getting to the nearest backend for this asset

Parameters
string$screenthe code name of the screen that you want displayed when the asset is loaded
boolean$backend_pagewhether to include the 'SQ_BACKEND_PAGE=main' query string include this bit when we are switching screens in the backend do not include when generating URL (e.g. for workflow emails)
Returns
string public

Definition at line 5186 of file asset.inc.

getContent ( )

Returns the editable content of this asset

Returns
string public

Definition at line 4279 of file asset.inc.

getCurrentDesignName ( )

Get the current design code-name from GET or SESSION as appropriate

Returns
string protected

Definition at line 4947 of file asset.inc.

getCurrentPaintLayoutName ( )

Get the current paint layout code-name from GET or SESSION as appropriate

Returns
string protected

Definition at line 4920 of file asset.inc.

getCustomKeywordReplacements (   $keywords = Array(),
  $invoke_backend = FALSE 
)

Gets replacements for keywords that are specific to this asset for LIMBO

Parameters
array$keywordsthe keywords to get replacements for
Returns
array public

Definition at line 4248 of file asset.inc.

getDependantParentsURL ( )

If the asset doesn't has URL, get it from the dependant parent, if any

Returns
string public

Definition at line 6571 of file asset.inc.

getDesignLookups ( )

Returns a list of design lookup information associated with this asset

Returns
array public

Definition at line 5480 of file asset.inc.

getEditFns ( )

Returns the Edit_Fns object appropriate for whatever asset type we are

Returns
object public

Definition at line 5159 of file asset.inc.

getEditingLocks (   $keywords)

Returns any locks that are needed for editing, based on a set of custom keywords

Parameters
array$keywordsthe keywords to govern what locks are required
Returns
array public

Definition at line 2864 of file asset.inc.

getEffectiveLastUpdatedTime (   $assetids)

Returns the most recent 'last modified time' among all component parts

used in conjunction with printFrontend to get a list of loaded asset ids see _sendHTTPHeaders() in mysource.inc for more information

Parameters
array$assetidsid of all assets that get loaded during printFrontend
Returns
int public

Definition at line 4310 of file asset.inc.

getEI ( )

Returns a reference to the Asset_Edit_Interface object for this asset type

Returns
object public

Definition at line 5142 of file asset.inc.

getFaskTrackedTaskAssetids (   $task)

Returns a list of assetids associated with the given task that has been fast tracked

Parameters
$taskstring Fasktracked task name
Returns
Array public

Definition at line 6558 of file asset.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 5235 of file asset.inc.

getKeywordReplacement (   $keyword)

Get bodycopy keyword replacement Provides a mechanism for providing keyword replacement functions by looking up the function named 'getKeywordNameKeywordReplacement' so an asset wishing to add support for 'best_ever' custom keyword should implement a function getBestEverKeywordReplacement() which returns a replacement string

Note that this function returns NULL for any keywords it doesn't recognise, unless the keyword begins with globals_

Parameters
string$keywordKeyword to find a replacement for
Returns
string public
See Also
_getKeywordReplacement

Definition at line 3836 of file asset.inc.

getLanguages ( )

Gets the default languages of the asset as an array

Returns
array public

Definition at line 1695 of file asset.inc.

getLookups (   $field = '')

Returns a list of lookup information associated with this asset

Parameters
string$fieldif only one field is required pass it's name through (url, http, https, root_urlid)
Returns
array public

Definition at line 5439 of file asset.inc.

getLookupValues (   $inherited = NULL,
  $prefix = '',
  $like_search = TRUE,
  $ignore_override = FALSE 
)

Returns a list of lookup value information associated with this asset matching the criteria

Return value is in the form

Array(
  [url] => Array(
  [name] => Array('value' => [value], 'inhd' => [inhd]),
  ....
)
Parameters
mixed$inheritedit takes a mixed argument, boolean or NULL NULL = FALSE = return only parent values TRUE = return parents and children values
string$prefixa prefix to search for in the name field of ast_lookup_value
boolean$like_searchTRUE = LIKE $prefix, FALSE = NOT LIKE $prefix
boolean$ignore_overrideTRUE = ignore URLs with '/' appended to the end, i.e. URLs with override designs/layouts applied FALSE = return the URL with all its current design/layout information, i.e. the fact that a URL has an override design/layout applied will be transparent
Returns
array public

Definition at line 5548 of file asset.inc.

getPrefix ( )

Generate a prefix to be used by paint() and process()

Returns
string public

Definition at line 5093 of file asset.inc.

getStatus ( )

Returns a status object for the current asset to be used for processing

Returns
Asset_Status public

Definition at line 2483 of file asset.inc.

getStatusDescription ( )

Returns a description representing the current status

Returns
string public

Definition at line 2521 of file asset.inc.

getTypeAncestors (   $include_asset = TRUE)

Get an array of all assets types that the asset extends from

Parameters
boolean$include_assetwhen TRUE adds the "Asset" type to the parent list, even though it's an unistantiable object
Returns
array public
See Also
Asset_Manager::getTypeAncestors()

Definition at line 1580 of file asset.inc.

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

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
int$base_contextidthe id of the context that we want the url from
Returns
string public

Definition at line 5205 of file asset.inc.

getURLs ( )

Returns an array of URLs of this asset, including the protocol information

Returns
array public

Definition at line 5218 of file asset.inc.

getValidProtocols ( )

Get the valid protocols for this asset for the current URL

Returns
boolean private

Definition at line 4846 of file asset.inc.

getWebDataPath ( )

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

Returns
string public

Definition at line 5248 of file asset.inc.

getWebPaths ( )

Returns a list of paths that this asset has

Returns
array public

Definition at line 5261 of file asset.inc.

incrementVersion (   $number = 'micro',
  $update_parents = TRUE 
)

Increments the version number of the asset based on the part of the version passed in

Parameters
string$numberthe part of the version to update (major|minor|micro)
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 public

Definition at line 1598 of file asset.inc.

initLimbo ( )

Initialise the limbo (simple-edit) interface by painting to the limbo outputter

This function should be overridden if assets want to expose another asset's interface instead of their own. By default, the normal backend is printed for the default screen.

Returns
void public
See Also
printLimbo

Definition at line 5030 of file asset.inc.

isDeletableLink (   $linkid)

Return TRUE if this link is deletable

Parameters
int$linkidthe link id of the link to remove
Returns
boolean public

Definition at line 3024 of file asset.inc.

linksUpdated ( )

Allow any required processesing to occur when any link is updated for the asset

Called whenever any type of link is changed. Allows caching of objects, links and other stuff to occur but not cause integrity issues during script execution. ONLY TO BE CALLED FROM THE ASSET MANAGER

Returns
void protected

Definition at line 3089 of file asset.inc.

liveEditAccess (   $lock_type)

Returns TRUE if the current user can live edit this asset Live edit means the asset is currently SQ_STATUS_LIVE but this user can edit the asset without going through a safe edit NOTE: will return FALSE if asset is not currently live

Parameters
string$lock_typethe type of lock
Returns
boolean public
See Also
canliveEdit()

Definition at line 4489 of file asset.inc.

load (   $assetid)

Load the asset represented by the passed asset ID

Parameters
int$assetidthe asset ID to be loaded
Returns
void public

Definition at line 657 of file asset.inc.

loadSystemVersion ( )

Load the asset from the system version

The system version is saved when the asset status becomes SQ_STATUS_LIVE.

Returns
boolean public

Definition at line 1031 of file asset.inc.

lockTypes ( )

Returns a list of lock types available for this asset type

Returns
array public

Definition at line 2779 of file asset.inc.

makeAndSaveInitialWebPath (   $path,
  $parent_link = NULL 
)
protected

Create an initial webpath for an asset This function is typically called by _createAdditional() Returns FALSE only if a web path cannot be saved

Parameters
string$pathan initial web path
Asset$parent_assetasset under which this asset is being created (NULL is none)
Returns
boolean protected

Definition at line 5299 of file asset.inc.

morph (   $new_type_code)

Morph the asset to either one of its parent types or one of its children types

Only succeeds if $type_code assets are allowed to link to all children that this asset has. Since 3.18, we cannot do $this = $morphed, so we return the morphed obj if successful We also call forgetAsset and getAsset again to refresh the cache.

Parameters
string$new_type_codethe new type_code to attempt to cast this asset to
Returns
object|null public

Definition at line 1862 of file asset.inc.

onRequestKeywords ( Asset  $broadcaster,
Array  $vars = Array() 
)

Handle a request for available asset-type keywords

We set $vars['my_keyword'] = 'my keyword desc' to tell the broadcaster what keywords are available for this asset type.

Parameters
Asset$broadcasterthe asset that triggered the event
array$varsthe vars that get submitted by the broadcaster we add keywords to the $vars['keywords'] array
Returns
void private

Definition at line 2093 of file asset.inc.

paintBackend ( Backend_Outputter  $o)

Prints out the backend interface for the asset

Parameters
Backend_Outputter&$oBackend_Outputter object
Returns
void public

Definition at line 5072 of file asset.inc.

permissionsUpdated ( )

Called when the any permission is updated for this asset

It returns TRUE if everything is OK.

Returns
boolean public

Definition at line 4726 of file asset.inc.

prepareLink ( Asset  $asset,
  $side_of_link,
$link_type,
$value,
$sort_order,
$dependant,
$exclusive 
)

Prepares for linking by checking that the link values are valid for this link

This function will be called if this asset is the major or minor party in the link, so the side_of_link flag should be checked to work out what side of the link this asset is on. The return value should indicate if any of the link fields were changed.

Parameters
Asset$assetthe major or minor asset that we are linking to
string$side_of_linkthe side of the link we are on (major or minor)
string&$link_typethe type of link we are creating
string&$valuethe value that is to be associated with the link
string&$sort_orderthe position in the links list that this link should take,
string&$dependant'0' / '1' on whether the this asset is dependant on the asset that will be linked by the new link
string&$exclusive'0' / '1' on whether the this asset is linked exclusivly to the asset that will be linked by the new link
Returns
boolean public

Definition at line 2951 of file asset.inc.

printBody ( )

Called by the design to print the body of this asset it's up to the kids to override TODO: empty function

Returns
void public

Definition at line 4908 of file asset.inc.

printBodyWithPaintLayout (   $layout_id = '')

Called by the design to print the body of this asset, WITH the paint layout applied

Parameters
string$layout_idthe assetid of the paint layout (leave empty to guess it from URL/Global define)
Returns
void public

Definition at line 4970 of file asset.inc.

printFrontend ( )

Prints out the Frontend for this asset it's up to the kids to override

Returns
void public

Definition at line 4743 of file asset.inc.

printFrontendAsset ( Asset  $asset,
  $design = NULL 
)

Paint the passed asset on the frontend Override printFrontend() if you wish to pass a different asset to print

Parameters
Asset&$assetthe asset to print in frontend
mixed$designthe design to print the asset with
Returns
void public

Definition at line 4760 of file asset.inc.

printHead ( )

Called by the design to print extra material in the head of the HTML document for this asset it's up to the kids to override

Returns
void public

Definition at line 4894 of file asset.inc.

printLimbo ( )

Print the body of the limbo (simple-edit) interface

Asset types should only override this if they want to bypass or supplement the output of the backend outputter. If the backend outputter is not painted then initLimbo should be overridden too to avoid wasting effort populating the backend outputter.

Returns
void public
See Also
initLimbo

Definition at line 5052 of file asset.inc.

processBackend ( Backend_Outputter  $o,
Array &  $link 
)

Processes a backend submission from this asset, returns TRUE if all OK Put's the array of processed attributes into $this->_tmp['process_attributes']

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

Definition at line 5110 of file asset.inc.

processCustomKeywords (   $keywords = Array())

Processes anything that was previously printed for a custom keyword for LIMBO

An example of this might be a keyword replacement for a bodycopy. When submitted, we need to process The bodycopy here

Parameters
array$keywordsthe keywords that were originally printed
Returns
boolean public

Definition at line 4266 of file asset.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 2539 of file asset.inc.

readAccess ( Array  $assetids = Array())

Returns TRUE if at least one of the passed assetids has read access to this asset

Parameters
array$assetidsAn array of user_group and/or user ids to check for read access If the array is empty, the current user will be checked
Returns
boolean public

Definition at line 4363 of file asset.inc.

reload ( )

Reload this asset from the DB, clearing all its local caches

Returns
void public

Definition at line 837 of file asset.inc.

remapAssetids ( Array  $map)

Remap existing assetids used to new ones for ourselves and all our dependants

Parameters
array$mapa map of the form Array([old asset id] => [new asset id]);
Returns
boolean public

Definition at line 1825 of file asset.inc.

replaceKeywordsInString (   $string)

Replaces all keywords in a string

This function shouldn't handle global keywords

Parameters
string$stringcontaining keywords
Returns
string public

Definition at line 6431 of file asset.inc.

revertNoticeLinksToSystemVersion ( )

Replaces the notice links in editing version with the system (live) version

Returns
boolean public

Definition at line 1312 of file asset.inc.

revertToSystemVersion ( )

Replace the editing version with the system (live) version

This is what happens when you cancel a safe edit. The database version (latest and greatest) is replaced with the system version that is currently being show to non-editors.

Returns
boolean public

Definition at line 1193 of file asset.inc.

saveAttributes (   $dont_run_updated = FALSE,
  $log_message = TRUE 
)

Save attributes set with setAttrValue to the database

Parameters
boolean$dont_run_updatedif TRUE this->_updated() won't be run
boolean$log_messageif FALSE attrubutes change won't be logged in system log
Returns
boolean public
See Also
setAttrValue()

Definition at line 3123 of file asset.inc.

saveSystemVersion ( )

Save 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 1068 of file asset.inc.

saveWebPaths (   $paths,
  $auto_add_remaps = TRUE 
)

Attempts to override all current paths for this asset with those passed in the array

Parameters
array$pathsarray of paths to give this asset
boolean$auto_add_remapswhether or not to add remaps for the asset when updating lookups
Returns
boolean public

Definition at line 5323 of file asset.inc.

setAttrValue (   $name,
  $value 
)

Queue the setting of the value of an attribute

This function sets the value of the attribute locally, but does not database updating. The change is queued awaiting the call of saveAttributes()

Parameters
string$namethe name of the attribute
string$valuethe new value of the attribute
Returns
boolean public
See Also
saveAttributes()

Definition at line 3402 of file asset.inc.

setCharset (   $charset)

Set the default character set of the asset

Parameters
string$charsetthe character set to set for the asset
Returns
boolean public

Definition at line 1744 of file asset.inc.

setContent ( )

Sets the editable content of this asset

Returns
boolean public

Definition at line 4292 of file asset.inc.

setDate (   $date_type,
  $time = NULL,
  $userid = NULL 
)

Modifies the specified date to the specified timestamp

The user field for the specified date is set to the userid specified. If none is specified, then the current user is used

Parameters
string$date_typethe date to update, which must be one of 'published' or 'created'
int$timethe time to set the date to. If NULL then use current time
int$useridthe userid that modified the specified date
Returns
boolean public

Definition at line 2666 of file asset.inc.

setForceSecure (   $force_secure)

Set the status of the Force Secure Flag

Force Secure now takes on three possible options: '0' => don't force any protocol. '1' => force secure (HTTPS only) '-' => force insecure (HTTP only)

It will still also accept boolean TRUE|FALSE, which corresponds with '1' and '0' respectively.

Returns TRUE if the setting is successfully changed, FALSE otherwise. It is NOT considered a successful change if the force secure setting wouldn't actually change (in which case this function does nothing).

Parameters
mixed$force_securewhether to force the use of SSL on URLs
Returns
boolean public

Definition at line 1786 of file asset.inc.

setLanguages ( Array  $languages)

Set the default languages of the asset

Parameters
array$languagesan array of languages to set for the asset
Returns
boolean public

Definition at line 1712 of file asset.inc.

setLookupValues ( Array  $values)

Set's the lookup values for this asset

Parameters
array$valuesarray of the values that we want to save
                        "[url]" => array (
                            "[name]" => array (
                                "value" => "[value]",
                            ),
                        ),
Returns
boolean public
See Also
updateLookups()

Definition at line 6309 of file asset.inc.

setPaintLayouts (   $layouts)

Sets asset based paint layouts which apply to all of this asset's URLs

Parameters
array$layoutsArray of the paint layouts that we wish to apply. There are 2 types you can apply and both are optional.
                        Array(
                            'paint_layout::system::frontend' => [assetid of paint layout],
                            'override::paint_layout::system::frontend' => [assetid of paint layout],
                        )
Returns
boolean public

Definition at line 5681 of file asset.inc.

shouldFastTrack (   $task,
  $assetid = NULL 
)

Determine if the given task should be fast tracked. Generally called from the place doing the expensive task.

Parameters
$taskstring Task to fasttrack
$assetidint Asset associated with the task
See Also
Trigger_Manager
Search_Manger
Metadata_Manager public

Definition at line 6534 of file asset.inc.

type ( )

Get the type of the asset

Note that as of PHP 5.x, return values from get_class() are in mixed case (eg. "Asset" instead of "asset"). This function ensures that asset types it returns are lower case, as in other parts of Matrix.

Returns
string public

Definition at line 1563 of file asset.inc.

unFastTrack (   $tasks)

Remove the given task from being fast tracked, usually so that the caller can finally perform the given tasks sanely (once).

See Also
CMS::Page_Asset_Builder
Metadata_Manager
Parameters
Mixed$tasksIdentifiers to be removed from fast track.
Returns
void public

Definition at line 6510 of file asset.inc.

updateLookups (   $auto_add_remaps = TRUE)

Called to force an update of this assets lookup information

Parameters
boolean$auto_add_remapswhether to add remaps for this asset
Returns
boolean private
See Also
saveWebPaths()

Definition at line 5758 of file asset.inc.

useSystemVersion ( )

Determine if the current user be shown the system version or not

You would want to show the system version if the asset is in safe edit and the user does not have write access

Returns
boolean public

Definition at line 993 of file asset.inc.

writeAccess (   $lock_type = '',
Array  $assetids = Array(),
  $only_workflow = TRUE 
)

Returns TRUE if at least one of the passed assetids has write access to this asset

The extra parameter, $only_workflow, is currently only be used in determining read access for an asset before it goes live.

Parameters
string$lock_typethe type of write access required - if blank returns a plain check against permissions set for this asset, otherwise returns effective access based on locking and status
array$assetidsAn array of user_group and/or user ids to check for write access If the array is empty, the current user will be checked
boolean$only_workflowIf TRUE (default), users with write access normally will be denied write access if outside the current step of the workflow. If FALSE, both those in the workflow and those with normal write access will be granted write access.
Returns
boolean public

Definition at line 4415 of file asset.inc.


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