3 declare(strict_types=1);
38 protected \ilLanguage
$lng;
57 public function __construct(
int $ref_id,
int $base_skill_id,
int $tref_id,
int $requested_level_id)
61 $this->
ctrl = $DIC->ctrl();
62 $this->
lng = $DIC->language();
63 $this->ui_fac = $DIC->ui()->factory();
64 $this->ui_ren = $DIC->ui()->renderer();
65 $this->request = $DIC->http()->request();
66 $this->query = $DIC->http()->wrapper()->query();
68 $this->tree = $DIC->repositoryTree();
69 $this->tree_access_manager = $DIC->skills()->internal()->manager()->getTreeAccessManager($ref_id);
70 $this->resource_manager = $DIC->skills()->internal()->manager()->getResourceManager();
71 $this->admin_gui_request = $DIC->skills()->internal()->gui()->admin_request();
72 $this->requested_table_action = $this->admin_gui_request->getTableLevelResourcesAction();
73 $this->requested_table_rep_ref_ids = $this->admin_gui_request->getTableRepoRefIds();
85 if ($this->requested_table_action ===
"removeResources") {
87 foreach ($this->requested_table_rep_ref_ids as
$id) {
88 if ($id ===
"ALL_OBJECTS") {
89 $resources = $this->resource_manager->getResourcesOfLevel(
92 $this->requested_level_id
97 $items[] = $this->ui_fac->modal()->interruptiveItem()->standard(
98 (
string) $resource->getRepoRefId(),
100 $this->ui_fac->image()->standard(
102 $this->
lng->txt(
"icon") .
" " . $this->
lng->txt(
"obj_" . $obj_type)
109 $items[] = $this->ui_fac->modal()->interruptiveItem()->standard(
112 $this->ui_fac->image()->standard(
114 $this->
lng->txt(
"icon") .
" " . $this->
lng->txt(
"obj_" . $obj_type)
119 echo($this->ui_ren->renderAsync([
120 $this->ui_fac->modal()->interruptive(
122 empty($items) ? $this->
lng->txt(
"no_checkbox") : $this->
lng->txt(
"skmg_confirm_level_resources_removal"),
123 $this->
ctrl->getFormActionByClass(
"ilbasicskillgui",
"removeLevelResources")
125 ->withAffectedItems($items)
126 ->withActionButtonLabel(empty($items) ? $this->
lng->txt(
"ok") : $this->
lng->txt(
"delete"))
131 $table = $this->ui_fac->table()
132 ->data($this->
lng->txt(
"skmg_suggested_resources"), $columns, $data_retrieval)
135 $this->base_skill_id .
"_" .
136 $this->tref_id .
"_" .
137 $this->requested_level_id
139 ->withActions($actions)
140 ->withRequest($this->request);
148 "type" => $this->ui_fac->table()->column()->statusIcon($this->
lng->txt(
"type"))
149 ->withIsSortable(
false),
150 "title" => $this->ui_fac->table()->column()->text($this->
lng->txt(
"title")),
151 "path" => $this->ui_fac->table()->column()->text($this->
lng->txt(
"path"))
152 ->withIsSortable(
false),
153 "suggested" => $this->ui_fac->table()->column()->text($this->
lng->txt(
"skmg_suggested"))
154 ->withIsSortable(
false),
155 "lp_trigger" => $this->ui_fac->table()->column()->text($this->
lng->txt(
"skmg_lp_triggers_level"))
156 ->withIsSortable(
false),
164 $query_params_namespace = [
"skl_level_resources_table"];
166 $uri_suggested = $this->df->uri(
167 ILIAS_HTTP_PATH .
"/" . $this->
ctrl->getLinkTargetByClass(
"ilbasicskillgui",
"saveResourcesAsSuggested")
169 $url_builder_suggested =
new UI\URLBuilder($uri_suggested);
170 list($url_builder_suggested, $action_parameter_token_suggested, $row_id_token_suggested) =
171 $url_builder_suggested->acquireParameters(
172 $query_params_namespace,
177 $uri_not_suggested = $this->df->uri(
178 ILIAS_HTTP_PATH .
"/" . $this->
ctrl->getLinkTargetByClass(
"ilbasicskillgui",
"saveResourcesAsNotSuggested")
180 $url_builder_not_suggested =
new UI\URLBuilder($uri_not_suggested);
181 list($url_builder_not_suggested, $action_parameter_token_not_suggested, $row_id_token_not_suggested) =
182 $url_builder_not_suggested->acquireParameters(
183 $query_params_namespace,
188 $uri_trigger = $this->df->uri(
189 ILIAS_HTTP_PATH .
"/" . $this->
ctrl->getLinkTargetByClass(
"ilbasicskillgui",
"saveResourcesAsTrigger")
191 $url_builder_trigger =
new UI\URLBuilder($uri_trigger);
192 list($url_builder_trigger, $action_parameter_token_trigger, $row_id_token_trigger) =
193 $url_builder_trigger->acquireParameters(
194 $query_params_namespace,
199 $uri_no_trigger = $this->df->uri(
200 ILIAS_HTTP_PATH .
"/" . $this->
ctrl->getLinkTargetByClass(
"ilbasicskillgui",
"saveResourcesAsNoTrigger")
202 $url_builder_no_trigger =
new UI\URLBuilder($uri_no_trigger);
203 list($url_builder_no_trigger, $action_parameter_token_no_trigger, $row_id_token_no_trigger) =
204 $url_builder_no_trigger->acquireParameters(
205 $query_params_namespace,
210 $url_builder_remove =
new UI\URLBuilder($this->df->uri($this->request->getUri()->__toString()));
211 list($url_builder_remove, $action_parameter_token_remove, $row_id_token_remove) =
212 $url_builder_remove->acquireParameters(
213 $query_params_namespace,
219 if ($this->tree_access_manager->hasManageCompetencesPermission()) {
221 "setSuggested" => $this->ui_fac->table()->action()->standard(
222 $this->
lng->txt(
"skmg_set_as_suggested"),
223 $url_builder_suggested->withParameter($action_parameter_token_suggested,
"setSuggested"),
224 $row_id_token_suggested
226 "unsetSuggested" => $this->ui_fac->table()->action()->standard(
227 $this->
lng->txt(
"skmg_set_as_no_suggested"),
228 $url_builder_not_suggested->withParameter($action_parameter_token_not_suggested,
"unsetSuggested"),
229 $row_id_token_not_suggested
231 "setTrigger" => $this->ui_fac->table()->action()->standard(
232 $this->
lng->txt(
"skmg_set_as_lp_trigger"),
233 $url_builder_trigger->withParameter($action_parameter_token_trigger,
"setTrigger"),
234 $row_id_token_trigger
236 "unsetTrigger" => $this->ui_fac->table()->action()->standard(
237 $this->
lng->txt(
"skmg_set_as_no_lp_trigger"),
238 $url_builder_no_trigger->withParameter($action_parameter_token_no_trigger,
"unsetTrigger"),
239 $row_id_token_no_trigger
241 "remove" => $this->ui_fac->table()->action()->multi(
242 $this->
lng->txt(
"remove"),
243 $url_builder_remove->withParameter($action_parameter_token_remove,
"removeResources"),
255 $data_retrieval =
new class (
273 protected int $base_skill_id,
274 protected int $tref_id,
275 protected int $level_id
279 public function getRows(
281 array $visible_column_ids,
285 ?array $additional_parameters
287 $records = $this->getRecords($range, $order);
288 foreach ($records as $idx => $record) {
289 $row_id = (string) $record[
"rep_ref_id"];
291 yield $row_builder->buildDataRow($row_id, $record)
292 ->withDisabledAction(
"setSuggested", ($record[
"suggested"] === $this->
lng->txt(
"yes")))
293 ->withDisabledAction(
"unsetSuggested", ($record[
"suggested"] === $this->
lng->txt(
"no")))
294 ->withDisabledAction(
"setTrigger", ($record[
"lp_trigger"] === $this->
lng->txt(
"yes")))
295 ->withDisabledAction(
"setTrigger", ($record[
"lp_trigger"] === $this->
lng->txt(
"not_available")))
296 ->withDisabledAction(
"unsetTrigger", ($record[
"lp_trigger"] === $this->
lng->txt(
"no")))
297 ->withDisabledAction(
"unsetTrigger", ($record[
"lp_trigger"] === $this->
lng->txt(
"not_available")));
301 public function getTotalRowCount(
303 ?array $additional_parameters
305 return count($this->getRecords());
308 protected function getRecords(
Data\
Range $range = null,
Data\
Order $order = null): array
310 $resources = $this->resource_manager->getResourcesOfLevel(
311 $this->base_skill_id,
319 $ref_id = $resource->getRepoRefId();
323 $records[$i][
"rep_ref_id"] =
$ref_id;
325 $records[$i][
"suggested"] = $resource->getImparting()
326 ? $this->
lng->txt(
"yes")
327 : $this->
lng->txt(
"no");
330 $trigger = $this->
lng->txt(
"not_available");
331 } elseif ($resource->getTrigger()) {
332 $trigger = $this->
lng->txt(
"yes");
334 $trigger = $this->
lng->txt(
"no");
336 $records[$i][
"lp_trigger"] = $trigger;
338 $icon = $this->ui_fac->symbol()->icon()->standard(
340 $this->
lng->txt(
"icon") .
" " . $this->
lng->txt($obj_type),
343 $records[$i][
"type"] = $icon;
347 foreach (
$path as $p) {
348 if ($p[
"type"] !=
"root" && $p[
"child"] !=
$ref_id) {
349 $path_items[] = $p[
"title"];
352 $records[$i][
"path"] = implode(
" > ", $path_items);
358 $records = $this->orderRecords($records, $order);
362 $records = $this->limitRecords($records, $range);
369 return $data_retrieval;
An entity that renders components to a string output.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
static isSupportedObjectType(string $type)
Access SkillTreeAccess $tree_access_manager
Request wrapper for guis in skill administration.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Resource SkillResourcesManager $resource_manager
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Both the subject and the direction need to be specified when expressing an order. ...
static _lookupObjId(int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(int $ref_id, int $base_skill_id, int $tref_id, int $requested_level_id)
ServerRequestInterface $request
static _lookupTitle(int $obj_id)
array $requested_table_rep_ref_ids
string $requested_table_action
Manages resources for skills.
Service SkillAdminGUIRequest $admin_gui_request
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ArrayBasedRequestWrapper $query
static _lookupType(int $id, bool $reference=false)
A simple class to express a range of whole positive numbers.
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...