ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPersonalSkillExplorer.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once("./Services/Skill/classes/class.ilSkillTreeNode.php");
6 
15 require_once("./Services/UIComponent/Explorer/classes/class.ilExplorer.php");
16 
18 {
24  var $root_id;
25  var $slm_obj;
26  var $output;
27 
34  function __construct($a_target, $a_templates = false)
35  {
36  $this->templates = $a_templates;
37 
38  parent::ilExplorer($a_target);
39 
41  $this->addFilter("skrt");
42  $this->addFilter("skll");
43  $this->addFilter("scat");
44  $this->addFilter("sktr");
45  $this->setTitleLength(999);
46 
47  include_once("./Services/Skill/classes/class.ilSkillTree.php");
48  $this->tree = new ilSkillTree();
49  $this->root_id = $this->tree->readRootId();
50 
51  $this->setSessionExpandVariable("skpexpand");
52  $this->checkPermissions(false);
53  $this->setPostSort(false);
54 
55  $this->setOrderColumn("order_nr");
56 // $this->textwidth = 200;
57 
58  $this->force_open_path = array();
59 
60  $this->all_nodes = $this->tree->getSubTree($this->tree->getNodeData($this->root_id));
61  foreach ($this->all_nodes as $n)
62  {
63  $this->node[$n["child"]] = $n;
64  $this->child_nodes[$n["parent"]][] = $n;
65  $this->parent[$n["child"]] = $n["parent"];
66 //echo "-$k-"; var_dump($n);
67  }
68 
69  $this->buildSelectableTree($this->root_id);
70  }
71 
78  function buildSelectableTree($a_node_id)
79  {
81  {
82  $this->selectable[$a_node_id] = true;
83  $this->selectable[$this->parent[$a_node_id]] = true;
84  }
85  foreach ($this->getOriginalChildsOfNode($a_node_id) as $n)
86  {
87  $this->buildSelectableTree($n["child"]);
88  }
89  if ($this->selectable[$a_node_id] &&
90  !ilSkillTreeNode::_lookupDraft($a_node_id))
91  {
92  $this->selectable_child_nodes[$this->node[$a_node_id]["parent"]][] =
93  $this->node[$a_node_id];
94  }
95  }
96 
97 
101  function setForceOpenPath($a_path)
102  {
103  $this->force_open_path = $a_path;
104  }
105 
113  function formatHeader(&$tpl, $a_obj_id,$a_option)
114  {
115  global $lng, $ilias, $ilCtrl;
116 return;
117  $ilCtrl->setParameterByClass("ilskillrootgui", "obj_id",
118  $this->tree->readRootId());
119 
120  $tpl->setCurrentBlock("icon");
121  $tpl->setVariable("ICON_IMAGE" , ilUtil::getImagePath("icon_scat_s.png"));
122  $tpl->setVariable("TXT_ALT_IMG", $lng->txt("skmg_skills"));
123  $tpl->parseCurrentBlock();
124 
125  $tpl->setCurrentBlock("link");
126  $tpl->setVariable("TITLE", $lng->txt("skmg_skills"));
127  if ($this->highlighted == $this->tree->readRootId())
128  {
129  $tpl->setVariable("A_CLASS", "class='il_HighlightedNode'");
130  }
131  $tpl->setVariable("LINK_TARGET",
132  $ilCtrl->getLinkTargetByClass("ilskillrootgui", "listSkills"));
133  $tpl->parseCurrentBlock();
134 
135  $tpl->touchBlock("element");
136 
137  $ilCtrl->setParameterByClass("ilskillrootgui", "obj_id",
138  $_GET["obj_id"]);
139 
140  }
141 
149  function formatObject(&$tpl, $a_node_id,$a_option,$a_obj_id = 0)
150  {
151  global $lng;
152 
153 /* $tpl->setCurrentBlock("icon");
154  $tpl->setVariable("ICON_IMAGE" , $this->getImage("icon_".$a_option["type"]."_s.png", $a_option["type"], $a_obj_id));
155  $tpl->setVariable("TARGET_ID" , "iconid_".$a_node_id);
156  $this->iconList[] = "iconid_".$a_node_id;
157  $tpl->setVariable("TXT_ALT_IMG", $lng->txt($a_option["desc"]));
158  $tpl->parseCurrentBlock();
159 
160  $this->outputIcons(false);*/
161  parent::formatObject($tpl, $a_node_id,$a_option,$a_obj_id);
162  }
163 
171  function isClickable($a_type, $a_obj_id = 0)
172  {
173  global $ilUser;
175  {
176  return false;
177  }
178  return true;
179  }
180 
184  function buildLinkTarget($a_node_id, $a_type)
185  {
186  global $ilCtrl;
187 
188  $ilCtrl->setParameterByClass("ilpersonalskillsgui", "obj_id", $a_node_id);
189  $ret = $ilCtrl->getLinkTargetByClass("ilpersonalskillsgui", "addSkill");
190  $ilCtrl->setParameterByClass("ilpersonalskillsgui", "obj_id", $_GET["obj_id"]);
191 
192  return $ret;
193  }
194 
198  function buildTitle($a_title, $a_id, $a_type)
199  {
200  global $lng;
201 
202  if ($a_type == "sktr")
203  {
204  include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
206 // $a_title.= " (".ilSkillTreeNode::_lookupTitle($tid).")";
207  }
208 
209 /* if (ilSkillTreeNode::_lookupSelfEvaluation($a_id))
210  {
211  $a_title.= " [".$lng->txt("add")."]";
212  }*/
213 
214  return $a_title;
215  }
216 
220  function forceExpanded($a_obj_id)
221  {
222  if (in_array($a_obj_id, $this->force_open_path))
223  {
224  return true;
225  }
226  return false;
227  }
228 
232  function buildFrameTarget($a_type, $a_child = 0, $a_obj_id = 0)
233  {
234  return "";
235  }
236 
244  {
245  $this->tree->getMaximumDepth();
246  }
247 
254  function getChildsOfNode($a_parent_id)
255  {
256  if (is_array($this->selectable_child_nodes[$a_parent_id]))
257  {
258  $childs = $this->selectable_child_nodes[$a_parent_id];
259  $childs = ilUtil::sortArray($childs, "order_nr", "asc", true);
260  return $childs;
261  }
262  return array();
263  }
264 
271  function getOriginalChildsOfNode($a_parent_id)
272  {
273  if (is_array($this->child_nodes[$a_parent_id]))
274  {
275  return $this->child_nodes[$a_parent_id];
276  }
277  return array();
278  }
279 
283  function getImage($a_name, $a_type = "", $a_obj_id = "")
284  {
285  if (in_array($a_type, array("sktr")))
286  {
287  return ilUtil::getImagePath("icon_skll_s.png");
288  }
289  return ilUtil::getImagePath($a_name);
290  }
291 
292 }
293 ?>