ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilSkillTreeExplorerGUI.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 
25  public function __construct($a_parent_obj, $a_parent_cmd)
26  {
27  global $DIC;
28 
29  $this->lng = $DIC->language();
30  $this->ctrl = $DIC->ctrl();
31  parent::__construct("skill_exp", $a_parent_obj, $a_parent_cmd);
32 
33  // node should be hidden #26849 (not not hidden, see discussion in #26813 and JF 6 Jan 2020)
34  $this->setSkipRootNode(false);
35  $this->setAjax(false);
36  $this->setShowDraftNodes(true);
37  $this->setShowOutdatedNodes(true);
38  }
39 
40 
47  public function getNodeContent($a_node)
48  {
49  $lng = $this->lng;
50 
51  $a_parent_id_parts = explode(":", $a_node["id"]);
52  $a_parent_skl_tree_id = $a_parent_id_parts[0];
53  $a_parent_skl_template_tree_id = $a_parent_id_parts[1];
54 
55  // title
56  $title = $a_node["title"];
57 
58  // root?
59  if ($a_node["type"] == "skrt") {
60  $title = $lng->txt("skmg_skills");
61  } else {
62  if ($a_node["type"] == "sktr") {
63  $tid = ilSkillTemplateReference::_lookupTemplateId($a_parent_skl_tree_id);
64  $title .= " (" . ilSkillTreeNode::_lookupTitle($tid) . ")";
65  }
66 
67  // @todo: fix this if possible for skill/tref_id combination
68  if (ilSkillTreeNode::_lookupSelfEvaluation($a_parent_skl_tree_id)) {
69  if ($a_parent_skl_template_tree_id == 0 || $a_node["type"] == "sktr") {
70  $title = "<u>" . $title . "</u>";
71  }
72  }
73  }
74 
75  if ($this->vtree->isOutdated($a_node["id"])) {
76  $title = "<span class='light'>" . $title . "</span>";
77  }
78 
79  return $title;
80  }
81 
88  public function getNodeIcon($a_node)
89  {
90  $a_parent_id_parts = explode(":", $a_node["id"]);
91  $a_parent_skl_tree_id = $a_parent_id_parts[0];
92  $a_parent_skl_template_tree_id = $a_parent_id_parts[1];
93 
94 
95  // root?
96  if ($a_node["type"] == "skrt") {
97  $icon = ilUtil::getImagePath("icon_scat.svg");
98  } else {
99  if (in_array($a_node["type"], array("skll", "scat", "sctr", "sktr", "sctp", "sktp"))) {
101  $a_parent_skl_tree_id,
102  $a_node["type"],
103  "",
104  ($this->vtree->isDraft($a_node["id"]) || $this->vtree->isOutdated($a_node["id"]))
105  );
106  } else {
107  $icon = ilUtil::getImagePath("icon_" . $a_node["type"] . ".svg");
108  }
109  }
110 
111  return $icon;
112  }
113 
120  public function isNodeHighlighted($a_node)
121  {
122  $id_parts = explode(":", $a_node["id"]);
123  if ($id_parts[1] == 0) {
124  // skill in main tree
125  $skill_id = $a_node["id"];
126  $tref_id = 0;
127  } else {
128  // skill in template
129  $tref_id = $id_parts[0];
130  $skill_id = $id_parts[1];
131  }
132 
133  if ($_GET["obj_id"] == "" && $a_node["type"] == "skrt") {
134  return true;
135  }
136 
137  if ($skill_id == $_GET["obj_id"] &&
138  ($_GET["tref_id"] == $tref_id)) {
139  return true;
140  }
141  return false;
142  }
143 
150  public function getNodeHref($a_node)
151  {
152  $ilCtrl = $this->ctrl;
153 
154  $id_parts = explode(":", $a_node["id"]);
155  if ($id_parts[1] == 0) {
156  // skill in main tree
157  $skill_id = $a_node["id"];
158  $tref_id = 0;
159  } else {
160  // skill in template
161  $tref_id = $id_parts[0];
162  $skill_id = $id_parts[1];
163  }
164 
165  $gui_class = array(
166  "skrt" => "ilskillrootgui",
167  "scat" => "ilskillcategorygui",
168  "sktr" => "ilskilltemplatereferencegui",
169  "skll" => "ilbasicskillgui",
170  "sktp" => "ilbasicskilltemplategui",
171  "sctp" => "ilskilltemplatecategorygui"
172  );
173 
174  $cmd = array(
175  "skrt" => "listSkills",
176  "scat" => "listItems",
177  "sktr" => "listItems",
178  "skll" => "edit",
179  "sktp" => "edit",
180  "sctp" => "listItems"
181  );
182 
183  $gui_class = $gui_class[$a_node["type"]];
184  $cmd = $cmd[$a_node["type"]];
185 
186  $ilCtrl->setParameterByClass($gui_class, "tref_id", $tref_id);
187  $ilCtrl->setParameterByClass($gui_class, "obj_id", $skill_id);
188  $ret = $ilCtrl->getLinkTargetByClass(["ilAdministrationGUI", "ilObjSkillManagementGUI", $gui_class], $cmd);
189  $ilCtrl->setParameterByClass($gui_class, "obj_id", $_GET["obj_id"]);
190  $ilCtrl->setParameterByClass($gui_class, "tref_id", $_GET["tref_id"]);
191 
192  return $ret;
193  }
194 
201  public function isNodeClickable($a_node)
202  {
203  return true;
204  }
205 }
$_GET["client_id"]
static _lookupSelfEvaluation($a_obj_id)
Lookup self evaluation.
static getIconPath($a_obj_id, $a_type, $a_size="", $a_status=0)
Get icon path.
setSkipRootNode($a_val)
Set skip root node.
isNodeClickable($a_node)
Is clickable.
setShowOutdatedNodes($a_val)
Set show outdated nodes.
getNodeHref($a_node)
Get href for node.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $DIC
Definition: goto.php:24
static _lookupTemplateId($a_obj_id)
Lookup template ID.
isNodeHighlighted($a_node)
Is node highlighted?
static _lookupTitle($a_obj_id, $a_tref_id=0)
Lookup Title.
__construct($a_parent_obj, $a_parent_cmd)
Constructor.
__construct(Container $dic, ilPlugin $plugin)
$ret
Definition: parser.php:6
getNodeIcon($a_node)
Get node content.
Explorer class that works on tree objects (Services/Tree)
getNodeContent($a_node)
Get node content.