17 require_once SQ_CORE_PACKAGE_PATH.
'/system/triggers/trigger_condition/trigger_condition.inc';
50 public static function evaluate($settings, &$state)
52 if (empty($settings[
'asset_id']))
return FALSE;
54 $metadata_value = $GLOBALS[
'SQ_SYSTEM']->getMetadataManager()->getMetadataValueByAssetid($state[
'assetid'], $settings[
'asset_id'], TRUE);
55 $default_value = $GLOBALS[
'SQ_SYSTEM']->getMetadataManager()->getMetadataFieldDefaultValue($settings[
'asset_id']);
58 if ( $metadata_value ==
'' || ($metadata_value === $default_value))
return FALSE;
76 public static function getInterface($settings, $prefix, $write_access=FALSE)
78 $selected_asset_id = array_get_index($settings,
'asset_id', 0);
79 $am = $GLOBALS[
'SQ_SYSTEM']->am;
80 if (!empty($selected_asset_id)) {
81 $selected_asset = $am->getAsset($selected_asset_id);
89 $restricted_types[
'metadata_field_text'] =
'I';
90 $restricted_types[
'metadata_field_thesaurus'] =
'I';
91 $restricted_types[
'metadata_field_select'] =
'I';
92 $restricted_types[
'metadata_field_wysiwyg'] =
'I';
93 $restricted_types[
'metadata_field_multiple_text'] =
'I';
94 asset_finder($prefix.
'[asset_id]', $selected_asset_id, $restricted_types);
96 if (!empty($selected_asset_id)) {
97 echo get_asset_tag_line($selected_asset_id);
102 $asset_id_component = ob_get_contents();
105 return translate(
'trigger_metadata_set', $asset_id_component);
122 if (empty($request_data)) {
123 return translate(
'trigger_input_data_error');
126 $asset_id = array_get_index($request_data,
'asset_id', FALSE);
128 return translate(
'trigger_asset_not_supplied');
131 if (!empty($asset_id[
'assetid'])) {
132 $asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($asset_id[
'assetid']);
133 $settings[
'asset_id'] = $asset_id[
'assetid'];