ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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{
14 protected $items = array();
15
16 const STATUS_OK = "ok";
17 const STATUS_NOT_OK = "nok";
18 const STATUS_NO_STATUS = "no_status";
19
20 function __construct()
21 {
22
23 }
24
30 function addEntry($a_txt, $a_href, $a_status = self::STATUS_NO_STATUS, $a_highlighted = false, $a_info_texts = array())
31 {
32 $this->items[] = array(
33 "txt" => $a_txt,
34 "href" => $a_href,
35 "status" => $a_status,
36 "highlighted" => $a_highlighted,
37 "info" => $a_info_texts
38 );
39 }
40
46 function setHeading($a_val)
47 {
48 $this->heading = $a_val;
49 }
50
56 function getHeading()
57 {
58 return $this->heading;
59 }
60
64 function getHTML()
65 {
66 global $lng;
67
68 include_once("./Services/UIComponent/Panel/classes/class.ilPanelGUI.php");
69 $panel = ilPanelGUI::getInstance();
70 $panel->setPanelStyle(ilPanelGUI::PANEL_STYLE_SECONDARY);
71 $panel->setHeadingStyle(ilPanelGUI::HEADING_STYLE_BLOCK);
72 $panel->setHeading($this->getHeading());
73 include_once("./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php");
74 $list = new ilGroupedListGUI();
75 foreach ($this->items as $i)
76 {
77 $item_tpl = new ilTemplate("tpl.checklist_item.html", true, true, "Services/UIComponent/Checklist");
78
79 if (!is_array($i["info"]) && $i["info"] != "")
80 {
81 $i["info"] = array($i["info"]);
82 }
83 if (is_array($i["info"]) && count($i["info"]) > 0)
84 {
85 foreach ($i["info"] as $info)
86 {
87 $item_tpl->setCurrentBlock("info");
88 $item_tpl->setVariable("INFO_MSG", $info);
89 $item_tpl->parseCurrentBlock();
90 }
91 }
92
93 $item_tpl->setVariable("TXT_STEP", $i["txt"]);
94 switch ($i["status"])
95 {
96 case self::STATUS_OK:
97 $item_tpl->setVariable("STATUS_IMG", ilUtil::getImagePath("icon_ok.svg"));
98 $item_tpl->setVariable("STATUS_ALT", $lng->txt("uic_checklist_ok"));
99 break;
100
102 $item_tpl->setVariable("STATUS_IMG", ilUtil::getImagePath("icon_not_ok.svg"));
103 $item_tpl->setVariable("STATUS_ALT", $lng->txt("uic_checklist_not_ok"));
104 break;
105 }
106 $list->addEntry($item_tpl->get(), $i["href"], "", "", $i["highlighted"] ? "ilHighlighted" : "");
107 }
108 $ch_tpl = new ilTemplate("tpl.checklist.html", true, true, "Services/UIComponent/Checklist");
109 $ch_tpl->setVariable("LIST", $list->getHTML());
110 $panel->setBody($ch_tpl->get());
111 return $panel->getHTML();
112 }
113
114}
115
116?>
getHeading()
Get heading.
addEntry($a_txt, $a_href, $a_status=self::STATUS_NO_STATUS, $a_highlighted=false, $a_info_texts=array())
Add item.
setHeading($a_val)
Set heading.
Grouped list GUI class.
const PANEL_STYLE_SECONDARY
const HEADING_STYLE_BLOCK
static getInstance()
Get instance.
special template class to simplify handling of ITX/PEAR
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$info
Definition: example_052.php:80
global $lng
Definition: privfeed.php:40