Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
trigger_condition_metadata_time.inc
1 <?php
17 require_once SQ_CORE_PACKAGE_PATH.'/system/triggers/trigger_condition/trigger_condition.inc';
18 
30 {
31 
48  public static function evaluate($settings, &$state)
49  {
50  if (empty($settings['trigger_metadata_date_fieldid'])) return FALSE;
51  if (empty($state['asset'])) return FALSE;
52 
53  $ret = FALSE;
54 
55  $mdata_fieldid = isset($state['event']['data']['trigger_metadata_date_fieldid']) ? $state['event']['data']['trigger_metadata_date_fieldid'] : '';
56 
57  if (!empty($mdata_fieldid) && ($settings['trigger_metadata_date_fieldid'] == $mdata_fieldid)) {
58  $ret = TRUE;
59  }
60 
61  return $ret;
62 
63  }//end evaluate()
64 
65 
76  public static function getInterface($settings, $prefix, $write_access=FALSE)
77  {
78  require_once SQ_LIB_PATH.'/html_form/html_form.inc';
79 
80  // mdata field
81  ob_start();
82  echo translate('trigger_metadata_date_fieldid');
83  $fieldid = array_get_index($settings, 'trigger_metadata_date_fieldid', 0);
84  if ($write_access) {
85  asset_finder($prefix.'[trigger_metadata_date_fieldid]', $fieldid, Array('metadata_field_date' => 'D'));
86  } else {
87  echo '<b>#'.$fieldid.'</b>';
88  }
89  $ret = ob_get_clean();
90 
91  return $ret;
92 
93  }//end getInterface()
94 
95 
106  public static function processInterface(&$settings, $request_data)
107  {
108  if (empty($request_data)) {
109  return translate('trigger_input_data_error');
110  }
111 
112  $settings['trigger_metadata_date_fieldid'] = empty($request_data['trigger_metadata_date_fieldid']['assetid']) ? 0 : $request_data['trigger_metadata_date_fieldid']['assetid'];
113 
114  return FALSE;
115 
116  }//end processInterface()
117 
118 
119 }//end class
120 
121 ?>