ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilGloAdvColSortInputGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once 'Services/Form/classes/class.ilFormPropertyGUI.php';
5
16{
17
23 public function __construct($a_title = "", $a_id = "")
24 {
25 global $DIC;
26
27 $this->lng = $DIC->language();
28 parent::__construct($a_title, $a_id);
29 $this->setType("glo_adv_col_sort");
30 }
31
37 public function setValue($a_value)
38 {
39 $this->value = $a_value;
40 }
41
47 public function getValue()
48 {
49 return $this->value;
50 }
51
52
58 public function checkInput()
59 {
60 if (is_array($_POST[$this->getPostVar()])) {
61 foreach ($_POST[$this->getPostVar()] as $k => $v) {
62 $_POST[$this->getPostVar()][$k]["id"] = ilUtil::stripSlashes($_POST[$this->getPostVar()][$k]["id"]);
63 $_POST[$this->getPostVar()][$k]["text"] = ilUtil::stripSlashes($_POST[$this->getPostVar()][$k]["text"]);
64 }
65 } else {
66 $_POST[$this->getPostVar()] = array();
67 }
68
69 return true;
70 }
71
75 public function render()
76 {
78
79 $tpl = new ilTemplate("tpl.adv_col_sort_input.html", true, true, "Modules/Glossary");
80 include_once("./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
81 if (is_array($this->getValue())) {
82 foreach ($this->getValue() as $k => $v) {
83 $tpl->setCurrentBlock("item");
84 $tpl->setVariable("TEXT", $v["text"]);
85 $tpl->setVariable("ID", $this->getFieldId() . "~" . $k);
86 $tpl->setVariable("DOWN", ilGlyphGUI::get(ilGlyphGUI::DOWN));
87 $tpl->setVariable("TXT_DOWN", $lng->txt("down"));
88 $tpl->setVariable("UP", ilGlyphGUI::get(ilGlyphGUI::UP));
89 $tpl->setVariable("TXT_UP", $lng->txt("up"));
90 $tpl->setVariable('NAME', $this->getPostVar() . "[" . $k . "][id]");
91 $tpl->setVariable('TNAME', $this->getPostVar() . "[" . $k . "][text]");
92 $tpl->setVariable('VAL', ilUtil::prepareFormOutput($v["id"]));
93 $tpl->setVariable('TVAL', ilUtil::prepareFormOutput($v["text"]));
94 $tpl->parseCurrentBlock();
95 }
96 }
97
98 return $tpl->get();
99 }
100
105 public function insert(&$a_tpl)
106 {
107 $a_tpl->setCurrentBlock("prop_generic");
108 $a_tpl->setVariable("PROP_GENERIC", $this->render());
109 $a_tpl->parseCurrentBlock();
110 }
111
117 public function setValueByArray($a_values)
118 {
119 if ($this->getPostVar() && isset($a_values[$this->getPostVar()])) {
120 $this->setValue($a_values[$this->getPostVar()]);
121 }
122 }
123
127 public function getTableFilterHTML()
128 {
129 $html = $this->render();
130 return $html;
131 }
132}
$tpl
Definition: ilias.php:10
$_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
$html
Definition: example_001.php:87
global $DIC
Definition: saml.php:7