ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 public function __construct($a_parent_obj, $a_parent_cmd)
20 {
21 parent::__construct("skill_exp", $a_parent_obj, $a_parent_cmd);
22
23 $this->setSkipRootNode(false);
24 $this->setAjax(false);
25 $this->setShowDraftNodes(true);
26 $this->setShowOutdatedNodes(true);
27 }
28
29
36 function getNodeContent($a_node)
37 {
38 global $lng;
39
40 $a_parent_id_parts = explode(":", $a_node["id"]);
41 $a_parent_skl_tree_id = $a_parent_id_parts[0];
42 $a_parent_skl_template_tree_id = $a_parent_id_parts[1];
43
44 // title
45 $title = $a_node["title"];
46
47 // root?
48 if ($a_node["type"] == "skrt")
49 {
50 $title = $lng->txt("skmg_skills");
51 }
52 else
53 {
54 if ($a_node["type"] == "sktr")
55 {
56 include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
57 $tid = ilSkillTemplateReference::_lookupTemplateId($a_parent_skl_tree_id);
58 $title.= " (".ilSkillTreeNode::_lookupTitle($tid).")";
59 }
60
61 // @todo: fix this if possible for skill/tref_id combination
62 if (ilSkillTreeNode::_lookupSelfEvaluation($a_parent_skl_tree_id))
63 {
64 if ($a_parent_skl_template_tree_id == 0 || $a_node["type"] == "sktr")
65 {
66 $title = "<u>".$title."</u>";
67 }
68 }
69 }
70
71 if ($this->vtree->isOutdated($a_node["id"]))
72 {
73 $title = "<span class='light'>".$title."</span>";
74 }
75
76 return $title;
77 }
78
85 function getNodeIcon($a_node)
86 {
87 $a_parent_id_parts = explode(":", $a_node["id"]);
88 $a_parent_skl_tree_id = $a_parent_id_parts[0];
89 $a_parent_skl_template_tree_id = $a_parent_id_parts[1];
90
91
92 // root?
93 if ($a_node["type"] == "skrt")
94 {
95 $icon = ilUtil::getImagePath("icon_scat.svg");
96 }
97 else
98 {
99 if (in_array($a_node["type"], array("skll", "scat", "sctr", "sktr", "sctp", "sktp")))
100 {
101 $icon = ilSkillTreeNode::getIconPath($a_parent_skl_tree_id, $a_node["type"], "",
102 ($this->vtree->isDraft($a_node["id"]) || $this->vtree->isOutdated($a_node["id"])));
103 }
104 else
105 {
106 $icon = ilUtil::getImagePath("icon_".$a_node["type"].".svg");
107 }
108 }
109
110 return $icon;
111 }
112
119 function isNodeHighlighted($a_node)
120 {
121 $id_parts = explode(":", $a_node["id"]);
122 if ($id_parts[1] == 0)
123 {
124 // skill in main tree
125 $skill_id = $a_node["id"];
126 $tref_id = 0;
127 }
128 else
129 {
130 // skill in template
131 $tref_id = $id_parts[0];
132 $skill_id = $id_parts[1];
133 }
134
135 if ($_GET["obj_id"] == "" && $a_node["type"] == "skrt")
136 {
137 return true;
138 }
139
140 if ($skill_id == $_GET["obj_id"] &&
141 ($_GET["tref_id"] == $tref_id))
142 {
143 return true;
144 }
145 return false;
146 }
147
154 function getNodeHref($a_node)
155 {
156 global $ilCtrl;
157
158 $id_parts = explode(":", $a_node["id"]);
159 if ($id_parts[1] == 0)
160 {
161 // skill in main tree
162 $skill_id = $a_node["id"];
163 $tref_id = 0;
164 }
165 else
166 {
167 // skill in template
168 $tref_id = $id_parts[0];
169 $skill_id = $id_parts[1];
170 }
171
172 $gui_class = array(
173 "skrt" => "ilskillrootgui",
174 "scat" => "ilskillcategorygui",
175 "sktr" => "ilskilltemplatereferencegui",
176 "skll" => "ilbasicskillgui",
177 "sktp" => "ilbasicskilltemplategui",
178 "sctp" => "ilskilltemplatecategorygui"
179 );
180
181 $cmd = array(
182 "skrt" => "listSkills",
183 "scat" => "listItems",
184 "sktr" => "listItems",
185 "skll" => "edit",
186 "sktp" => "edit",
187 "sctp" => "listItems"
188 );
189
190 $gui_class = $gui_class[$a_node["type"]];
191 $cmd = $cmd[$a_node["type"]];
192
193 $ilCtrl->setParameterByClass($gui_class, "tref_id", $tref_id);
194 $ilCtrl->setParameterByClass($gui_class, "obj_id", $skill_id);
195 $ret = $ilCtrl->getLinkTargetByClass($gui_class, $cmd);
196 $ilCtrl->setParameterByClass($gui_class, "obj_id", $_GET["obj_id"]);
197 $ilCtrl->setParameterByClass($gui_class, "tref_id", $_GET["tref_id"]);
198
199 return $ret;
200 }
201
208 function isNodeClickable($a_node)
209 {
210 return true;
211 }
212
213}
214
215?>
$_GET["client_id"]
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 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
global $lng
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35