ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 {
12  private $items = array();
13 
14  const DOWN_ARROW_LIGHT = "mm_down_arrow.png";
15  const DOWN_ARROW_DARK = "mm_down_arrow_dark.png";
16  const NO_ICON = "";
17 
18 
23  public function __construct($a_id = "")
24  {
26  $this->setId($a_id);
27  }
28 
34  function setId($a_val)
35  {
36  $this->id = $a_val;
37  }
38 
44  function getId()
45  {
46  return $this->id;
47  }
48 
54  function setHeaderIcon($a_headericon)
55  {
56  $this->headericon = $a_headericon;
57  }
58 
64  function getHeaderIcon()
65  {
66  return $this->headericon;
67  }
68 
74  function setLinkTitle($a_val)
75  {
76  $this->link_title = $a_val;
77  }
78 
84  function getLinkTitle()
85  {
86  return $this->link_title;
87  }
88 
94  function setItems($a_val)
95  {
96  $this->items = $a_val;
97  }
98 
104  function getItems()
105  {
106  return $this->items;
107  }
108 
114  function setSelectionHeaderClass($a_selectionheaderclass)
115  {
116  $this->selectionheaderclass = $a_selectionheaderclass;
117  }
118 
125  {
126  return $this->selectionheaderclass;
127  }
128 
134  function setFormCmd($a_val)
135  {
136  $this->form_cmd = $a_val;
137  }
138 
144  function getFormCmd()
145  {
146  return $this->form_cmd;
147  }
148 
154  function setFieldVar($a_val)
155  {
156  $this->field_var = $a_val;
157  }
158 
164  function getFieldVar()
165  {
166  return $this->field_var;
167  }
168 
174  function setHiddenVar($a_val)
175  {
176  $this->hidden_var = $a_val;
177  }
178 
184  function getHiddenVar()
185  {
186  return $this->hidden_var;
187  }
191  public function getHTML()
192  {
193  global $lng;
194 
195  $items = $this->getItems();
196 
197  include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
198  $overlay = new ilOverlayGUI("ilChkboxListOverlay_".$this->getId());
199  $overlay->setAnchor("ilChkboxListAnchorEl_".$this->getId());
200  $overlay->setTrigger("ilChkboxListTrigger_".$this->getId());
201  $overlay->setAutoHide(false);
202  //$overlay->setSize("300px", "300px");
203  $overlay->add();
204 
205  $tpl = new ilTemplate("tpl.checkbox_list_overlay.html", true, true,
206  "Services/UIComponent/CheckboxListOverlay", "DEFAULT", false, true);
207 
208  $tpl->setCurrentBlock("top_img");
209  switch ($this->getHeaderIcon())
210  {
212  $tpl->setVariable("IMG_DOWN",
214  break;
216  $tpl->setVariable("IMG_DOWN",
218  break;
219  default:
220  $tpl->setVariable("IMG_DOWN", $this->getHeaderIcon());
221  break;
222  }
223  // do not repeat title (accessibility) -> empty alt
224  $tpl->setVariable("TXT_SEL_TOP", $this->getLinkTitle());
225  $tpl->setVariable("ALT_SEL_TOP", "");
226  $tpl->setVariable("CLASS_SEL_TOP", $this->getSelectionHeaderClass());
227  $tpl->parseCurrentBlock();
228 
229  reset($items);
230  foreach ($items as $k => $v)
231  {
232  $tpl->setCurrentBlock("list_entry");
233  $tpl->setVariable("VAR", $this->getFieldVar());
234  $tpl->setVariable("VAL_ENTRY", $k);
235  $tpl->setVariable("TXT_ENTRY", $v["txt"]);
236  if ($v["selected"])
237  {
238  $tpl->setVariable("CHECKED", "checked='checked'");
239  }
240  $tpl->parseCurrentBlock();
241  }
242 
243  $tpl->setVariable("ID", $this->getId());
244  $tpl->setVariable("HIDDEN_VAR", $this->getHiddenVar());
245  $tpl->setVariable("CMD_SUBMIT", $this->getFormCmd());
246  $tpl->setVariable("VAL_SUBMIT", $lng->txt("refresh"));
247  return $tpl->get();
248  }
249 }
250 ?>