Squiz Matrix
4.12.2
|
Public Member Functions | |
Asset_Manager () | |
_loadAssetTypes () | |
getAssetTypes ($instantiable=NULL, $non_system_access=FALSE) | |
refreshAssetType ($type_code) | |
installed ($type_code) | |
getTypeList () | |
getTypeInfo ($type_code, $field='') | |
getAssetTypeHierarchy ($base_type_code='', $allowed_access='') | |
_recurseGetAssetTypeHierarchy ($offspring, $base_type_code) | |
getAssetTypeInfo ($assetids, $type_code=Array(), $strict_type_code=TRUE) | |
includeAsset ($type_code, $with_edit_fns=FALSE) | |
getTypeAncestors ($type_code, $include_asset=TRUE, $query_db=FALSE) | |
getTypeDescendants ($type_code, $include_passed=FALSE) | |
isTypeDecendant ($type_code1, $type_code2) | |
isTypeAncestor ($type_code1, $type_code2) | |
validAttributeType ($attr_type) | |
getAttributeInfo ($attrids) | |
getAttribute ($attrid, $value=NULL, $mute_errors=FALSE) | |
getAssetTypeAttributes ($type_code, $details=Array('name', 'type')) | |
getAttributeValuesByName ($attr_name, $asset_type, $assetids, $contextid=NULL) | |
getAllAttributeValues ($assetid='', $type_code, $contextid=NULL) | |
getAsset ($assetid, $type_code='', $mute_errors=FALSE) | |
assetExists ($assetids) | |
rememberAsset (&$obj) | |
forgetAsset (&$obj, $force_clean=FALSE) | |
getSystemAssetid ($name) | |
_reloadSystemAssetList () | |
resetSystemAssetList () | |
isSystemAssetType ($asset_type) | |
registerSystemAsset ($asset_type=NULL, $assetid=NULL) | |
getSystemAsset ($name, $mute_errors=FALSE) | |
canPurgeAsset (&$asset) | |
getAssetInfo ($assetids, $type_code=Array(), $strict_type_code=TRUE, $field='') | |
getAssetInfoFields () | |
getTypeAssetids ($type_code, $strict=TRUE, $include_type=FALSE) | |
getEditableContents ($assetid) | |
setEditableContents ($assetid, $content) | |
_cloneAsset (&$source, &$link, &$clone_map, $components, $cloning_dependent=FALSE) | |
& | _cloneLink (&$clone, &$link, &$lock, &$source) |
& | cloneAsset (&$source, &$link, &$clone_map, $components, $clone_dependents=TRUE, $cloning_dependent=FALSE) |
acquireLock ($assetid, $lock_type, $source_assetid=0, $force=FALSE, $expires=0) | |
releaseLock ($assetid, $lock_type) | |
updateLock ($assetid, $lock_type, $expires=0) | |
getLockInfo ($assetid, $lock_type, $force_array=FALSE, $full_chain=FALSE, $check_expires=TRUE, $allow_only_one=FALSE) | |
getLockTypes ($assetid, $lock_type) | |
getLink ($assetid, $link_type=NULL, $type_code='', $strict_type_code=TRUE, $value=NULL, $side_of_link='major', $exclusive=NULL) | |
getShadowLinkByAsset ($assetid, $other_assetid=NULL, $link_types=NULL, $value=NULL, $side_of_link='major', $force_array=FALSE) | |
getLinkById ($linkid, $assetid=0, $side_of_link='major') | |
getLinkByAsset ($assetid, $other_assetid, $link_types=NULL, $value=NULL, $side_of_link='major', $force_array=FALSE, $dependant=NULL, $exclusive=NULL) | |
arrayMerge ($array1, $array2) | |
getLinks ($assetid, $link_types, $type_code='', $strict_type_code=TRUE, $side_of_link='major', $value=NULL, $dependant=NULL, $exclusive=NULL, $sort_by=NULL, $access=NULL, $effective=TRUE) | |
getAllChildLinks ($assetid, $link_type=0, $access=NULL, $effective=TRUE, $bind_prefix='gc_', $depth=0) | |
getLinkLineages ($assetid, $result_limit=0, $from_treeid=NULL, $fields='name', $only_significant=FALSE) | |
getParents ($assetid, $type_code='', $strict_type_code=TRUE, $sort_by=NULL, $access=NULL, $effective=TRUE, $min_height=NULL, $max_height=NULL, $ignore_bridge=FALSE, $link_value_wanted=NULL, $bind_var_prefix='gp_') | |
getChildren ($assetid, $type_code='', $strict_type_code=TRUE, $dependant=NULL, $sort_by=NULL, $access=NULL, $effective=TRUE, $min_depth=NULL, $max_depth=NULL, $direct_shadows_only=TRUE, $link_value_wanted=NULL, Array $link_types_wanted=Array(), $expand_shadows=FALSE) | |
getDependantChildren ($assetid, $type_code='', $strict_type_code=TRUE) | |
getDependantParents ($assetid, $type_code='', $strict_type_code=TRUE, $include_all_dependants=TRUE) | |
getAssetTree ($majorids, $levels=NULL, $exclude_list=Array(), $link_type=SQ_SC_LINK_FRONTEND_NAV, $include_type_list=Array(), $include_dependants=TRUE) | |
_getAssetTree ($majorids, &$tree_data, $levels, $exclude_list, $link_type, $include_type_list, $include_dependants) | |
getAssetTreeids ($assetid, $link_type=NULL) | |
getLinkTreeid ($linkid) | |
assetInTrash ($assetid, $exclusively=FALSE) | |
countLinks ($assetid, $side_of_link='major', $link_types=0, $type_code='', $strict_type_code=TRUE, $ignore_linkid=0) | |
createAssetLink (Asset $major, Asset $minor, $link_type, $value='', $sort_order=NULL, $dependant='0', $exclusive='0', $moving=FALSE, $locked='0') | |
createShadowAssetLink (Asset $major, Asset $minor, $link_type, $value='') | |
canCreateLink (Asset $major, Asset $minor, $link_type, $exclusive) | |
canLinkToType (Asset $major, $type_code, $link_type, $ignore_linkid=0, $exclusive=0) | |
moveLink ($linkid, $to_parentid, $link_type, $to_parent_pos, $link_value='') | |
moveLinkPos ($linkid, $sort_order=-1) | |
updateLink ($linkid, $link_type=NULL, $value=NULL, $sort_order=NULL, $locked=NULL) | |
deleteAssetLink ($linkid, $check_locked=TRUE) | |
deleteAssetLinkByLink (Array $link, $check_locked=TRUE, $aborting=FALSE) | |
deleteShadowAssetLink ($linkid) | |
couldTrashAsset ($assetid, $check_locked=TRUE) | |
canSafeTrashAsset ($assetid, $ignore_linkid=0, $ignore_other_links=TRUE) | |
trashAsset ($assetid, $force_trash=FALSE) | |
getPermission ($assetid, $permission, $granted=NULL, $and_greater=TRUE, $expand_groups=FALSE, $all_info=FALSE, $collapse_roles=FALSE) | |
getAssetPermissionByCascade ($assetid, $permission, $userid=NULL, $cascades=NULL) | |
setPermission ($assetid, $userid, $permission, $granted, $cascades=TRUE, $force_set=FALSE) | |
deletePermission ($assetid, $userid, $permission) | |
getRole ($assetid=NULL, $roleid=NULL, $userid=NULL, $include_assetid=FALSE, $include_globals=FALSE, $expand_groups=FALSE, $inc_dependants=TRUE, $include_parents=FALSE, $type_codes=Array(), $strict_type_code=TRUE) | |
setRole ($assetid, $roleid, $userid) | |
deleteRole ($assetid, $roleid=NULL, $userid=NULL) | |
& | getAssetFromURL ($protocol=NULL, $url=NULL, $exact_match=TRUE, $mute_errors=FALSE) |
getRootURL ($url=NULL) | |
getURLs ($assetid) | |
getLineageFromURL ($protocol=NULL, $url=NULL, $mute_errors=FALSE) | |
getUrlFromLineage ($lineage=Array(), $root_url=NULL, $protocol=NULL) | |
getDesignFromURL ($url, $design_name='design::system::frontend') | |
getInheritedDesignValueFromURL ($url, $design_name='design::system::frontend') | |
getValueFromURL ($url, $value_name, $like_value=FALSE) | |
getAssetidsByLookupValue ($lookup_name_exp, $lookup_value_exp, $include_treeids) | |
getAssetURL ($assetids, $base_url=NULL, $ignore_rollback=FALSE, $base_contextid=NULL) | |
getAssetHref ($assetids, $base_url=NULL, $ignore_rollback=FALSE) | |
clearLookupsCache ($assetid) | |
getAssetBackendHref ($asset_info, $backend_page=TRUE) | |
getAssetIconURL ($asset_type) | |
webPathsInUse (Asset $major, $paths, $ignore_assetid=0, $return_alternatives=FALSE) | |
paintBackend (&$backend) | |
generateGetLinksQuery ($assetid, $link_types, $type_code='', $strict_type_code=TRUE, $side_of_link='major', $value=NULL, $dependant=NULL, $exclusive=NULL, $sort_by=NULL, $access=NULL, $effective=TRUE, $bind_prefix='gl_') | |
generateGetChildrenQuery (&$asset, $type_code='', $strict_type_code=TRUE, $dependant=NULL, $sort_by=NULL, $access=NULL, $effective=TRUE, $inc_type_code=TRUE, $min_depth=NULL, $max_depth=NULL, $direct_shadows_only=TRUE, $link_value_wanted=NULL, $bind_prefix='gc_', Array $link_types_wanted=Array()) | |
generateGetParentsQuery ($assetid, $type_code='', $strict_type_code=TRUE, $sort_by=NULL, $access=NULL, $effective=TRUE, $min_height=NULL, $max_height=NULL, $link_value_wanted=NULL, $bind_prefix='gp_') | |
getForgottenItemsReport () | |
isDependant ($assetid) | |
getSnippetKeywords ($more_info=FALSE) | |
generateRawContent ($details) | |
purgeAsset ($asset_id) | |
getDesignHideFrameValues ($designid) | |
isUnderRootNodes ($assetid, $root_nodes=Array(), $return_matched_nodes=FALSE) | |
Public Member Functions inherited from MySource_Object | |
MySource_Object () | |
__sleep () | |
__wakeup () | |
Data Fields | |
$_asset_types | |
$_assets = Array() | |
$_asset_cache | |
$_system_assetids = Array() | |
$_attributes = Array() | |
$_get_asset_history = Array() | |
Data Fields inherited from MySource_Object | |
$_tmp | |
Definition at line 31 of file asset_manager.inc.
_cloneAsset | ( | & | $source, |
& | $link, | ||
& | $clone_map, | ||
$components, | |||
$cloning_dependent = FALSE |
|||
) |
Creates the shell of a clone without cloning any of the source's components
The only child assets that are cloned are the ones that are DEPENDENTLY linked to this asset. NO OTHER linked assets are cloned. It returns the reference to the new object or NULL if an error occured
object | &$source | the source asset that we are creating a clone of |
array | &$link | information 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] ) |
array | &$clone_map | a map for that can be used for re-indexing data held in assets of the form Array([old asset id] => [new asset id]) |
array | $components | the wanted components to clone, Array( 'attributes', 'metadata_schemas', 'metadata', 'workflow', 'permissions', 'data', 'content_tags', 'roles', ); or alternately Array('all'); |
boolean | $cloning_dependent | by default FALSE, flipped to TRUE if the asset being cloned is another asset's dependent |
Definition at line 2004 of file asset_manager.inc.
& _cloneLink | ( | & | $clone, |
& | $link, | ||
& | $lock, | ||
& | $source | ||
) |
Links a cloned asset the under its new parent
This function also handles [links] locking of the new parent to accommodate the new link.
object | &$clone | the new clone |
string | &$link | the link object |
array | &$lock | the lock object |
object | &$source | the source object the clone is based off |
Definition at line 2228 of file asset_manager.inc.
_getAssetTree | ( | $majorids, | |
& | $tree_data, | ||
$levels, | |||
$exclude_list, | |||
$link_type, | |||
$include_type_list, | |||
$include_dependants | |||
) |
Does the work for getAssetTree
int | array | $majorids | the majorids to traverse the tree from |
array | &$tree_data | the data that is created recursively |
int | $levels | the number of levels to traverse (if NULL, traverse all levels) |
array | $exclude_list | an array of assetid to exclude from the tree |
int | $link_type | the type of wanted links |
array | $include_type_list | Array of asset types to include Array( 'type_code' => Array( 0 => 'type_code1', 1 => 'type_code2' ), 'inherit' => Array( 0 => TRUE, 1 => FALSE, ), ) |
boolean | $include_dependants | Whether to include dependants |
Definition at line 4396 of file asset_manager.inc.
_loadAssetTypes | ( | ) |
Loads all the assets types into the asset array
Definition at line 105 of file asset_manager.inc.
_recurseGetAssetTypeHierarchy | ( | $offspring, | |
$base_type_code | |||
) |
Private function called by getAssetTypeHierarchy()
array | $offspring | offspring |
string | $base_type_code | the asset type's hierarchy to return |
Definition at line 491 of file asset_manager.inc.
_reloadSystemAssetList | ( | ) |
Refreshes the list of cached system assets
Definition at line 1514 of file asset_manager.inc.
acquireLock | ( | $assetid, | |
$lock_type, | |||
$source_assetid = 0 , |
|||
$force = FALSE , |
|||
$expires = 0 |
|||
) |
Acquires a lock on an asset
Note that this method operates on a single asset only. To get the locks on children too (as per backend behaviour), you need to use the acquire_locks HIPO job. It returns zero on failure, non-zero on success (1 on success if all lock types requested had to be acquired, 2 if any lock was updated [ie if at least one lock type was already held])
int | $assetid | the assetid of the asset that we want to lock |
string | $lock_type | any valid lock type for the passed asset's type, plus 'all' which will attempt to acquire all locks that this asset has |
int | $source_assetid | the id of the asset that started this locking process |
boolean | $force | attempt to forcibly acquire (if allowed) |
int | NULL | $expires | when the lock expires (timestamp or NULL) If expires is null or zero, the lock will be acquired for the current time plus SQ_CONF_LOCK_LENGTH |
Definition at line 2444 of file asset_manager.inc.
arrayMerge | ( | $array1, | |
$array2 | |||
) |
Get details of the link(s) between the two specified assets
It returns array of link info if only one link and force_array=FALSE, array of arrays of link info otherwise
array | $array1 | first array to merge |
array | $array2 | second array to merge |
Definition at line 3270 of file asset_manager.inc.
Asset_Manager | ( | ) |
Constructor
Definition at line 84 of file asset_manager.inc.
assetExists | ( | $assetids | ) |
Determine if the passed assetid or assetids refer(s) to a valid asset in the system
Note that this will always return FALSE if you pass it a shadow asset
int | array | $assetids | the ID of the asset we are going to the check for existence or an array of assetids we want to check |
Definition at line 1319 of file asset_manager.inc.
assetInTrash | ( | $assetid, | |
$exclusively = FALSE |
|||
) |
Return TRUE if the passed assetid is in the trash, FALSE otherwise
Note that if the passed assetid is the id of the trash folder, FALSE will be returned NOTE: If $exclusively is TRUE, TRUE will be returned for assets that are not linked anywhere outside the trash including non existent assets
int | $assetid | the asset id to check the trash for |
boolean | $exclusively | is the asset ONLY in the trash (ie. does it have no other significant links outside the trash?) |
Definition at line 4667 of file asset_manager.inc.
Returns TRUE if the supplied assets can be linked in the specified way
Asset | $major | the major asset in the proposed link |
Asset | $minor | the minor asset in the proposed link |
string | $link_type | the type of link that is proposed |
int | $exclusive | (0|1) whether this will be the only significant link with $minor as the minor asset |
Definition at line 5749 of file asset_manager.inc.
canLinkToType | ( | Asset | $major, |
$type_code, | |||
$link_type, | |||
$ignore_linkid = 0 , |
|||
$exclusive = 0 |
|||
) |
Returns TRUE if the supplied asset can have assets of the specified type linked under it
Asset | $major | the major asset that we are linking to |
string | $type_code | the type code of the proposed link |
string | $link_type | the type of the proposed link |
int | $ignore_linkid | if it gets down to the checking of the cardinality, ignore the link represented by this link id |
int | $exclusive | (0|1) whether this will be the only significant link with $minor as the minor asset |
Definition at line 5852 of file asset_manager.inc.
canPurgeAsset | ( | & | $asset | ) |
Determine if this asset can be purged from the trash
The function stops system assets and their dependent children from being purged.
object | &$asset | the asset to purge |
Definition at line 1622 of file asset_manager.inc.
canSafeTrashAsset | ( | $assetid, | |
$ignore_linkid = 0 , |
|||
$ignore_other_links = TRUE |
|||
) |
Return list of errors if the asset would be blocked from being trashed if Safe Trash feature is on, empty array otherwise
int | $assetid | The asset we want to trash |
int | $ignore_linkid | Link ID to ignore when calculating the number of type 1/2 links remaining (typically the link we are moving) |
boolean | $ignore_other_links | Whether to check whether there are any remaining type 1/2 links before providing link errors (default = TRUE, as most use of this is for status of safe trash cron job) |
Definition at line 6833 of file asset_manager.inc.
clearLookupsCache | ( | $assetid | ) |
Clear the asset manager's internal cache of URLs and HREFs for the specified asset
int | $assetid | The assetid whose cached lookup values we want cleared |
Definition at line 8731 of file asset_manager.inc.
& cloneAsset | ( | & | $source, |
& | $link, | ||
& | $clone_map, | ||
$components, | |||
$clone_dependents = TRUE , |
|||
$cloning_dependent = FALSE |
|||
) |
Creates a clone of an asset and clones the required components of the source asset
if $clone_dependents is set the TRUE, the dependents of the source asset will be cloned, and the specified components will be cloned to them as well. It returns the clone of the source, NULL on error
object | &$source | the source asset that we are creating a clone of |
array | &$link | information 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] ); |
array | &$clone_map | a map for that can be used for re-indexing data held in assets of the form Array([old asset id] => [new asset id]) |
array | $components | the wanted components to clone, Array( 'attributes', 'metadata_schemas', 'metadata', 'workflow', 'permissions', 'data'// data directory );or alternately Array('all'); |
boolean | $clone_dependents | if TRUE the dependents of the source asset will be cloned and will have their sources components cloned |
boolean | $cloning_dependent | TRUE mean this call is a recursive call from itself, and it is cloning the dependent of an asset (in a recursive manner) |
Definition at line 2297 of file asset_manager.inc.
couldTrashAsset | ( | $assetid, | |
$check_locked = TRUE |
|||
) |
See whether we COULD send the specified asset to the trash IF we got the locks on its parents
It reutns TRUE if we can trash, FALSE if assetid=0, Array(linkid=>problem) otherwise
int | $assetid | The asset we want to trash |
Definition at line 6799 of file asset_manager.inc.
countLinks | ( | $assetid, | |
$side_of_link = 'major' , |
|||
$link_types = 0 , |
|||
$type_code = '' , |
|||
$strict_type_code = TRUE , |
|||
$ignore_linkid = 0 |
|||
) |
Return the number of links in the system that involve the specified asset
Can be restricted by either link type afnd/or asset type code
int | $assetid | id of the the $side_of_link asset |
string | $side_of_link | Which side of the link this (the current) asset is on ('major' or 'minor') |
int | $link_types | integer that can be the product of bitwise operations on the SQ_LINK_* constants |
string | array | $type_code | the type of asset that is linked (eg 'Page', 'File', etc) if an array returns link if matches any of the array values |
boolean | $strict_type_code | whether we are finding assets that are just a $type_code or $type_code and any of it's sub-classes |
int | $ignore_linkid | ignore the link represented by this link id when returning the count |
Definition at line 4731 of file asset_manager.inc.
createAssetLink | ( | Asset | $major, |
Asset | $minor, | ||
$link_type, | |||
$value = '' , |
|||
$sort_order = NULL , |
|||
$dependant = '0' , |
|||
$exclusive = '0' , |
|||
$moving = FALSE , |
|||
$locked = '0' |
|||
) |
Create a link between the two supplied assets
It returns the linkid of the created link
Asset | $major | the major asset that we are linking from |
Asset | $minor | the minor asset that we are linking to |
string | $link_type | the type of link this is |
string | $value | the value that is to be associated with this link |
string | $sort_order | the 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' - whether the minor asset is dependant on the major |
string | $exclusive | '0' / '1' - whether the major asset is to be the minor's only parent |
boolean | $moving | whether or not this asset is being moved |
string | $locked | whether or not this asset's link is locked |
Definition at line 4828 of file asset_manager.inc.
Create a "shadow" asset link between the two supplied assets
It returns the linkid of the created link
Asset | $major | the major asset that we are linking from |
Asset | $minor | the minor asset that we are linking to |
string | $link_type | the type of link this is |
string | $value | the value that is to be associated with this link |
Definition at line 5677 of file asset_manager.inc.
deleteAssetLink | ( | $linkid, | |
$check_locked = TRUE |
|||
) |
Remove a link by id
int | $linkid | the link id of the link to remove |
boolean | $check_locked | Check if the link is locked or not |
Definition at line 6421 of file asset_manager.inc.
deleteAssetLinkByLink | ( | Array | $link, |
$check_locked = TRUE , |
|||
$aborting = FALSE |
|||
) |
Remove a link by the link that is passed This function the initial checking that is done by deleteAssetLink() Fix to #3877 Matrix will create and retain links in DB if asset fails to get created a new function call made to deleteAssetLinkByLink() from _abortCreate() from asset.inc
Array | $link | the link we are supposed to delete |
boolean | $check_locked | Check if the link is locked or not |
boolean | $aborting | set to TRUE when link to be deleted belongs an asset that was just aborted (TRUE when called by Asset->_abortCreate()) |
Definition at line 6462 of file asset_manager.inc.
deletePermission | ( | $assetid, | |
$userid, | |||
$permission | |||
) |
Deletes a permission with the passed user or user_group
int | $assetid | the assetid for asset whose permissions to delete |
int | $userid | the id of the user or user_group to remove the permission from |
string | $permission | the permission code you are deleting |
Definition at line 7382 of file asset_manager.inc.
deleteRole | ( | $assetid, | |
$roleid = NULL , |
|||
$userid = NULL |
|||
) |
Remove a role from an asset
int | $assetid | the assetid of the asset |
int | $roleid | the assetid the role |
int | $userid | the assetid of the user performing the role |
Definition at line 7757 of file asset_manager.inc.
deleteShadowAssetLink | ( | $linkid | ) |
Remove a SHADOW asset link by id
int | $linkid | the link id of the link to remove |
Definition at line 6768 of file asset_manager.inc.
forgetAsset | ( | & | $obj, |
$force_clean = FALSE |
|||
) |
Tell the asset manager that you have finished with the asset, when everyone has finished with the asset is is removed from the asset store
object | &$obj | the asset to be unregistered |
boolean | $force_clean | force the asset manager to forget this asset rather than just reducing its entires (only used by the asset itself during a purge) |
Definition at line 1458 of file asset_manager.inc.
generateGetChildrenQuery | ( | & | $asset, |
$type_code = '' , |
|||
$strict_type_code = TRUE , |
|||
$dependant = NULL , |
|||
$sort_by = NULL , |
|||
$access = NULL , |
|||
$effective = TRUE , |
|||
$inc_type_code = TRUE , |
|||
$min_depth = NULL , |
|||
$max_depth = NULL , |
|||
$direct_shadows_only = TRUE , |
|||
$link_value_wanted = NULL , |
|||
$bind_prefix = 'gc_' , |
|||
Array | $link_types_wanted = Array() |
||
) |
Generate the parts of the query needed to get children of the passed asset
The return value is array consisting of a select statement, a from statement, a where clause (which may be blank is we are getting children of the root node) and an order by clause (which may be blank if we are not sorting). The return array is structed so you can implode it using ' ' as glue to form the full query.
object | &$asset | the asset to get its children for |
string | array | $type_code | the type of asset that is linked (eg 'Page', 'File', etc) if an array returns link if matches any of the array values |
boolean | $strict_type_code | whether we are finding assets that are just a $type_code or $type_code and any of it's sub-classes |
boolean | $dependant | if TRUE, results will be filtered to assets that are dependants. If FALSE, results will all not be dependants. If NULL, results will not be filtered |
string | $sort_by | a field in the asset table you would like the results sorted by (eg. name, short_name etc) |
int | $access | SQ_PERMISSION_READ|SQ_PERMISSION_WRITE|SQ_PERMISSION_ADMIN Specify that links should be returned for assets the user has read, write, or admin access for. Leave NULL to ignore permissions. |
boolean | $effective | If effective permissions should be considered or not. |
boolean | $inc_type_code | whether to include the type code in the SELECT or not |
int | $min_depth | Optional parameter that specifies minimum number of levels below the specified asset for a child to qualify (immediate child is 1) |
int | $max_depth | Optional parameter that specifies maximum number of levels below the specified asset for a child to qualify to be returned |
boolean | $direct_shadows_only | If TRUE, ONLY direct shadow asset children will be returned If FALSE, ALL the shadow asset children will be returned |
string | $link_value_wanted | Link Value Wanted |
string | $bind_prefix | The prefix for bind variables generated by this function (default: 'gc_'). Set this parameter if you are planning to use more than one call to this function in a query (through a UNION, say). |
array | $link_types_wanted | link_type we want our results to be filtered by. By default it uses empty array which mean it will return all the link_types Other values that can be used in the array : SQ_LINK_TYPE_1, SQ_LINK_TYPE_2, SQ_LINK_TYPE_3, SQ_LINK_NOTICE, SQ_SC_LINK_FRONTEND_NAV, SQ_SC_LINK_BACKEND_NAV, SQ_SC_LINK_SIGNIFICANT, SQ_SC_LINK_WEB_PATHS |
We do need the ast table if we're in rollback mode though so shadow assets can check dates/times
Definition at line 9308 of file asset_manager.inc.
generateGetLinksQuery | ( | $assetid, | |
$link_types, | |||
$type_code = '' , |
|||
$strict_type_code = TRUE , |
|||
$side_of_link = 'major' , |
|||
$value = NULL , |
|||
$dependant = NULL , |
|||
$exclusive = NULL , |
|||
$sort_by = NULL , |
|||
$access = NULL , |
|||
$effective = TRUE , |
|||
$bind_prefix = 'gl_' |
|||
) |
Return all links between the specified asset and other assets
The return value is array consisting of a select statement, a from statement, a where clause (which may be blank is we are getting children of the root node) and an order by clause (which may be blank if we are not sorting). The return array is structed so you can implode it using ' ' as glue to form the full query.
int | $assetid | id of the the $side_of_link asset |
int | $link_types | integer that can be the product of bitwise operations on the SQ_LINK_* constants |
string | array | $type_code | the type of asset that is linked (eg 'Page', 'File', etc) if an array returns link if matches any of the array values |
boolean | $strict_type_code | whether we are finding assets that are just a $type_code or $type_code and any of it's sub-classes |
string | $side_of_link | Which side of the link the specified asset is on ('major' or 'minor') |
array | $value | The value for all the links must equal this (if not null) |
boolean | $dependant | The dependant status for all the links must be this (if not null) |
boolean | $exclusive | The exclusive status for all the links must be this (if not null) |
string | $sort_by | a field in the asset table you would like the results sorted by (eg. name, short_name etc) |
int | $access | SQ_PERMISSION_READ|SQ_PERMISSION_WRITE|SQ_PERMISSION_ADMIN Specify that links should be returned for assets the user has read, write, or admin access for. Leave NULL to ignore permissions. |
boolean | $effective | If effective permissions should be considered or not. |
string | $bind_prefix | The prefix for bind variables generated by this function (default: 'gc_'). Set this parameter if you are planning to use more than one call to this function in a query (through a UNION, say). |
Definition at line 9057 of file asset_manager.inc.
generateGetParentsQuery | ( | $assetid, | |
$type_code = '' , |
|||
$strict_type_code = TRUE , |
|||
$sort_by = NULL , |
|||
$access = NULL , |
|||
$effective = TRUE , |
|||
$min_height = NULL , |
|||
$max_height = NULL , |
|||
$link_value_wanted = NULL , |
|||
$bind_prefix = 'gp_' |
|||
) |
Get all asset ids that are above the passed assetid in the various trees in which it exists
int | $assetid | the id of the asset to get its parents for |
string | array | $type_code | the type of asset that is linked (eg 'Page', 'File', etc) if an array returns link if matches any of the array values |
boolean | $strict_type_code | whether we are finding assets that are just a $type_code or $type_code and any of it's sub-classes |
string | $sort_by | a field in the asset table you would like the results sorted by (eg. name, short_name etc) |
int | $access | SQ_PERMISSION_READ|SQ_PERMISSION_WRITE|SQ_PERMISSION_ADMIN Specify that links should be returned for assets the user has read, write, or admin access for. Leave NULL to ignore permissions. |
boolean | $effective | If effective permissions should be considered or not. |
int | $min_height | Optional parameter that specifies minimum number of levels above the specified asset for a parent to qualify (immediate parent is 1) |
int | $max_height | Optional parameter that specifies maximum number of levels above the specified asset for a parent to qualify to be returned |
array | $link_value_wanted | the link value wanted |
string | $bind_prefix | The prefix for bind variables generated by this function (default: 'gp_'). Set this parameter if you are planning to use more than one call to this function in a query (through a UNION, say). |
keep an array of id's we've already added to where clauses. this is used so we don't duplicate looking for the same treeid's in the query (though the db should be smart enough to do that itself)
if max_height is null, that means we specified a min_height
this means we can look for specific treeid's rather than doing a like search, and get rid of the length(treeid) check.
($treeid = t.treeid or $treeid2 = t.treeid or $treeid3 = t.treeid)
it loops over the treeid and takes SQ_CONF_ASSET_TREE_SIZE chars off the end until it ends up with the root tree node.
in the get children query function this section gets minor links, but we want the major links in this case, so we have to go one further link down - hence the '-1' in these queries
we've got this far - so we've specified a min & max heights. if they are the same, we can look for specific treeid's. we need to take off one SQ_CONF_ASSET_TREE_SIZE section to get the right id to search for
also only add the treeid if we haven't done it already to save duplicate id's being passed in.
so we end up with this (which works much better performance wise): $treeid = t.treeid
if we've already processed this treeid, continue no need to put it in the query multiple times.
Here we have both min_height & max_height and they are also different values
If min_height > max_height, just switch them We would end up with the same queries anyway.
Set some temporary variables in case the originals are used elsewhere.
Get exact treeid's by taking off SQ_CONF_ASSET_TREE_SIZE chunks from the end until we end up with the length we're looking for (i.e. between temp_min_height and temp_max_height)
If there are no conditions, then work out which treeid's to look at.
This is a separate query for performance reasons. Previously it was an 'IN' clause in the main query, but because it runs through a function the query optimizers can't cope with it efficiently. (this affects both oracle and postgres)
So we do a query here to get the treeid's which are then put into the main query.
and since we're now looking at static id's basically, the optimizers are a lot happier
This is also done with the assumption that you'll never have a lot of parents as oracle has a limit on the number of id's you can use in an in clause (999).
Instead of calling the sq_get_parent_treeids database function/stored procedure, take the query directly and run it here. Then we need to chop the treeid's returned from that into SQ_CONF_ASSET_TREE_SIZE chunks and use those in the where clause.
If we didn't find any tree id's, make a where clause that will return nothing which then causes the parent query to return an empty result set. If we leave the where clause blank, we actually return every treeid which is not what we want.
See if we've dealt with this id before. It's not necessarily all the results from $tree_result we need to worry about Rather the shared 'parent' tree id's. eg they all have base tree id 0000, we only need to include that once.
Definition at line 9634 of file asset_manager.inc.
generateRawContent | ( | $details | ) |
Generate the raw content to be sent, ignoring user switching and recpient keyword replacement
array | $details | The details of the job |
Definition at line 10268 of file asset_manager.inc.
getAllAttributeValues | ( | $assetid = '' , |
|
$type_code, | |||
$contextid = NULL |
|||
) |
Get all the attribute values of the given assetid and type code. This method is similar to asset:_loadVars() except it does not unserialize any attributes. Return array of name => array (attrid, type, value, is_contextable, use_default)
If there are no custom value for an attribute, its default value will be loaded. If no asset ID is provided, this function just loads the default values for the asset type. This method will also allow you to get attribute values for a different context.
mixed | $assetid | (int | string) the asset id to be loaded |
string | $type_code | the type of $assetid |
int | $contextid | The ID of the context we wish to get the value of the attr for. (If omitted, use the currently active context.) |
Definition at line 1119 of file asset_manager.inc.
getAllChildLinks | ( | $assetid, | |
$link_type = 0 , |
|||
$access = NULL , |
|||
$effective = TRUE , |
|||
$bind_prefix = 'gc_' , |
|||
$depth = 0 |
|||
) |
Get details of the links from the specified asset to all its children
string | $assetid | the assetid of the asset to find the child links for |
int | $link_type | the type of links to get |
int | $access | SQ_PERMISSION_READ|SQ_PERMISSION_WRITE|SQ_PERMISSION_ADMIN Specify that links should be returned for assets the user has read, write, or admin access for. Leave NULL to ignore permissions. |
boolean | $effective | If effective permissions should be considered or not. |
string | $bind_prefix | The prefix for bind variables generated by this function (default: 'gc_') |
int | $depth | The maximum depth we need to get links until |
Definition at line 3514 of file asset_manager.inc.
getAsset | ( | $assetid, | |
$type_code = '' , |
|||
$mute_errors = FALSE |
|||
) |
Returns a reference to the asset represented by the passed assetid
mixed | $assetid | (int | string) the asset id to be loaded |
string | $type_code | if this exists then this object is used to load the asset, if not then the DB is queried to find out the asset type |
boolean | $mute_errors | stops the outputting of errors in this fn, needed because you can't use the '@' operator when returning by reference |
We got the asset from the cache
If we also have a type_code to check, make sure it matches the one we're loading from cache.
Definition at line 1192 of file asset_manager.inc.
getAssetBackendHref | ( | $asset_info, | |
$backend_page = TRUE |
|||
) |
Returns the href(s) of an asset based on its assetid and the wanted screen
It reutrns an array of assetid and hrefs to the wanted screen
array | $asset_info | an array of asset info in the form assetid => screen code name |
boolean | $backend_page | whether 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) |
Definition at line 8756 of file asset_manager.inc.
& getAssetFromURL | ( | $protocol = NULL , |
|
$url = NULL , |
|||
$exact_match = TRUE , |
|||
$mute_errors = FALSE |
|||
) |
Returns a reference to the asset that has the passed url If no url is passed the current (aka PHP_SELF) one is used
string | $protocol | the protocol to match -> null means it is ignored |
string | $url | the urls to check for -> null defaults it to current url |
boolean | $exact_match | when TRUE only returns an asset if there is an exact match on the url, if FALSE searches back along the URL path for the asset that matches |
boolean | $mute_errors | stops the outputting of errors in this fn, needed because you can't use the '@' operator when returning by reference |
Definition at line 7821 of file asset_manager.inc.
getAssetHref | ( | $assetids, | |
$base_url = NULL , |
|||
$ignore_rollback = FALSE |
|||
) |
Returns the href for an asset closest to the $base_url, but relative to the current url
It returns string if $assetids is an in and an array(int => string) if $assetids is an array
int | array | $assetids | the id of the asset you want the href for or an array for a whole bunch of them |
string | $base_url | the url that we are want to match closest to |
boolean | $ignore_rollback | ignore rollback checks |
Definition at line 8654 of file asset_manager.inc.
getAssetIconURL | ( | $asset_type | ) |
Get a URL to access the icon for a type of asset
string | $asset_type | the type code to get the icon for |
Definition at line 8790 of file asset_manager.inc.
getAssetidsByLookupValue | ( | $lookup_name_exp, | |
$lookup_value_exp, | |||
$include_treeids | |||
) |
Get assetids that match the given lookup name and value
string | $lookup_name_exp | The name of the lookup value, or a SQL expression to match it |
string | $lookup_value_exp | The value of the lookup value, or a SQL expression to match it |
boolean | $include_treeids | If true, the result will be an array indexed by assetid where the values are arrays of treeids for that assetid. Otherwise it will be a simple array of treeids. |
Query 1 gets all the override values. Query 2 gets all the inherited values.
These are both DISTINCT's because we're potentially joining to the ast_lnk table which can have different link values for the same assetid.
The joins are a little different. override values are based on (almost) matching urls.
inherited values are based on like urls (basically, they start the same).
If we're including tree id's, we need to join to the lnk table, which has the matching of lookup.assetid = lnk.minorid so then we can get to the treeid.
Both queries need to restrict based on the lookup name and the value.
Definition at line 8410 of file asset_manager.inc.
getAssetInfo | ( | $assetids, | |
$type_code = Array() , |
|||
$strict_type_code = TRUE , |
|||
$field = '' |
|||
) |
Returns an array of information about assets of the passed codes
If one value in $field then the return value is Array(assetid => '[field]'), otherwise Array(assetid => Array())
array | $assetids | an array of assets to limit |
string | array | $type_code | an asset type code, or array of typecodes, to limit results to |
boolean | $strict_type_code | ensure returned assets are of the passed type codes |
string | $field | single field from the asset table to return (along with the assetid) Default is all fields |
Definition at line 1660 of file asset_manager.inc.
getAssetInfoFields | ( | ) |
Get the list of fields that getAssetInfo can return for an asset
Definition at line 1821 of file asset_manager.inc.
getAssetPermissionByCascade | ( | $assetid, | |
$permission, | |||
$userid = NULL , |
|||
$cascades = NULL |
|||
) |
Get list of permissions for a certain asset, filtered by cascading setting
This is primarily used for showing settings on the Permissions screen. Therefore, roles will NOT be collapsed.
Definition at line 7157 of file asset_manager.inc.
getAssetTree | ( | $majorids, | |
$levels = NULL , |
|||
$exclude_list = Array() , |
|||
$link_type = SQ_SC_LINK_FRONTEND_NAV , |
|||
$include_type_list = Array() , |
|||
$include_dependants = TRUE |
|||
) |
Return an array of asset ids in the order that they propogate out from the passed in assetIDs
The array returned for each asset is in the following format:
Array( 'assetid' => '155', 'majorid' => '151', 'type_code' => 'page_standard', 'status' => '2', 'name' => '(( page2 ))', 'short_name' => '(( page2 ))', 'path' => 'page2', 'sort_order' => '0', )
int | array | $majorids | the majorids to traverse the tree from |
int | $levels | the number of levels to traverse (if null, traverse all levels) |
array | $exclude_list | an array of assetid to exclude from the tree |
int | $link_type | the type of wanted links |
array | $include_type_list | Array of asset types to include Array( 'type_code' => Array( 0 => 'type_code1', 1 => 'type_code2' ), 'inherit' => Array( 0 => TRUE, 1 => FALSE, ), ) |
boolean | $include_dependants | a boolean |
Definition at line 4360 of file asset_manager.inc.
getAssetTreeids | ( | $assetid, | |
$link_type = NULL |
|||
) |
Returns the treeids of any links between the passed assetid(s) and any parents
If a single assetid is supplied, a simple array of treeids is returned. If an array of assetids is supplied then the result is indexed by assetid and each element is an array of treeids for that assetid.
int | array | $assetid | the id of the asset passed, or array of assetids |
int | $link_type | the type of wanted links |
Definition at line 4573 of file asset_manager.inc.
getAssetTypeAttributes | ( | $type_code, | |
$details = Array('name', 'type') |
|||
) |
Retrieves the attributes (with null values) for the asset type
string | $type_code | the type of asset |
array | $details | an array of columns from the DB table you want returned |
Definition at line 878 of file asset_manager.inc.
getAssetTypeHierarchy | ( | $base_type_code = '' , |
|
$allowed_access = '' |
|||
) |
Returns an array representing the class hierarchy for the asset types, either for whole system or for under the the passed asset type
string | $base_type_code | the asset type's hierarchy to return |
string | $allowed_access | the access type to return |
Definition at line 443 of file asset_manager.inc.
getAssetTypeInfo | ( | $assetids, | |
$type_code = Array() , |
|||
$strict_type_code = TRUE |
|||
) |
Returns an array of assetid => inherited_types for assets of the passed codes
array | $assetids | an array of assets to limit |
array | $type_code | an array of types codes to limit the results to |
boolean | $strict_type_code | ensure returned assets are of the passed type codes |
Definition at line 517 of file asset_manager.inc.
getAssetTypes | ( | $instantiable = NULL , |
|
$non_system_access = FALSE |
|||
) |
Returns the asset types and their information.
boolean | $instantiable | does the asset type need to instanstiable or not ? NULL = don't care |
boolean | $non_system_access | we don't want assets that only have system access |
Definition at line 136 of file asset_manager.inc.
getAssetURL | ( | $assetids, | |
$base_url = NULL , |
|||
$ignore_rollback = FALSE , |
|||
$base_contextid = NULL |
|||
) |
Returns the URL for an asset, closest to the $base_url
It returns string if $assetids is an int and an array(int => string) if $assetids is an array
int | array | $assetids | the id of the asset you want the url for or an array for a whole bunch of them |
string | $base_url | the url that we are want to match closest to |
boolean | $ignore_rollback | ignore rollback checks |
int | $base_contextid | the id of the context that you want the url from |
Definition at line 8494 of file asset_manager.inc.
getAttribute | ( | $attrid, | |
$value = NULL , |
|||
$mute_errors = FALSE |
|||
) |
Returns a reference to an attribute object
string | $attrid | the id of the attribute |
string | $value | the value of the attribute |
boolean | $mute_errors | stops the outputting of errors in this fn, needed because you can't use the '@' operator when returning by reference |
Definition at line 845 of file asset_manager.inc.
getAttributeInfo | ( | $attrids | ) |
Returns an array of information about attributes
array | $attrids | an array of assets to limit |
Definition at line 799 of file asset_manager.inc.
getAttributeValuesByName | ( | $attr_name, | |
$asset_type, | |||
$assetids, | |||
$contextid = NULL |
|||
) |
Get the values of the attribute with the given name for the given assetids
The assetids supplied must be assets of the specified type, or assets which inherit the specified attribute from the specified asset type. You may use 'asset' for the $asset_type to skip asset type checking (recommended that this only be used for common attributes like name). It returns the array of (string => mixed) representing assetid => attribute value
This method will also allow you to get attribute values for a different context. (The methods in Asset class, like attr(), will only return information for the currently active context, for simplicity in handling.)
string | $attr_name | The name of the attribute to get the values of |
string | $asset_type | The type code of the asset type that defines the attribute |
array | $assetids | IDs of the assets whose values we want |
int | $contextid | The ID of the context we wish to get the value of the attr for. (If omitted, use the currently active context.) |
For small number of assetids, we can safely nest them in where clause.
We make two parts of a query here This is for performance reasons If we get lots of asset id's in the where clause, performance isn't great so use an intersect query to break it down (this lets the db use different indexes)
The first part of the query gets the asset id's with the right attribute id's the second part gets the right asset id's then intersect
If it's an oracle db we're talking to, we can't do an intersect query as above because oracle won't let you use intersect queries where a nvarchar field is included in the query (custom_val)
so we're going to have to take the performance hit if there are lots of asset id's to filter through.
Definition at line 932 of file asset_manager.inc.
getChildren | ( | $assetid, | |
$type_code = '' , |
|||
$strict_type_code = TRUE , |
|||
$dependant = NULL , |
|||
$sort_by = NULL , |
|||
$access = NULL , |
|||
$effective = TRUE , |
|||
$min_depth = NULL , |
|||
$max_depth = NULL , |
|||
$direct_shadows_only = TRUE , |
|||
$link_value_wanted = NULL , |
|||
Array | $link_types_wanted = Array() , |
||
$expand_shadows = FALSE |
|||
) |
Get all asset ids that are below the passed assetid in the various trees in which it exists
The query generated to get the children is actually constructed in the Asset Manager's generateGetChildrenQuery function. It returns Array(int => string) returns an array of assetids and their type code The function might return a list of users without their type code (i.e.: when shadow assets are returned)
int | string | $assetid | the id of the asset to get its children for |
string | array | $type_code | the type of asset that is linked (eg 'Page', 'File', etc) if an array returns link if matches any of the array values |
boolean | $strict_type_code | whether we are finding assets that are just a $type_code or $type_code and any of it's sub-classes |
boolean | $dependant | if TRUE, results will be filtered to assets that are dependants. If FALSE, results will all not be dependants. If NULL, results will not be filtered |
string | $sort_by | a field in the asset table you would like the results sorted by (eg. name, short_name etc) |
int | $access | SQ_PERMISSION_READ|SQ_PERMISSION_WRITE|SQ_PERMISSION_ADMIN Specify that links should be returned for assets the user has read, write, or admin access for. Leave NULL to ignore permissions. |
boolean | $effective | If effective permissions should be considered or not. |
int | $min_depth | Optional parameter that specifies minimum number of levels below the specified asset for a child to qualify (immediate child is 1) |
int | $max_depth | Optional parameter that specifies maximum number of levels below the specified asset for a child to qualify to be returned |
boolean | $direct_shadows_only | If TRUE, ONLY direct shadow asset children will be returned If FALSE, ALL the shadow asset children will be returned |
string | array | $link_value_wanted | Link value wanted |
array | $link_types_wanted | link_type we want our results to be filtered by. By default it uses empty array which mean it will return all the link_types Other values that can be used in the array : SQ_LINK_TYPE_1, SQ_LINK_TYPE_2, SQ_LINK_TYPE_3, SQ_LINK_NOTICE, SQ_SC_LINK_FRONTEND_NAV, SQ_SC_LINK_BACKEND_NAV, SQ_SC_LINK_SIGNIFICANT, SQ_SC_LINK_WEB_PATHS |
boolean | $expand_shadows | Get shadow children of shadow asset links. Enable this where necessary but keep performance in mind. |
Definition at line 4146 of file asset_manager.inc.
getDependantChildren | ( | $assetid, | |
$type_code = '' , |
|||
$strict_type_code = TRUE |
|||
) |
Get all dependent children of an asset in the various tress in which it exists
It returns an array of the form Array([assetid] => [type_code])
int | $assetid | the id of the asset to get its children for |
string | array | $type_code | the type of asset that is linked (eg 'Page', 'File', etc) if an array returns link if matches any of the array values |
boolean | $strict_type_code | whether we are finding assets that are just a $type_code or $type_code and any of it's sub-classes |
Definition at line 4243 of file asset_manager.inc.
getDependantParents | ( | $assetid, | |
$type_code = '' , |
|||
$strict_type_code = TRUE , |
|||
$include_all_dependants = TRUE |
|||
) |
Get all dependent parents of an asset in the various trees in which it exists
It returns an array of assetids
int | $assetid | the id of the asset to get its children for |
string | array | $type_code | the type of asset that is linked (eg 'Page', 'File', etc) if an array returns link if matches any of the array values |
boolean | $strict_type_code | whether we are finding assets that are just a $type_code or $type_code and any of it's sub-classes |
boolean | $include_all_dependants | When FALSE, only show the top level of dependant parents |
Definition at line 4295 of file asset_manager.inc.
getDesignFromURL | ( | $url, | |
$design_name = 'design::system::frontend' |
|||
) |
Return the design for the passed URL
string | $url | the url to get the design for |
string | $design_name | the code for the design (eg. design::system::frontend) |
Since we have the url, we don't need to include the ast_lookup table in the query. we can just join the ast_lookup_value table to ast directly.
Definition at line 8275 of file asset_manager.inc.
getDesignHideFrameValues | ( | $designid | ) |
This function returns the hide frame value for a design.
int | $asset_id | the asset ID of the asset to delete |
Definition at line 10413 of file asset_manager.inc.
getEditableContents | ( | $assetid | ) |
Get the editable content of any asset below the passed assetid It returns FALSE if assetid is invalid, Array(assetid=>content) otherwise
int | $assetid | The asset we want to get the contents of |
Definition at line 1901 of file asset_manager.inc.
getForgottenItemsReport | ( | ) |
Returns a information string about all the assets in the cache which Ref Count > 0
Definition at line 10084 of file asset_manager.inc.
getInheritedDesignValueFromURL | ( | $url, | |
$design_name = 'design::system::frontend' |
|||
) |
Return an inheritable design value, given a URL
Currently called by Asset::updateLookups() when a design or paint layout is being handled and the asset's gone to its parents for an inherited value. In the case of designs we need to now go directly to links, because we can't use the lookup table values by itself anymore - we might end up inheriting an override instead
string | $url | the url to get the design for |
string | $design_name | the code for the design (eg. design::system::frontend) |
Definition at line 8327 of file asset_manager.inc.
getLineageFromURL | ( | $protocol = NULL , |
|
$url = NULL , |
|||
$mute_errors = FALSE |
|||
) |
Returns an array of assetid's + info in the order that they propogate out from the site url
If no url is passed the current (aka PHP_SELF) one is used
string | $protocol | the protocol to match -> null means it is ignored |
string | $url | the urls to check for -> null defaults it to current url |
boolean | $mute_errors | Mute errors - to stop errors appearing on a clean system |
Definition at line 7974 of file asset_manager.inc.
getLink | ( | $assetid, | |
$link_type = NULL , |
|||
$type_code = '' , |
|||
$strict_type_code = TRUE , |
|||
$value = NULL , |
|||
$side_of_link = 'major' , |
|||
$exclusive = NULL |
|||
) |
Get details of a link with the specified characteristics
int | $assetid | id of the the $side_of_link asset |
int | $link_type | integer that should be a single integer of the SQ_LINK_* constants |
string | array | $type_code | the type of asset that is linked (eg 'Page', 'File', etc) if an array returns link if matches any of the array values |
boolean | $strict_type_code | whether we are finding an asset that is just a $type_code or potentially an inherited type or $type_code and any of it's sub-classes |
string | $value | the value that is associated with this link |
string | $side_of_link | Which side of the link this (the current) asset is on ('major' or 'minor') |
boolean | $exclusive | The exclusive status for the link must be this (if not null) |
Definition at line 2825 of file asset_manager.inc.
getLinkByAsset | ( | $assetid, | |
$other_assetid, | |||
$link_types = NULL , |
|||
$value = NULL , |
|||
$side_of_link = 'major' , |
|||
$force_array = FALSE , |
|||
$dependant = NULL , |
|||
$exclusive = NULL |
|||
) |
Get details of the link(s) between the two specified assets
It returns array of link info if only one link and force_array=FALSE, array of arrays of link info otherwise
int | $assetid | id of the the $side_of_link asset |
mixed | $other_assetid | the asset(s) on the other side of the link - can be an array of assets |
int | $link_types | integer that can be the product of bitwise operations on the SQ_LINK_* constants |
string | $value | the value that is associated with this link |
string | $side_of_link | Which side of the link the first assetid is on ('major' or 'minor') |
boolean | $force_array | force the results to return an array of links even if there is only one link |
boolean | $dependant | The dependant status for all the links must be this (if not null) |
boolean | $exclusive | The exclusive status for all the links must be this (if not null) |
Definition at line 3077 of file asset_manager.inc.
getLinkById | ( | $linkid, | |
$assetid = 0 , |
|||
$side_of_link = 'major' |
|||
) |
Get details of the link with specified linkid
int | $linkid | id of the link |
string | $assetid | id of the the $side_of_link asset if zero no check is made and both major and minor information is returned |
string | $side_of_link | Which side of the link the asset represented by $assetid is on ('major' or 'minor') |
Definition at line 2997 of file asset_manager.inc.
getLinkLineages | ( | $assetid, | |
$result_limit = 0 , |
|||
$from_treeid = NULL , |
|||
$fields = 'name' , |
|||
$only_significant = FALSE |
|||
) |
For a given asset, get the lineages from the Root folder down to it
Also returns basic information about the last link (linkid and link type) linkid => Array ('linkid' => linkid, 'link_type' => link_type, 'lineage' => Array(...))
string | $assetid | ID of the asset whose linages we want |
int | $result_limit | limits the number of results returned |
string | array | $from_treeid | Uses this/these treeid(s) as the root node |
string | array | $fields | Returns these asset field(s) in lineage details (e.g name, type_code) |
boolean | $only_significant | Only return the significant links, and ignore notice links |
get the parent treeid's for this asset.
This is done as a separate db call for performance reasons if it's done as a subquery, then there are multiple seq-scans of the lnk & lnk_tree tables (which can be quite large) separating the two calls means the second call looks at hardcoded id's - which can then be looked up in the index which is a nice win.
we found some tree id's - quote them and plug them back in to the main query directly.
check if we've seen this tree id before if we have, skip it. if we haven't, add it to the list this check can provide an improvement if an asset is linked in lots of places all over the system
no parent tree ids? then we don't have any lineages we are on the top level.
Definition at line 3698 of file asset_manager.inc.
getLinks | ( | $assetid, | |
$link_types, | |||
$type_code = '' , |
|||
$strict_type_code = TRUE , |
|||
$side_of_link = 'major' , |
|||
$value = NULL , |
|||
$dependant = NULL , |
|||
$exclusive = NULL , |
|||
$sort_by = NULL , |
|||
$access = NULL , |
|||
$effective = TRUE |
|||
) |
Get all links matching the specified characteristics
The query generated to get the links is actually contructed in the Asset Manager's generateGetLinksQuery function.
int | $assetid | id of the the $side_of_link asset |
int | $link_types | integer that can be the product of bitwise operations on the SQ_LINK_* constants |
string | array | $type_code | the type of asset that is linked (eg 'Page', 'File', etc) if an array returns link if matches any of the array values |
boolean | $strict_type_code | whether we are finding assets that are just a $type_code or $type_code and any of it's sub-classes |
string | $side_of_link | Which side of the link this (the current) asset is on ('major' or 'minor') |
string | array | $value | The value for all the links must equal this (if not null) |
boolean | $dependant | The dependant status for all the links must be this (if not null) |
boolean | $exclusive | The exclusive status for all the links must be this (if not null) |
string | $sort_by | a field in the asset table you would like the results sorted by (eg. name, short_name etc) |
int | $access | SQ_PERMISSION_READ|SQ_PERMISSION_WRITE|SQ_PERMISSION_ADMIN Specify that links should be returned for assets the user has read, write, or admin access for. Leave NULL to ignore permissions. |
boolean | $effective | If effective permissions should be considered or not. |
Definition at line 3334 of file asset_manager.inc.
getLinkTreeid | ( | $linkid | ) |
Returns the treeids for linkids passed in.
Accepts a single treeid int or an array of treeids for which to get link ids
int | array | $linkid | the id of the link passed, or array of linkids |
Definition at line 4634 of file asset_manager.inc.
getLockInfo | ( | $assetid, | |
$lock_type, | |||
$force_array = FALSE , |
|||
$full_chain = FALSE , |
|||
$check_expires = TRUE , |
|||
$allow_only_one = FALSE |
|||
) |
Returns an array of information about the current lock on this asset (if any)
int | $assetid | the assetid of the asset that we want lock info for |
string | $lock_type | any valid lock type for the passed asset's type, plus 'all' which will return all locks that this asset has - will force an array to be returned |
boolean | $force_array | always return the information in an array, as though more than one lock has been requested |
boolean | $full_chain | return the info for every asset in the lock chain |
boolean | $check_expires | check the expiry date and cleanup the lock if it has expired |
boolean | $allow_only_one | Force only one lock returned |
Definition at line 2696 of file asset_manager.inc.
getLockTypes | ( | $assetid, | |
$lock_type | |||
) |
Returns an array of lock types strings that the passed lock type really represents for the passed asset eg 'content' could mean 'attributes' and 'links'
int | $assetid | the assetid of the asset that we want lock info for |
string | $lock_type | any valid lock type for the passed asset's type, plus 'all' which will return all lock types that this asset has |
Definition at line 2761 of file asset_manager.inc.
getParents | ( | $assetid, | |
$type_code = '' , |
|||
$strict_type_code = TRUE , |
|||
$sort_by = NULL , |
|||
$access = NULL , |
|||
$effective = TRUE , |
|||
$min_height = NULL , |
|||
$max_height = NULL , |
|||
$ignore_bridge = FALSE , |
|||
$link_value_wanted = NULL , |
|||
$bind_var_prefix = 'gp_' |
|||
) |
Get all asset ids that are above the passed assetid in the various trees in which it exists
It returns Array(int => string) returns an array of assetids and their type code
int | $assetid | the id of the asset to get its parents for |
string | array | $type_code | the type of asset that is linked (eg 'Page', 'File', etc) if an array returns link if matches any of the array values |
boolean | $strict_type_code | whether we are finding assets that are just a $type_code or $type_code and any of it's sub-classes |
string | $sort_by | a field in the asset table you would like the results sorted by (eg. name, short_name etc) |
int | $access | SQ_PERMISSION_READ|SQ_PERMISSION_WRITE|SQ_PERMISSION_ADMIN Specify that links should be returned for assets the user has read, write, or admin access for. Leave NULL to ignore permissions. |
boolean | $effective | If effective permissions should be considered or not. |
int | $min_height | Optional parameter that specifies minimum number of levels above the specified asset for a parent to qualify (immediate parent is 1) |
int | $max_height | Optional parameter that specifies maximum number of levels above the specified asset for a parent to qualify to be returned |
boolean | $ignore_bridge | Optional parameter that, if true, will prevent this function from requesting parents from shadow asset bridges |
string | array | $link_value_wanted | Link Value Wanted |
string | $bind_var_prefix | Prefix for bind variables. Use if this query is going to be used more than once in a larger query (say, a UNION). |
Definition at line 3999 of file asset_manager.inc.
getPermission | ( | $assetid, | |
$permission, | |||
$granted = NULL , |
|||
$and_greater = TRUE , |
|||
$expand_groups = FALSE , |
|||
$all_info = FALSE , |
|||
$collapse_roles = FALSE |
|||
) |
Returns an array of all user or user_group assets that have the passed permission for the passed asset
int | $assetid | the assetid for asset whose permissions to get |
string | $permission | the permission code you are getting |
boolean | $granted | type of Access : NULL = all, TRUE = granted, FALSE = denied |
boolean | $and_greater | get effective permission (eg read access = read or write or admin) |
boolean | $expand_groups | expand user groups so only user ids get returned (NOTE: only valid if $all_info is FALSE) |
boolean | $all_info | when FALSE fn just returns an array of userids for those that have permission When TRUE fn returns all info about the permission in the form of Array(userid => granted) (NOTE: TRUE is only valid if $and_greater and $expand_groups are FALSE) |
boolean | $collapse_roles | When TRUE, only use the permissions table (ie. don't expand roles) Otherwise, the permissions view (which includes role expansions) are used |
Definition at line 7042 of file asset_manager.inc.
getRole | ( | $assetid = NULL , |
|
$roleid = NULL , |
|||
$userid = NULL , |
|||
$include_assetid = FALSE , |
|||
$include_globals = FALSE , |
|||
$expand_groups = FALSE , |
|||
$inc_dependants = TRUE , |
|||
$include_parents = FALSE , |
|||
$type_codes = Array() , |
|||
$strict_type_code = TRUE |
|||
) |
Returns an array of roles and the users/groups which can perform it
int | $assetid | the assetid of the asset the role is applied to |
int | $roleid | the assetid of the the role that is applied |
int | $userid | the assetid of the user performing the role |
boolean | $include_assetid | whether to include the assetid in the returned array |
boolean | $include_globals | whether to query the role view which includes expanded global roles as individual users |
boolean | $expand_groups | when TRUE, any groups defined within a role will be replaced with the userids in that group. If FALSE, return the groupids |
boolean | $inc_dependants | If false it will filter out the dependant assets |
boolean | $include_parents | When $userid is specified. This will include the roles applied directly to the user and indirectly to user parent groups. |
array | $type_codes | When $include_assetid is TRUE. This is a type code filter for returned assetids. |
array | $strict_type_code | Use strict type code for type code filter |
Definition at line 7510 of file asset_manager.inc.
getRootURL | ( | $url = NULL | ) |
Returns the information from the sq_asset_url table for the root url closest to the passed URL i.e. returns the info for the site closest to this url If no url is passed the current (aka PHP_SELF) one is used
string | $url | the urls to check for (excluding protocol) -> NULL defaults it to current url |
Definition at line 7898 of file asset_manager.inc.
getShadowLinkByAsset | ( | $assetid, | |
$other_assetid = NULL , |
|||
$link_types = NULL , |
|||
$value = NULL , |
|||
$side_of_link = 'major' , |
|||
$force_array = FALSE |
|||
) |
Get details of a "shadow" asset link with the specified characteristics
int | $assetid | id of the the $side_of_link asset |
int | $other_assetid | id of the the other asset |
int | $link_types | integer that should be a single integer of the SQ_LINK_* constants |
string | $value | the value that is associated with this link |
string | $side_of_link | side of this asset in this link |
boolean | $force_array | if it's TRUE, the returned value is always an array |
Definition at line 2930 of file asset_manager.inc.
getSnippetKeywords | ( | $more_info = FALSE | ) |
Returns an array of global snippet keywords that are available to the current user
boolean | $more_info | returns description if this is true |
Check if we've generated this list before. If we have, return the old list. include the more_info var in case we get a call with & without more_info requested
Definition at line 10127 of file asset_manager.inc.
getSystemAsset | ( | $name, | |
$mute_errors = FALSE |
|||
) |
Returns a reference to a system asset
string | $name | the name of the system asset 'root_folder', 'trash_folder' etc |
boolean | $mute_errors | stops the outputting of errors in this fn, needed because you can't use the '@' operator when returning by reference |
Definition at line 1597 of file asset_manager.inc.
getSystemAssetid | ( | $name | ) |
Returns an assetid for a system asset if it exists
string | $name | the name of the system asset 'root_folder', 'trash_folder' etc |
Definition at line 1487 of file asset_manager.inc.
getTypeAncestors | ( | $type_code, | |
$include_asset = TRUE , |
|||
$query_db = FALSE |
|||
) |
Returns an array of all assets types that are parents for the passed asset in the order Array ('parent', 'grand-parent', 'great-grand-parent', ..., 'asset')
string | $type_code | the code name for the asset that you want to check |
boolean | $include_asset | when TRUE adds the "Asset" type to the parent list, even though it's an uninstantiable object |
boolean | $query_db | whether to ask the DB instead of using the cache file |
Definition at line 656 of file asset_manager.inc.
getTypeAssetids | ( | $type_code, | |
$strict = TRUE , |
|||
$include_type = FALSE |
|||
) |
Returns list of all assetids of a certain type
string | $type_code | if this exists then this object is used to load the asset, if not then the DB is queried to find out the asset type |
boolean | $strict | whether we are finding assets that are just a $type_code or $type_code and any of it's sub-classes |
boolean | $include_type | if FALSE returns Array(assetid, assetid, ...), if TRUE returns Array(assetid => asset_type, assetid => asset_type, ...) |
Definition at line 1849 of file asset_manager.inc.
getTypeDescendants | ( | $type_code, | |
$include_passed = FALSE |
|||
) |
Returns an array of all assets types that are descendants for the passed asset type in the order Array ('type_code_sub_class_one', 'type_code_sub_class_two', ..., 'type_code_sub_class_one_sub_class_one', ...)
string | array | $type_code | the type code that you want the decendants of |
boolean | $include_passed | when TRUE includes the passed $type_code in the result |
Definition at line 707 of file asset_manager.inc.
getTypeInfo | ( | $type_code, | |
$field = '' |
|||
) |
Returns an array of asset information or a specific piece of information
on success: field value if field specified, array of field values if field blank on failure: null if field specified, empty array otherwise
mixed | $type_code | the code name (or array of code names) for the asset that you want to check |
string | $field | if exists, returns this information from the array for this specific field |
Definition at line 331 of file asset_manager.inc.
getTypeList | ( | ) |
Returns an array of type codes that are installed in the system
Definition at line 312 of file asset_manager.inc.
getUrlFromLineage | ( | $lineage = Array() , |
|
$root_url = NULL , |
|||
$protocol = NULL |
|||
) |
Given lineage of asset ids from top to bottom, this funciton will pick an URL of the bottom asset (current asset) that matches with given lineage.
array | $lineage | array of asset ids from top to bottom |
string | $root_url | additional root url to help filtering the results in case the root site has multiple urls |
Definition at line 8212 of file asset_manager.inc.
getURLs | ( | $assetid | ) |
Returns an array of URLs of an asset, including the protocol information
int | $assetid | the assetid of the asset |
Definition at line 7940 of file asset_manager.inc.
getValueFromURL | ( | $url, | |
$value_name, | |||
$like_value = FALSE |
|||
) |
Return the lookup value for the passed URL
string | $url | the url to get the design for |
string | $value_name | the code for the design/layout (eg. design/paint_layout::system::frontend), the code pattern if using $like_value (eg. design/paint_layout::%) |
boolean | $like_value | TRUE = LIKE $value_name, otherwise direct match to $value_name |
Definition at line 8364 of file asset_manager.inc.
includeAsset | ( | $type_code, | |
$with_edit_fns = FALSE |
|||
) |
Includes the class file for the passed asset
string | $type_code | the code name for the asset that you want to check |
boolean | $with_edit_fns | Whether to include the Edit_Fns class file too |
Definition at line 617 of file asset_manager.inc.
installed | ( | $type_code | ) |
Returns whether the passed asset is installed in the system or not
string | $type_code | the code name for the asset that you want to check |
Definition at line 299 of file asset_manager.inc.
isDependant | ( | $assetid | ) |
isDependant function: check if an asset is linked dependantly somewhere
string | $assetid | The id of the asset that we are checking for |
Definition at line 10099 of file asset_manager.inc.
isSystemAssetType | ( | $asset_type | ) |
Returns TRUE if given asset type is already registered as a system asset
During install, the output of this function should not be cached as it can change when new asset types are installed
string | $asset_type | typecode of asset in question |
Definition at line 1555 of file asset_manager.inc.
isTypeAncestor | ( | $type_code1, | |
$type_code2 | |||
) |
Returns whether or not a type code is an ancestor of another
string | $type_code1 | potential parent type code |
string | $type_code2 | potential child type code |
Definition at line 762 of file asset_manager.inc.
isTypeDecendant | ( | $type_code1, | |
$type_code2 | |||
) |
Returns whether or not a type code is a decendant of another
string | $type_code1 | potential child type code |
string | $type_code2 | potential parent type code |
Definition at line 744 of file asset_manager.inc.
isUnderRootNodes | ( | $assetid, | |
$root_nodes = Array() , |
|||
$return_matched_nodes = FALSE |
|||
) |
Checks whehter the given asset is under specific root nodes
string | $assetid | the asset ID of the asset to see if it's under specific root nodes |
array | $root_nodes | an array of assetids of root nodes |
Definition at line 10443 of file asset_manager.inc.
moveLink | ( | $linkid, | |
$to_parentid, | |||
$link_type, | |||
$to_parent_pos, | |||
$link_value = '' |
|||
) |
Move a link to a new parent
int | $linkid | the link id of the link to move |
int | $to_parentid | the asset id of the new parent asset |
int | $link_type | the type of the new link |
int | $to_parent_pos | the position under the new parent |
string | $link_value | the value of the new link |
Definition at line 5928 of file asset_manager.inc.
moveLinkPos | ( | $linkid, | |
$sort_order = -1 |
|||
) |
Move a link from one position in the asset's links order to another
int | $linkid | the link id of the link to move about |
int | $sort_order | the position in the links list that this link should take, if less than zero places at end of list |
Definition at line 6052 of file asset_manager.inc.
paintBackend | ( | & | $backend | ) |
Prints out the interface for viewing and customising asset types
object | &$backend | backend |
Definition at line 9008 of file asset_manager.inc.
purgeAsset | ( | $asset_id | ) |
Deletes an asset for good - bypassing the trash. PLEASE NOTE: This is a permanent and irreversible action, so please use with extreme care.
int | $asset_id | the asset ID of the asset to delete |
Definition at line 10307 of file asset_manager.inc.
refreshAssetType | ( | $type_code | ) |
Refreshes the passed asset types data in the assets array Also updates the sq_ast_typ_inhd table so as to have all links pointing correctly
string | $type_code | the code name for the asset type that you want to refresh |
Definition at line 172 of file asset_manager.inc.
registerSystemAsset | ( | $asset_type = NULL , |
|
$assetid = NULL |
|||
) |
Registers a system asset, identified by the type,id pair
string | $asset_type | asset typecode |
string | $assetid | asset id |
Definition at line 1575 of file asset_manager.inc.
releaseLock | ( | $assetid, | |
$lock_type | |||
) |
Release the locks that the passed asset holds
Assume that the current user has the lock to release before trying to see if it can be released by force.
int | $assetid | the assetid of the asset that we want to release |
string | $lock_type | the type of the lock (eg 'contents', 'permissions', etc) |
Definition at line 2587 of file asset_manager.inc.
rememberAsset | ( | & | $obj | ) |
Registers the passed object in the store, for others to get Used when a new record has just been "created"
object | &$obj | the asset to be registered |
Definition at line 1429 of file asset_manager.inc.
resetSystemAssetList | ( | ) |
Empties the cached list of system assets
Definition at line 1537 of file asset_manager.inc.
setEditableContents | ( | $assetid, | |
$content | |||
) |
Set the editable content of the specified asset It returns FALSE if assetid is invalid, TRUE if successful
int | $assetid | The asset we want to set the contents of |
string | $content | The content of editable asset |
Definition at line 1947 of file asset_manager.inc.
setPermission | ( | $assetid, | |
$userid, | |||
$permission, | |||
$granted, | |||
$cascades = TRUE , |
|||
$force_set = FALSE |
|||
) |
Sets a permission for the passed user or user_group
int | $assetid | the assetid for asset whose permissions to set |
int | $userid | the id of the user or user_group to add the permission for |
string | $permission | the permission code you are adding |
boolean | $granted | whether this permission grants access or not |
boolean | $cascades | whether this permission cascades to children or not |
boolean | $force_set | if TRUE, existing permissions will be overridden even if the new permissions are found to conflict with them |
Definition at line 7203 of file asset_manager.inc.
setRole | ( | $assetid, | |
$roleid, | |||
$userid | |||
) |
Apply a role to an asset and specify a user to perform the role
int | $assetid | the assetid of the asset |
int | $roleid | the assetid the role |
int | $userid | the assetid of the user performing the role |
Definition at line 7690 of file asset_manager.inc.
trashAsset | ( | $assetid, | |
$force_trash = FALSE |
|||
) |
Send the specified asset directly to the trash, where possible
This deletes its links to all its current parents, and creates a link for it in the trash folder
string | $assetid | the asset to trash |
boolean | $force_trash | do not abort trashing if any error occurs |
Definition at line 6942 of file asset_manager.inc.
updateLink | ( | $linkid, | |
$link_type = NULL , |
|||
$value = NULL , |
|||
$sort_order = NULL , |
|||
$locked = NULL |
|||
) |
Update the details of an existing link
If any of the detail vars are NULL they are not updated.
int | $linkid | the link id of the link to update |
int | $link_type | the type of the link (one of the SQ_LINK_* constants) |
string | $value | the value to place on the link |
int | $sort_order | the position in the links list that this link should take, if less than zero places at end of list |
string | $locked | the asset's link lock status |
Definition at line 6074 of file asset_manager.inc.
updateLock | ( | $assetid, | |
$lock_type, | |||
$expires = 0 |
|||
) |
Updates the expiry date of the lock on this asset
int | $assetid | the assetid of the asset that we want to release |
string | $lock_type | the type of the lock (eg 'contents', 'permissions', etc) |
int | NULL | $expires | when the lock expires (timestamp or NULL) |
Definition at line 2652 of file asset_manager.inc.
validAttributeType | ( | $attr_type | ) |
Checks the passed attribute type is valid type or not
string | $attr_type | the type of asset represented by the id |
Definition at line 778 of file asset_manager.inc.
webPathsInUse | ( | Asset | $major, |
$paths, | |||
$ignore_assetid = 0 , |
|||
$return_alternatives = FALSE |
|||
) |
Returns an array of the passed web paths that are currently in use by any the children of the major asset
Ideally we could do this in only a couple of queries:
Asset | $major | the major asset, whose children we are to check |
array | $paths | array of web paths to check |
int | $ignore_assetid | ignore this assetid when checking |
boolean | $return_alternatives | return all paths but replace the bad paths with a valid alternative |
fixPaths will be a list of paths that are already taken and need to be adjusted.
There are none? Yay!
We only need to do this for the paths we need to fix. We'll go through them one by one and work out the closest match. We do that by stripping numbers off the end of the path and seeing if there are any matches.
endPaths keeps a lits of the last path used in each chunk received from the database. See function comments about #99 vs #120 for why
Since we're fetching in chunks we need to make sure we order the results. So we don't double up and we don't miss any.
(path, assetid) is the primary key - so use that for ordering.
If we're only looking at numeric paths, get rid of non-numeric paths we can't use 'max' here to do it because '1' and 'page-1' will get returned depending on which path was found first (see php.net/max for details/examples) and also if a path starts with a number it will be included (which is not what we want at all).
Keep a list of the last path in this chunk. We'll use this later on in case we need to increment the path id's.
increment each modified path based on the last_path above. no need to check if the id is taken again, we've done that.
Definition at line 8818 of file asset_manager.inc.