ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilFormulaInputGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Services/Form/classes/class.ilTextInputGUI.php");
5include_once("./Services/Math/classes/class.EvalMath.php");
6
15{
21 function setValue($a_value)
22 {
23 $this->value = str_replace(',', '.', $a_value);
24 }
25
31 function checkInput()
32 {
33 global $lng;
34
36 if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "")
37 {
38 $this->setAlert($lng->txt("msg_input_is_required"));
39
40 return false;
41 }
42 else
43 {
44 $eval = new EvalMath();
45 $eval->suppress_errors = true;
46 $result = $eval->e(str_replace(",", ".", ilUtil::stripSlashes($_POST[$this->getPostVar()], FALSE)));
47 if ($result === false)
48 {
49 $this->setAlert($lng->txt("form_msg_formula_is_required"));
50 return false;
51 }
52 }
53
54 return $this->checkSubItemsInput();
55 }
56}
57?>
$result
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
This class represents a formula text property in a property form.
setValue($a_value)
Set Value.
checkInput()
Check input, strip slashes etc.
This class represents a text property in a property form.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST['username']
Definition: cron.php:12
global $lng
Definition: privfeed.php:40