Squiz Matrix
4.12.2
|
Public Member Functions | |
Metadata_Manager () | |
requiredFieldsComplete ($assetid) | |
allowsMetadata ($assetid) | |
getSchemas ($assetid, $granted=NULL, $cascades=NULL) | |
getAssetSchemaInfo ($assetid, $schemaid=NULL, $cascades=NULL, $include_cascades=TRUE) | |
setSchema ($assetid, $schemaid, $granted, $cascades=TRUE, $force_set=FALSE) | |
deleteSchema ($assetid, $schemaid) | |
getSchemaAssets ($schemaid, $granted=NULL) | |
getMetadataFields ($schemaids) | |
getMetadata ($assetid, $schemaid=0, $contextid=NULL) | |
_cleanupMetadataValues ($assetid) | |
getSchemaDefaultValues ($schemaid, $contextid=NULL) | |
loadMetadataFile ($assetid, $metadata_filename) | |
getMetadataFieldValues ($assetid, $field_names=Array(), $contextid=NULL) | |
setMetadata ($assetid, $metadata, $contextid=NULL, $update_asset=TRUE, $broadcast_all_fields=FALSE, $ignore_editable=FALSE) | |
generateContentFile ($assetid, $regenerate=FALSE, $contextid=NULL, $update_asset=TRUE) | |
generateKeywordReplacements (&$metadata_asset, $keywords, $generating=TRUE) | |
regenerateMetadata ($assetid, $contextid=NULL, $update_asset=TRUE) | |
purgeMetadata ($assetid) | |
getMetadataInterfaceValueByAssetid ($assetid, $field_assetid, $mute_errors=FALSE, &$has_errors=FALSE, $contextid=NULL) | |
getMetadataValueByAssetid ($assetid, $field_assetid, $mute_errors=FALSE, $replace_nested_keyword=FALSE, $contextid=NULL) | |
isMetadataFieldAssetid ($field_assetid) | |
getMetadataFieldDefaultValue ($field_assetid, $contextid=NULL) | |
setMetadataFieldDefaultValue ($field_assetid, $value, $contextid=NULL) | |
escapeMetadata ($value, $escape_single=FALSE) | |
getFieldAssetIdFromName ($assetid, $target_field_name) | |
getMetadataFieldTypeValues ($assetid, $metadata_field_type, $contextid=NULL) | |
Public Member Functions inherited from MySource_Object | |
MySource_Object () | |
__sleep () | |
__wakeup () | |
Additional Inherited Members | |
Data Fields inherited from MySource_Object | |
$_tmp | |
Definition at line 29 of file metadata_manager.inc.
_cleanupMetadataValues | ( | $assetid | ) |
Remove entries from the mdata_val table that don't correspond to an applied schema or a currently available context
int | $assetid | The ID of the asset whose values we want to clean up |
Definition at line 613 of file metadata_manager.inc.
allowsMetadata | ( | $assetid | ) |
Check if metadata can be set on an asset
string | $assetid | the ID of the asset to check |
Definition at line 91 of file metadata_manager.inc.
deleteSchema | ( | $assetid, | |
$schemaid | |||
) |
Remove a set schema from an asset
string | $assetid | the ID of the asset to delete the schema from |
string | $schemaid | the ID of the schema to delete |
Definition at line 367 of file metadata_manager.inc.
escapeMetadata | ( | $value, | |
$escape_single = FALSE |
|||
) |
Escapes the passed value to be used inside quotes in a block of PHP (eg. when the field names and values are cached out to each asset's metadata.php)
string | $value | the value to escape |
boolean | $escape_single | whether or not the apostrophes are escaped with backslashes; defaults to FALSE |
Definition at line 2328 of file metadata_manager.inc.
generateContentFile | ( | $assetid, | |
$regenerate = FALSE , |
|||
$contextid = NULL , |
|||
$update_asset = TRUE |
|||
) |
Generate a PHP file that can be included to print all metadata fields for an asset
The generated file contains PHP code to do any keyword replacing based on current values instead of the ones at the time of caching.
string | $assetid | the ID of the asset to generate the file for |
boolean | $regenerate | regenerate the DB information as well |
int | $contextid | Context to generate the content file for |
boolean | $update_asset | Update the asset? |
Definition at line 1113 of file metadata_manager.inc.
generateKeywordReplacements | ( | & | $metadata_asset, |
$keywords, | |||
$generating = TRUE |
|||
) |
Generate an array of keyword replacements, or the PHP code to generate it
This function outputs the PHP required to generate all the keywords that it is passed. All PHP generated places values in an array called $metadata_replacements (which happens in the outputted PHP code). An array of replacements is returned that can be used to replace all the keywords with a PHP string to output the correct value from the $metadata_replacements array. Return format is (keyword => replacement) This function can also return the values of the replacement values instead of the PHP code.
object | &$metadata_asset | the asset to use for replacment values |
array | $keywords | an array of keywords in |
boolean | $generating | generate the PHP code or not (which generates the value) |
Definition at line 1451 of file metadata_manager.inc.
getAssetSchemaInfo | ( | $assetid, | |
$schemaid = NULL , |
|||
$cascades = NULL , |
|||
$include_cascades = TRUE |
|||
) |
Get list of schemas for a certain asset, optionally filtered by cascading setting
This is primarily used for showing settings on the Metadata Schemas screen.
Definition at line 163 of file metadata_manager.inc.
getFieldAssetIdFromName | ( | $assetid, | |
$target_field_name | |||
) |
Given the ID of an asset that has metadata applied and the name of a field that is applied to that asset, get the asset ID of that metadata field
Returns FALSE if the asset ID does not exist, or if the asset doesn't have a field matching the field name
Throws an assertion exception if the asset ID is completely invalid, or if the field name is not a string.
string | $assetid | The ID of the asset we wish to check |
string | $target_field_name | The name of the field we wish to find |
Definition at line 2379 of file metadata_manager.inc.
getMetadata | ( | $assetid, | |
$schemaid = 0 , |
|||
$contextid = NULL |
|||
) |
Get the metadata values set for an asset on a particular schema
The array returned may have some fields missing. If there is no field value it means that the field is using the default value (whatever that happens to be at the time). This cuts down on storage and allows defaults to change over time without updating metadata values.
string | $assetid | the ID of the asset to get metadata for |
string | $schemaid | optional ID of the schema to only the get metadata for |
int | $contextid | The context which we should get values from |
Definition at line 528 of file metadata_manager.inc.
getMetadataFieldDefaultValue | ( | $field_assetid, | |
$contextid = NULL |
|||
) |
Returns whether the asset ID being passed into this function is some kind of metadata field asset
string | $field_assetid | the ID of the metadata field asset |
string | $contextid | the context that this applies to |
Definition at line 2141 of file metadata_manager.inc.
getMetadataFields | ( | $schemaids | ) |
Get an array of metatata fields IDs for a metadata schema
string | array | $schemaids | single schemaid or an array of schema ids whose fields we are getting |
Definition at line 492 of file metadata_manager.inc.
getMetadataFieldTypeValues | ( | $assetid, | |
$metadata_field_type, | |||
$contextid = NULL |
|||
) |
For given asset with metadata schema(s) applied, this function returns the value for all metadata fields of given type in following format:
Array( '<fieldname>' => '<metadata_value>' )
string | $assetid | The ID of the asset we wish to get metadata value of |
string | $metadata_field_type | The asset type of the field we wish to get |
boolean | $contextid |
Definition at line 2418 of file metadata_manager.inc.
getMetadataFieldValues | ( | $assetid, | |
$field_names = Array() , |
|||
$contextid = NULL |
|||
) |
Generate an array of current values for the passed metadata field names
If the passed fields array is empty, all field values will be returned
string | $assetid | the ID of the asset to get field values for |
array | $field_names | an array of field names |
int | $contextid | The context to get these values from |
Definition at line 755 of file metadata_manager.inc.
getMetadataInterfaceValueByAssetid | ( | $assetid, | |
$field_assetid, | |||
$mute_errors = FALSE , |
|||
& | $has_errors = FALSE , |
||
$contextid = NULL |
|||
) |
Get the value of an asset's metadata field based on that field's asset ID to populate its interface
string | $assetid | The ID of the asset that we want the metadata value of |
string | $field_assetid | The field that we wish to check |
boolean | $mute_errors | Set TRUE to mute errors that occur when the asset (specified in $assetid) does not have a schema applied to it |
boolean | $has_errors | This parameter is set to TRUE when an error occurs so that errors are acknowledged even they are mute ($mute_errors = TRUE) |
int | $contextid | The context to get the value of metadata for |
Definition at line 1956 of file metadata_manager.inc.
getMetadataValueByAssetid | ( | $assetid, | |
$field_assetid, | |||
$mute_errors = FALSE , |
|||
$replace_nested_keyword = FALSE , |
|||
$contextid = NULL |
|||
) |
Get the value of an asset's metadata field based on that field's asset ID
Because this value is for displaying on the front end, use the default value if required
string | $assetid | The ID of the asset that we want the metadata value of |
string | $field_assetid | The field that we wish to check |
boolean | $mute_errors | Set TRUE to mute errors that occur when the asset (specified in $assetid) does not have a schema applied to it |
boolean | $replace_nested_keyword | Set TRUE to replace nested keywords. If FALSE the function may return the value of the metadata field that contains keywords |
int | $contextid | The context to get the value of metadata for |
Definition at line 2038 of file metadata_manager.inc.
getSchemaAssets | ( | $schemaid, | |
$granted = NULL |
|||
) |
Get an array of assetIDs that have the passed schemaID applied or denied on them
string | $schemaid | the ID of the schema to get assets for |
boolean | $granted | type of access : null = all, TRUE = applied, FALSE = denied |
Definition at line 445 of file metadata_manager.inc.
getSchemaDefaultValues | ( | $schemaid, | |
$contextid = NULL |
|||
) |
Get the default metadata values for a particular schema
string | $schemaid | the ID of the schema to get default metadata for |
int | $contextid | Context to get the values for (omit for current) |
Definition at line 664 of file metadata_manager.inc.
getSchemas | ( | $assetid, | |
$granted = NULL , |
|||
$cascades = NULL |
|||
) |
Get an array of schemaIDs for all schemas applied and denied on an asset
if $granted is null returns Array(schemaid) otherwise returns Array(schemaid => granted[1|0])
string | $assetid | the ID of the asset to get schemas for |
boolean | $granted | type of access : null = all, TRUE = applied, FALSE = denied |
Definition at line 116 of file metadata_manager.inc.
isMetadataFieldAssetid | ( | $field_assetid | ) |
Returns whether the asset ID being passed into this function is some kind of metadata field asset
string | $field_assetid | the ID of the metadata field asset |
Definition at line 2100 of file metadata_manager.inc.
loadMetadataFile | ( | $assetid, | |
$metadata_filename | |||
) |
Load metadata values, principally from $metadata_filename
string | $assetid | |
string | $metadata_filename |
Definition at line 723 of file metadata_manager.inc.
Metadata_Manager | ( | ) |
Constructor
Definition at line 37 of file metadata_manager.inc.
purgeMetadata | ( | $assetid | ) |
Removes the metadata entries for the specified asset
string | $assetid | the assetid of the asset to purge |
Definition at line 1911 of file metadata_manager.inc.
regenerateMetadata | ( | $assetid, | |
$contextid = NULL , |
|||
$update_asset = TRUE |
|||
) |
Regenerate both the cached tag metadata and the serialised DB values
If $contextid is NULL, the current context will be used, like usual. However, if $contextid is "all", ALL content files will be generated. This is intended for regenerate metadata HIPOs, or first creation.
string | $assetid | the ID of the asset to regenerate metadata for |
mixed | $contextid | the context to regenerate |
boolean | $update_asset | update the asset? |
Definition at line 1857 of file metadata_manager.inc.
requiredFieldsComplete | ( | $assetid | ) |
Check if all required fields have been completed for an asset
If no values have been entered, the default schema values are checked
string | $assetid | the ID of the asset to check |
Definition at line 54 of file metadata_manager.inc.
setMetadata | ( | $assetid, | |
$metadata, | |||
$contextid = NULL , |
|||
$update_asset = TRUE , |
|||
$broadcast_all_fields = FALSE , |
|||
$ignore_editable = FALSE |
|||
) |
Set metadata values for an asset
string | $assetid | the ID of the asset to set the values for |
array | $metadata | the values to set |
int | $contextid | The context ID that this metadata setting applies for |
boolean | $broadcast_all_fields | If true, the event "metadata updated" will be broadcasted for all metadata fields |
Definition at line 842 of file metadata_manager.inc.
setMetadataFieldDefaultValue | ( | $field_assetid, | |
$value, | |||
$contextid = NULL |
|||
) |
Sets the default value of a certain metadata field asset (as identified by assetid)
string | $field_assetid | the ID of the metadata field asset |
string | $value | the value to be stored |
string | $contextid | the context that this applies to |
Definition at line 2223 of file metadata_manager.inc.
setSchema | ( | $assetid, | |
$schemaid, | |||
$granted, | |||
$cascades = TRUE , |
|||
$force_set = FALSE |
|||
) |
Apply a schema to or Deny from, an asset
string | $assetid | the ID of the asset to set the schema on |
string | $schemaid | the ID of the schema to set |
boolean | $granted | is this schema applied (TRUE) or denied (FALSE)? |
boolean | $cascades | does this schema cascade to newly created assets? |
boolean | $force_set | if true, existing metadata schemas will be updated regardless of whether or not the new metadata schemas are found to conflict with them |
Definition at line 228 of file metadata_manager.inc.