ILIAS  Release_5_0_x_branch Revision 61816
 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  protected $tref_id = 0;
20 
24  function __construct($a_parent_obj, $a_parent_cmd, $a_obj_id,
25  $a_mode = self::MODE_SCAT, $a_tref_id = 0)
26  {
27  global $ilCtrl, $lng, $ilAccess, $lng;
28 
29  $this->tref_id = $a_tref_id;
30  $ilCtrl->setParameter($a_parent_obj, "tmpmode", $a_mode);
31 
32  $this->mode = $a_mode;
33  include_once("./Services/Skill/classes/class.ilSkillTree.php");
34  $this->skill_tree = new ilSkillTree();
35  $this->obj_id = $a_obj_id;
36 
37  parent::__construct($a_parent_obj, $a_parent_cmd);
38 
39  if ($this->mode == self::MODE_SCAT)
40  {
41  $childs = $this->skill_tree->getChildsByTypeFilter($a_obj_id,
42  array("skrt", "skll", "scat", "sktr"));
43  $childs = ilUtil::sortArray($childs, "order_nr", "asc", true);
44  $this->setData($childs);
45  }
46  else if ($this->mode == self::MODE_SCTP)
47  {
48  $childs = $this->skill_tree->getChildsByTypeFilter($a_obj_id,
49  array("skrt", "sktp", "sctp"));
50  $childs = ilUtil::sortArray($childs, "order_nr", "asc", true);
51  $this->setData($childs);
52  }
53 
54  if ($this->obj_id != $this->skill_tree->readRootId())
55  {
56 // $this->setTitle(ilSkillTreeNode::_lookupTitle($this->obj_id));
57  }
58  $this->setTitle($lng->txt("skmg_items"));
59 
60  if ($this->tref_id == 0)
61  {
62  $this->addColumn($this->lng->txt(""), "", "1px", true);
63  }
64  $this->addColumn($this->lng->txt("type"), "", "1px");
65  if ($this->tref_id == 0)
66  {
67  $this->addColumn($this->lng->txt("skmg_order"), "", "1px");
68  }
69  $this->addColumn($this->lng->txt("title"));
70 
71  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
72  $this->setRowTemplate("tpl.skill_cat_row.html", "Services/Skill");
73 
74  if ($this->tref_id == 0)
75  {
76  $this->addMultiCommand("cutItems", $lng->txt("cut"));
77  $this->addMultiCommand("copyItems", $lng->txt("copy"));
78  $this->addMultiCommand("deleteNodes", $lng->txt("delete"));
79  $this->addCommandButton("saveOrder", $lng->txt("skmg_save_order"));
80  }
81  }
82 
86  protected function fillRow($a_set)
87  {
88  global $lng, $ilCtrl;
89 
90  switch($a_set["type"])
91  {
92  // category
93  case "scat":
94  $ilCtrl->setParameterByClass("ilskillcategorygui", "obj_id", $a_set["child"]);
95  $ret = $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "listItems");
96  $ilCtrl->setParameterByClass("ilskillcategorygui", "obj_id", $_GET["obj_id"]);
97  break;
98 
99  // skill template reference
100  case "sktr":
101  $tid = ilSkillTemplateReference::_lookupTemplateId($a_set["child"]);
102  $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "tref_id", $a_set["child"]);
103  $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "obj_id", $tid);
104  $ret = $ilCtrl->getLinkTargetByClass("ilskilltemplatereferencegui", "listItems");
105  $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "obj_id", $_GET["obj_id"]);
106  $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "tref_id", $_GET["tref_id"]);
107  break;
108 
109  // skill
110  case "skll":
111  $ilCtrl->setParameterByClass("ilbasicskillgui", "obj_id", $a_set["child"]);
112  $ret = $ilCtrl->getLinkTargetByClass("ilbasicskillgui", "edit");
113  $ilCtrl->setParameterByClass("ilbasicskillgui", "obj_id", $_GET["obj_id"]);
114  break;
115 
116  // --------
117 
118  // template
119  case "sktp":
120  $ilCtrl->setParameterByClass("ilbasicskilltemplategui", "obj_id", $a_set["child"]);
121  $ret = $ilCtrl->getLinkTargetByClass("ilbasicskilltemplategui", "edit");
122  $ilCtrl->setParameterByClass("ilbasicskilltemplategui", "obj_id", $_GET["obj_id"]);
123  break;
124 
125  // template category
126  case "sctp":
127  $ilCtrl->setParameterByClass("ilskilltemplatecategorygui", "obj_id", $a_set["child"]);
128  $ret = $ilCtrl->getLinkTargetByClass("ilskilltemplatecategorygui", "listItems");
129  $ilCtrl->setParameterByClass("ilskilltemplatecategorygui", "obj_id", $_GET["obj_id"]);
130  break;
131  }
132 
133  if ($this->tref_id == 0)
134  {
135  $this->tpl->setCurrentBlock("cb");
136  $this->tpl->setVariable("CB_ID", $a_set["child"]);
137  $this->tpl->parseCurrentBlock();
138 
139  $this->tpl->setCurrentBlock("nr");
140  $this->tpl->setVariable("OBJ_ID", $a_set["child"]);
141  $this->tpl->setVariable("ORDER_NR", $a_set["order_nr"]);
142  $this->tpl->parseCurrentBlock();
143  }
144 
145  $this->tpl->setVariable("HREF_TITLE", $ret);
146 
147  $this->tpl->setVariable("TITLE", $a_set["title"]);
148  $icon = ilSkillTreeNode::getIconPath($a_set["child"],
149  $a_set["type"], "", ilSkillTreeNode::_lookupStatus($a_set["child"]));
150  $this->tpl->setVariable("ICON", ilUtil::img($icon, ""));
151  }
152 
153 }
154 ?>