ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilSkillSelectorGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Skill/classes/class.ilVirtualSkillTreeExplorerGUI.php");
5 
15 {
19  protected $ctrl;
20 
24  public function __construct($a_parent_obj, $a_parent_cmd, $a_select_gui, $a_select_cmd, $a_select_par = "selected_skill")
25  {
26  global $DIC;
27 
28  $this->ctrl = $DIC->ctrl();
29  parent::__construct("skill_sel", $a_parent_obj, $a_parent_cmd);
30  $this->select_gui = (is_object($a_select_gui))
31  ? strtolower(get_class($a_select_gui))
32  : $a_select_gui;
33  $this->select_cmd = $a_select_cmd;
34  $this->select_par = $a_select_par;
35  $this->setSkipRootNode(true);
36  }
37 
43  public function setSkillSelected($a_id)
44  {
45  $this->setNodeSelected($this->vtree->getCSkillIdForVTreeId($a_id));
46  }
47 
51  public function getSelectedSkills()
52  {
53  $skills = array();
55  if (is_array($pa)) {
56  foreach ($pa as $p) {
57  $skills[] = $this->vtree->getCSkillIdForVTreeId($p);
58  }
59  }
60  return $skills;
61  }
62 
69  public function getNodeHref($a_node)
70  {
71  if ($this->select_multi) {
72  return "#";
73  }
74 
76 
77  // we have a tree id like <skl_tree_id>:<skl_template_tree_id>
78  // and make a "common" skill id in format <skill_id>:<tref_id>
79 
80  $id_parts = explode(":", $a_node["id"]);
81  if ($id_parts[1] == 0) {
82  // skill in main tree
83  $skill_id = $a_node["id"];
84  } else {
85  // skill in template
86  $skill_id = $id_parts[1] . ":" . $id_parts[0];
87  }
88 
89  $ilCtrl->setParameterByClass($this->select_gui, $this->select_par, $skill_id);
90  $ret = $ilCtrl->getLinkTargetByClass($this->select_gui, $this->select_cmd);
91  $ilCtrl->setParameterByClass($this->select_gui, $this->select_par, "");
92 
93  return $ret;
94  }
95 
102  public function isNodeClickable($a_node)
103  {
104  return $this->nodeHasAction($a_node);
105  }
106 
107  protected function isNodeSelectable($a_node)
108  {
109  return $this->nodeHasAction($a_node);
110  }
111 
112  private function nodeHasAction($a_node)
113  {
114  if (in_array($a_node["type"], array("skll", "sktp"))) {
115  return true;
116  }
117  // references that refer directly to a (basic) skill template
118  if ($a_node["type"] == "sktr" && ilSkillTreeNode::_lookupType($a_node["skill_id"]) == "sktp") {
119  return true;
120  }
121 
122  return false;
123  }
124 }
__construct($a_parent_obj, $a_parent_cmd, $a_select_gui, $a_select_cmd, $a_select_par="selected_skill")
Constructor.
setSkillSelected($a_id)
Set skill to be opened.
global $DIC
Definition: saml.php:7
setSkipRootNode($a_val)
Set skip root node.
getSelectedSkills()
Get selected skills (from POST)
isNodeClickable($a_node)
Is clickable.
static _lookupType($a_obj_id)
Lookup Type.
global $ilCtrl
Definition: ilias.php:18
setNodeSelected($a_id)
Set node to be opened (additional custom opened node, not standard expand behaviour) ...
Explorer class that works on tree objects (Services/Tree)
getNodeHref($a_node)
Get href for node.
$ret
Definition: parser.php:6
$_POST["username"]