ILIAS  release_7 Revision v7.30-3-g800a261c036
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{
20 protected $lng;
21
25 protected $ctrl;
26
27 protected $letters;
28 protected $parent_object;
29 protected $parent_cmd;
30 protected $highlight;
32
36 protected $fix_db_umlauts = false;
37
44 public function __construct($a_title = "", $a_postvar = "")
45 {
46 global $DIC;
47
48 $this->lng = $DIC->language();
49 $this->ctrl = $DIC->ctrl();
50 parent::__construct($a_title, $a_postvar);
51 }
52
58 public function setValue($a_value)
59 {
60 $this->value = $a_value;
61 }
62
68 public function getValue()
69 {
70 return $this->value;
71 }
72
73
79 public function setValueByArray($a_values)
80 {
81 $this->setValue($a_values[$this->getPostVar()]);
82 }
83
89 public function setLetters($a_val)
90 {
91 $this->letters = $a_val;
92 }
93
99 public function getLetters()
100 {
101 return $this->letters;
102 }
103
109 public function checkInput()
110 {
112
114 if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "") {
115 $this->setAlert($lng->txt("msg_input_is_required"));
116
117 return false;
118 }
119
120 return true;
121 }
122
128 public function setFixDBUmlauts($a_val)
129 {
130 $this->fix_db_umlauts = $a_val;
131 }
132
138 public function getFixDBUmlauts()
139 {
141 }
142
149 public function fixDBUmlauts($l)
150 {
151 if ($this->fix_db_umlauts && !ilUtil::dbSupportsDisctinctUmlauts()) {
152 $l = str_replace(array("Ä", "Ö", "Ü", "ä", "ö", "ü"), array("A", "O", "U", "a", "o", "u"), $l);
153 }
154 return $l;
155 }
156
157
161 protected function render($a_mode = "")
162 {
163 die("only implemented for toolbar usage");
164 }
165
171 // function insert($a_tpl)
172 // {
173 // $a_tpl->setCurrentBlock("prop_generic");
174 // $a_tpl->setVariable("PROP_GENERIC", "zz");
175 // $a_tpl->parseCurrentBlock();
176 // }
177
184 public function setParentCommand($a_obj, $a_cmd)
185 {
186 $this->parent_object = $a_obj;
187 $this->parent_cmd = $a_cmd;
188 }
189
196 public function setHighlighted($a_high_letter)
197 {
198 $this->highlight = true;
199 $this->highlight_letter = $a_high_letter;
200 }
201
205 public function getToolbarHTML()
206 {
207 $ilCtrl = $this->ctrl;
209
210 $lng->loadLanguageModule("form");
211
212 $tpl = new ilTemplate("tpl.prop_alphabet.html", true, true, "Services/Form");
213 foreach ((array) $this->getLetters() as $l) {
214 $l = $this->fixDBUmlauts($l);
215 $tpl->setCurrentBlock("letter");
216 $tpl->setVariable("TXT_LET", $l);
217 $ilCtrl->setParameter($this->parent_object, "letter", rawurlencode($l));
218 $tpl->setVariable("TXT_LET", $l);
219 $tpl->setVariable("HREF_LET", $ilCtrl->getLinkTarget($this->parent_object, $this->parent_cmd));
220 if ($this->highlight && $this->highlight_letter !== null && $this->highlight_letter == $l) {
221 $tpl->setVariable("CLASS", ' class="ilHighlighted" ');
222 }
223 $tpl->parseCurrentBlock();
224 }
225 $ilCtrl->setParameter($this->parent_object, "letter", "");
226 $tpl->setVariable("TXT_ALL", $lng->txt("form_alphabet_all"));
227 $tpl->setVariable("HREF_ALL", $ilCtrl->getLinkTarget($this->parent_object, $this->parent_cmd));
228 if ($this->highlight && $this->highlight_letter === null) {
229 $tpl->setVariable("CLASSA", ' class="ilHighlighted" ');
230 }
231 return $tpl->get();
232 }
233}
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
This class represents a text property in a property form.
setValueByArray($a_values)
Set value by array.
getToolbarHTML()
Get HTML for toolbar.
fixDBUmlauts($l)
Fix db umlauts.
setHighlighted($a_high_letter)
Set highlighted.
render($a_mode="")
Render item.
__construct($a_title="", $a_postvar="")
Constructor.
checkInput()
Check input, strip slashes etc.
getFixDBUmlauts()
Get fix db umlauts.
getLetters()
Get letters available.
setParentCommand($a_obj, $a_cmd)
Insert property html.
setValue($a_value)
Set Value.
setFixDBUmlauts($a_val)
Set fix db umlauts.
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 dbSupportsDisctinctUmlauts()
Only temp fix for #8603, should go to db classes.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
global $DIC
Definition: goto.php:24
Interface for property form input GUI classes that can be used in ilToolbarGUI.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc