ILIAS  release_8 Revision v8.24
class.ilSkillLevelResourcesTableGUI.php
Go to the documentation of this file.
1<?php
2
26{
28 protected ilTree $tree;
29 protected int $level_id = 0;
30 protected bool $write_permission = false;
32 protected \ILIAS\UI\Factory $ui_fac;
33 protected \ILIAS\UI\Renderer $ui_ren;
34
35 public function __construct(
36 $a_parent_obj,
37 string $a_parent_cmd,
38 int $a_skill_id,
39 int $a_tref_id,
40 int $a_level_id,
41 bool $a_write_permission = false
42 ) {
43 global $DIC;
44
45 $this->ctrl = $DIC->ctrl();
46 $this->lng = $DIC->language();
47 $this->access = $DIC->access();
48 $this->tree = $DIC->repositoryTree();
49 $this->ui_fac = $DIC->ui()->factory();
50 $this->ui_ren = $DIC->ui()->renderer();
51
52 $ilCtrl = $DIC->ctrl();
53 $lng = $DIC->language();
54
55 $this->level_id = $a_level_id;
56 $this->write_permission = $a_write_permission;
57
58 $this->resources = new ilSkillResources($a_skill_id, $a_tref_id);
59
60 parent::__construct($a_parent_obj, $a_parent_cmd);
61 $this->setData($this->resources->getResourcesOfLevel($this->level_id));
62 $this->setTitle($lng->txt("skmg_suggested_resources"));
63
64 if ($this->write_permission) {
65 $this->addColumn("", "", "1px", true);
66 }
67 $this->addColumn($this->lng->txt("type"), "", "1px");
68 $this->addColumn($this->lng->txt("title"), "");
69 $this->addColumn($this->lng->txt("path"));
70 $this->addColumn($this->lng->txt("skmg_suggested"));
71 $this->addColumn($this->lng->txt("skmg_lp_triggers_level"));
72
73 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
74 $this->setRowTemplate("tpl.level_resources_row.html", "Services/Skill");
75
76 if ($this->write_permission) {
77 $this->addMultiCommand("confirmLevelResourcesRemoval", $lng->txt("remove"));
78 $this->addCommandButton("saveResourceSettings", $lng->txt("skmg_save_settings"));
79 }
80 }
81
82 protected function fillRow(array $a_set): void
83 {
86
87 $ref_id = $a_set["rep_ref_id"];
89 $obj_type = ilObject::_lookupType($obj_id);
90
91 if ($a_set["imparting"]) {
92 $this->tpl->touchBlock("sugg_checked");
93 }
94 $this->tpl->setCurrentBlock("suggested_checkbox");
95 $this->tpl->setVariable("SG_ID", $ref_id);
96 $this->tpl->parseCurrentBlock();
97
98 if (ilObjectLP::isSupportedObjectType($obj_type)) {
99 if ($a_set["trigger"]) {
100 $this->tpl->touchBlock("trig_checked");
101 }
102 $this->tpl->setCurrentBlock("trigger_checkbox");
103 $this->tpl->setVariable("TR_ID", $ref_id);
104 $this->tpl->parseCurrentBlock();
105 }
106
107 $icon = $this->ui_fac->symbol()->icon()->standard(
108 $obj_type,
109 $this->lng->txt("icon") . " " . $this->lng->txt($obj_type),
110 "medium"
111 );
112 $this->tpl->setVariable("TITLE", ilObject::_lookupTitle($obj_id));
113 $this->tpl->setVariable("IMG", $this->ui_ren->render($icon));
114 if ($this->write_permission) {
115 $this->tpl->setCurrentBlock("checkbox");
116 $this->tpl->setVariable("ID", $ref_id);
117 $this->tpl->parseCurrentBlock();
118 }
119
121 $path_items = [];
122 foreach ($path as $p) {
123 if ($p["type"] != "root" && $p["child"] != $ref_id) {
124 $path_items[] = $p["title"];
125 }
126 }
127 $this->tpl->setVariable("PATH", implode(" > ", $path_items));
128 }
129}
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...
static isSupportedObjectType(string $type)
static _lookupType(int $id, bool $reference=false)
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
fillRow(array $a_set)
Standard Version of Fill Row.
__construct( $a_parent_obj, string $a_parent_cmd, int $a_skill_id, int $a_tref_id, int $a_level_id, bool $a_write_permission=false)
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getPathFull(int $a_endnode_id, int $a_startnode_id=0)
get path from a given startnode to a given endnode if startnode is not given the rootnode is startnod...
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:67
$path
Definition: ltiservices.php:32
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc