Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
trigger_action_fail.inc
1 <?php
17 require_once SQ_CORE_PACKAGE_PATH.'/system/triggers/trigger_action/trigger_action.inc';
18 
33 {
34 
35 
47  public static function execute($settings, &$state)
48  {
49  $error_level = $settings['error_level'];
50  if (!empty($error_level)) {
51  trigger_error($settings['error_message'], $error_level);
52  }
53  return FALSE;
54 
55  }//end execute()
56 
57 
68  public static function getInterface($settings, $prefix, $write_access=FALSE)
69  {
70 
71  // check settings, set defaults if necessary
72  $error_level = array_get_index($settings, 'error_level', 0);
73  $error_message = array_get_index($settings, 'error_message', '');
74 
75  ob_start();
76  $error_level_list = Array(
77  0 => translate('no_error'),
78  E_USER_NOTICE => translate('notice'),
79  E_USER_WARNING => translate('warning'),
80  E_USER_ERROR => translate('error'),
81  );
82  if ($write_access) {
83  combo_box($prefix.'[error_level]', $error_level_list, FALSE, $error_level);
84  } else {
85  echo '<b>'.$error_level_list[$error_level].'</b>';
86  }
87 
88  $part_1 = ob_get_contents();
89  ob_end_clean();
90 
91  ob_start();
92 
93  if ($write_access) {
94  text_area($prefix.'[error_message]', $error_message, 40, 5);
95  } else {
96  echo '<b>'.$error_message.'</b>';
97  }
98 
99  $part_2 = ob_get_contents();
100  ob_end_clean();
101 
102 
103  // now patch together the output
104  $contents = translate('trigger_fail_level_label').$part_1.
105  '<br /><br />'.
106  translate('trigger_fail_message_label').$part_2.
107  '<br /><br />'.
108  '<span class="sq-backend-warning"><b>'.translate('trigger_always_fails_warning').'</b></span>';
109 
110  return $contents;
111 
112  }//end getInterface()
113 
114 
126  public static function processInterface(&$settings, $request_data)
127  {
128 
129 
130  $settings['error_level'] = $request_data['error_level'];
131 
132  $settings['error_message'] = array_get_index($request_data, 'error_message', '');
133 
134  return FALSE;
135 
136  }//end processInterface()
137 
138 
148  public static function getLocks($settings, &$state)
149  {
150  return Array();
151 
152  }//end getLocks()
153 
154 
155 }//end class
156 
157 ?>