Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
form_question_rule_type_selection_edit_fns.inc
1 <?php
18 require_once dirname(__FILE__).'/../../form_question_rule/form_question_rule_edit_fns.inc';
19 
32 {
33 
34 
40  {
42 
43  }//end constructor
44 
45 
46  function paintRule(&$asset, &$o, $prefix, $rule_data, $write_access, &$q_asset)
47  {
48  $operator_list = $asset->getOperators();
49  $options = $q_asset->getOptions();
50 
51  if (!$write_access) {
52  $o->openField(translate('core_form_rule_details'));
53  echo translate('core_form_rule_selection_edit_'.(array_get_index($rule_data, 'operator', 1) ? 'true' : 'false'), $q_asset->getSummary($rule_data['value']));
54 
55  $o->closeField();
56 
57  } else {
58 
59  $o->openField(translate('operator'));
60  // list of operators
61  combo_box($prefix.'[operator]', $operator_list, false, array_get_index($rule_data, 'operator', 1));
62  $o->closeField();
63 
64  $o->openField(translate('option'));
65  // give a text box to write the comparison value in
66  combo_box($prefix.'[value]', $options, false, array_get_index($rule_data, 'value', ''));
67  $o->closeField();
68  }
69 
70  return $write_access;
71 
72  }//end paintRule()
73 
74 
81  function processRule(&$asset, &$o, $prefix, &$rule_data)
82  {
83  if (!isset($_POST[$prefix])) return false;
84 
85  $operator = array_get_index($_POST[$prefix], 'operator', null);
86  $comparison = array_get_index($_POST[$prefix], 'value', null);
87 
88  $rule_data['operator'] = $operator;
89  $rule_data['value'] = $comparison;
90 
91  return true;
92 
93  }//end processRule()
94 
95 
96 }//end class
97 ?>