Changeset 2596179
- Timestamp:
- 09/09/2021 12:07:46 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lisette-cost-calculator/trunk/LisetteCCApplication.php
r1749731 r2596179 119 119 if(!isset($level['items'])) 120 120 return ''; 121 $key = $this->keys[$i];122 $value = $this->values[$i];123 121 $out = '<ul>'; 124 122 $j = $i; 125 123 while($j < count($this->keys)) { 126 $choice = $level['items'][$this->keys[$j]]; 127 // question: answer 128 if($choice['question']) 129 $out .= '<li>'. 130 $choice['question'] . ': ' . 131 $choice['answers'][$this->values[$j]]['caption'] . 132 '</li>'; 133 // calculate sum and keep coefficient 134 $v = $choice['answers'][$this->values[$j]]['value']; 135 if(substr($v, 0, 1) == '*') 136 $this->coeff *= substr($v, 1); 137 else 138 $this->sum += $v; 139 // if next level of questionnaire exists then keep make output 140 if(isset($level['items'])) { 141 $out .= $this->answer($j, $level['items'][$this->keys[$j]]['answers'][$this->values[$j]]); 124 $key = $this->keys[$j]; 125 $value = $this->values[$j]; 126 127 if (isset($level['items'][$key])) { 128 $choice = $level['items'][$key]; 129 // question: answer 130 if (isset($choice['question']) && $choice['question']) { 131 $out .= '<li>' . 132 $choice['question'] . ': ' . 133 $choice['answers'][$value]['caption'] . 134 '</li>'; 135 } 136 // calculate sum and keep coefficient 137 $v = isset($choice['answers'][$value]['value']) 138 ? $choice['answers'][$value]['value'] : ''; 139 if (substr($v, 0, 1) === '*') 140 $this->coeff *= (int)substr($v, 1); 141 else 142 $this->sum += (int)$v; 143 // if next level of questionnaire exists then keep make output 144 if (isset($level['items']) && isset($level['items'][$key]['answers'][$value])) { 145 $out .= $this->answer($j, $level['items'][$key]['answers'][$value]); 146 } 142 147 } 143 148 $j++;
Note: See TracChangeset
for help on using the changeset viewer.