ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilSkillCatTableGUI.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/Table/classes/class.ilTable2GUI.php");
6 
16 {
17  const MODE_SCAT = 0;
18  const MODE_SCTP = 1;
19 
23  function __construct($a_parent_obj, $a_parent_cmd, $a_obj_id,
24  $a_mode = self::MODE_SCAT)
25  {
26  global $ilCtrl, $lng, $ilAccess, $lng;
27 
28  $ilCtrl->setParameter($a_parent_obj, "tmpmode", $a_mode);
29 
30  $this->mode = $a_mode;
31  include_once("./Services/Skill/classes/class.ilSkillTree.php");
32  $this->skill_tree = new ilSkillTree();
33  $this->obj_id = $a_obj_id;
34 
35  parent::__construct($a_parent_obj, $a_parent_cmd);
36 
37  if ($this->mode == self::MODE_SCAT)
38  {
39  $childs = $this->skill_tree->getChildsByTypeFilter($a_obj_id,
40  array("skrt", "skll", "scat", "sktr"));
41  $childs = ilUtil::sortArray($childs, "order_nr", "asc", true);
42  $this->setData($childs);
43  }
44  else if ($this->mode == self::MODE_SCTP)
45  {
46  $childs = $this->skill_tree->getChildsByTypeFilter($a_obj_id,
47  array("skrt", "sktp", "sctp"));
48  $childs = ilUtil::sortArray($childs, "order_nr", "asc", true);
49  $this->setData($childs);
50  }
51 
52  if ($this->obj_id != $this->skill_tree->readRootId())
53  {
54 // $this->setTitle(ilSkillTreeNode::_lookupTitle($this->obj_id));
55  }
56  $this->setTitle($lng->txt("skmg_items"));
57 
58  $this->addColumn($this->lng->txt(""), "", "1px", true);
59  $this->addColumn($this->lng->txt("type"), "", "1px");
60  $this->addColumn($this->lng->txt("skmg_order"), "", "1px");
61  $this->addColumn($this->lng->txt("title"));
62 
63  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
64  $this->setRowTemplate("tpl.skill_cat_row.html", "Services/Skill");
65 
66  $this->addMultiCommand("deleteNodes", $lng->txt("delete"));
67  $this->addMultiCommand("cutItems", $lng->txt("cut"));
68  $this->addMultiCommand("copyItems", $lng->txt("copy"));
69  $this->addCommandButton("saveOrder", $lng->txt("skmg_save_order"));
70 
71  }
72 
76  protected function fillRow($a_set)
77  {
78  global $lng, $ilCtrl;
79 
80  switch($a_set["type"])
81  {
82  // category
83  case "scat":
84  $ilCtrl->setParameterByClass("ilskillcategorygui", "obj_id", $a_set["child"]);
85  $ret = $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "listItems");
86  $ilCtrl->setParameterByClass("ilskillcategorygui", "obj_id", $_GET["obj_id"]);
87  break;
88 
89  // skill template reference
90  case "sktr":
91  $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "obj_id", $a_set["child"]);
92  $ret = $ilCtrl->getLinkTargetByClass("ilskilltemplatereferencegui", "listItems");
93  $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "obj_id", $_GET["obj_id"]);
94  break;
95 
96  // skill
97  case "skll":
98  $ilCtrl->setParameterByClass("ilbasicskillgui", "obj_id", $a_set["child"]);
99  $ret = $ilCtrl->getLinkTargetByClass("ilbasicskillgui", "edit");
100  $ilCtrl->setParameterByClass("ilbasicskillgui", "obj_id", $_GET["obj_id"]);
101  break;
102 
103  // --------
104 
105  // template
106  case "sktp":
107  $ilCtrl->setParameterByClass("ilbasicskilltemplategui", "obj_id", $a_set["child"]);
108  $ret = $ilCtrl->getLinkTargetByClass("ilbasicskilltemplategui", "edit");
109  $ilCtrl->setParameterByClass("ilbasicskilltemplategui", "obj_id", $_GET["obj_id"]);
110  break;
111 
112  // template category
113  case "sctp":
114  $ilCtrl->setParameterByClass("ilskilltemplatecategorygui", "obj_id", $a_set["child"]);
115  $ret = $ilCtrl->getLinkTargetByClass("ilskilltemplatecategorygui", "listItems");
116  $ilCtrl->setParameterByClass("ilskilltemplatecategorygui", "obj_id", $_GET["obj_id"]);
117  break;
118  }
119 
120  $this->tpl->setVariable("HREF_TITLE", $ret);
121 
122  $this->tpl->setVariable("TITLE", $a_set["title"]);
123  $this->tpl->setVariable("OBJ_ID", $a_set["child"]);
124  $this->tpl->setVariable("ORDER_NR", $a_set["order_nr"]);
125  $icon = ilSkillTreeNode::getIconPath($a_set["child"],
126  $a_set["type"], "", ilSkillTreeNode::_lookupDraft($a_set["child"]));
127  $this->tpl->setVariable("ICON", ilUtil::img($icon, ""));
128  }
129 
130 }
131 ?>