ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilVirtualSkillTreeExplorerGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2020 ILIAS open source, Extended GPL, see docs/LICENSE */
4
11{
15 protected $lng;
16
20 protected $ctrl;
21
22 protected $show_draft_nodes = false;
23 protected $show_outdated_nodes = false;
24
28 public function __construct($a_id, $a_parent_obj, $a_parent_cmd)
29 {
30 global $DIC;
31
32 $this->lng = $DIC->language();
33 $this->ctrl = $DIC->ctrl();
34 parent::__construct($a_id, $a_parent_obj, $a_parent_cmd);
35
36 $this->vtree = new ilVirtualSkillTree();
37
38 $this->setSkipRootNode(false);
39 $this->setAjax(false);
40 }
41
47 public function setShowDraftNodes($a_val)
48 {
49 $this->show_draft_nodes = $a_val;
50 $this->vtree->setIncludeDrafts($a_val);
51 }
52
58 public function getShowDraftNodes()
59 {
61 }
62
68 public function setShowOutdatedNodes($a_val)
69 {
70 $this->show_outdated_nodes = $a_val;
71 $this->vtree->setIncludeOutdated($a_val);
72 }
73
79 public function getShowOutdatedNodes()
80 {
82 }
83
89 public function getRootNode()
90 {
91 return $this->vtree->getRootNode();
92 }
93
100 public function getNodeId($a_node)
101 {
102 return $a_node["id"];
103 }
104
108 public function getDomNodeIdForNodeId($node_id)
109 {
110 return parent::getDomNodeIdForNodeId(str_replace(":", "_", $node_id));
111 }
112
116 public function getNodeIdForDomNodeId($a_dom_node_id)
117 {
118 $id = parent::getNodeIdForDomNodeId($a_dom_node_id);
119 return str_replace("_", ":", $id);
120 }
121
122
129 public function getChildsOfNode($a_parent_id)
130 {
131 return $this->vtree->getChildsOfNode($a_parent_id);
132 }
133
140 public function getNodeContent($a_node)
141 {
143
144 $a_parent_id_parts = explode(":", $a_node["id"]);
145 $a_parent_skl_tree_id = $a_parent_id_parts[0];
146 $a_parent_skl_template_tree_id = $a_parent_id_parts[1];
147
148 // title
149 $title = $a_node["title"];
150
151 // root?
152 if ($a_node["type"] == "skrt") {
153 $lng->txt("skmg_skills");
154 } else {
155 if ($a_node["type"] == "sktr") {
156 // $title.= " (".ilSkillTreeNode::_lookupTitle($a_parent_skl_template_tree_id).")";
157 }
158 }
159
160 return $title;
161 }
162
169 public function getNodeIcon($a_node)
170 {
171 $a_id_parts = explode(":", $a_node["id"]);
172 $a_skl_template_tree_id = $a_id_parts[1];
173
174 // root?
175 if ($a_node["type"] == "skrt") {
176 $icon = ilUtil::getImagePath("icon_scat.svg");
177 } else {
178 $type = $a_node["type"];
179 if ($type == "sktr") {
180 $type = ilSkillTreeNode::_lookupType($a_skl_template_tree_id);
181 }
182 if ($type == "sktp") {
183 $type = "skll";
184 }
185 if ($type == "sctp") {
186 $type = "scat";
187 }
188 $icon = ilUtil::getImagePath("icon_" . $type . ".svg");
189 }
190
191 return $icon;
192 }
193
200 public function getNodeHref($a_node)
201 {
202 $ilCtrl = $this->ctrl;
203
204 // we have a tree id like <skl_tree_id>:<skl_template_tree_id> here
205 // use this, if you want a "common" skill id in format <skill_id>:<tref_id>
206 $id_parts = explode(":", $a_node["id"]);
207 if ($id_parts[1] == 0) {
208 // skill in main tree
209 $skill_id = $a_node["id"];
210 } else {
211 // skill in template
212 $skill_id = $id_parts[1] . ":" . $id_parts[0];
213 }
214
215 return "";
216 }
217
224 public function isNodeClickable($a_node)
225 {
226 return false;
227 }
228
235 public function getNodeIconAlt($a_node)
236 {
238
239 if ($lng->exists("skmg_" . $a_node["type"])) {
240 return $lng->txt("skmg_" . $a_node["type"]);
241 }
242
243 return $lng->txt($a_node["type"]);
244 }
245
246}
An exception for terminatinating execution or to throw for unit testing.
Explorer base GUI class.
setSkipRootNode($a_val)
Set skip root node.
static _lookupType($a_obj_id)
Lookup Type.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
__construct($a_id, $a_parent_obj, $a_parent_cmd)
Constructor.
setShowOutdatedNodes($a_val)
Set show outdated nodes.
getChildsOfNode($a_parent_id)
Get childs of node.
getDomNodeIdForNodeId($node_id)
Get DOM node id for node id.return
getNodeIconAlt($a_node)
Get node icon alt attribute.
getNodeIdForDomNodeId($a_dom_node_id)
Get node id for dom node id.return
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$type