18 require_once dirname(__FILE__).
'/../../form_question_rule/form_question_rule_edit_fns.inc';
46 function paintRule(&$asset, &$o, $prefix, $rule_data, $write_access)
48 $operator_list = $asset->getOperators();
51 $o->openField(translate(
'core_form_rule_details'));
52 if (($cq_id = array_get_index($rule_data,
'comparison_question_id', 0)) != 0) {
53 $value = get_asset_tag_line($cq_id);
55 $value = array_get_index($rule_data,
'value',
'');
58 echo translate(
'core_form_rule_contain_edit_'.(array_get_index($rule_data,
'operator', 1) ?
'true' :
'false').($cq_id ?
'_q' :
''), $value);
63 $o->openField(translate(
'operator'));
65 combo_box($prefix.
'[operator]', $operator_list,
false, array_get_index($rule_data,
'operator', 1));
68 $o->openField(translate(
'core_form_rule_static_value'));
70 text_box($prefix.
'[value]', array_get_index($rule_data,
'value',
''), 30);
73 $o->openField(translate(
'core_form_rule_or_value_of_question'));
75 asset_finder($prefix.
'[asset]', array_get_index($rule_data,
'comparison_question_id',
'0'), Array(
'form_question' =>
'D'));
78 $o->openField(translate(
'core_form_case_sensitive_question'));
80 check_box($prefix.
'[case]', 1, array_get_index($rule_data,
'case_sensitive', 1));
83 $o->sectionNote(translate(
'core_form_rule_static_or_question_note'));
99 if (!isset($_POST[$prefix]))
return false;
101 $operator = array_get_index($_POST[$prefix],
'operator', 1);
102 $comparison = array_get_index($_POST[$prefix],
'value', null);
103 $comp_asset = array_get_index($_POST[$prefix],
'asset', null);
104 $case = array_get_index($_POST[$prefix],
'case', 0);
106 $rule_data[
'operator'] = $operator;
107 $rule_data[
'case_sensitive'] = $case;
108 if (is_null($comp_asset) || ($comp_asset[
'assetid'] ==
'0')) {
109 $rule_data[
'value'] = $comparison;
110 $rule_data[
'comparison_question_id'] =
'0';
112 $rule_data[
'comparison_question_id'] = $comp_asset[
'assetid'];
113 $rule_data[
'value'] = null;