ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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{
19 protected $lng;
20
24 protected $ctrl;
25
32 public function __construct($a_parent_obj, $a_parent_cmd)
33 {
34 global $DIC;
35
36 $this->lng = $DIC->language();
37 $this->ctrl = $DIC->ctrl();
38 include_once("./Services/Skill/classes/class.ilSkillTree.php");
39 $tree = new ilSkillTree();
40 parent::__construct("skill_exp", $a_parent_obj, $a_parent_cmd, $tree);
41
42 $this->setTypeWhiteList(array("skrt", "sktp", "sctp"));
43
44 $this->setSkipRootNode(false);
45 $this->setAjax(true);
46 $this->setOrderField("order_nr");
47 }
48
54 public function getRootNode()
55 {
56 $path = $this->getTree()->getPathId($_GET["obj_id"]);
57 return $this->getTree()->getNodeData($path[1]);
58 }
59
60
67 public function getChildsOfNode($a_parent_id)
68 {
69 $childs = parent::getChildsOfNode($a_parent_id);
70
71 include_once("./Services/Skill/classes/class.ilSkillTreeNode.php");
72 foreach ($childs as $c) {
73 $this->parent[$c["child"]] = $c["parent"];
74 if ($this->draft[$c["parent"]]) {
75 $this->draft[$c["child"]] = true;
76 } else {
77 $this->draft[$c["child"]] = (ilSkillTreeNode::_lookupStatus($c["child"]) == ilSkillTreeNode::STATUS_DRAFT);
78 }
79 }
80 return $childs;
81 }
82
89 public function getNodeContent($a_node)
90 {
92
93 // title
94 $title = $a_node["title"];
95
96 // root?
97 if ($a_node["type"] == "skrt") {
98 $title = $lng->txt("skmg_skill_templates");
99 } else {
100 if ($a_node["type"] == "sktr") {
101 include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
102 $tid = ilSkillTemplateReference::_lookupTemplateId($a_node["child"]);
103 $title.= " (" . ilSkillTreeNode::_lookupTitle($tid) . ")";
104 }
105 if (ilSkillTreeNode::_lookupSelfEvaluation($a_node["child"])) {
106 $title = "<u>" . $title . "</u>";
107 }
108 }
109
110 return $title;
111 }
112
119 public function getNodeIcon($a_node)
120 {
121 // root?
122 if ($a_node["type"] == "skrt") {
123 $icon = ilUtil::getImagePath("icon_sctp.svg");
124 } else {
125 if (in_array($a_node["type"], array("skll", "scat", "sctr", "sktr"))) {
127 $a_node["child"],
128 $a_node["type"],
129 "",
130 $this->draft[$a_node["child"]]
131 );
132 } else {
133 $icon = ilUtil::getImagePath("icon_" . $a_node["type"] . ".svg");
134 }
135 }
136
137 return $icon;
138 }
139
146 public function isNodeHighlighted($a_node)
147 {
148 if ($a_node["child"] == $_GET["obj_id"] ||
149 ($_GET["obj_id"] == "" && $a_node["type"] == "skrt")) {
150 return true;
151 }
152 return false;
153 }
154
161 public function getNodeHref($a_node)
162 {
164
165 switch ($a_node["type"]) {
166 // root
167 case "skrt":
168 $ilCtrl->setParameterByClass("ilskillrootgui", "obj_id", $a_node["child"]);
169 $ret = $ilCtrl->getLinkTargetByClass("ilskillrootgui", "listTemplates");
170 $ilCtrl->setParameterByClass("ilskillrootgui", "obj_id", $_GET["obj_id"]);
171 return $ret;
172 break;
173
174 // template
175 case "sktp":
176 $ilCtrl->setParameterByClass("ilbasicskilltemplategui", "obj_id", $a_node["child"]);
177 $ret = $ilCtrl->getLinkTargetByClass("ilbasicskilltemplategui", "edit");
178 $ilCtrl->setParameterByClass("ilbasicskilltemplategui", "obj_id", $_GET["obj_id"]);
179 return $ret;
180 break;
181
182 // template category
183 case "sctp":
184 $ilCtrl->setParameterByClass("ilskilltemplatecategorygui", "obj_id", $a_node["child"]);
185 $ret = $ilCtrl->getLinkTargetByClass("ilskilltemplatecategorygui", "listItems");
186 $ilCtrl->setParameterByClass("ilskilltemplatecategorygui", "obj_id", $_GET["obj_id"]);
187 return $ret;
188 break;
189
190 }
191 }
192}
$_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.
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.
static _lookupTitle($a_obj_id, $a_tref_id=0)
Lookup Title.
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
$ret
Definition: parser.php:6
global $DIC
Definition: saml.php:7