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_comparison_edit_'.array_get_index($rule_data,
'operator',
'==').($cq_id ?
'_q' :
''), $value);
63 $o->openField(translate(
'operator'));
65 combo_box($prefix.
'[operator]', $operator_list,
false, array_get_index($rule_data,
'operator',
'=='));
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->sectionNote(translate(
'core_form_rule_static_or_question_note'));
94 if (!isset($_POST[$prefix]))
return false;
96 $operator = array_get_index($_POST[$prefix],
'operator', null);
97 $comparison = array_get_index($_POST[$prefix],
'value', null);
98 $comp_asset = array_get_index($_POST[$prefix],
'asset', null);
100 $rule_data[
'operator'] = $operator;
101 if (is_null($comp_asset) || ($comp_asset[
'assetid'] ==
'0')) {
102 $rule_data[
'value'] = $comparison;
103 $rule_data[
'comparison_question_id'] =
'0';
105 $rule_data[
'comparison_question_id'] = $comp_asset[
'assetid'];
106 $rule_data[
'value'] = null;