ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilSkillTemplateTreeExplorerGUI.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/UIComponent/Explorer2/classes/class.ilTreeExplorerGUI.php");
5
15{
22 public function __construct($a_parent_obj, $a_parent_cmd)
23 {
24 include_once("./Services/Skill/classes/class.ilSkillTree.php");
25 $tree = new ilSkillTree();
26 parent::__construct("skill_exp", $a_parent_obj, $a_parent_cmd, $tree);
27
28 $this->setTypeWhiteList(array("skrt", "sktp", "sctp"));
29
30 $this->setSkipRootNode(false);
31 $this->setAjax(true);
32 $this->setOrderField("order_nr");
33 }
34
40 function getRootNode()
41 {
42 $path = $this->getTree()->getPathId($_GET["obj_id"]);
43 return $this->getTree()->getNodeData($path[1]);
44 }
45
46
53 function getChildsOfNode($a_parent_id)
54 {
55 $childs = parent::getChildsOfNode($a_parent_id);
56
57 include_once("./Services/Skill/classes/class.ilSkillTreeNode.php");
58 foreach ($childs as $c)
59 {
60 $this->parent[$c["child"]] = $c["parent"];
61 if ($this->draft[$c["parent"]])
62 {
63 $this->draft[$c["child"]] = true;
64 }
65 else
66 {
67 $this->draft[$c["child"]] = (ilSkillTreeNode::_lookupStatus($c["child"]) == ilSkillTreeNode::STATUS_DRAFT);
68 }
69 }
70 return $childs;
71 }
72
79 function getNodeContent($a_node)
80 {
81 global $lng;
82
83 // title
84 $title = $a_node["title"];
85
86 // root?
87 if ($a_node["type"] == "skrt")
88 {
89 $title = $lng->txt("skmg_skill_templates");
90 }
91 else
92 {
93 if ($a_node["type"] == "sktr")
94 {
95 include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
96 $tid = ilSkillTemplateReference::_lookupTemplateId($a_node["child"]);
97 $title.= " (".ilSkillTreeNode::_lookupTitle($tid).")";
98 }
99 if (ilSkillTreeNode::_lookupSelfEvaluation($a_node["child"]))
100 {
101 $title = "<u>".$title."</u>";
102 }
103 }
104
105 return $title;
106 }
107
114 function getNodeIcon($a_node)
115 {
116 // root?
117 if ($a_node["type"] == "skrt")
118 {
119 $icon = ilUtil::getImagePath("icon_sctp.svg");
120 }
121 else
122 {
123 if (in_array($a_node["type"], array("skll", "scat", "sctr", "sktr")))
124 {
125 $icon = ilSkillTreeNode::getIconPath($a_node["child"], $a_node["type"], "",
126 $this->draft[$a_node["child"]]);
127 }
128 else
129 {
130 $icon = ilUtil::getImagePath("icon_".$a_node["type"].".svg");
131 }
132 }
133
134 return $icon;
135 }
136
143 function isNodeHighlighted($a_node)
144 {
145 if ($a_node["child"] == $_GET["obj_id"] ||
146 ($_GET["obj_id"] == "" && $a_node["type"] == "skrt"))
147 {
148 return true;
149 }
150 return false;
151 }
152
159 function getNodeHref($a_node)
160 {
161 global $ilCtrl;
162
163 switch($a_node["type"])
164 {
165 // root
166 case "skrt":
167 $ilCtrl->setParameterByClass("ilskillrootgui", "obj_id", $a_node["child"]);
168 $ret = $ilCtrl->getLinkTargetByClass("ilskillrootgui", "listTemplates");
169 $ilCtrl->setParameterByClass("ilskillrootgui", "obj_id", $_GET["obj_id"]);
170 return $ret;
171 break;
172
173 // template
174 case "sktp":
175 $ilCtrl->setParameterByClass("ilbasicskilltemplategui", "obj_id", $a_node["child"]);
176 $ret = $ilCtrl->getLinkTargetByClass("ilbasicskilltemplategui", "edit");
177 $ilCtrl->setParameterByClass("ilbasicskilltemplategui", "obj_id", $_GET["obj_id"]);
178 return $ret;
179 break;
180
181 // template category
182 case "sctp":
183 $ilCtrl->setParameterByClass("ilskilltemplatecategorygui", "obj_id", $a_node["child"]);
184 $ret = $ilCtrl->getLinkTargetByClass("ilskilltemplatecategorygui", "listItems");
185 $ilCtrl->setParameterByClass("ilskilltemplatecategorygui", "obj_id", $_GET["obj_id"]);
186 return $ret;
187 break;
188
189 }
190 }
191
192}
193
194?>
$_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.
getChildsOfNode($a_parent_id)
Get childs of node.
static getIconPath($a_obj_id, $a_type, $a_size="", $a_status=0)
Get icon path.
static _lookupStatus($a_obj_id)
Lookup Status.
static _lookupSelfEvaluation($a_obj_id)
Lookup self evaluation.
Explorer class that works on tree objects (Services/Tree)
setTypeWhiteList($a_val)
Set type white list.
setOrderField($a_val, $a_numeric=false)
Set order field.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
$path
Definition: index.php:22