ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilAlphabetInputGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once("./Services/Form/classes/class.ilFormPropertyGUI.php");
6 include_once 'Services/UIComponent/Toolbar/interfaces/interface.ilToolbarItem.php';
7 
16 {
17  protected $letters;
18  protected $parent_object;
19  protected $parent_cmd;
20  protected $highlight;
21  protected $highlight_letter;
22 
29  function __construct($a_title = "", $a_postvar = "")
30  {
31  parent::__construct($a_title, $a_postvar);
32  }
33 
39  function setValue($a_value)
40  {
41  $this->value = $a_value;
42  }
43 
49  function getValue()
50  {
51  return $this->value;
52  }
53 
54 
60  function setValueByArray($a_values)
61  {
62  $this->setValue($a_values[$this->getPostVar()]);
63  }
64 
70  function setLetters($a_val)
71  {
72  $this->letters = $a_val;
73  }
74 
80  function getLetters()
81  {
82  return $this->letters;
83  }
84 
90  function checkInput()
91  {
92  global $lng;
93 
95  if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "")
96  {
97  $this->setAlert($lng->txt("msg_input_is_required"));
98 
99  return false;
100  }
101 
102  return true;
103  }
104 
108  protected function render($a_mode = "")
109  {
110  die("only implemented for toolbar usage");
111  }
112 
118 // function insert($a_tpl)
119 // {
120 // $a_tpl->setCurrentBlock("prop_generic");
121 // $a_tpl->setVariable("PROP_GENERIC", "zz");
122 // $a_tpl->parseCurrentBlock();
123 // }
124 
131  function setParentCommand($a_obj, $a_cmd)
132  {
133  $this->parent_object = $a_obj;
134  $this->parent_cmd = $a_cmd;
135  }
136 
143  function setHighlighted($a_high_letter)
144  {
145  $this->highlight = true;
146  $this->highlight_letter = $a_high_letter;
147  }
148 
149 
150 
154  function getToolbarHTML()
155  {
156  global $ilCtrl, $lng;
157 
158  $lng->loadLanguageModule("form");
159 
160  $tpl = new ilTemplate("tpl.prop_alphabet.html", true, true, "Services/Form");
161  foreach ((array)$this->getLetters() as $l)
162  {
163  $tpl->setCurrentBlock("letter");
164  $tpl->setVariable("TXT_LET", $l);
165  $ilCtrl->setParameter($this->parent_object, "letter", rawurlencode($l));
166  $tpl->setVariable("TXT_LET", $l);
167  $tpl->setVariable("HREF_LET", $ilCtrl->getLinkTarget($this->parent_object, $this->parent_cmd));
168  if ($this->highlight && $this->highlight_letter !== null && $this->highlight_letter == $l)
169  {
170  $tpl->setVariable("CLASS", ' class="ilHighlighted" ');
171  }
172  $tpl->parseCurrentBlock();
173  }
174  $ilCtrl->setParameter($this->parent_object, "letter", "");
175  $tpl->setVariable("TXT_ALL", $lng->txt("form_alphabet_all"));
176  $tpl->setVariable("HREF_ALL", $ilCtrl->getLinkTarget($this->parent_object, $this->parent_cmd));
177  if ($this->highlight && $this->highlight_letter === null)
178  {
179  $tpl->setVariable("CLASSA", ' class="ilHighlighted" ');
180  }
181  return $tpl->get();
182  }
183 
184 }
185 ?>
getPostVar()
Get Post Variable.
This class represents a text property in a property form.
Interface for property form input GUI classes that can be used in ilToolbarGUI.
checkInput()
Check input, strip slashes etc.
setHighlighted($a_high_letter)
Set highlighted.
setParentCommand($a_obj, $a_cmd)
Insert property html.
setAlert($a_alert)
Set Alert Text.
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
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
Create styles array
The data for the language used.
__construct($a_title="", $a_postvar="")
Constructor.
global $l
Definition: afr.php:30
This class represents a property in a property form.
global $lng
Definition: privfeed.php:17
getLetters()
Get letters available.
getToolbarHTML()
Get HTML for toolbar.
setLetters($a_val)
Set letters available.
setValueByArray($a_values)
Set value by array.
render($a_mode="")
Render item.
setValue($a_value)
Set Value.
$_POST["username"]