ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilSkillTreeExplorerGUI.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/Skill/classes/class.ilVirtualSkillTreeExplorerGUI.php");
5
15{
19 protected $lng;
20
24 protected $ctrl;
25
29 public function __construct($a_parent_obj, $a_parent_cmd)
30 {
31 global $DIC;
32
33 $this->lng = $DIC->language();
34 $this->ctrl = $DIC->ctrl();
35 parent::__construct("skill_exp", $a_parent_obj, $a_parent_cmd);
36
37 // node should be hidden #26849 (not not hidden, see discussion in #26813 and JF 6 Jan 2020)
38 $this->setSkipRootNode(false);
39 $this->setAjax(false);
40 $this->setShowDraftNodes(true);
41 $this->setShowOutdatedNodes(true);
42 }
43
44
51 public function getNodeContent($a_node)
52 {
54
55 $a_parent_id_parts = explode(":", $a_node["id"]);
56 $a_parent_skl_tree_id = $a_parent_id_parts[0];
57 $a_parent_skl_template_tree_id = $a_parent_id_parts[1];
58
59 // title
60 $title = $a_node["title"];
61
62 // root?
63 if ($a_node["type"] == "skrt") {
64 $title = $lng->txt("skmg_skills");
65 } else {
66 if ($a_node["type"] == "sktr") {
67 include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
68 $tid = ilSkillTemplateReference::_lookupTemplateId($a_parent_skl_tree_id);
69 $title .= " (" . ilSkillTreeNode::_lookupTitle($tid) . ")";
70 }
71
72 // @todo: fix this if possible for skill/tref_id combination
73 if (ilSkillTreeNode::_lookupSelfEvaluation($a_parent_skl_tree_id)) {
74 if ($a_parent_skl_template_tree_id == 0 || $a_node["type"] == "sktr") {
75 $title = "<u>" . $title . "</u>";
76 }
77 }
78 }
79
80 if ($this->vtree->isOutdated($a_node["id"])) {
81 $title = "<span class='light'>" . $title . "</span>";
82 }
83
84 return $title;
85 }
86
93 public function getNodeIcon($a_node)
94 {
95 $a_parent_id_parts = explode(":", $a_node["id"]);
96 $a_parent_skl_tree_id = $a_parent_id_parts[0];
97 $a_parent_skl_template_tree_id = $a_parent_id_parts[1];
98
99
100 // root?
101 if ($a_node["type"] == "skrt") {
102 $icon = ilUtil::getImagePath("icon_scat.svg");
103 } else {
104 if (in_array($a_node["type"], array("skll", "scat", "sctr", "sktr", "sctp", "sktp"))) {
106 $a_parent_skl_tree_id,
107 $a_node["type"],
108 "",
109 ($this->vtree->isDraft($a_node["id"]) || $this->vtree->isOutdated($a_node["id"]))
110 );
111 } else {
112 $icon = ilUtil::getImagePath("icon_" . $a_node["type"] . ".svg");
113 }
114 }
115
116 return $icon;
117 }
118
125 public function isNodeHighlighted($a_node)
126 {
127 $id_parts = explode(":", $a_node["id"]);
128 if ($id_parts[1] == 0) {
129 // skill in main tree
130 $skill_id = $a_node["id"];
131 $tref_id = 0;
132 } else {
133 // skill in template
134 $tref_id = $id_parts[0];
135 $skill_id = $id_parts[1];
136 }
137
138 if ($_GET["obj_id"] == "" && $a_node["type"] == "skrt") {
139 return true;
140 }
141
142 if ($skill_id == $_GET["obj_id"] &&
143 ($_GET["tref_id"] == $tref_id)) {
144 return true;
145 }
146 return false;
147 }
148
155 public function getNodeHref($a_node)
156 {
158
159 $id_parts = explode(":", $a_node["id"]);
160 if ($id_parts[1] == 0) {
161 // skill in main tree
162 $skill_id = $a_node["id"];
163 $tref_id = 0;
164 } else {
165 // skill in template
166 $tref_id = $id_parts[0];
167 $skill_id = $id_parts[1];
168 }
169
170 $gui_class = array(
171 "skrt" => "ilskillrootgui",
172 "scat" => "ilskillcategorygui",
173 "sktr" => "ilskilltemplatereferencegui",
174 "skll" => "ilbasicskillgui",
175 "sktp" => "ilbasicskilltemplategui",
176 "sctp" => "ilskilltemplatecategorygui"
177 );
178
179 $cmd = array(
180 "skrt" => "listSkills",
181 "scat" => "listItems",
182 "sktr" => "listItems",
183 "skll" => "edit",
184 "sktp" => "edit",
185 "sctp" => "listItems"
186 );
187
188 $gui_class = $gui_class[$a_node["type"]];
189 $cmd = $cmd[$a_node["type"]];
190
191 $ilCtrl->setParameterByClass($gui_class, "tref_id", $tref_id);
192 $ilCtrl->setParameterByClass($gui_class, "obj_id", $skill_id);
193 $ret = $ilCtrl->getLinkTargetByClass(["ilAdministrationGUI", "ilObjSkillManagementGUI", $gui_class], $cmd);
194 $ilCtrl->setParameterByClass($gui_class, "obj_id", $_GET["obj_id"]);
195 $ilCtrl->setParameterByClass($gui_class, "tref_id", $_GET["tref_id"]);
196
197 return $ret;
198 }
199
206 public function isNodeClickable($a_node)
207 {
208 return true;
209 }
210}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
setSkipRootNode($a_val)
Set skip root node.
static _lookupTemplateId($a_obj_id)
Lookup template ID.
Explorer class that works on tree objects (Services/Tree)
__construct($a_parent_obj, $a_parent_cmd)
Constructor.
getNodeIcon($a_node)
Get node content.
getNodeContent($a_node)
Get node content.
getNodeHref($a_node)
Get href for node.
isNodeHighlighted($a_node)
Is node highlighted?
static getIconPath($a_obj_id, $a_type, $a_size="", $a_status=0)
Get icon path.
static _lookupSelfEvaluation($a_obj_id)
Lookup self evaluation.
static _lookupTitle($a_obj_id, $a_tref_id=0)
Lookup Title.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
setShowOutdatedNodes($a_val)
Set show outdated nodes.
global $ilCtrl
Definition: ilias.php:18
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ret
Definition: parser.php:6
$DIC
Definition: xapitoken.php:46