ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilCheckboxListOverlayGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
11 {
15  protected $lng;
16 
17  private $items = array();
18 
23  public function __construct($a_id = "")
24  {
25  global $DIC;
26 
27  $this->lng = $DIC->language();
28  $this->setId($a_id);
29  }
30 
36  public function setId($a_val)
37  {
38  $this->id = $a_val;
39  }
40 
46  public function getId()
47  {
48  return $this->id;
49  }
50 
51 
57  public function setLinkTitle($a_val)
58  {
59  $this->link_title = $a_val;
60  }
61 
67  public function getLinkTitle()
68  {
69  return $this->link_title;
70  }
71 
77  public function setItems($a_val)
78  {
79  $this->items = $a_val;
80  }
81 
87  public function getItems()
88  {
89  return $this->items;
90  }
91 
97  public function setSelectionHeaderClass($a_selectionheaderclass)
98  {
99  $this->selectionheaderclass = $a_selectionheaderclass;
100  }
101 
107  public function getSelectionHeaderClass()
108  {
109  return $this->selectionheaderclass;
110  }
111 
117  public function setFormCmd($a_val)
118  {
119  $this->form_cmd = $a_val;
120  }
121 
127  public function getFormCmd()
128  {
129  return $this->form_cmd;
130  }
131 
137  public function setFieldVar($a_val)
138  {
139  $this->field_var = $a_val;
140  }
141 
147  public function getFieldVar()
148  {
149  return $this->field_var;
150  }
151 
157  public function setHiddenVar($a_val)
158  {
159  $this->hidden_var = $a_val;
160  }
161 
167  public function getHiddenVar()
168  {
169  return $this->hidden_var;
170  }
174  public function getHTML()
175  {
176  $lng = $this->lng;
177 
178  $items = $this->getItems();
179 
180  $tpl = new ilTemplate(
181  "tpl.checkbox_list_overlay.html",
182  true,
183  true,
184  "Services/UIComponent/CheckboxListOverlay",
185  "DEFAULT",
186  false,
187  true
188  );
189 
190  $tpl->setCurrentBlock("top_img");
191 
192  // do not repeat title (accessibility) -> empty alt
193  $tpl->setVariable("TXT_SEL_TOP", $this->getLinkTitle());
194 
195  $tpl->parseCurrentBlock();
196 
197  reset($items);
198  $cnt = 0;
199  foreach ($items as $k => $v) {
200  $tpl->setCurrentBlock("list_entry");
201  $tpl->setVariable("VAR", $this->getFieldVar());
202  $tpl->setVariable("VAL_ENTRY", $k);
203  $tpl->setVariable("TXT_ENTRY", $v["txt"]);
204  $tpl->setVariable("IDX_ENTRY", ++$cnt);
205  if ($v["selected"]) {
206  $tpl->setVariable("CHECKED", "checked='checked'");
207  }
208  $tpl->parseCurrentBlock();
209  }
210 
211  $tpl->setVariable("ID", $this->getId());
212  $tpl->setVariable("HIDDEN_VAR", $this->getHiddenVar());
213  $tpl->setVariable("CMD_SUBMIT", $this->getFormCmd());
214  $tpl->setVariable("VAL_SUBMIT", $lng->txt("refresh"));
215  return $tpl->get();
216  }
217 }
getSelectionHeaderClass()
Get Selection Header Class.
setHiddenVar($a_val)
Set hidden var (used to indicated that checkbox array has been sent in a form)
global $DIC
Definition: saml.php:7
$tpl
Definition: ilias.php:10
if(!array_key_exists('StateId', $_REQUEST)) $id
special template class to simplify handling of ITX/PEAR
User interface class for a checkbox list overlay.
setSelectionHeaderClass($a_selectionheaderclass)
Set Selection Header Class.