ILIAS  release_8 Revision v8.24
class.ilHiddenInputGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
27{
28 protected string $value = "";
29
30 public function __construct(
31 string $a_postvar
32 ) {
33 parent::__construct("", $a_postvar);
34 $this->setType("hidden");
35 }
36
37 public function setValue(string $a_value): void
38 {
39 $this->value = $a_value;
40 }
41
42 public function getValue(): string
43 {
44 return $this->value;
45 }
46
47 public function checkInput(): bool
48 {
49 return true; // please overwrite
50 }
51
52 public function getInput(): string
53 {
54 return $this->str($this->getPostVar());
55 }
56
57 public function setValueByArray(array $a_values): void
58 {
59 $this->setValue((string) ($a_values[$this->getPostVar()] ?? ""));
60 }
61
62 public function insert(ilTemplate $a_tpl): void
63 {
64 $a_tpl->setCurrentBlock("hidden");
65 $a_tpl->setVariable('PROP_INPUT_TYPE', 'hidden');
66 $a_tpl->setVariable("POST_VAR", $this->getPostVar());
67 $a_tpl->setVariable("ID", $this->getFieldId());
68 $a_tpl->setVariable("PROPERTY_VALUE", ilLegacyFormElementsUtil::prepareFormOutput($this->getValue()));
69 $a_tpl->parseCurrentBlock();
70 }
71
72 public function getToolbarHTML(): string
73 {
74 return "<input type=\"hidden\"" .
75 " name=\"" . $this->getPostVar() . "\"" .
76 " value=\"" . ilLegacyFormElementsUtil::prepareFormOutput($this->getValue()) . "\"" .
77 " id=\"" . $this->getFieldId() . "\" />";
78 }
79}
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
This class represents a property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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