ILIAS  release_8 Revision v8.24
class.ilSkillCatTableGUI.php
Go to the documentation of this file.
1<?php
2
22
29{
31 protected int $tref_id = 0;
32 protected int $mode = 0;
35 protected bool $manage_perm = false;
37 protected int $requested_node_id = 0;
38 protected int $requested_tref_id = 0;
39 protected int $requested_ref_id = 0;
40 protected \ILIAS\UI\Factory $ui_fac;
41 protected \ILIAS\UI\Renderer $ui_ren;
42
43 public const MODE_SCAT = 0;
44 public const MODE_SCTP = 1;
45
46 public function __construct(
47 $a_parent_obj,
48 string $a_parent_cmd,
49 int $a_obj_id,
50 int $a_mode = self::MODE_SCAT,
51 int $a_tref_id = 0
52 ) {
53 global $DIC;
54
55 $this->ctrl = $DIC->ctrl();
56 $this->lng = $DIC->language();
57 $this->access = $DIC->access();
58 $this->admin_gui_request = $DIC->skills()->internal()->gui()->admin_request();
59 $this->ui_fac = $DIC->ui()->factory();
60 $this->ui_ren = $DIC->ui()->renderer();
61
62 $ilCtrl = $DIC->ctrl();
63 $lng = $DIC->language();
64
65 $this->tref_id = $a_tref_id;
66 $ilCtrl->setParameter($a_parent_obj, "tmpmode", $a_mode);
67
68 $this->requested_node_id = $this->admin_gui_request->getNodeId();
69 $this->requested_tref_id = $this->admin_gui_request->getTrefId();
70 $this->requested_ref_id = $this->admin_gui_request->getRefId();
71
72 $this->mode = $a_mode;
73 $this->skill_tree = $DIC->skills()->internal()->repo()->getTreeRepo()->getTreeForNodeId($a_obj_id);
74 $this->tree_access_manager = $DIC->skills()->internal()->manager()->getTreeAccessManager($this->requested_ref_id);
75
76 parent::__construct($a_parent_obj, $a_parent_cmd);
77
78 if ($this->mode == self::MODE_SCAT) {
79 $this->manage_perm = $this->tree_access_manager->hasManageCompetencesPermission();
80 $childs = $this->skill_tree->getChildsByTypeFilter(
81 $a_obj_id,
82 array("skrt", "skll", "scat", "sktr")
83 );
84 $childs = ilArrayUtil::sortArray($childs, "order_nr", "asc", true);
85 $this->setData($childs);
86 } elseif ($this->mode == self::MODE_SCTP) {
87 $this->manage_perm = $this->tree_access_manager->hasManageCompetenceTemplatesPermission();
88 $childs = $this->skill_tree->getChildsByTypeFilter(
89 $a_obj_id,
90 array("skrt", "sktp", "sctp")
91 );
92 $childs = ilArrayUtil::sortArray($childs, "order_nr", "asc", true);
93 $this->setData($childs);
94 }
95
96 $this->setTitle($lng->txt("skmg_items"));
97
98 if ($this->tref_id == 0 && $this->manage_perm) {
99 $this->addColumn($this->lng->txt(""), "", "1px", true);
100 }
101 $this->addColumn($this->lng->txt("type"), "", "1px");
102 if ($this->tref_id == 0) {
103 $this->addColumn($this->lng->txt("skmg_order"), "", "1px");
104 }
105 $this->addColumn($this->lng->txt("title"));
106
107 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
108 $this->setRowTemplate("tpl.skill_cat_row.html", "Services/Skill");
109
110 if ($this->tref_id == 0 && $this->manage_perm) {
111 $this->addMultiCommand("cutItems", $lng->txt("cut"));
112 $this->addMultiCommand("copyItems", $lng->txt("copy"));
113 $this->addMultiCommand("deleteNodes", $lng->txt("delete"));
114 if ($a_mode == self::MODE_SCAT) {
115 $this->addMultiCommand("exportSelectedNodes", $lng->txt("export"));
116 }
117 $this->addCommandButton("saveOrder", $lng->txt("skmg_save_order"));
118 }
119 }
120
121 protected function fillRow(array $a_set): void
122 {
124 $ilCtrl = $this->ctrl;
125
126 $ret = "";
127 switch ($a_set["type"]) {
128 // category
129 case "scat":
130 $ilCtrl->setParameterByClass("ilskillcategorygui", "node_id", $a_set["child"]);
131 $ret = $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "listItems");
132 $ilCtrl->setParameterByClass("ilskillcategorygui", "node_id", $this->requested_node_id);
133 break;
134
135 // skill template reference
136 case "sktr":
137 $tid = ilSkillTemplateReference::_lookupTemplateId($a_set["child"]);
138 $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "tref_id", $a_set["child"]);
139 $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "node_id", $tid);
140 $ret = $ilCtrl->getLinkTargetByClass("ilskilltemplatereferencegui", "listItems");
141 $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "node_id", $this->requested_node_id);
142 $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "tref_id", $this->requested_tref_id);
143 break;
144
145 // skill
146 case "skll":
147 $ilCtrl->setParameterByClass("ilbasicskillgui", "node_id", $a_set["child"]);
148 $ret = $ilCtrl->getLinkTargetByClass("ilbasicskillgui", "edit");
149 $ilCtrl->setParameterByClass("ilbasicskillgui", "node_id", $this->requested_node_id);
150 break;
151
152 // --------
153
154 // template
155 case "sktp":
156 $ilCtrl->setParameterByClass("ilbasicskilltemplategui", "node_id", $a_set["child"]);
157 $ret = $ilCtrl->getLinkTargetByClass("ilbasicskilltemplategui", "edit");
158 $ilCtrl->setParameterByClass("ilbasicskilltemplategui", "node_id", $this->requested_node_id);
159 break;
160
161 // template category
162 case "sctp":
163 $ilCtrl->setParameterByClass("ilskilltemplatecategorygui", "node_id", $a_set["child"]);
164 $ret = $ilCtrl->getLinkTargetByClass("ilskilltemplatecategorygui", "listItems");
165 $ilCtrl->setParameterByClass("ilskilltemplatecategorygui", "node_id", $this->requested_node_id);
166 break;
167 }
168
169 if ($this->tref_id == 0) {
170 if ($this->manage_perm) {
171 $this->tpl->setCurrentBlock("cb");
172 $this->tpl->setVariable("CB_ID", $a_set["child"]);
173 $this->tpl->parseCurrentBlock();
174 }
175
176 $this->tpl->setCurrentBlock("nr");
177 $this->tpl->setVariable("OBJ_ID", $a_set["child"]);
178 $this->tpl->setVariable("ORDER_NR", $a_set["order_nr"]);
179 if (!$this->manage_perm) {
180 $this->tpl->touchBlock("disabled");
181 }
182 $this->tpl->parseCurrentBlock();
183 }
184
185 $this->tpl->setVariable("HREF_TITLE", $ret);
186
187 $this->tpl->setVariable("TITLE", $a_set["title"]);
188 $icon_path = ilSkillTreeNode::getIconPath(
189 $a_set["child"],
190 $a_set["type"],
191 "",
192 ilSkillTreeNode::_lookupStatus($a_set["child"])
193 );
194 $icon = $this->ui_fac->symbol()->icon()->custom(
195 $icon_path,
196 "",
197 "medium"
198 );
199 $this->tpl->setVariable("ICON", $this->ui_ren->render($icon));
200 }
201}
Request wrapper for guis in skill administration.
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
setParameterByClass(string $a_class, string $a_parameter, $a_value)
@inheritDoc
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
__construct( $a_parent_obj, string $a_parent_cmd, int $a_obj_id, int $a_mode=self::MODE_SCAT, int $a_tref_id=0)
SkillTreeAccess $tree_access_manager
SkillAdminGUIRequest $admin_gui_request
fillRow(array $a_set)
Standard Version of Fill Row.
static getIconPath(int $a_obj_id, string $a_type, string $a_size="", int $a_status=0)
static _lookupStatus(int $a_obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
addMultiCommand(string $a_cmd, string $a_text)
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setData(array $a_data)
Set table data.
ilLanguage $lng
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc