ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
4 include_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 }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
insert(&$a_tpl)
Insert property html.
getPostVar()
Get Post Variable.
__construct($a_title="", $a_id="")
Constructor.
static get($a_glyph, $a_text="")
Get glyph html.
setValueByArray($a_values)
Set value by array.
global $tpl
Definition: ilias.php:8
setType($a_type)
Set Type.
getFieldId()
Get Post Variable.
special template class to simplify handling of ITX/PEAR
checkInput()
Input should always be valid, since we sort only.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
Create styles array
The data for the language used.
This class represents a property in a property form.
global $lng
Definition: privfeed.php:17
getTableFilterHTML()
Get HTML for table filter.
$_POST["username"]
$html
Definition: example_001.php:87
Input for adv meta data column sorting in glossaries.