ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 
4 include_once("Services/UIComponent/Explorer2/classes/class.ilExplorerBaseGUI.php");
5 
7 
12 {
16  protected $ctrl;
17 
21  protected $id = "ksDocumentationExplorer";
22 
26  protected $parentLink = "";
27 
31  protected $entries = null;
32 
36  protected $current_opened_node_id = "";
37 
45  public function __construct(ilSystemStyleDocumentationGUI $a_parent_obj, $a_parent_cmd, Entry\ComponentEntries $entries, $current_opened_node_id)
46  {
47  global $DIC;
48  $this->ctrl = $DIC->ctrl();
49 
50  parent::__construct($this->id, $a_parent_obj, $a_parent_cmd);
51 
52  $this->setParentLink($this->ctrl->getLinkTarget($this->parent_obj, $this->parent_cmd));
53 
54  $this->setEntries($entries);
55  $this->setOfflineMode(true);
56 
58  $this->setCurrentOpenedNodeId($this->getEntries()->getRootEntryId());
59  } else {
61  }
62 
64  }
65 
70  protected function openNodesRecursively($id)
71  {
72  $this->setNodeOpen($id);
73  $parent_id = $this->getEntries()->getEntryById($id)->getParent();
74 
75  if ($parent_id) {
76  $this->openNodesRecursively($parent_id);
77  }
78  }
84  public function getRootNode()
85  {
86  return $this->getEntries()->getRootEntry();
87  }
88 
93  public function getChildsOfNode($a_parent_node_id)
94  {
95  $entry = $this->getEntries()->getEntryById($a_parent_node_id);
96 
100  $children = array();
101  foreach ($entry->getChildren() as $child_id) {
102  $children[$child_id] = $this->getEntries()->getEntryById($child_id);
103  }
104  return $children;
105  }
106 
112  public function getNodeById($a_entry_id)
113  {
114  return $this->getEntries()->getEntryById($a_entry_id);
115  }
116 
121  public function getNodeContent($entry)
122  {
123  return $entry->getTitle();
124  }
125 
130  public function getNodeHref($entry)
131  {
132  return $this->getParentLink() . "&node_id=" . $entry->getId();
133  }
134 
139  public function isNodeHighlighted($entry)
140  {
141  return $entry->getId() == $this->getCurrentOpenedNode()->getId();
142  }
147  public function getNodeId($entry)
148  {
149  return $entry->getId();
150  }
151 
155  public function getParentLink()
156  {
157  return $this->parentLink;
158  }
159 
163  public function setParentLink($parentLink)
164  {
165  $this->parentLink = $parentLink;
166  }
167 
171  public function getEntries()
172  {
173  return $this->entries;
174  }
175 
179  public function setEntries($entries)
180  {
181  $this->entries = $entries;
182  }
183 
187  public function getCurrentOpenedNodeId()
188  {
190  }
191 
196  {
197  $this->current_opened_node_id = $current_opened_node_id;
198  }
199 
204  public function getCurrentOpenedNode()
205  {
206  return $this->getEntries()->getEntryById($this->getCurrentOpenedNodeId());
207  }
208 }
setOfflineMode($a_val)
Set offline mode.
global $DIC
Definition: saml.php:7
setNodeOpen($a_id)
Set node to be opened (additional custom opened node, not standard expand behaviour) ...
Explorer base GUI class.
getChildsOfNode($a_parent_node_id)
Get childs of node.
__construct(ilSystemStyleDocumentationGUI $a_parent_obj, $a_parent_cmd, Entry\ComponentEntries $entries, $current_opened_node_id)
ilKSDocumentationExplorerGUI constructor.