ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $ilCtrl;
48  $this->ctrl = $ilCtrl;
49  parent::__construct($this->id, $a_parent_obj, $a_parent_cmd);
50 
51  $this->setParentLink($this->ctrl->getLinkTarget($this->parent_obj, $this->parent_cmd));
52 
53  $this->setEntries($entries);
54  $this->setOfflineMode(true);
55 
57  $this->setCurrentOpenedNodeId($this->getEntries()->getRootEntryId());
58  } else {
60  }
61 
63  }
64 
69  protected function openNodesRecursively($id)
70  {
71  $this->setNodeOpen($id);
72  $parent_id = $this->getEntries()->getEntryById($id)->getParent();
73 
74  if ($parent_id) {
75  $this->openNodesRecursively($parent_id);
76  }
77  }
83  public function getRootNode()
84  {
85  return $this->getEntries()->getRootEntry();
86  }
87 
92  public function getChildsOfNode($a_parent_node_id)
93  {
94  $entry = $this->getEntries()->getEntryById($a_parent_node_id);
95 
99  $children = array();
100  foreach ($entry->getChildren() as $child_id) {
101  $children[$child_id] = $this->getEntries()->getEntryById($child_id);
102  }
103  return $children;
104  }
105 
111  public function getNodeById($a_entry_id)
112  {
113  return $this->getEntries()->getEntryById($a_entry_id);
114  }
115 
120  public function getNodeContent($entry)
121  {
122  return $entry->getTitle();
123  }
124 
129  public function getNodeHref($entry)
130  {
131  return $this->getParentLink() . "&node_id=" . $entry->getId();
132  }
133 
138  public function isNodeHighlighted($entry)
139  {
140  return $entry->getId() == $this->getCurrentOpenedNode()->getId();
141  }
146  public function getNodeId($entry)
147  {
148  return $entry->getId();
149  }
150 
154  public function getParentLink()
155  {
156  return $this->parentLink;
157  }
158 
162  public function setParentLink($parentLink)
163  {
164  $this->parentLink = $parentLink;
165  }
166 
170  public function getEntries()
171  {
172  return $this->entries;
173  }
174 
178  public function setEntries($entries)
179  {
180  $this->entries = $entries;
181  }
182 
186  public function getCurrentOpenedNodeId()
187  {
189  }
190 
195  {
196  $this->current_opened_node_id = $current_opened_node_id;
197  }
198 
203  public function getCurrentOpenedNode()
204  {
205  return $this->getEntries()->getEntryById($this->getCurrentOpenedNodeId());
206  }
207 }
setOfflineMode($a_val)
Set offline mode.
setNodeOpen($a_id)
Set node to be opened (additional custom opened node, not standard expand behaviour) ...
global $ilCtrl
Definition: ilias.php:18
Explorer base GUI class.
Create styles array
The data for the language used.
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.