3 declare(strict_types=1);
38 protected \ilLanguage
$lng;
59 $this->
ctrl = $DIC->ctrl();
60 $this->
lng = $DIC->language();
61 $this->ui_fac = $DIC->ui()->factory();
62 $this->ui_ren = $DIC->ui()->renderer();
63 $this->request = $DIC->http()->request();
64 $this->query = $DIC->http()->wrapper()->query();
66 $this->tree_access_manager = $DIC->skills()->internal()->manager()->getTreeAccessManager($ref_id);
67 $this->profile_manager = $DIC->skills()->internal()->manager()->getProfileManager();
68 $this->admin_gui_request = $DIC->skills()->internal()->gui()->admin_request();
69 $this->requested_table_profile_action = $this->admin_gui_request->getTableProfileAction();
70 $this->requested_table_profile_ids = $this->admin_gui_request->getTableProfileIds();
80 if ($this->requested_table_profile_action ===
"deleteProfiles") {
82 foreach ($this->requested_table_profile_ids as
$id) {
83 if ($id ===
"ALL_OBJECTS") {
84 $profiles = $this->skill_tree_id
85 ? $this->profile_manager->getProfilesForSkillTree($this->skill_tree_id)
86 : $this->profile_manager->getProfilesForAllSkillTrees();
87 foreach ($profiles as $profile) {
88 $items[] = $this->ui_fac->modal()->interruptiveItem()->standard(
89 (
string) $profile->getId(),
94 $items[] = $this->ui_fac->modal()->interruptiveItem()->standard(
96 $this->profile_manager->lookupTitle((
int) $id)
100 echo($this->ui_ren->renderAsync([
101 $this->ui_fac->modal()->interruptive(
103 empty($items) ? $this->
lng->txt(
"no_checkbox") : $this->
lng->txt(
"skmg_delete_profiles"),
104 $this->
ctrl->getFormActionByClass(
"ilskillprofilegui",
"deleteProfiles")
106 ->withAffectedItems($items)
107 ->withActionButtonLabel(empty($items) ? $this->
lng->txt(
"ok") : $this->
lng->txt(
"delete"))
112 $table = $this->ui_fac->table()
113 ->data($this->
lng->txt(
"skmg_skill_profiles"), $columns, $data_retrieval)
118 ->withActions($actions)
119 ->withRequest($this->request);
127 "title" => $this->ui_fac->table()->column()->text($this->
lng->txt(
"title")),
128 "context" => $this->ui_fac->table()->column()->text($this->
lng->txt(
"context"))
129 ->withIsSortable(
false),
130 "users" => $this->ui_fac->table()->column()->text($this->
lng->txt(
"users"))
131 ->withIsSortable(
false),
132 "roles" => $this->ui_fac->table()->column()->text($this->
lng->txt(
"roles"))
133 ->withIsSortable(
false),
141 $query_params_namespace = [
"skl_profile_table"];
143 $uri_edit = $this->df->uri(
144 ILIAS_HTTP_PATH .
"/" . $this->
ctrl->getLinkTargetByClass(
"ilskillprofilegui",
"showLevelsWithTableContext")
146 $url_builder_edit =
new UI\URLBuilder($uri_edit);
147 list($url_builder_edit, $action_parameter_token_edit, $row_id_token_edit) =
148 $url_builder_edit->acquireParameters(
149 $query_params_namespace,
154 $url_builder_delete =
new UI\URLBuilder($this->df->uri($this->request->getUri()->__toString()));
155 list($url_builder_delete, $action_parameter_token_delete, $row_id_token_delete) =
156 $url_builder_delete->acquireParameters(
157 $query_params_namespace,
162 $uri_export = $this->df->uri(
163 ILIAS_HTTP_PATH .
"/" . $this->
ctrl->getLinkTargetByClass(
"ilskillprofilegui",
"exportProfiles")
165 $url_builder_export =
new UI\URLBuilder($uri_export);
166 list($url_builder_export, $action_parameter_token_export, $row_id_token_export) =
167 $url_builder_export->acquireParameters(
168 $query_params_namespace,
174 "edit" => $this->ui_fac->table()->action()->single(
175 $this->tree_access_manager->hasManageProfilesPermission() ? $this->
lng->txt(
"edit") : $this->
lng->txt(
"show"),
176 $url_builder_edit->withParameter($action_parameter_token_edit,
"editProfile"),
180 if ($this->tree_access_manager->hasManageProfilesPermission()) {
181 $actions[
"delete"] = $this->ui_fac->table()->action()->multi(
182 $this->
lng->txt(
"delete"),
183 $url_builder_delete->withParameter($action_parameter_token_delete,
"deleteProfiles"),
187 $actions[
"export"] = $this->ui_fac->table()->action()->multi(
188 $this->
lng->txt(
"export"),
189 $url_builder_export->withParameter($action_parameter_token_export,
"exportProfiles"),
199 $data_retrieval =
new class (
208 protected int $skill_tree_id,
213 public function getRows(
215 array $visible_column_ids,
219 ?array $additional_parameters
221 $records = $this->getRecords($range, $order);
222 foreach ($records as $idx => $record) {
223 $row_id = (string) $record[
"profile_id"];
225 yield $row_builder->buildDataRow($row_id, $record);
229 public function getTotalRowCount(
231 ?array $additional_parameters
233 return count($this->getRecords());
236 protected function getRecords(
Data\
Range $range = null,
Data\
Order $order = null): array
238 if ($this->skill_tree_id) {
239 $profiles = $this->skill_profile_manager->getProfilesForSkillTree($this->skill_tree_id);
241 $profiles = $this->skill_profile_manager->getProfilesForAllSkillTrees();
246 foreach ($profiles as $profile) {
247 $records[$i][
"profile_id"] = $profile->getId();
248 $records[$i][
"title"] = $profile->getTitle();
249 $profile_ref_id = $this->skill_profile_manager->lookupRefId($profile->getId());
252 if ($profile_ref_id > 0) {
253 $records[$i][
"context"] = $this->
lng->txt(
"skmg_context_local") .
" (" . $profile_obj_title .
")";
255 $records[$i][
"context"] = $this->
lng->txt(
"skmg_context_global");
257 $records[$i][
"users"] = $this->skill_profile_manager->countUsers($profile->getId());
258 $records[$i][
"roles"] = $this->skill_profile_manager->countRoles($profile->getId());
263 $records = $this->orderRecords($records, $order);
267 $records = $this->limitRecords($records, $range);
274 return $data_retrieval;
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ServerRequestInterface $request
Profile SkillProfileManager $profile_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...
ArrayBasedRequestWrapper $query
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. ...
Access SkillTreeAccess $tree_access_manager
static _lookupTitle(int $obj_id)
Service SkillAdminGUIRequest $admin_gui_request
static _lookupObjectId(int $ref_id)
string $requested_table_profile_action
__construct(int $ref_id, int $skill_tree_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
array $requested_table_profile_ids
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...