ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
4 include_once("./Services/Form/classes/class.ilTextInputGUI.php");
5 include_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 ?>
This class represents a formula text property in a property form.
$result
setValue($a_value)
Set Value.
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
This class represents a text property in a property form.
checkInput()
Check input, strip slashes etc.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
global $lng
Definition: privfeed.php:17
$_POST["username"]