ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 
4 include_once("./Services/Skill/classes/class.ilVirtualSkillTreeExplorerGUI.php");
5 
15 {
19  protected $lng;
20 
24  protected $ctrl;
25 
29  public function __construct($a_parent_obj, $a_parent_cmd)
30  {
31  global $DIC;
32 
33  $this->lng = $DIC->language();
34  $this->ctrl = $DIC->ctrl();
35  parent::__construct("skill_exp", $a_parent_obj, $a_parent_cmd);
36 
37  $this->setSkipRootNode(false);
38  $this->setAjax(false);
39  $this->setShowDraftNodes(true);
40  $this->setShowOutdatedNodes(true);
41  }
42 
43 
50  public function getNodeContent($a_node)
51  {
52  $lng = $this->lng;
53 
54  $a_parent_id_parts = explode(":", $a_node["id"]);
55  $a_parent_skl_tree_id = $a_parent_id_parts[0];
56  $a_parent_skl_template_tree_id = $a_parent_id_parts[1];
57 
58  // title
59  $title = $a_node["title"];
60 
61  // root?
62  if ($a_node["type"] == "skrt") {
63  $title = $lng->txt("skmg_skills");
64  } else {
65  if ($a_node["type"] == "sktr") {
66  include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
67  $tid = ilSkillTemplateReference::_lookupTemplateId($a_parent_skl_tree_id);
68  $title.= " (" . ilSkillTreeNode::_lookupTitle($tid) . ")";
69  }
70 
71  // @todo: fix this if possible for skill/tref_id combination
72  if (ilSkillTreeNode::_lookupSelfEvaluation($a_parent_skl_tree_id)) {
73  if ($a_parent_skl_template_tree_id == 0 || $a_node["type"] == "sktr") {
74  $title = "<u>" . $title . "</u>";
75  }
76  }
77  }
78 
79  if ($this->vtree->isOutdated($a_node["id"])) {
80  $title = "<span class='light'>" . $title . "</span>";
81  }
82 
83  return $title;
84  }
85 
92  public function getNodeIcon($a_node)
93  {
94  $a_parent_id_parts = explode(":", $a_node["id"]);
95  $a_parent_skl_tree_id = $a_parent_id_parts[0];
96  $a_parent_skl_template_tree_id = $a_parent_id_parts[1];
97 
98 
99  // root?
100  if ($a_node["type"] == "skrt") {
101  $icon = ilUtil::getImagePath("icon_scat.svg");
102  } else {
103  if (in_array($a_node["type"], array("skll", "scat", "sctr", "sktr", "sctp", "sktp"))) {
105  $a_parent_skl_tree_id,
106  $a_node["type"],
107  "",
108  ($this->vtree->isDraft($a_node["id"]) || $this->vtree->isOutdated($a_node["id"]))
109  );
110  } else {
111  $icon = ilUtil::getImagePath("icon_" . $a_node["type"] . ".svg");
112  }
113  }
114 
115  return $icon;
116  }
117 
124  public function isNodeHighlighted($a_node)
125  {
126  $id_parts = explode(":", $a_node["id"]);
127  if ($id_parts[1] == 0) {
128  // skill in main tree
129  $skill_id = $a_node["id"];
130  $tref_id = 0;
131  } else {
132  // skill in template
133  $tref_id = $id_parts[0];
134  $skill_id = $id_parts[1];
135  }
136 
137  if ($_GET["obj_id"] == "" && $a_node["type"] == "skrt") {
138  return true;
139  }
140 
141  if ($skill_id == $_GET["obj_id"] &&
142  ($_GET["tref_id"] == $tref_id)) {
143  return true;
144  }
145  return false;
146  }
147 
154  public function getNodeHref($a_node)
155  {
157 
158  $id_parts = explode(":", $a_node["id"]);
159  if ($id_parts[1] == 0) {
160  // skill in main tree
161  $skill_id = $a_node["id"];
162  $tref_id = 0;
163  } else {
164  // skill in template
165  $tref_id = $id_parts[0];
166  $skill_id = $id_parts[1];
167  }
168 
169  $gui_class = array(
170  "skrt" => "ilskillrootgui",
171  "scat" => "ilskillcategorygui",
172  "sktr" => "ilskilltemplatereferencegui",
173  "skll" => "ilbasicskillgui",
174  "sktp" => "ilbasicskilltemplategui",
175  "sctp" => "ilskilltemplatecategorygui"
176  );
177 
178  $cmd = array(
179  "skrt" => "listSkills",
180  "scat" => "listItems",
181  "sktr" => "listItems",
182  "skll" => "edit",
183  "sktp" => "edit",
184  "sctp" => "listItems"
185  );
186 
187  $gui_class = $gui_class[$a_node["type"]];
188  $cmd = $cmd[$a_node["type"]];
189 
190  $ilCtrl->setParameterByClass($gui_class, "tref_id", $tref_id);
191  $ilCtrl->setParameterByClass($gui_class, "obj_id", $skill_id);
192  $ret = $ilCtrl->getLinkTargetByClass($gui_class, $cmd);
193  $ilCtrl->setParameterByClass($gui_class, "obj_id", $_GET["obj_id"]);
194  $ilCtrl->setParameterByClass($gui_class, "tref_id", $_GET["tref_id"]);
195 
196  return $ret;
197  }
198 
205  public function isNodeClickable($a_node)
206  {
207  return true;
208  }
209 }
global $DIC
Definition: saml.php:7
$_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.
global $ilCtrl
Definition: ilias.php:18
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)
static _lookupTemplateId($a_obj_id)
Lookup template ID.
Create styles array
The data for the language used.
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.
$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.