ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilVirtualSkillTreeExplorerGUI.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 
15 {
19  protected $lng;
20 
24  protected $ctrl;
25 
26  protected $show_draft_nodes = false;
27  protected $show_outdated_nodes = false;
28 
32  public function __construct($a_id, $a_parent_obj, $a_parent_cmd)
33  {
34  global $DIC;
35 
36  $this->lng = $DIC->language();
37  $this->ctrl = $DIC->ctrl();
38  parent::__construct($a_id, $a_parent_obj, $a_parent_cmd);
39 
40  include_once("./Services/Skill/classes/class.ilVirtualSkillTree.php");
41  $this->vtree = new ilVirtualSkillTree();
42 
43  $this->setSkipRootNode(false);
44  $this->setAjax(false);
45  }
46 
52  public function setShowDraftNodes($a_val)
53  {
54  $this->show_draft_nodes = $a_val;
55  $this->vtree->setIncludeDrafts($a_val);
56  }
57 
63  public function getShowDraftNodes()
64  {
66  }
67 
73  public function setShowOutdatedNodes($a_val)
74  {
75  $this->show_outdated_nodes = $a_val;
76  $this->vtree->setIncludeOutdated($a_val);
77  }
78 
84  public function getShowOutdatedNodes()
85  {
87  }
88 
94  public function getRootNode()
95  {
96  return $this->vtree->getRootNode();
97  }
98 
105  public function getNodeId($a_node)
106  {
107  return $a_node["id"];
108  }
109 
113  public function getDomNodeIdForNodeId($node_id)
114  {
115  return parent::getDomNodeIdForNodeId(str_replace(":", "_", $node_id));
116  }
117 
121  public function getNodeIdForDomNodeId($a_dom_node_id)
122  {
123  $id = parent::getNodeIdForDomNodeId($a_dom_node_id);
124  return str_replace("_", ":", $id);
125  }
126 
127 
134  public function getChildsOfNode($a_parent_id)
135  {
136  return $this->vtree->getChildsOfNode($a_parent_id);
137  }
138 
145  public function getNodeContent($a_node)
146  {
147  $lng = $this->lng;
148 
149  $a_parent_id_parts = explode(":", $a_node["id"]);
150  $a_parent_skl_tree_id = $a_parent_id_parts[0];
151  $a_parent_skl_template_tree_id = $a_parent_id_parts[1];
152 
153  // title
154  $title = $a_node["title"];
155 
156  // root?
157  if ($a_node["type"] == "skrt") {
158  $lng->txt("skmg_skills");
159  } else {
160  if ($a_node["type"] == "sktr") {
161  // include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
162 // $title.= " (".ilSkillTreeNode::_lookupTitle($a_parent_skl_template_tree_id).")";
163  }
164  }
165 
166  return $title;
167  }
168 
175  public function getNodeIcon($a_node)
176  {
177  $a_id_parts = explode(":", $a_node["id"]);
178  $a_skl_template_tree_id = $a_id_parts[1];
179 
180  // root?
181  if ($a_node["type"] == "skrt") {
182  $icon = ilUtil::getImagePath("icon_scat.svg");
183  } else {
184  $type = $a_node["type"];
185  if ($type == "sktr") {
186  include_once("./Services/Skill/classes/class.ilSkillTreeNode.php");
187  $type = ilSkillTreeNode::_lookupType($a_skl_template_tree_id);
188  }
189  if ($type == "sktp") {
190  $type = "skll";
191  }
192  if ($type == "sctp") {
193  $type = "scat";
194  }
195  $icon = ilUtil::getImagePath("icon_" . $type . ".svg");
196  }
197 
198  return $icon;
199  }
200 
207  public function getNodeHref($a_node)
208  {
210 
211  // we have a tree id like <skl_tree_id>:<skl_template_tree_id> here
212  // use this, if you want a "common" skill id in format <skill_id>:<tref_id>
213  $id_parts = explode(":", $a_node["id"]);
214  if ($id_parts[1] == 0) {
215  // skill in main tree
216  $skill_id = $a_node["id"];
217  } else {
218  // skill in template
219  $skill_id = $id_parts[1] . ":" . $id_parts[0];
220  }
221 
222  return "";
223  }
224 
231  public function isNodeClickable($a_node)
232  {
233  return false;
234  }
235 
242  public function getNodeIconAlt($a_node)
243  {
244  $lng = $this->lng;
245 
246  if ($lng->exists("skmg_" . $a_node["type"])) {
247  return $lng->txt("skmg_" . $a_node["type"]);
248  }
249 
250  return $lng->txt($a_node["type"]);
251  }
252 
253 }
$type
global $DIC
Definition: saml.php:7
getNodeIconAlt($a_node)
Get node icon alt attribute.
setSkipRootNode($a_val)
Set skip root node.
if(!array_key_exists('StateId', $_REQUEST)) $id
__construct($a_id, $a_parent_obj, $a_parent_cmd)
Constructor.
static _lookupType($a_obj_id)
Lookup Type.
global $ilCtrl
Definition: ilias.php:18
setShowOutdatedNodes($a_val)
Set show outdated nodes.
Explorer base GUI class.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
getChildsOfNode($a_parent_id)
Get childs of node.