ILIAS  release_4-4 Revision
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  if (is_array($this->getValue()))
81  {
82  foreach ($this->getValue() as $k => $v)
83  {
84  $tpl->setCurrentBlock("item");
85  $tpl->setVariable("TEXT", $v["text"]);
86  $tpl->setVariable("ID", $this->getFieldId()."~".$k);
87  $tpl->setVariable("SRC_DOWN", ilUtil::getImagePath('icon_down_s.png'));
88  $tpl->setVariable("TXT_DOWN", $lng->txt("down"));
89  $tpl->setVariable("SRC_UP", ilUtil::getImagePath('icon_up_s.png'));
90  $tpl->setVariable("TXT_UP", $lng->txt("up"));
91  $tpl->setVariable('NAME', $this->getPostVar()."[".$k."][id]");
92  $tpl->setVariable('TNAME', $this->getPostVar()."[".$k."][text]");
93  $tpl->setVariable('VAL', ilUtil::prepareFormOutput($v["id"]));
94  $tpl->setVariable('TVAL', ilUtil::prepareFormOutput($v["text"]));
95  $tpl->parseCurrentBlock();
96  }
97  }
98 
99  return $tpl->get();
100  }
101 
106  function insert(&$a_tpl)
107  {
108  $a_tpl->setCurrentBlock("prop_generic");
109  $a_tpl->setVariable("PROP_GENERIC", $this->render());
110  $a_tpl->parseCurrentBlock();
111  }
112 
118  function setValueByArray($a_values)
119  {
120  if ($this->getPostVar() && isset($a_values[$this->getPostVar()]))
121  {
122  $this->setValue($a_values[$this->getPostVar()]);
123  }
124  }
125 
130  {
131  $html = $this->render();
132  return $html;
133  }
134 }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
$_POST['username']
Definition: cron.php:12
insert(&$a_tpl)
Insert property html.
getPostVar()
Get Post Variable.
__construct($a_title="", $a_id="")
Constructor.
setValueByArray($a_values)
Set value by array.
setType($a_type)
Set Type.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
getFieldId()
Get Post Variable.
special template class to simplify handling of ITX/PEAR
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
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
This class represents a property in a property form.
global $lng
Definition: privfeed.php:40
getTableFilterHTML()
Get HTML for table filter.
Input for adv meta data column sorting in glossaries.