50 public static function evaluate($settings, &$state)
54 if (!isset($state[
'assetid'])) {
55 if (isset($state[
'asset'])) {
56 $state[
'assetid'] = $state[
'asset']->id();
64 if ($state[
'assetid'] == $settings[
'assetid']) {
83 public static function getInterface($settings, $prefix, $write_access=FALSE)
85 $selected_assetid = array_get_index($settings,
'assetid', 0);
88 if ($selected_assetid && !$GLOBALS[
'SQ_SYSTEM']->am->assetExists($selected_assetid)) {
89 $selected_assetid = 0;
93 $form_element_extras =
'disabled="disabled"';
95 $form_element_extras =
'';
101 asset_finder($prefix.
'[assetid]', $selected_assetid);
103 if ($selected_assetid) {
104 $selected_assetname = $GLOBALS[
'SQ_SYSTEM']->am->getAssetInfo(Array($selected_assetid), Array(), TRUE,
'name');
105 text_box($prefix.
'[assetid]', $selected_assetname[$selected_assetid].
' (#'.$selected_assetid.
')',
'',
'', FALSE, $form_element_extras);
107 text_box($prefix.
'[assetid]',
'',
'',
'', FALSE, $form_element_extras);
111 $basic_part_1 = ob_get_contents();
114 return translate(
'trigger_asset_id', $basic_part_1);
130 if (empty($request_data)) {
131 return 'There was an error with input data';
134 if (empty($request_data[
'assetid']) || empty($request_data[
'assetid'][
'assetid'])) {
135 return 'Asset id is not specified';
138 $assetid = $request_data[
'assetid'][
'assetid'];
139 $settings[
'assetid'] = $assetid;
156 public static function setHash(&$settings, &$hash)
158 if (isset($settings[
'assetid'])) {
159 $hash->setAssetID($settings[
'assetid']);