18 require_once SQ_INCLUDE_PATH.
'/general_occasional.inc';
52 public static function evaluate($settings, &$state)
54 $tag_manager = $GLOBALS[
'SQ_SYSTEM']->getTagManager();
56 $assetid = $state[
'assetid'];
57 $tagids = array_get_index($settings,
'tagids');
58 $is_strict = array_get_index($settings,
'is_strict', FALSE);
61 trigger_localised_error(
'TRIG0004', E_USER_WARNING);
64 return $tag_manager->isAssetTaggedWith($assetid, $tagids, $is_strict);
79 public static function getInterface($settings, $prefix, $write_access=FALSE)
82 $tagids = array_get_index($settings,
'tagids', Array());
83 $is_strict = array_get_index($settings,
'is_strict', FALSE);
87 $strict_options[TRUE] = translate(
'all');
88 $strict_options[FALSE] = translate(
'some');
91 combo_box($prefix.
'[is_strict]', $strict_options, FALSE, $is_strict);
93 echo
'<strong>'.$strict_options[$is_strict].
'</strong>';
96 echo
' '.translate(
'tags_must_be_assigned');
100 $interface = ob_get_contents();
106 multiple_asset_finder($prefix.
'[tagids]', $tagids, Array(
'thesaurus_term'=>
'D'));
108 foreach ($tagids as $tagid) {
109 echo get_asset_tag_line($tagid).
' ';
113 $interface .= ob_get_contents();
133 $tagids = array_get_index($request_data,
'tagids', Array());
134 $settings[
'is_strict'] = (boolean) array_get_index($request_data,
'is_strict', FALSE);
136 foreach ($tagids as $tag) {
137 if (empty($tag[
'assetid']))
continue;
138 $settings[
'tagids'][$tag[
'assetid']] = $tag[
'assetid'];