ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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{
17 protected $selectable = array();
18 protected $selectable_child_nodes = array();
19 protected $has_selectable_nodes = false;
20
24 public function __construct($a_parent_obj, $a_parent_cmd, $a_select_gui, $a_select_cmd, $a_select_par = "obj_id")
25 {
26
27 $this->select_gui = (is_object($a_select_gui))
28 ? strtolower(get_class($a_select_gui))
29 : $a_select_gui;
30 $this->select_cmd = $a_select_cmd;
31 $this->select_par = $a_select_par;
32
33
34 include_once("./Services/Skill/classes/class.ilSkillTree.php");
35 $this->tree = new ilSkillTree();
36 $this->root_id = $this->tree->readRootId();
37
38 parent::__construct("pskill_sel", $a_parent_obj, $a_parent_cmd, $this->tree);
39 $this->setSkipRootNode(true);
40
41 $this->all_nodes = $this->tree->getSubTree($this->tree->getNodeData($this->root_id));
42 foreach ($this->all_nodes as $n)
43 {
44 $this->node[$n["child"]] = $n;
45 $this->child_nodes[$n["parent"]][] = $n;
46 $this->parent[$n["child"]] = $n["parent"];
47//echo "-$k-"; var_dump($n);
48 }
49
50
51// $this->setTypeWhiteList(array("skrt", "skll", "scat", "sktr"));
52 $this->buildSelectableTree($this->tree->readRootId());
53 }
54
60 protected function setHasSelectableNodes($a_val)
61 {
62 $this->has_selectable_nodes = $a_val;
63 }
64
71 {
73 }
74
80 function buildSelectableTree($a_node_id)
81 {
82//echo "<br>-$a_node_id-";
84 {
85 return;
86 }
87
89 {
90 $this->selectable[$a_node_id] = true;
91 $cid = $a_node_id;
92 //$this->selectable[$this->parent[$a_node_id]] = true;
93 while(isset($this->parent[$cid]))
94 {
95 $this->selectable[$this->parent[$cid]] = true;
96 $cid = $this->parent[$cid];
97 }
98 }
99 foreach ($this->getOriginalChildsOfNode($a_node_id) as $n)
100 {
101//echo "+".$n["child"]."+";
102 $this->buildSelectableTree($n["child"]);
103 }
104 if ($this->selectable[$a_node_id])
105 {
106 $this->setHasSelectableNodes(true);
107 $this->selectable_child_nodes[$this->node[$a_node_id]["parent"]][] =
108 $this->node[$a_node_id];
109 }
110 }
111
118 function getChildsOfNode($a_parent_id)
119 {
120 if (is_array($this->selectable_child_nodes[$a_parent_id]))
121 {
122 $childs = $this->selectable_child_nodes[$a_parent_id];
123 $childs = ilUtil::sortArray($childs, "order_nr", "asc", true);
124 return $childs;
125 }
126 return array();
127 }
128
135 function getOriginalChildsOfNode($a_parent_id)
136 {
137 if (is_array($this->child_nodes[$a_parent_id]))
138 {
139 return $this->child_nodes[$a_parent_id];
140 }
141 return array();
142 }
143
150 function getNodeHref($a_node)
151 {
152 global $ilCtrl;
153
154 $skill_id = $a_node["child"];
155
156 $ilCtrl->setParameterByClass($this->select_gui, $this->select_par, $skill_id);
157 $ret = $ilCtrl->getLinkTargetByClass($this->select_gui, $this->select_cmd);
158 $ilCtrl->setParameterByClass($this->select_gui, $this->select_par, "");
159
160 return $ret;
161 }
162
169 function getNodeContent($a_node)
170 {
171 global $lng;
172
173 // title
174 $title = $a_node["title"];
175
176 return $title;
177 }
178
185 function isNodeClickable($a_node)
186 {
187 if (!ilSkillTreeNode::_lookupSelfEvaluation($a_node["child"]))
188 {
189 return false;
190 }
191 return true;
192 }
193
197 function getNodeIcon($a_node)
198 {
199 $t = $a_node["type"];
200 if (in_array($t, array("sktr")))
201 {
202 return ilUtil::getImagePath("icon_skll.svg");
203 }
204 return ilUtil::getImagePath("icon_".$t.".svg");
205 }
206
207}
208
209?>
$n
Definition: RandomTest.php:80
setSkipRootNode($a_val)
Set skip root node.
Explorer for selecting a personal skill.
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
global $lng
Definition: privfeed.php:40