ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilKSDocumentationExplorerGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("Services/UIComponent/Explorer2/classes/class.ilExplorerBaseGUI.php");
5
8
13{
17 protected $ctrl;
18
22 protected $id = "ksDocumentationExplorer";
23
27 protected $parentLink = "";
28
32 protected $entries = null;
33
38
45 public function __construct()
46 {
47 global $DIC;
48 $this->ctrl = $DIC->ctrl();
49
50 parent::__construct($this->id, null, "");
51
52 $this->setParentLink($this->ctrl->getLinkTargetByClass(["ilAdministrationGUI","ilObjStyleSettingsGUI","ilSystemStyleMainGUI","ilSystemStyleDocumentationGUI"], "entries"));
53
54 $entries = Crawler\Entry\ComponentEntries::createFromArray(include ilSystemStyleDocumentationGUI::$DATA_PATH);
55
56 $this->setEntries($entries);
57 $this->setOfflineMode(true);
58 $current_opened_node_id = $_GET["node_id"];
59
62 } else {
63 $this->setCurrentOpenedNodeId($this->getEntries()->getRootEntryId());
64 }
65
67 }
68
73 protected function openNodesRecursively($id)
74 {
75 $this->setNodeOpen($id);
76 $parent_id = $this->getEntries()->getEntryById($id)->getParent();
77
78 if ($parent_id) {
79 $this->openNodesRecursively($parent_id);
80 }
81 }
87 public function getRootNode()
88 {
89 return $this->getEntries()->getRootEntry();
90 }
91
96 public function getChildsOfNode($a_parent_node_id)
97 {
98 $entry = $this->getEntries()->getEntryById($a_parent_node_id);
99
103 $children = array();
104 foreach ($entry->getChildren() as $child_id) {
105 $children[$child_id] = $this->getEntries()->getEntryById($child_id);
106 }
107 return $children;
108 }
109
115 public function getNodeById($a_entry_id)
116 {
117 return $this->getEntries()->getEntryById($a_entry_id);
118 }
119
124 public function getNodeContent($entry)
125 {
126 return $entry->getTitle();
127 }
128
133 public function getNodeHref($entry)
134 {
135 return $this->getParentLink() . "&node_id=" . $entry->getId();
136 }
137
142 public function isNodeHighlighted($entry)
143 {
144 return $entry->getId() == $this->getCurrentOpenedNode()->getId();
145 }
150 public function getNodeId($entry)
151 {
152 return $entry->getId();
153 }
154
158 public function getParentLink()
159 {
160 return $this->parentLink;
161 }
162
166 public function setParentLink($parentLink)
167 {
168 $this->parentLink = $parentLink;
169 }
170
174 public function getEntries()
175 {
176 return $this->entries;
177 }
178
182 public function setEntries($entries)
183 {
184 $this->entries = $entries;
185 }
186
190 public function getCurrentOpenedNodeId()
191 {
193 }
194
199 {
200 $this->current_opened_node_id = $current_opened_node_id;
201 }
202
207 public function getCurrentOpenedNode()
208 {
209 return $this->getEntries()->getEntryById($this->getCurrentOpenedNodeId());
210 }
211}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
Explorer base GUI class.
getChildsOfNode($a_parent_node_id)
Get childs of node.
setNodeOpen($a_id)
Set node to be opened (additional custom opened node, not standard expand behaviour)
setOfflineMode($a_val)
Set offline mode.
__construct()
ilKSDocumentationExplorerGUI constructor.
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc