ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilHiddenInputGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(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 }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
insert(ilTemplate $a_tpl)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setValue(string $a_value)
static prepareFormOutput($a_str, bool $a_strip=false)
This class represents a hidden form property in a property form.
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
__construct(string $a_postvar)
setValueByArray(array $a_values)
getToolbarHTML()
Get input item HTML to be inserted into ilToolbarGUI.
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
__construct(Container $dic, ilPlugin $plugin)