ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
5include_once("./Services/Form/classes/class.ilFormPropertyGUI.php");
6include_once 'Services/UIComponent/Toolbar/interfaces/interface.ilToolbarItem.php';
7
16{
17 protected $letters;
18 protected $parent_object;
19 protected $parent_cmd;
20 protected $highlight;
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
152 function getToolbarHTML()
153 {
154 global $ilCtrl, $lng;
155
156 $lng->loadLanguageModule("form");
157
158 $tpl = new ilTemplate("tpl.prop_alphabet.html", true, true, "Services/Form");
159 foreach ((array)$this->getLetters() as $l)
160 {
161 $tpl->setCurrentBlock("letter");
162 $tpl->setVariable("TXT_LET", $l);
163 $ilCtrl->setParameter($this->parent_object, "letter", rawurlencode($l));
164 $tpl->setVariable("TXT_LET", $l);
165 $tpl->setVariable("HREF_LET", $ilCtrl->getLinkTarget($this->parent_object, $this->parent_cmd));
166 if ($this->highlight && $this->highlight_letter !== null && $this->highlight_letter == $l)
167 {
168 $tpl->setVariable("CLASS", ' class="ilHighlighted" ');
169 }
170 $tpl->parseCurrentBlock();
171 }
172 $ilCtrl->setParameter($this->parent_object, "letter", "");
173 $tpl->setVariable("TXT_ALL", $lng->txt("form_alphabet_all"));
174 $tpl->setVariable("HREF_ALL", $ilCtrl->getLinkTarget($this->parent_object, $this->parent_cmd));
175 if ($this->highlight && $this->highlight_letter === null)
176 {
177 $tpl->setVariable("CLASSA", ' class="ilHighlighted" ');
178 }
179 return $tpl->get();
180 }
181
182}
183?>
global $tpl
Definition: ilias.php:8
global $l
Definition: afr.php:30
This class represents a text property in a property form.
setValueByArray($a_values)
Set value by array.
getToolbarHTML()
Get HTML for toolbar.
setHighlighted($a_high_letter)
Set highlighted.
render($a_mode="")
Render item.
__construct($a_title="", $a_postvar="")
Constructor.
checkInput()
Check input, strip slashes etc.
getLetters()
Get letters available.
setParentCommand($a_obj, $a_cmd)
Insert property html.
setValue($a_value)
Set Value.
setLetters($a_val)
Set letters available.
This class represents a property in a property form.
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
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
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18
Interface for property form input GUI classes that can be used in ilToolbarGUI.
global $lng
Definition: privfeed.php:40