ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilPersonalSkillExplorerGUI.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 $ctrl;
16
20 protected $lng;
21
22 protected $selectable = array();
23 protected $selectable_child_nodes = array();
24 protected $has_selectable_nodes = false;
25
29 public function __construct($a_parent_obj, $a_parent_cmd, $a_select_gui, $a_select_cmd, $a_select_par = "obj_id")
30 {
31 global $DIC;
32
33 $this->ctrl = $DIC->ctrl();
34 $this->lng = $DIC->language();
35
36 $this->select_gui = (is_object($a_select_gui))
37 ? strtolower(get_class($a_select_gui))
38 : $a_select_gui;
39 $this->select_cmd = $a_select_cmd;
40 $this->select_par = $a_select_par;
41
42
43 $this->lng->loadLanguageModule("skmg");
44
45 $this->tree = new ilSkillTree();
46 $this->root_id = $this->tree->readRootId();
47
48 parent::__construct("pskill_sel", $a_parent_obj, $a_parent_cmd, $this->tree);
49 $this->setSkipRootNode(true);
50
51 $this->all_nodes = $this->tree->getSubTree($this->tree->getNodeData($this->root_id));
52 foreach ($this->all_nodes as $n) {
53 $this->node[$n["child"]] = $n;
54 $this->child_nodes[$n["parent"]][] = $n;
55 $this->parent[$n["child"]] = $n["parent"];
56 //echo "-$k-"; var_dump($n);
57 }
58
59
60 // $this->setTypeWhiteList(array("skrt", "skll", "scat", "sktr"));
61 $this->buildSelectableTree($this->tree->readRootId());
62 }
63
69 protected function setHasSelectableNodes($a_val)
70 {
71 $this->has_selectable_nodes = $a_val;
72 }
73
79 public function getHasSelectableNodes()
80 {
82 }
83
89 public function buildSelectableTree($a_node_id)
90 {
91 //echo "<br>-$a_node_id-";
93 return;
94 }
95
97 $this->selectable[$a_node_id] = true;
98 $cid = $a_node_id;
99 //$this->selectable[$this->parent[$a_node_id]] = true;
100 while (isset($this->parent[$cid])) {
101 $this->selectable[$this->parent[$cid]] = true;
102 $cid = $this->parent[$cid];
103 }
104 }
105 foreach ($this->getOriginalChildsOfNode($a_node_id) as $n) {
106 //echo "+".$n["child"]."+";
107 $this->buildSelectableTree($n["child"]);
108 }
109 if ($this->selectable[$a_node_id]) {
110 $this->setHasSelectableNodes(true);
111 $this->selectable_child_nodes[$this->node[$a_node_id]["parent"]][] =
112 $this->node[$a_node_id];
113 }
114 }
115
122 public function getChildsOfNode($a_parent_id)
123 {
124 if (is_array($this->selectable_child_nodes[$a_parent_id])) {
125 $childs = $this->selectable_child_nodes[$a_parent_id];
126 $childs = ilUtil::sortArray($childs, "order_nr", "asc", true);
127 return $childs;
128 }
129 return array();
130 }
131
138 public function getOriginalChildsOfNode($a_parent_id)
139 {
140 if (is_array($this->child_nodes[$a_parent_id])) {
141 return $this->child_nodes[$a_parent_id];
142 }
143 return array();
144 }
145
152 public function getNodeHref($a_node)
153 {
154 $ilCtrl = $this->ctrl;
155
156 $skill_id = $a_node["child"];
157
158 $ilCtrl->setParameterByClass($this->select_gui, $this->select_par, $skill_id);
159 $ret = $ilCtrl->getLinkTargetByClass($this->select_gui, $this->select_cmd);
160 $ilCtrl->setParameterByClass($this->select_gui, $this->select_par, "");
161
162 return $ret;
163 }
164
171 public function getNodeContent($a_node)
172 {
174
175 // title
176 $title = $a_node["title"];
177
178 return $title;
179 }
180
187 public function isNodeClickable($a_node)
188 {
189 if (!ilSkillTreeNode::_lookupSelfEvaluation($a_node["child"])) {
190 return false;
191 }
192 return true;
193 }
194
198 public function getNodeIcon($a_node)
199 {
200 $t = $a_node["type"];
201 if (in_array($t, array("sktr"))) {
202 return ilUtil::getImagePath("icon_skll.svg");
203 }
204 return ilUtil::getImagePath("icon_" . $t . ".svg");
205 }
206
213 public function getNodeIconAlt($a_node)
214 {
216
217 if ($lng->exists("skmg_" . $a_node["type"])) {
218 return $lng->txt("skmg_" . $a_node["type"]);
219 }
220
221 return $lng->txt($a_node["type"]);
222 }
223
224}
$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 $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ret
Definition: parser.php:6