ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilHiddenInputGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
28{
29 protected string $value = "";
30
31 public function __construct(
32 string $a_postvar
33 ) {
34 parent::__construct("", $a_postvar);
35 $this->setType("hidden");
36 }
37
38 public function setValue(string $a_value): void
39 {
40 $this->value = $a_value;
41 }
42
43 public function getValue(): string
44 {
45 return $this->value;
46 }
47
48 public function checkInput(): bool
49 {
50 return true; // please overwrite
51 }
52
53 public function getInput(): string
54 {
55 return $this->str($this->getPostVar());
56 }
57
58 public function setValueByArray(array $a_values): void
59 {
60 $this->setValue((string) ($a_values[$this->getPostVar()] ?? ""));
61 }
62
63 public function insert(ilTemplate $a_tpl): void
64 {
65 $a_tpl->setCurrentBlock("hidden");
66 $a_tpl->setVariable('PROP_INPUT_TYPE', 'hidden');
67 $a_tpl->setVariable("POST_VAR", $this->getPostVar());
68 $a_tpl->setVariable("ID", $this->getFieldId());
69 $a_tpl->setVariable("PROPERTY_VALUE", ilLegacyFormElementsUtil::prepareFormOutput($this->getValue()));
70 $a_tpl->parseCurrentBlock();
71 }
72
73 public function getToolbarHTML(): string
74 {
75 return "<input type=\"hidden\"" .
76 " name=\"" . $this->getPostVar() . "\"" .
77 " value=\"" . ilLegacyFormElementsUtil::prepareFormOutput($this->getValue()) . "\"" .
78 " id=\"" . $this->getFieldId() . "\" />";
79 }
80}
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
This class represents a property in a property form.
This class represents a hidden form property in a property form.
checkInput()
Check input, strip slashes etc.
setValue(string $a_value)
setValueByArray(array $a_values)
__construct(string $a_postvar)
insert(ilTemplate $a_tpl)
getToolbarHTML()
Get input item HTML to be inserted into ilToolbarGUI.
static prepareFormOutput($a_str, bool $a_strip=false)
special template class to simplify handling of ITX/PEAR
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc