ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
5include_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 $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?>
$_GET["client_id"]
fillRow($a_set)
Fill table row.
__construct($a_parent_obj, $a_parent_cmd, $a_obj_id, $a_mode=self::MODE_SCAT, $a_tref_id=0)
Constructor.
static _lookupTemplateId($a_obj_id)
Lookup template ID.
static getIconPath($a_obj_id, $a_type, $a_size="", $a_status=0)
Get icon path.
static _lookupStatus($a_obj_id)
Lookup Status.
Class ilTable2GUI.
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.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40