ILIAS  release_8 Revision v8.24
class.ilGloAdvColSortInputGUI.php
Go to the documentation of this file.
1<?php
2
27{
28 protected array $value;
29
30 public function __construct(
31 string $a_title = "",
32 string $a_id = ""
33 ) {
34 global $DIC;
35
36 $this->lng = $DIC->language();
37 parent::__construct($a_title, $a_id);
38 $this->setType("glo_adv_col_sort");
39 }
40
41 public function setValue(array $a_value): void
42 {
43 $this->value = $a_value;
44 }
45
46 public function getValue(): array
47 {
48 return $this->value;
49 }
50
51
55 public function checkInput(): bool
56 {
57 return true;
58 }
59
60 public function getInput(): array
61 {
62 $val = $this->arrayArray($this->getPostVar());
64 return $val;
65 }
66
67 public function render(): string
68 {
70
71 $tpl = new ilTemplate("tpl.adv_col_sort_input.html", true, true, "Modules/Glossary");
72 if (is_array($this->getValue())) {
73 foreach ($this->getValue() as $k => $v) {
74 $tpl->setCurrentBlock("item");
75 $tpl->setVariable("TEXT", $v["text"]);
76 $tpl->setVariable("ID", $this->getFieldId() . "~" . $k);
77 $tpl->setVariable("DOWN", ilGlyphGUI::get(ilGlyphGUI::DOWN));
78 $tpl->setVariable("TXT_DOWN", $lng->txt("down"));
79 $tpl->setVariable("UP", ilGlyphGUI::get(ilGlyphGUI::UP));
80 $tpl->setVariable("TXT_UP", $lng->txt("up"));
81 $tpl->setVariable('NAME', $this->getPostVar() . "[" . $k . "][id]");
82 $tpl->setVariable('TNAME', $this->getPostVar() . "[" . $k . "][text]");
83 $tpl->setVariable('VAL', ilLegacyFormElementsUtil::prepareFormOutput($v["id"]));
84 $tpl->setVariable('TVAL', ilLegacyFormElementsUtil::prepareFormOutput($v["text"]));
85 $tpl->parseCurrentBlock();
86 }
87 }
88
89 return $tpl->get();
90 }
91
92 public function insert(ilTemplate $a_tpl): void
93 {
94 $a_tpl->setCurrentBlock("prop_generic");
95 $a_tpl->setVariable("PROP_GENERIC", $this->render());
96 $a_tpl->parseCurrentBlock();
97 }
98
99 public function setValueByArray(array $a_values): void
100 {
101 if ($this->getPostVar() && isset($a_values[$this->getPostVar()])) {
102 $this->setValue($a_values[$this->getPostVar()]);
103 }
104 }
105
106 public function getTableFilterHTML(): string
107 {
108 $html = $this->render();
109 return $html;
110 }
111}
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
static stripSlashesRecursive($a_data, bool $a_strip_html=true, string $a_allow="")
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...
__construct(string $a_title="", string $a_id="")
checkInput()
Input should always be valid, since we sort only.
static get(string $a_glyph, string $a_text="")
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...
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)
global $DIC
Definition: feed.php:28
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc