ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 function __construct($a_title = "", $a_id = "")
24 {
25 parent::__construct($a_title, $a_id);
26 $this->setType("glo_adv_col_sort");
27 }
28
34 function setValue($a_value)
35 {
36 $this->value = $a_value;
37 }
38
44 function getValue()
45 {
46 return $this->value;
47 }
48
49
55 function checkInput()
56 {
57 if (is_array($_POST[$this->getPostVar()])) {
58 foreach ($_POST[$this->getPostVar()] as $k => $v)
59 {
60 $_POST[$this->getPostVar()][$k]["id"] = ilUtil::stripSlashes($_POST[$this->getPostVar()][$k]["id"]);
61 $_POST[$this->getPostVar()][$k]["text"] = ilUtil::stripSlashes($_POST[$this->getPostVar()][$k]["text"]);
62 }
63 }
64 else
65 {
66 $_POST[$this->getPostVar()] = array();
67 }
68
69 return true;
70 }
71
75 function render()
76 {
77 global $lng;
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 {
83 foreach ($this->getValue() as $k => $v)
84 {
85 $tpl->setCurrentBlock("item");
86 $tpl->setVariable("TEXT", $v["text"]);
87 $tpl->setVariable("ID", $this->getFieldId()."~".$k);
88 $tpl->setVariable("DOWN", ilGlyphGUI::get(ilGlyphGUI::DOWN));
89 $tpl->setVariable("TXT_DOWN", $lng->txt("down"));
90 $tpl->setVariable("UP", ilGlyphGUI::get(ilGlyphGUI::UP));
91 $tpl->setVariable("TXT_UP", $lng->txt("up"));
92 $tpl->setVariable('NAME', $this->getPostVar()."[".$k."][id]");
93 $tpl->setVariable('TNAME', $this->getPostVar()."[".$k."][text]");
94 $tpl->setVariable('VAL', ilUtil::prepareFormOutput($v["id"]));
95 $tpl->setVariable('TVAL', ilUtil::prepareFormOutput($v["text"]));
96 $tpl->parseCurrentBlock();
97 }
98 }
99
100 return $tpl->get();
101 }
102
107 function insert(&$a_tpl)
108 {
109 $a_tpl->setCurrentBlock("prop_generic");
110 $a_tpl->setVariable("PROP_GENERIC", $this->render());
111 $a_tpl->parseCurrentBlock();
112 }
113
119 function setValueByArray($a_values)
120 {
121 if ($this->getPostVar() && isset($a_values[$this->getPostVar()]))
122 {
123 $this->setValue($a_values[$this->getPostVar()]);
124 }
125 }
126
131 {
132 $html = $this->render();
133 return $html;
134 }
135}
global $tpl
Definition: ilias.php:8
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
$_POST['username']
Definition: cron.php:12
$html
Definition: example_001.php:87
global $lng
Definition: privfeed.php:40