ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilGloAdvColSortInputGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
13{
14
20 public function __construct($a_title = "", $a_id = "")
21 {
22 global $DIC;
23
24 $this->lng = $DIC->language();
25 parent::__construct($a_title, $a_id);
26 $this->setType("glo_adv_col_sort");
27 }
28
34 public function setValue($a_value)
35 {
36 $this->value = $a_value;
37 }
38
44 public function getValue()
45 {
46 return $this->value;
47 }
48
49
55 public function checkInput()
56 {
57 if (is_array($_POST[$this->getPostVar()])) {
58 foreach ($_POST[$this->getPostVar()] as $k => $v) {
59 $_POST[$this->getPostVar()][$k]["id"] = ilUtil::stripSlashes($_POST[$this->getPostVar()][$k]["id"]);
60 $_POST[$this->getPostVar()][$k]["text"] = ilUtil::stripSlashes($_POST[$this->getPostVar()][$k]["text"]);
61 }
62 } else {
63 $_POST[$this->getPostVar()] = array();
64 }
65
66 return true;
67 }
68
72 public function render()
73 {
75
76 $tpl = new ilTemplate("tpl.adv_col_sort_input.html", true, true, "Modules/Glossary");
77 if (is_array($this->getValue())) {
78 foreach ($this->getValue() as $k => $v) {
79 $tpl->setCurrentBlock("item");
80 $tpl->setVariable("TEXT", $v["text"]);
81 $tpl->setVariable("ID", $this->getFieldId() . "~" . $k);
82 $tpl->setVariable("DOWN", ilGlyphGUI::get(ilGlyphGUI::DOWN));
83 $tpl->setVariable("TXT_DOWN", $lng->txt("down"));
84 $tpl->setVariable("UP", ilGlyphGUI::get(ilGlyphGUI::UP));
85 $tpl->setVariable("TXT_UP", $lng->txt("up"));
86 $tpl->setVariable('NAME', $this->getPostVar() . "[" . $k . "][id]");
87 $tpl->setVariable('TNAME', $this->getPostVar() . "[" . $k . "][text]");
88 $tpl->setVariable('VAL', ilUtil::prepareFormOutput($v["id"]));
89 $tpl->setVariable('TVAL', ilUtil::prepareFormOutput($v["text"]));
90 $tpl->parseCurrentBlock();
91 }
92 }
93
94 return $tpl->get();
95 }
96
101 public function insert(&$a_tpl)
102 {
103 $a_tpl->setCurrentBlock("prop_generic");
104 $a_tpl->setVariable("PROP_GENERIC", $this->render());
105 $a_tpl->parseCurrentBlock();
106 }
107
113 public function setValueByArray($a_values)
114 {
115 if ($this->getPostVar() && isset($a_values[$this->getPostVar()])) {
116 $this->setValue($a_values[$this->getPostVar()]);
117 }
118 }
119
123 public function getTableFilterHTML()
124 {
125 $html = $this->render();
126 return $html;
127 }
128}
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
This class represents a property in a property form.
setType($a_type)
Set Type.
getPostVar()
Get Post Variable.
getFieldId()
Get Post Variable.
Input for adv meta data column sorting in glossaries.
setValueByArray($a_values)
Set value by array.
insert(&$a_tpl)
Insert property html.
__construct($a_title="", $a_id="")
Constructor.
getTableFilterHTML()
Get HTML for table filter.
checkInput()
Input should always be valid, since we sort only.
static get($a_glyph, $a_text="")
Get glyph html.
special template class to simplify handling of ITX/PEAR
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
$DIC
Definition: xapitoken.php:46