ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilCustomInputGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
29{
30 protected bool $skip_required_check = false;
31 protected string $html = "";
32
33 public function __construct(
34 string $a_title = "",
35 string $a_postvar = ""
36 ) {
37 global $DIC;
38 $this->lng = $DIC->language();
39 parent::__construct($a_title, $a_postvar);
40 $this->setType("custom");
41 }
42
43 public function setHtml(string $a_html): void
44 {
45 $this->html = $a_html;
46 }
47
48 public function getHtml(): string
49 {
50 return $this->html;
51 }
52
53 public function setValueByArray(array $a_values): void
54 {
55 foreach ($this->getSubItems() as $item) {
56 $item->setValueByArray($a_values);
57 }
58 }
59
60 public function insert(ilTemplate $a_tpl): void
61 {
62 $a_tpl->setCurrentBlock("prop_custom");
63 $a_tpl->setVariable("CUSTOM_CONTENT", $this->getHtml());
64 $a_tpl->parseCurrentBlock();
65 }
66
67 public function setSkipRequiredCheck(bool $skip): void
68 {
69 $this->skip_required_check = $skip;
70 }
71
72 public function checkInput(): bool
73 {
75
76 if ($this->getPostVar()) {
77 if (!$this->skip_required_check && $this->getRequired() && $this->getInput() == "") {
78 $this->setAlert($lng->txt("msg_input_is_required"));
79 return false;
80 }
81 }
82 return $this->checkSubItemsInput();
83 }
84
85 public function getInput(): string
86 {
87 return trim($this->str($this->getPostVar()));
88 }
89}
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
This class represents a custom property in a property form.
checkInput()
Check input, strip slashes etc.
__construct(string $a_title="", string $a_postvar="")
setValueByArray(array $a_values)
setSkipRequiredCheck(bool $skip)
insert(ilTemplate $a_tpl)
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 property that may include a sub form.
special template class to simplify handling of ITX/PEAR
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26