ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 && $this->parent_obj->checkPermissionBool("write"))
75  {
76  $this->addMultiCommand("cutItems", $lng->txt("cut"));
77  $this->addMultiCommand("copyItems", $lng->txt("copy"));
78  $this->addMultiCommand("deleteNodes", $lng->txt("delete"));
79  if ($a_mode == self::MODE_SCAT)
80  {
81  $this->addMultiCommand("exportSelectedNodes", $lng->txt("export"));
82  }
83  $this->addCommandButton("saveOrder", $lng->txt("skmg_save_order"));
84  }
85  }
86 
90  protected function fillRow($a_set)
91  {
92  global $lng, $ilCtrl;
93 
94  switch($a_set["type"])
95  {
96  // category
97  case "scat":
98  $ilCtrl->setParameterByClass("ilskillcategorygui", "obj_id", $a_set["child"]);
99  $ret = $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "listItems");
100  $ilCtrl->setParameterByClass("ilskillcategorygui", "obj_id", $_GET["obj_id"]);
101  break;
102 
103  // skill template reference
104  case "sktr":
105  $tid = ilSkillTemplateReference::_lookupTemplateId($a_set["child"]);
106  $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "tref_id", $a_set["child"]);
107  $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "obj_id", $tid);
108  $ret = $ilCtrl->getLinkTargetByClass("ilskilltemplatereferencegui", "listItems");
109  $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "obj_id", $_GET["obj_id"]);
110  $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "tref_id", $_GET["tref_id"]);
111  break;
112 
113  // skill
114  case "skll":
115  $ilCtrl->setParameterByClass("ilbasicskillgui", "obj_id", $a_set["child"]);
116  $ret = $ilCtrl->getLinkTargetByClass("ilbasicskillgui", "edit");
117  $ilCtrl->setParameterByClass("ilbasicskillgui", "obj_id", $_GET["obj_id"]);
118  break;
119 
120  // --------
121 
122  // template
123  case "sktp":
124  $ilCtrl->setParameterByClass("ilbasicskilltemplategui", "obj_id", $a_set["child"]);
125  $ret = $ilCtrl->getLinkTargetByClass("ilbasicskilltemplategui", "edit");
126  $ilCtrl->setParameterByClass("ilbasicskilltemplategui", "obj_id", $_GET["obj_id"]);
127  break;
128 
129  // template category
130  case "sctp":
131  $ilCtrl->setParameterByClass("ilskilltemplatecategorygui", "obj_id", $a_set["child"]);
132  $ret = $ilCtrl->getLinkTargetByClass("ilskilltemplatecategorygui", "listItems");
133  $ilCtrl->setParameterByClass("ilskilltemplatecategorygui", "obj_id", $_GET["obj_id"]);
134  break;
135  }
136 
137  if ($this->tref_id == 0)
138  {
139  $this->tpl->setCurrentBlock("cb");
140  $this->tpl->setVariable("CB_ID", $a_set["child"]);
141  $this->tpl->parseCurrentBlock();
142 
143  $this->tpl->setCurrentBlock("nr");
144  $this->tpl->setVariable("OBJ_ID", $a_set["child"]);
145  $this->tpl->setVariable("ORDER_NR", $a_set["order_nr"]);
146  $this->tpl->parseCurrentBlock();
147  }
148 
149  $this->tpl->setVariable("HREF_TITLE", $ret);
150 
151  $this->tpl->setVariable("TITLE", $a_set["title"]);
152  $icon = ilSkillTreeNode::getIconPath($a_set["child"],
153  $a_set["type"], "", ilSkillTreeNode::_lookupStatus($a_set["child"]));
154  $this->tpl->setVariable("ICON", ilUtil::img($icon, ""));
155  }
156 
157 }
158 ?>
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
Skill tree.
$_GET["client_id"]
static getIconPath($a_obj_id, $a_type, $a_size="", $a_status=0)
Get icon path.
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
__construct($a_parent_obj, $a_parent_cmd, $a_obj_id, $a_mode=self::MODE_SCAT, $a_tref_id=0)
Constructor.
addMultiCommand($a_cmd, $a_text)
Add Command button.
static _lookupTemplateId($a_obj_id)
Lookup template ID.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
global $lng
Definition: privfeed.php:17
$ret
Definition: parser.php:6
static _lookupStatus($a_obj_id)
Lookup Status.
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
fillRow($a_set)
Fill table row.