ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
48 include_once("./Services/Skill/classes/class.ilSkillTree.php");
49 $this->tree = new ilSkillTree();
50 $this->root_id = $this->tree->readRootId();
51
52 parent::__construct("pskill_sel", $a_parent_obj, $a_parent_cmd, $this->tree);
53 $this->setSkipRootNode(true);
54
55 $this->all_nodes = $this->tree->getSubTree($this->tree->getNodeData($this->root_id));
56 foreach ($this->all_nodes as $n) {
57 $this->node[$n["child"]] = $n;
58 $this->child_nodes[$n["parent"]][] = $n;
59 $this->parent[$n["child"]] = $n["parent"];
60 //echo "-$k-"; var_dump($n);
61 }
62
63
64 // $this->setTypeWhiteList(array("skrt", "skll", "scat", "sktr"));
65 $this->buildSelectableTree($this->tree->readRootId());
66 }
67
73 protected function setHasSelectableNodes($a_val)
74 {
75 $this->has_selectable_nodes = $a_val;
76 }
77
83 public function getHasSelectableNodes()
84 {
86 }
87
93 public function buildSelectableTree($a_node_id)
94 {
95 //echo "<br>-$a_node_id-";
97 return;
98 }
99
101 $this->selectable[$a_node_id] = true;
102 $cid = $a_node_id;
103 //$this->selectable[$this->parent[$a_node_id]] = true;
104 while (isset($this->parent[$cid])) {
105 $this->selectable[$this->parent[$cid]] = true;
106 $cid = $this->parent[$cid];
107 }
108 }
109 foreach ($this->getOriginalChildsOfNode($a_node_id) as $n) {
110 //echo "+".$n["child"]."+";
111 $this->buildSelectableTree($n["child"]);
112 }
113 if ($this->selectable[$a_node_id]) {
114 $this->setHasSelectableNodes(true);
115 $this->selectable_child_nodes[$this->node[$a_node_id]["parent"]][] =
116 $this->node[$a_node_id];
117 }
118 }
119
126 public function getChildsOfNode($a_parent_id)
127 {
128 if (is_array($this->selectable_child_nodes[$a_parent_id])) {
129 $childs = $this->selectable_child_nodes[$a_parent_id];
130 $childs = ilUtil::sortArray($childs, "order_nr", "asc", true);
131 return $childs;
132 }
133 return array();
134 }
135
142 public function getOriginalChildsOfNode($a_parent_id)
143 {
144 if (is_array($this->child_nodes[$a_parent_id])) {
145 return $this->child_nodes[$a_parent_id];
146 }
147 return array();
148 }
149
156 public function getNodeHref($a_node)
157 {
159
160 $skill_id = $a_node["child"];
161
162 $ilCtrl->setParameterByClass($this->select_gui, $this->select_par, $skill_id);
163 $ret = $ilCtrl->getLinkTargetByClass($this->select_gui, $this->select_cmd);
164 $ilCtrl->setParameterByClass($this->select_gui, $this->select_par, "");
165
166 return $ret;
167 }
168
175 public function getNodeContent($a_node)
176 {
178
179 // title
180 $title = $a_node["title"];
181
182 return $title;
183 }
184
191 public function isNodeClickable($a_node)
192 {
193 if (!ilSkillTreeNode::_lookupSelfEvaluation($a_node["child"])) {
194 return false;
195 }
196 return true;
197 }
198
202 public function getNodeIcon($a_node)
203 {
204 $t = $a_node["type"];
205 if (in_array($t, array("sktr"))) {
206 return ilUtil::getImagePath("icon_skll.svg");
207 }
208 return ilUtil::getImagePath("icon_" . $t . ".svg");
209 }
210}
$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.
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