Merge branch 'wip-MDL-53557-fix' of https://github.com/marinaglancy/moodle
[moodle.git] / mod / feedback / item / numeric / lib.php
CommitLineData
1adbd2c3 1<?php
9c5bc7a5
AG
2// This file is part of Moodle - http://moodle.org/
3//
4// Moodle is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// Moodle is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16
01910dff 17defined('MOODLE_INTERNAL') OR die('not allowed');
c70ad9f7 18require_once($CFG->dirroot.'/mod/feedback/item/feedback_item_class.php');
19
20class feedback_item_numeric extends feedback_item_base {
9c5bc7a5 21 protected $type = "numeric";
9c5bc7a5
AG
22 private $commonparams;
23 private $item_form;
24 private $item;
d4b1d58c 25
9c5bc7a5 26 public function init() {
d4b1d58c 27
c70ad9f7 28 }
d4b1d58c 29
9c5bc7a5 30 public function build_editform($item, $feedback, $cm) {
271fdd62 31 global $DB, $CFG;
6ee09cfe 32 require_once('numeric_form.php');
d4b1d58c 33
271fdd62
AG
34 //get the lastposition number of the feedback_items
35 $position = $item->position;
36 $lastposition = $DB->count_records('feedback_item', array('feedback'=>$feedback->id));
9c5bc7a5 37 if ($position == -1) {
271fdd62
AG
38 $i_formselect_last = $lastposition + 1;
39 $i_formselect_value = $lastposition + 1;
40 $item->position = $lastposition + 1;
9c5bc7a5 41 } else {
271fdd62
AG
42 $i_formselect_last = $lastposition;
43 $i_formselect_value = $item->position;
6ee09cfe 44 }
271fdd62 45 //the elements for position dropdownlist
9c5bc7a5
AG
46 $positionlist = array_slice(range(0, $i_formselect_last), 1, $i_formselect_last, true);
47
271fdd62 48 $item->presentation = empty($item->presentation) ? '' : $item->presentation;
9c5bc7a5
AG
49
50 $range_from_to = explode('|', $item->presentation);
51 if (isset($range_from_to[0]) AND is_numeric($range_from_to[0])) {
17e16684 52 $range_from = $this->format_float($range_from_to[0]);
9c5bc7a5
AG
53 } else {
54 $range_from = '-';
55 }
56
57 if (isset($range_from_to[1]) AND is_numeric($range_from_to[1])) {
17e16684 58 $range_to = $this->format_float($range_from_to[1]);
9c5bc7a5
AG
59 } else {
60 $range_to = '-';
61 }
62
271fdd62
AG
63 $item->rangefrom = $range_from;
64 $item->rangeto = $range_to;
65
73043833
AG
66 //all items for dependitem
67 $feedbackitems = feedback_get_depend_candidates_for_item($feedback, $item);
271fdd62 68 $commonparams = array('cmid'=>$cm->id,
9c5bc7a5 69 'id'=>isset($item->id) ? $item->id : null,
271fdd62 70 'typ'=>$item->typ,
73043833 71 'items'=>$feedbackitems,
271fdd62 72 'feedback'=>$feedback->id);
d4b1d58c 73
271fdd62 74 //build the form
9c5bc7a5
AG
75 $customdata = array('item' => $item,
76 'common' => $commonparams,
77 'positionlist' => $positionlist,
78 'position' => $position);
79
80 $this->item_form = new feedback_numeric_form('edit_item.php', $customdata);
271fdd62 81 }
d4b1d58c 82
271fdd62 83 //this function only can used after the call of build_editform()
9c5bc7a5 84 public function show_editform() {
271fdd62
AG
85 $this->item_form->display();
86 }
9c5bc7a5
AG
87
88 public function is_cancelled() {
271fdd62
AG
89 return $this->item_form->is_cancelled();
90 }
d4b1d58c 91
9c5bc7a5
AG
92 public function get_data() {
93 if ($this->item = $this->item_form->get_data()) {
271fdd62
AG
94 return true;
95 }
96 return false;
c70ad9f7 97 }
98
9c5bc7a5 99 public function save_item() {
271fdd62 100 global $DB;
9c5bc7a5
AG
101
102 if (!$item = $this->item_form->get_data()) {
271fdd62
AG
103 return false;
104 }
9c5bc7a5
AG
105
106 if (isset($item->clone_item) AND $item->clone_item) {
9e1aed53
AG
107 $item->id = ''; //to clone this item
108 $item->position++;
109 }
9c5bc7a5 110
45c2f92a 111 $item->hasvalue = $this->get_hasvalue();
9c5bc7a5 112 if (!$item->id) {
271fdd62 113 $item->id = $DB->insert_record('feedback_item', $item);
9c5bc7a5 114 } else {
271fdd62
AG
115 $DB->update_record('feedback_item', $item);
116 }
9c5bc7a5 117
271fdd62
AG
118 return $DB->get_record('feedback_item', array('id'=>$item->id));
119 }
120
121
c70ad9f7 122 //liefert eine Struktur ->name, ->data = array(mit Antworten)
9c5bc7a5 123 public function get_analysed($item, $groupid = false, $courseid = false) {
0085fff8 124 global $DB;
125
411fd747 126 $analysed = new stdClass();
c70ad9f7 127 $analysed->data = array();
128 $analysed->name = $item->name;
c70ad9f7 129 $values = feedback_get_group_values($item, $groupid, $courseid);
d4b1d58c 130
c70ad9f7 131 $avg = 0.0;
132 $counter = 0;
9c5bc7a5 133 if ($values) {
c70ad9f7 134 $data = array();
9c5bc7a5
AG
135 foreach ($values as $value) {
136 if (is_numeric($value->value)) {
c70ad9f7 137 $data[] = $value->value;
138 $avg += $value->value;
139 $counter++;
140 }
141 }
17e16684 142 $avg = $counter > 0 ? $avg / $counter : null;
c70ad9f7 143 $analysed->data = $data;
144 $analysed->avg = $avg;
145 }
146 return $analysed;
147 }
148
9c5bc7a5
AG
149 public function get_printval($item, $value) {
150 if (!isset($value->value)) {
151 return '';
152 }
d4b1d58c 153
c70ad9f7 154 return $value->value;
155 }
156
9c5bc7a5 157 public function print_analysed($item, $itemnr = '', $groupid = false, $courseid = false) {
d4b1d58c 158
c70ad9f7 159 $values = $this->get_analysed($item, $groupid, $courseid);
160
9c5bc7a5
AG
161 if (isset($values->data) AND is_array($values->data)) {
162 echo '<tr><th colspan="2" align="left">';
2aad1094
MG
163 echo $itemnr . ' ';
164 if (strval($item->label) !== '') {
165 echo '('. format_string($item->label).') ';
166 }
167 echo format_text($item->name, FORMAT_HTML, array('noclean' => true, 'para' => false));
9c5bc7a5
AG
168 echo '</th></tr>';
169
170 foreach ($values->data as $value) {
171 echo '<tr><td colspan="2" valign="top" align="left">';
17e16684 172 echo '-&nbsp;&nbsp;'.$this->format_float($value);
9c5bc7a5 173 echo '</td></tr>';
c70ad9f7 174 }
9c5bc7a5
AG
175
176 if (isset($values->avg)) {
17e16684 177 $avg = format_float($values->avg, 2);
efc59167 178 } else {
17e16684 179 $avg = '-';
efc59167 180 }
9c5bc7a5
AG
181 echo '<tr><td align="left" colspan="2"><b>';
182 echo get_string('average', 'feedback').': '.$avg;
183 echo '</b></td></tr>';
c70ad9f7 184 }
c70ad9f7 185 }
186
9c5bc7a5
AG
187 public function excelprint_item(&$worksheet, $row_offset,
188 $xls_formats, $item,
189 $groupid, $courseid = false) {
190
c70ad9f7 191 $analysed_item = $this->get_analysed($item, $groupid, $courseid);
192
9c5bc7a5
AG
193 $worksheet->write_string($row_offset, 0, $item->label, $xls_formats->head2);
194 $worksheet->write_string($row_offset, 1, $item->name, $xls_formats->head2);
c70ad9f7 195 $data = $analysed_item->data;
9c5bc7a5 196 if (is_array($data)) {
d4b1d58c 197
17e16684 198 // Export average.
9c5bc7a5
AG
199 $worksheet->write_string($row_offset,
200 2,
201 get_string('average', 'feedback'),
202 $xls_formats->value_bold);
203
17e16684
MG
204 if (isset($analysed_item->avg)) {
205 $worksheet->write_number($row_offset + 1,
206 2,
207 $analysed_item->avg,
208 $xls_formats->value_bold);
209 } else {
210 $worksheet->write_string($row_offset + 1,
211 2,
212 '',
213 $xls_formats->value_bold);
214 }
9c5bc7a5 215 $row_offset++;
c70ad9f7 216 }
9c5bc7a5
AG
217 $row_offset++;
218 return $row_offset;
c70ad9f7 219 }
9c5bc7a5 220
5f17311f 221 /**
9d5fbd65
AG
222 * print the item at the edit-page of feedback
223 *
224 * @global object
225 * @param object $item
226 * @return void
227 */
9c5bc7a5 228 public function print_item_preview($item) {
73043833 229 global $OUTPUT, $DB;
9c5bc7a5 230
9d5fbd65 231 $align = right_to_left() ? 'right' : 'left';
cba01194
MM
232 $strrequiredmark = '<img class="req" title="'.get_string('requiredelement', 'form').'" alt="'.
233 get_string('requiredelement', 'form').'" src="'.$OUTPUT->pix_url('req') .'" />';
c70ad9f7 234
9d5fbd65 235 //get the range
9c5bc7a5
AG
236 $range_from_to = explode('|', $item->presentation);
237
9d5fbd65 238 //get the min-value
9c5bc7a5
AG
239 if (isset($range_from_to[0]) AND is_numeric($range_from_to[0])) {
240 $range_from = floatval($range_from_to[0]);
241 } else {
17e16684 242 $range_from = '-';
9c5bc7a5
AG
243 }
244
9d5fbd65 245 //get the max-value
9c5bc7a5
AG
246 if (isset($range_from_to[1]) AND is_numeric($range_from_to[1])) {
247 $range_to = floatval($range_from_to[1]);
248 } else {
17e16684 249 $range_to = '-';
9c5bc7a5
AG
250 }
251
cba01194 252 $requiredmark = ($item->required == 1) ? $strrequiredmark : '';
afdb1920 253 //print the question and label
bb4191ff 254 $inputname = $item->typ . '_' . $item->id;
afdb1920 255 echo '<div class="feedback_item_label_'.$align.'">';
690266bc 256 echo '<label for="'. $inputname .'">';
2aad1094
MG
257 if (strval($item->label) !== '') {
258 echo '('. format_string($item->label).') ';
259 }
260 echo format_text($item->name . $requiredmark, FORMAT_HTML, array('noclean' => true, 'para' => false));
9c5bc7a5
AG
261 if ($item->dependitem) {
262 $params = array('id'=>$item->dependitem);
263 if ($dependitem = $DB->get_record('feedback_item', $params)) {
264 echo ' <span class="feedback_depend">';
2aad1094 265 echo '('.format_string($dependitem->label).'-&gt;'.$item->dependvalue.')';
9c5bc7a5 266 echo '</span>';
afdb1920 267 }
9c5bc7a5
AG
268 }
269 echo '<span class="feedback_item_numinfo">';
270 switch(true) {
271 case ($range_from === '-' AND is_numeric($range_to)):
272 echo ' ('.get_string('maximal', 'feedback').
17e16684 273 ': '.$this->format_float($range_to).')';
9c5bc7a5
AG
274 break;
275 case (is_numeric($range_from) AND $range_to === '-'):
276 echo ' ('.get_string('minimal', 'feedback').
17e16684 277 ': '.$this->format_float($range_from).')';
9c5bc7a5
AG
278 break;
279 case ($range_from === '-' AND $range_to === '-'):
280 break;
281 default:
17e16684
MG
282 echo ' ('.$this->format_float($range_from).
283 ' - '.$this->format_float($range_to).')';
9c5bc7a5
AG
284 break;
285 }
286 echo '</span>';
bb4191ff 287 echo '</label>';
afdb1920
AG
288 echo '</div>';
289
290 //print the presentation
291 echo '<div class="feedback_item_presentation_'.$align.'">';
292 echo '<span class="feedback_item_textfield">';
9c5bc7a5 293 echo '<input type="text" '.
690266bc
MM
294 'id="'.$inputname.'" '.
295 'name="'.$inputname.'" '.
9c5bc7a5
AG
296 'size="10" '.
297 'maxlength="10" '.
298 'value="" />';
299
afdb1920
AG
300 echo '</span>';
301 echo '</div>';
9d5fbd65 302 }
9c5bc7a5 303
17e16684
MG
304 /**
305 * Prints the float nicely in the localized format
306 *
307 * Similar to format_float() but automatically calculates the number of decimal places
308 *
309 * @param float $value The float to print
310 * @return string
311 */
312 protected function format_float($value) {
313 if (!is_numeric($value)) {
314 return null;
315 }
4ba67534 316 $decimal = is_int($value) ? 0 : strlen(substr(strrchr($value, '.'), 1));
17e16684
MG
317 return format_float($value, $decimal);
318 }
319
5f17311f 320 /**
9d5fbd65
AG
321 * print the item at the complete-page of feedback
322 *
323 * @global object
324 * @param object $item
325 * @param string $value
326 * @param bool $highlightrequire
327 * @return void
328 */
9c5bc7a5 329 public function print_item_complete($item, $value = '', $highlightrequire = false) {
d4b1d58c 330 global $OUTPUT;
e372f4c7 331 $align = right_to_left() ? 'right' : 'left';
cba01194
MM
332 $strrequiredmark = '<img class="req" title="'.get_string('requiredelement', 'form').'" alt="'.
333 get_string('requiredelement', 'form').'" src="'.$OUTPUT->pix_url('req') .'" />';
d4b1d58c 334
c70ad9f7 335 //get the range
9c5bc7a5
AG
336 $range_from_to = explode('|', $item->presentation);
337
c70ad9f7 338 //get the min-value
9c5bc7a5
AG
339 if (isset($range_from_to[0]) AND is_numeric($range_from_to[0])) {
340 $range_from = floatval($range_from_to[0]);
341 } else {
17e16684 342 $range_from = '-';
9c5bc7a5
AG
343 }
344
c70ad9f7 345 //get the max-value
9c5bc7a5
AG
346 if (isset($range_from_to[1]) AND is_numeric($range_from_to[1])) {
347 $range_to = floatval($range_from_to[1]);
348 } else {
17e16684 349 $range_to = '-';
9c5bc7a5
AG
350 }
351
cba01194 352 $requiredmark = ($item->required == 1) ? $strrequiredmark : '';
9c5bc7a5 353
afdb1920 354 //print the question and label
bb4191ff 355 $inputname = $item->typ . '_' . $item->id;
cba01194 356 echo '<div class="feedback_item_label_'.$align.'">';
690266bc 357 echo '<label for="'. $inputname .'">';
2aad1094 358 echo format_text($item->name . $requiredmark, FORMAT_HTML, array('noclean' => true, 'para' => false));
9c5bc7a5
AG
359 echo '<span class="feedback_item_numinfo">';
360 switch(true) {
361 case ($range_from === '-' AND is_numeric($range_to)):
362 echo ' ('.get_string('maximal', 'feedback').
17e16684 363 ': '.$this->format_float($range_to).')';
9c5bc7a5
AG
364 break;
365 case (is_numeric($range_from) AND $range_to === '-'):
366 echo ' ('.get_string('minimal', 'feedback').
17e16684 367 ': '.$this->format_float($range_from).')';
9c5bc7a5
AG
368 break;
369 case ($range_from === '-' AND $range_to === '-'):
370 break;
371 default:
17e16684
MG
372 echo ' ('.$this->format_float($range_from).
373 ' - '.$this->format_float($range_to).')';
9c5bc7a5
AG
374 break;
375 }
376 echo '</span>';
cba01194
MM
377 if ($highlightrequire AND (!$this->check_value($value, $item))) {
378 echo '<br class="error"><span id="id_error_'.$inputname.'" class="error"> '.get_string('err_required', 'form').
379 '</span><br id="id_error_break_'.$inputname.'" class="error" >';
380 }
bb4191ff 381 echo '</label>';
afdb1920 382 echo '</div>';
9c5bc7a5 383
afdb1920 384 //print the presentation
cba01194 385 echo '<div class="feedback_item_presentation_'.$align.'">';
afdb1920 386 echo '<span class="feedback_item_textfield">';
9c5bc7a5 387 echo '<input type="text" '.
690266bc 388 'id="'.$inputname.'" '.
9c5bc7a5
AG
389 'name="'.$item->typ.'_'.$item->id.'" '.
390 'size="10" '.
391 'maxlength="10" '.
e7fc2ff4 392 'value="'.$value.'" />';
9c5bc7a5 393
afdb1920
AG
394 echo '</span>';
395 echo '</div>';
9d5fbd65
AG
396 }
397
5f17311f 398 /**
9d5fbd65
AG
399 * print the item at the complete-page of feedback
400 *
401 * @global object
402 * @param object $item
403 * @param string $value
404 * @return void
405 */
9c5bc7a5 406 public function print_item_show_value($item, $value = '') {
9d5fbd65
AG
407 global $OUTPUT;
408 $align = right_to_left() ? 'right' : 'left';
cba01194
MM
409 $strrequiredmark = '<img class="req" title="'.get_string('requiredelement', 'form').'" alt="'.
410 get_string('requiredelement', 'form').'" src="'.$OUTPUT->pix_url('req') .'" />';
9d5fbd65
AG
411
412 //get the range
9c5bc7a5 413 $range_from_to = explode('|', $item->presentation);
9d5fbd65 414 //get the min-value
9c5bc7a5
AG
415 if (isset($range_from_to[0]) AND is_numeric($range_from_to[0])) {
416 $range_from = floatval($range_from_to[0]);
417 } else {
17e16684 418 $range_from = '-';
9c5bc7a5 419 }
9d5fbd65 420 //get the max-value
9c5bc7a5
AG
421 if (isset($range_from_to[1]) AND is_numeric($range_from_to[1])) {
422 $range_to = floatval($range_from_to[1]);
423 } else {
17e16684 424 $range_to = '-';
9c5bc7a5 425 }
cba01194 426 $requiredmark = ($item->required == 1) ? $strrequiredmark : '';
9c5bc7a5 427
afdb1920
AG
428 //print the question and label
429 echo '<div class="feedback_item_label_'.$align.'">';
2aad1094
MG
430 if (strval($item->label) !== '') {
431 echo '('. format_string($item->label).') ';
432 }
433 echo format_text($item->name . $requiredmark, FORMAT_HTML, array('noclean' => true, 'para' => false));
9c5bc7a5
AG
434 switch(true) {
435 case ($range_from === '-' AND is_numeric($range_to)):
436 echo ' ('.get_string('maximal', 'feedback').
17e16684 437 ': '.$this->format_float($range_to).')';
9c5bc7a5
AG
438 break;
439 case (is_numeric($range_from) AND $range_to === '-'):
440 echo ' ('.get_string('minimal', 'feedback').
17e16684 441 ': '.$this->format_float($range_from).')';
9c5bc7a5
AG
442 break;
443 case ($range_from === '-' AND $range_to === '-'):
444 break;
445 default:
17e16684
MG
446 echo ' ('.$this->format_float($range_from).
447 ' - '.$this->format_float($range_to).')';
9c5bc7a5
AG
448 break;
449 }
afdb1920 450 echo '</div>';
9c5bc7a5 451
afdb1920
AG
452 //print the presentation
453 echo '<div class="feedback_item_presentation_'.$align.'">';
9d5fbd65 454 echo $OUTPUT->box_start('generalbox boxalign'.$align);
9c5bc7a5 455 if (is_numeric($value)) {
17e16684 456 $str_num_value = $this->format_float($value);
9c5bc7a5
AG
457 } else {
458 $str_num_value = '&nbsp;';
459 }
460 echo $str_num_value;
9d5fbd65 461 echo $OUTPUT->box_end();
afdb1920 462 echo '</div>';
c70ad9f7 463 }
464
9c5bc7a5 465 public function check_value($value, $item) {
17e16684 466 $value = unformat_float($value, true);
c70ad9f7 467 //if the item is not required, so the check is true if no value is given
9c5bc7a5
AG
468 if ((!isset($value) OR $value == '') AND $item->required != 1) {
469 return true;
470 }
471 if (!is_numeric($value)) {
472 return false;
473 }
d4b1d58c 474
9c5bc7a5
AG
475 $range_from_to = explode('|', $item->presentation);
476 if (isset($range_from_to[0]) AND is_numeric($range_from_to[0])) {
477 $range_from = floatval($range_from_to[0]);
478 } else {
479 $range_from = '-';
480 }
481 if (isset($range_from_to[1]) AND is_numeric($range_from_to[1])) {
482 $range_to = floatval($range_from_to[1]);
483 } else {
484 $range_to = '-';
485 }
d4b1d58c 486
c70ad9f7 487 switch(true) {
fc9e2caa 488 case ($range_from === '-' AND is_numeric($range_to)):
9c5bc7a5
AG
489 if (floatval($value) <= $range_to) {
490 return true;
491 }
c70ad9f7 492 break;
fc9e2caa 493 case (is_numeric($range_from) AND $range_to === '-'):
9c5bc7a5
AG
494 if (floatval($value) >= $range_from) {
495 return true;
496 }
c70ad9f7 497 break;
fc9e2caa 498 case ($range_from === '-' AND $range_to === '-'):
c70ad9f7 499 return true;
500 break;
501 default:
9c5bc7a5
AG
502 if (floatval($value) >= $range_from AND floatval($value) <= $range_to) {
503 return true;
504 }
c70ad9f7 505 break;
506 }
d4b1d58c 507
c70ad9f7 508 return false;
509 }
510
9c5bc7a5 511 public function create_value($data) {
17e16684 512 $data = unformat_float($data, true);
d4b1d58c 513
9c5bc7a5 514 if (is_numeric($data)) {
fc9e2caa 515 $data = floatval($data);
9c5bc7a5 516 } else {
c70ad9f7 517 $data = '';
518 }
519 return $data;
520 }
521
73043833
AG
522 //compares the dbvalue with the dependvalue
523 //dbvalue is the number put in by the user
524 //dependvalue is the value that is compared
9c5bc7a5
AG
525 public function compare_value($item, $dbvalue, $dependvalue) {
526 if ($dbvalue == $dependvalue) {
73043833
AG
527 return true;
528 }
529 return false;
530 }
9c5bc7a5
AG
531
532 public function get_presentation($data) {
17e16684 533 $num1 = unformat_float($data->numericrangefrom, true);
9c5bc7a5 534 if (is_numeric($num1)) {
fc9e2caa 535 $num1 = floatval($num1);
9c5bc7a5 536 } else {
fc9e2caa 537 $num1 = '-';
538 }
d4b1d58c 539
17e16684 540 $num2 = unformat_float($data->numericrangeto, true);
9c5bc7a5 541 if (is_numeric($num2)) {
fc9e2caa 542 $num2 = floatval($num2);
9c5bc7a5 543 } else {
fc9e2caa 544 $num2 = '-';
545 }
d4b1d58c 546
9c5bc7a5 547 if ($num1 === '-' OR $num2 === '-') {
fc9e2caa 548 return $num1 . '|'. $num2;
549 }
d4b1d58c 550
9c5bc7a5 551 if ($num1 > $num2) {
fc9e2caa 552 return $num2 . '|'. $num1;
9c5bc7a5 553 } else {
d4b1d58c 554 return $num1 . '|'. $num2;
fc9e2caa 555 }
c70ad9f7 556 }
557
9c5bc7a5 558 public function get_hasvalue() {
c70ad9f7 559 return 1;
560 }
9c5bc7a5
AG
561
562 public function can_switch_require() {
6cc1599e
AG
563 return true;
564 }
5f17311f 565
e7fc2ff4 566 public function value_type() {
17e16684 567 return PARAM_TEXT;
e7fc2ff4
AG
568 }
569
d2448b8b 570 public function clean_input_value($value) {
17e16684 571 $value = unformat_float($value, true);
e7fc2ff4 572 if (!is_numeric($value)) {
94848b07
AG
573 if ($value == '') {
574 return null; //an empty string should be null
575 } else {
576 return clean_param($value, PARAM_TEXT); //we have to know the value if it is wrong
577 }
e7fc2ff4 578 }
17e16684 579 return clean_param($value, PARAM_FLOAT);
e7fc2ff4 580 }
c70ad9f7 581}