ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilPersonalSkillExplorerGUI.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");
5include_once("./Services/Skill/classes/class.ilSkillTreeNode.php");
6
16{
20 protected $ctrl;
21
25 protected $lng;
26
27 protected $selectable = array();
28 protected $selectable_child_nodes = array();
29 protected $has_selectable_nodes = false;
30
34 public function __construct($a_parent_obj, $a_parent_cmd, $a_select_gui, $a_select_cmd, $a_select_par = "obj_id")
35 {
36 global $DIC;
37
38 $this->ctrl = $DIC->ctrl();
39 $this->lng = $DIC->language();
40
41 $this->select_gui = (is_object($a_select_gui))
42 ? strtolower(get_class($a_select_gui))
43 : $a_select_gui;
44 $this->select_cmd = $a_select_cmd;
45 $this->select_par = $a_select_par;
46
47 $this->lng->loadLanguageModule("skmg");
48
49 include_once("./Services/Skill/classes/class.ilSkillTree.php");
50 $this->tree = new ilSkillTree();
51 $this->root_id = $this->tree->readRootId();
52
53 parent::__construct("pskill_sel", $a_parent_obj, $a_parent_cmd, $this->tree);
54 $this->setSkipRootNode(true);
55
56 $this->all_nodes = $this->tree->getSubTree($this->tree->getNodeData($this->root_id));
57 foreach ($this->all_nodes as $n) {
58 $this->node[$n["child"]] = $n;
59 $this->child_nodes[$n["parent"]][] = $n;
60 $this->parent[$n["child"]] = $n["parent"];
61 //echo "-$k-"; var_dump($n);
62 }
63
64
65 // $this->setTypeWhiteList(array("skrt", "skll", "scat", "sktr"));
66 $this->buildSelectableTree($this->tree->readRootId());
67 }
68
74 protected function setHasSelectableNodes($a_val)
75 {
76 $this->has_selectable_nodes = $a_val;
77 }
78
84 public function getHasSelectableNodes()
85 {
87 }
88
94 public function buildSelectableTree($a_node_id)
95 {
96 //echo "<br>-$a_node_id-";
98 return;
99 }
100
102 $this->selectable[$a_node_id] = true;
103 $cid = $a_node_id;
104 //$this->selectable[$this->parent[$a_node_id]] = true;
105 while (isset($this->parent[$cid])) {
106 $this->selectable[$this->parent[$cid]] = true;
107 $cid = $this->parent[$cid];
108 }
109 }
110 foreach ($this->getOriginalChildsOfNode($a_node_id) as $n) {
111 //echo "+".$n["child"]."+";
112 $this->buildSelectableTree($n["child"]);
113 }
114 if ($this->selectable[$a_node_id]) {
115 $this->setHasSelectableNodes(true);
116 $this->selectable_child_nodes[$this->node[$a_node_id]["parent"]][] =
117 $this->node[$a_node_id];
118 }
119 }
120
127 public function getChildsOfNode($a_parent_id)
128 {
129 if (is_array($this->selectable_child_nodes[$a_parent_id])) {
130 $childs = $this->selectable_child_nodes[$a_parent_id];
131 $childs = ilUtil::sortArray($childs, "order_nr", "asc", true);
132 return $childs;
133 }
134 return array();
135 }
136
143 public function getOriginalChildsOfNode($a_parent_id)
144 {
145 if (is_array($this->child_nodes[$a_parent_id])) {
146 return $this->child_nodes[$a_parent_id];
147 }
148 return array();
149 }
150
157 public function getNodeHref($a_node)
158 {
160
161 $skill_id = $a_node["child"];
162
163 $ilCtrl->setParameterByClass($this->select_gui, $this->select_par, $skill_id);
164 $ret = $ilCtrl->getLinkTargetByClass($this->select_gui, $this->select_cmd);
165 $ilCtrl->setParameterByClass($this->select_gui, $this->select_par, "");
166
167 return $ret;
168 }
169
176 public function getNodeContent($a_node)
177 {
179
180 // title
181 $title = $a_node["title"];
182
183 return $title;
184 }
185
192 public function isNodeClickable($a_node)
193 {
194 if (!ilSkillTreeNode::_lookupSelfEvaluation($a_node["child"])) {
195 return false;
196 }
197 return true;
198 }
199
203 public function getNodeIcon($a_node)
204 {
205 $t = $a_node["type"];
206 if (in_array($t, array("sktr"))) {
207 return ilUtil::getImagePath("icon_skll.svg");
208 }
209 return ilUtil::getImagePath("icon_" . $t . ".svg");
210 }
211
218 public function getNodeIconAlt($a_node)
219 {
221
222 if ($lng->exists("skmg_" . $a_node["type"])) {
223 return $lng->txt("skmg_" . $a_node["type"]);
224 }
225
226 return $lng->txt($a_node["type"]);
227 }
228
229}
$n
Definition: RandomTest.php:85
An exception for terminatinating execution or to throw for unit testing.
setSkipRootNode($a_val)
Set skip root node.
Explorer for selecting a personal skill.
getNodeIconAlt($a_node)
Get node icon alt attribute.
getNodeIcon($a_node)
get image path (may be overwritten by derived classes)
getHasSelectableNodes()
Get selectable nodes exist?
getOriginalChildsOfNode($a_parent_id)
Get original childs of node (whole tree)
getChildsOfNode($a_parent_id)
Get childs of node (selectable tree)
__construct($a_parent_obj, $a_parent_cmd, $a_select_gui, $a_select_cmd, $a_select_par="obj_id")
Constructor.
setHasSelectableNodes($a_val)
Set selectable nodes exist?
buildSelectableTree($a_node_id)
Build selectable tree.
static _lookupStatus($a_obj_id)
Lookup Status.
static _lookupSelfEvaluation($a_obj_id)
Lookup self evaluation.
Explorer class that works on tree objects (Services/Tree)
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
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