18 require_once SQ_PACKAGES_PATH.
'/cms/page_templates/page_decision_tree/decision_tree_question/decision_tree_question.inc';
41 parent::__construct($assetid);
55 $page_links = parent::_getAllowedLinks();
70 $width = $this->
attr(
'width');
71 $max = $this->
attr(
'max');
72 $extras = $this->
attr(
'extra');
73 $name =
'q'.$this->id;
76 $extras = $extras.
' id="'.$name.
'"';
79 text_box($name,
'', $width, $max, FALSE, $extras);
80 $html = ob_get_contents();
96 $name =
'q'.$this->id.
'_button';
97 $value = $this->
attr(
'button_value');
98 $on_click =
"get_next_step(document.getElementById('q$this->id').value, $this->id)";
101 normal_button($name, $value, $on_click,
'');
102 $html = ob_get_contents();
120 'INCL' => translate(
'all_inclusive'),
121 'L_INCL' => translate(
'left_inclusive'),
122 'R_INCL' => translate(
'right_inclusive'),
123 'N_INCL' => translate(
'not_inclusive'),
147 $answer = trim($answer);
148 if (strlen($answer) == 0 || !is_numeric($answer))
return FALSE;
150 if (empty($rule_data))
return FALSE;
151 if ((strlen($rule_data[
'value_1']) == 0 && strlen($rule_data[
'value_2']) == 0) || empty($rule_data[
'logic']))
return FALSE;
153 switch ($rule_data[
'logic']) {
155 if (strlen($rule_data[
'value_1']) == 0){
156 $valid = ($answer <= $rule_data[
'value_2']);
157 }
else if (strlen($rule_data[
'value_2']) == 0){
158 $valid = ($answer >= $rule_data[
'value_1']);
160 $valid = ($answer >= $rule_data[
'value_1'] && $answer <= $rule_data[
'value_2']);
165 if (strlen($rule_data[
'value_1']) == 0){
166 $valid = ($answer < $rule_data[
'value_2']);
167 }
else if (strlen($rule_data[
'value_2']) == 0){
168 $valid = ($answer >= $rule_data[
'value_1']);
170 $valid = ($answer >= $rule_data[
'value_1'] && $answer < $rule_data[
'value_2']);
175 if (strlen($rule_data[
'value_1']) == 0){
176 $valid = ($answer <= $rule_data[
'value_2']);
177 }
else if (strlen($rule_data[
'value_2']) == 0){
178 $valid = ($answer > $rule_data[
'value_1']);
180 $valid = ($answer > $rule_data[
'value_1'] && $answer <= $rule_data[
'value_2']);
185 if (strlen($rule_data[
'value_1']) == 0){
186 $valid = ($answer < $rule_data[
'value_2']);
187 }
else if (strlen($rule_data[
'value_2']) == 0){
188 $valid = ($answer > $rule_data[
'value_1']);
190 $valid = ($answer > $rule_data[
'value_1'] && $answer < $rule_data[
'value_2']);
219 if ((strlen($rule_data[
'value_1']) == 0 && strlen($rule_data[
'value_2']) == 0) || empty($rule_data[
'logic']))
return;
220 switch ($rule_data[
'logic']) {
222 if (strlen($rule_data[
'value_1']) == 0){
223 echo
"<= $rule_data[value_2]";
224 }
else if (strlen($rule_data[
'value_2']) == 0){
225 echo
">= $rule_data[value_1]";
227 echo (
">= $rule_data[value_1] AND <= $rule_data[value_2]");
232 if (strlen($rule_data[
'value_1']) == 0){
233 echo
"< $rule_data[value_2]";
234 }
else if (strlen($rule_data[
'value_2']) == 0){
235 echo
">= $rule_data[value_1]";
237 echo (
">= $rule_data[value_1] AND < $rule_data[value_2]");
242 if (strlen($rule_data[
'value_1']) == 0){
243 echo
"<= $rule_data[value_2]";
244 }
else if (strlen($rule_data[
'value_2']) == 0){
245 echo
"> $rule_data[value_1]";
247 echo (
"> $rule_data[value_1] AND <= $rule_data[value_2]");
252 if (strlen($rule_data[
'value_1']) == 0){
253 echo
"< $rule_data[value_2]";
254 }
else if (strlen($rule_data[
'value_2']) == 0){
255 echo
"> $rule_data[value_1]";
257 echo (
"> $rule_data[value_1] AND < $rule_data[value_2]");