Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
trigger_condition_metadata_field_updated.inc
1 <?php
17 require_once SQ_CORE_PACKAGE_PATH.'/system/triggers/trigger_condition/trigger_condition.inc';
18 
31 {
32 
33 
50  public static function evaluate($settings, &$state)
51  {
52  if (!isset($settings['field'])) return FALSE;
53  if (empty($settings['field'])) return FALSE;
54 
55  // No event data set
56  if (!isset($state['event']['data']['fieldids'])) return FALSE;
57  if (empty($state['event']['data']['fieldids'])) return FALSE;
58 
59  $fields_changed = $state['event']['data']['fieldids'];
60 
61  if (in_array($settings['field'], $fields_changed)) return TRUE;
62 
63  return FALSE;
64 
65  }//end evaluate()
66 
67 
78  public static function getInterface($settings, $prefix, $write_access=FALSE)
79  {
80  // Get defaults
81  $field = array_get_index($settings, 'field', 0);
82 
83  // Paint the interface
84  ob_start();
85  if ($write_access) {
86  echo translate('metadata_field');
87  echo asset_finder($prefix.'[metadata_field]', $field, Array('metadata_field'=>'D'));
88  echo '<br />';
89  echo translate('trigger_condition_metadata_field_updated_note');
90  } else {
91  if (empty($field)) {
92  echo translate('no_asset_selected');
93  } else {
94  echo get_asset_tag_line($field);
95  }//end if
96  }//end if
97  $contents = ob_get_contents();
98  ob_end_clean();
99 
100  return $contents;
101 
102  }//end getInterface()
103 
104 
115  public static function processInterface(&$settings, $request_data)
116  {
117  if (empty($request_data)) {
118  return translate('trigger_input_data_error');
119  }
120 
121  $options = array_get_index($request_data, 'metadata_field', Array());
122  $settings['field'] = array_get_index($options, 'assetid', 0);
123 
124  return FALSE;
125 
126  }//end processInterface()
127 
128 
135  public static function allowMultiple()
136  {
137  return TRUE;
138 
139  }//end allowMultiple()
140 
141 
142 }//end class
143 
144 ?>