ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilSkillCatTableGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2020 ILIAS open source, Extended GPL, see docs/LICENSE */
4
11{
15 protected $ctrl;
16
20 protected $access;
21
22 const MODE_SCAT = 0;
23 const MODE_SCTP = 1;
24 protected $tref_id = 0;
25
29 public function __construct(
30 $a_parent_obj,
31 $a_parent_cmd,
32 $a_obj_id,
33 $a_mode = self::MODE_SCAT,
34 $a_tref_id = 0
35 ) {
36 global $DIC;
37
38 $this->ctrl = $DIC->ctrl();
39 $this->lng = $DIC->language();
40 $this->access = $DIC->access();
41
42 $ilCtrl = $DIC->ctrl();
43 $lng = $DIC->language();
44
45 $this->tref_id = $a_tref_id;
46 $ilCtrl->setParameter($a_parent_obj, "tmpmode", $a_mode);
47
48 $this->mode = $a_mode;
49 $this->skill_tree = new ilSkillTree();
50 $this->obj_id = $a_obj_id;
51
52 parent::__construct($a_parent_obj, $a_parent_cmd);
53
54 if ($this->mode == self::MODE_SCAT) {
55 $childs = $this->skill_tree->getChildsByTypeFilter(
56 $a_obj_id,
57 array("skrt", "skll", "scat", "sktr")
58 );
59 $childs = ilUtil::sortArray($childs, "order_nr", "asc", true);
60 $this->setData($childs);
61 } elseif ($this->mode == self::MODE_SCTP) {
62 $childs = $this->skill_tree->getChildsByTypeFilter(
63 $a_obj_id,
64 array("skrt", "sktp", "sctp")
65 );
66 $childs = ilUtil::sortArray($childs, "order_nr", "asc", true);
67 $this->setData($childs);
68 }
69
70 if ($this->obj_id != $this->skill_tree->readRootId()) {
71 // $this->setTitle(ilSkillTreeNode::_lookupTitle($this->obj_id));
72 }
73 $this->setTitle($lng->txt("skmg_items"));
74
75 if ($this->tref_id == 0) {
76 $this->addColumn($this->lng->txt(""), "", "1px", true);
77 }
78 $this->addColumn($this->lng->txt("type"), "", "1px");
79 if ($this->tref_id == 0) {
80 $this->addColumn($this->lng->txt("skmg_order"), "", "1px");
81 }
82 $this->addColumn($this->lng->txt("title"));
83
84 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
85 $this->setRowTemplate("tpl.skill_cat_row.html", "Services/Skill");
86
87 if ($this->tref_id == 0 && $this->parent_obj->checkPermissionBool("write")) {
88 $this->addMultiCommand("cutItems", $lng->txt("cut"));
89 $this->addMultiCommand("copyItems", $lng->txt("copy"));
90 $this->addMultiCommand("deleteNodes", $lng->txt("delete"));
91 if ($a_mode == self::MODE_SCAT) {
92 $this->addMultiCommand("exportSelectedNodes", $lng->txt("export"));
93 }
94 $this->addCommandButton("saveOrder", $lng->txt("skmg_save_order"));
95 }
96 }
97
101 protected function fillRow($a_set)
102 {
104 $ilCtrl = $this->ctrl;
105
106 switch ($a_set["type"]) {
107 // category
108 case "scat":
109 $ilCtrl->setParameterByClass("ilskillcategorygui", "obj_id", $a_set["child"]);
110 $ret = $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "listItems");
111 $ilCtrl->setParameterByClass("ilskillcategorygui", "obj_id", $_GET["obj_id"]);
112 break;
113
114 // skill template reference
115 case "sktr":
116 $tid = ilSkillTemplateReference::_lookupTemplateId($a_set["child"]);
117 $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "tref_id", $a_set["child"]);
118 $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "obj_id", $tid);
119 $ret = $ilCtrl->getLinkTargetByClass("ilskilltemplatereferencegui", "listItems");
120 $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "obj_id", $_GET["obj_id"]);
121 $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "tref_id", $_GET["tref_id"]);
122 break;
123
124 // skill
125 case "skll":
126 $ilCtrl->setParameterByClass("ilbasicskillgui", "obj_id", $a_set["child"]);
127 $ret = $ilCtrl->getLinkTargetByClass("ilbasicskillgui", "edit");
128 $ilCtrl->setParameterByClass("ilbasicskillgui", "obj_id", $_GET["obj_id"]);
129 break;
130
131 // --------
132
133 // template
134 case "sktp":
135 $ilCtrl->setParameterByClass("ilbasicskilltemplategui", "obj_id", $a_set["child"]);
136 $ret = $ilCtrl->getLinkTargetByClass("ilbasicskilltemplategui", "edit");
137 $ilCtrl->setParameterByClass("ilbasicskilltemplategui", "obj_id", $_GET["obj_id"]);
138 break;
139
140 // template category
141 case "sctp":
142 $ilCtrl->setParameterByClass("ilskilltemplatecategorygui", "obj_id", $a_set["child"]);
143 $ret = $ilCtrl->getLinkTargetByClass("ilskilltemplatecategorygui", "listItems");
144 $ilCtrl->setParameterByClass("ilskilltemplatecategorygui", "obj_id", $_GET["obj_id"]);
145 break;
146 }
147
148 if ($this->tref_id == 0) {
149 $this->tpl->setCurrentBlock("cb");
150 $this->tpl->setVariable("CB_ID", $a_set["child"]);
151 $this->tpl->parseCurrentBlock();
152
153 $this->tpl->setCurrentBlock("nr");
154 $this->tpl->setVariable("OBJ_ID", $a_set["child"]);
155 $this->tpl->setVariable("ORDER_NR", $a_set["order_nr"]);
156 $this->tpl->parseCurrentBlock();
157 }
158
159 $this->tpl->setVariable("HREF_TITLE", $ret);
160
161 $this->tpl->setVariable("TITLE", $a_set["title"]);
163 $a_set["child"],
164 $a_set["type"],
165 "",
166 ilSkillTreeNode::_lookupStatus($a_set["child"])
167 );
168 $this->tpl->setVariable("ICON", ilUtil::img($icon, ""));
169 }
170}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
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.
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.
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.
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=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ret
Definition: parser.php:6