ILIAS  release_8 Revision v8.24
class.ilCustomInputGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
28{
29 protected bool $skip_required_check = false;
30 protected string $html = "";
31
32 public function __construct(
33 string $a_title = "",
34 string $a_postvar = ""
35 ) {
36 global $DIC;
37 $this->lng = $DIC->language();
38 parent::__construct($a_title, $a_postvar);
39 $this->setType("custom");
40 }
41
42 public function setHtml(string $a_html): void
43 {
44 $this->html = $a_html;
45 }
46
47 public function getHtml(): string
48 {
49 return $this->html;
50 }
51
52 public function setValueByArray(array $a_values): void
53 {
54 foreach ($this->getSubItems() as $item) {
55 $item->setValueByArray($a_values);
56 }
57 }
58
59 public function insert(ilTemplate $a_tpl): void
60 {
61 $a_tpl->setCurrentBlock("prop_custom");
62 $a_tpl->setVariable("CUSTOM_CONTENT", $this->getHtml());
63 $a_tpl->parseCurrentBlock();
64 }
65
66 public function setSkipRequiredCheck(bool $skip): void
67 {
68 $this->skip_required_check = $skip;
69 }
70
71 public function checkInput(): bool
72 {
74
75 if ($this->getPostVar()) {
76 if (!$this->skip_required_check && $this->getRequired() && $this->getInput() == "") {
77 $this->setAlert($lng->txt("msg_input_is_required"));
78 return false;
79 }
80 }
81 return $this->checkSubItemsInput();
82 }
83
84 public function getInput(): string
85 {
86 return trim($this->str($this->getPostVar()));
87 }
88}
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
special template class to simplify handling of ITX/PEAR
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc