ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilChecklistGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
13 {
17  protected $lng;
18 
19  protected $items = array();
20 
21  const STATUS_OK = "ok";
22  const STATUS_NOT_OK = "nok";
23  const STATUS_NO_STATUS = "no_status";
24 
25  public function __construct()
26  {
27  global $DIC;
28 
29  $this->lng = $DIC->language();
30  }
31 
37  public function addEntry($a_txt, $a_href, $a_status = self::STATUS_NO_STATUS, $a_highlighted = false, $a_info_texts = array())
38  {
39  $this->items[] = array(
40  "txt" => $a_txt,
41  "href" => $a_href,
42  "status" => $a_status,
43  "highlighted" => $a_highlighted,
44  "info" => $a_info_texts
45  );
46  }
47 
53  public function setHeading($a_val)
54  {
55  $this->heading = $a_val;
56  }
57 
63  public function getHeading()
64  {
65  return $this->heading;
66  }
67 
71  public function getHTML()
72  {
73  $lng = $this->lng;
74 
75  include_once("./Services/UIComponent/Panel/classes/class.ilPanelGUI.php");
76  $panel = ilPanelGUI::getInstance();
77  $panel->setPanelStyle(ilPanelGUI::PANEL_STYLE_SECONDARY);
78  $panel->setHeadingStyle(ilPanelGUI::HEADING_STYLE_BLOCK);
79  $panel->setHeading($this->getHeading());
80  include_once("./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php");
81  $list = new ilGroupedListGUI();
82  foreach ($this->items as $i) {
83  $item_tpl = new ilTemplate("tpl.checklist_item.html", true, true, "Services/UIComponent/Checklist");
84 
85  if (!is_array($i["info"]) && $i["info"] != "") {
86  $i["info"] = array($i["info"]);
87  }
88  if (is_array($i["info"]) && count($i["info"]) > 0) {
89  foreach ($i["info"] as $info) {
90  $item_tpl->setCurrentBlock("info");
91  $item_tpl->setVariable("INFO_MSG", $info);
92  $item_tpl->parseCurrentBlock();
93  }
94  }
95 
96  $item_tpl->setVariable("TXT_STEP", $i["txt"]);
97  switch ($i["status"]) {
98  case self::STATUS_OK:
99  $item_tpl->setVariable("STATUS_IMG", ilUtil::getImagePath("icon_ok.svg"));
100  $item_tpl->setVariable("STATUS_ALT", $lng->txt("uic_checklist_ok"));
101  break;
102 
103  case self::STATUS_NOT_OK:
104  $item_tpl->setVariable("STATUS_IMG", ilUtil::getImagePath("icon_not_ok.svg"));
105  $item_tpl->setVariable("STATUS_ALT", $lng->txt("uic_checklist_not_ok"));
106  break;
107  }
108  $list->addEntry($item_tpl->get(), $i["href"], "", "", $i["highlighted"] ? "ilHighlighted" : "");
109  }
110  $ch_tpl = new ilTemplate("tpl.checklist.html", true, true, "Services/UIComponent/Checklist");
111  $ch_tpl->setVariable("LIST", $list->getHTML());
112  $panel->setBody($ch_tpl->get());
113  return $panel->getHTML();
114  }
115 }
setHeading($a_val)
Set heading.
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
global $DIC
Definition: saml.php:7
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Grouped list GUI class.
special template class to simplify handling of ITX/PEAR
Create styles array
The data for the language used.
getHeading()
Get heading.
addEntry($a_txt, $a_href, $a_status=self::STATUS_NO_STATUS, $a_highlighted=false, $a_info_texts=array())
Add item.
static getInstance()
Get instance.
$i
Definition: disco.tpl.php:19
const PANEL_STYLE_SECONDARY
const HEADING_STYLE_BLOCK
$info
Definition: index.php:5