ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilSkillSelectorGUI.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 public function __construct($a_parent_obj, $a_parent_cmd, $a_select_gui, $a_select_cmd, $a_select_par = "selected_skill")
21 {
22 global $DIC;
23
24 $this->ctrl = $DIC->ctrl();
25 parent::__construct("skill_sel", $a_parent_obj, $a_parent_cmd);
26 $this->select_gui = (is_object($a_select_gui))
27 ? strtolower(get_class($a_select_gui))
28 : $a_select_gui;
29 $this->select_cmd = $a_select_cmd;
30 $this->select_par = $a_select_par;
31 $this->setSkipRootNode(true);
32 }
33
39 public function setSkillSelected($a_id)
40 {
41 $this->setNodeSelected($this->vtree->getCSkillIdForVTreeId($a_id));
42 }
43
47 public function getSelectedSkills()
48 {
49 $skills = array();
51 if (is_array($pa)) {
52 foreach ($pa as $p) {
53 $skills[] = $this->vtree->getCSkillIdForVTreeId($p);
54 }
55 }
56 return $skills;
57 }
58
65 public function getNodeHref($a_node)
66 {
67 if ($this->select_multi) {
68 return "#";
69 }
70
71 $ilCtrl = $this->ctrl;
72
73 // we have a tree id like <skl_tree_id>:<skl_template_tree_id>
74 // and make a "common" skill id in format <skill_id>:<tref_id>
75
76 $id_parts = explode(":", $a_node["id"]);
77 if ($id_parts[1] == 0) {
78 // skill in main tree
79 $skill_id = $a_node["id"];
80 } else {
81 // skill in template
82 $skill_id = $id_parts[1] . ":" . $id_parts[0];
83 }
84
85 $ilCtrl->setParameterByClass($this->select_gui, $this->select_par, $skill_id);
86 $ret = $ilCtrl->getLinkTargetByClass($this->select_gui, $this->select_cmd);
87 $ilCtrl->setParameterByClass($this->select_gui, $this->select_par, "");
88
89 return $ret;
90 }
91
98 public function isNodeClickable($a_node)
99 {
100 return $this->nodeHasAction($a_node);
101 }
102
103 protected function isNodeSelectable($a_node)
104 {
105 return $this->nodeHasAction($a_node);
106 }
107
108 private function nodeHasAction($a_node)
109 {
110 if (in_array($a_node["type"], array("skll", "sktp"))) {
111 return true;
112 }
113 // references that refer directly to a (basic) skill template
114 if ($a_node["type"] == "sktr" && ilSkillTreeNode::_lookupType($a_node["skill_id"]) == "sktp") {
115 return true;
116 }
117
118 return false;
119 }
120}
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
setNodeSelected($a_id)
Set node to be opened (additional custom opened node, not standard expand behaviour)
setSkipRootNode($a_val)
Set skip root node.
Explorer class that works on tree objects (Services/Tree)
isNodeSelectable($a_node)
Is node selectable?
getSelectedSkills()
Get selected skills (from POST)
setSkillSelected($a_id)
Set skill to be opened.
__construct($a_parent_obj, $a_parent_cmd, $a_select_gui, $a_select_cmd, $a_select_par="selected_skill")
Constructor.
getNodeHref($a_node)
Get href for node.
isNodeClickable($a_node)
Is clickable.
static _lookupType($a_obj_id)
Lookup Type.
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ret
Definition: parser.php:6