ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilFormulaInputGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
28{
29 public function __construct(
30 string $a_title = "",
31 string $a_postvar = ""
32 ) {
33 global $DIC;
34 parent::__construct($a_title, $a_postvar);
35
36 $this->lng = $DIC->language();
37 }
38
42 public function setValue($a_value): void
43 {
44 $this->value = str_replace(',', '.', $a_value);
45 }
46
51 public function checkInput(): bool
52 {
54
55 if ($this->getRequired() && $this->getInput() == "") {
56 $this->setAlert($lng->txt("msg_input_is_required"));
57 return false;
58 } else {
59 $eval = new EvalMath();
60 $eval->suppress_errors = true;
61 $result = $eval->e(str_replace(",", ".", $this->getInput()));
62 if ($result === false) {
63 $this->setAlert($lng->txt("form_msg_formula_is_required"));
64 return false;
65 }
66 }
67
68 return $this->checkSubItemsInput();
69 }
70
71 public function getInput(): string
72 {
73 $t = $this->refinery->kindlyTo()->string();
75 (string) ($this->getRequestParam($this->getPostVar(), $t) ?? ""),
76 false
77 );
78 }
79}
getRequestParam(string $key, Refinery\Transformation $t)
This class represents a formula text property in a property form.
checkInput()
Check input, strip slashes etc.
__construct(string $a_title="", string $a_postvar="")
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This class represents a text property in a property form.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26