ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilSkillTemplateTreeExplorerGUI.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
28 public function __construct($a_parent_obj, $a_parent_cmd)
29 {
30 global $DIC;
31
32 $this->lng = $DIC->language();
33 $this->ctrl = $DIC->ctrl();
34 $tree = new ilSkillTree();
35 parent::__construct("skill_exp", $a_parent_obj, $a_parent_cmd, $tree);
36
37 $this->setTypeWhiteList(array("skrt", "sktp", "sctp"));
38
39 $this->setSkipRootNode(false);
40 $this->setAjax(true);
41 $this->setOrderField("order_nr");
42 }
43
49 public function getRootNode()
50 {
51 $path = $this->getTree()->getPathId($_GET["obj_id"]);
52 return $this->getTree()->getNodeData($path[1]);
53 }
54
55
62 public function getChildsOfNode($a_parent_id)
63 {
64 $childs = parent::getChildsOfNode($a_parent_id);
65
66 foreach ($childs as $c) {
67 $this->parent[$c["child"]] = $c["parent"];
68 if ($this->draft[$c["parent"]]) {
69 $this->draft[$c["child"]] = true;
70 } else {
71 $this->draft[$c["child"]] = (ilSkillTreeNode::_lookupStatus($c["child"]) == ilSkillTreeNode::STATUS_DRAFT);
72 }
73 }
74 return $childs;
75 }
76
83 public function getNodeContent($a_node)
84 {
86
87 // title
88 $title = $a_node["title"];
89
90 // root?
91 if ($a_node["type"] == "skrt") {
92 $title = $lng->txt("skmg_skill_templates");
93 } else {
94 if ($a_node["type"] == "sktr") {
95 $tid = ilSkillTemplateReference::_lookupTemplateId($a_node["child"]);
96 $title .= " (" . ilSkillTreeNode::_lookupTitle($tid) . ")";
97 }
98 if (ilSkillTreeNode::_lookupSelfEvaluation($a_node["child"])) {
99 $title = "<u>" . $title . "</u>";
100 }
101 }
102
103 return $title;
104 }
105
112 public function getNodeIcon($a_node)
113 {
114 // root?
115 if ($a_node["type"] == "skrt") {
116 $icon = ilUtil::getImagePath("icon_sctp.svg");
117 } else {
118 if (in_array($a_node["type"], array("skll", "scat", "sctr", "sktr"))) {
120 $a_node["child"],
121 $a_node["type"],
122 "",
123 $this->draft[$a_node["child"]]
124 );
125 } else {
126 $icon = ilUtil::getImagePath("icon_" . $a_node["type"] . ".svg");
127 }
128 }
129
130 return $icon;
131 }
132
139 public function isNodeHighlighted($a_node)
140 {
141 if ($a_node["child"] == $_GET["obj_id"] ||
142 ($_GET["obj_id"] == "" && $a_node["type"] == "skrt")) {
143 return true;
144 }
145 return false;
146 }
147
154 public function getNodeHref($a_node)
155 {
156 $ilCtrl = $this->ctrl;
157
158 switch ($a_node["type"]) {
159 // root
160 case "skrt":
161 $ilCtrl->setParameterByClass("ilskillrootgui", "obj_id", $a_node["child"]);
162 $ret = $ilCtrl->getLinkTargetByClass(["ilAdministrationGUI", "ilObjSkillManagementGUI","ilskillrootgui"], "listTemplates");
163 $ilCtrl->setParameterByClass("ilskillrootgui", "obj_id", $_GET["obj_id"]);
164 return $ret;
165 break;
166
167 // template
168 case "sktp":
169 $ilCtrl->setParameterByClass("ilbasicskilltemplategui", "obj_id", $a_node["child"]);
170 $ret = $ilCtrl->getLinkTargetByClass(["ilAdministrationGUI", "ilObjSkillManagementGUI","ilbasicskilltemplategui"], "edit");
171 $ilCtrl->setParameterByClass("ilbasicskilltemplategui", "obj_id", $_GET["obj_id"]);
172 return $ret;
173 break;
174
175 // template category
176 case "sctp":
177 $ilCtrl->setParameterByClass("ilskilltemplatecategorygui", "obj_id", $a_node["child"]);
178 $ret = $ilCtrl->getLinkTargetByClass(["ilAdministrationGUI", "ilObjSkillManagementGUI","ilskilltemplatecategorygui"], "listItems");
179 $ilCtrl->setParameterByClass("ilskilltemplatecategorygui", "obj_id", $_GET["obj_id"]);
180 return $ret;
181 break;
182
183 }
184 }
185
192 public function getNodeIconAlt($a_node)
193 {
195
196 if ($lng->exists("skmg_" . $a_node["type"])) {
197 return $lng->txt("skmg_" . $a_node["type"]);
198 }
199
200 return $lng->txt($a_node["type"]);
201 }
202
203}
$_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.
getNodeIconAlt($a_node)
Get node icon alt attribute.
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)
$c
Definition: cli.php:37
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ret
Definition: parser.php:6