ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSkillProfileLevelsTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25
32{
37 protected int $requested_ref_id = 0;
38
39 public function __construct(
40 $a_parent_obj,
41 string $a_parent_cmd,
42 Profile\SkillProfile $a_profile
43 ) {
44 global $DIC;
45
46 $this->skill_manager = $DIC->skills()->internal()->manager();
47 $this->tree_repo = $DIC->skills()->internal()->repo()->getTreeRepo();
48 $this->admin_gui_request = $DIC->skills()->internal()->gui()->admin_request();
49
50 $this->profile = $a_profile;
51 $this->requested_ref_id = $this->admin_gui_request->getRefId();
52 parent::__construct($a_parent_obj, $a_parent_cmd);
53
54 // convert skill levels to array structure, because tables can only handle arrays
55 $levels = $this->skill_manager->getProfileManager()->getSkillLevels($this->profile->getId());
56 $levels_array = [];
57 foreach ($levels as $level) {
58 $levels_array[] = [
59 "profile_id" => $level->getProfileId(),
60 "base_skill_id" => $level->getBaseSkillId(),
61 "tref_id" => $level->getTrefId(),
62 "level_id" => $level->getLevelId(),
63 "order_nr" => $level->getOrderNr()
64 ];
65 }
66
67 $this->setData($levels_array);
68 $this->setTitle($this->lng->txt("skmg_target_levels"));
69
70 $access_manager = $this->skill_manager->getTreeAccessManager($this->requested_ref_id);
71 if ($access_manager->hasManageProfilesPermission()) {
72 $this->addColumn("", "", "1", true);
73 $this->addColumn($this->lng->txt("skmg_order"), "", "1px");
74 }
75 $this->addColumn($this->lng->txt("skmg_skill"));
76 $this->addColumn($this->lng->txt("skmg_level"));
77 if ($access_manager->hasManageProfilesPermission()) {
78 $this->addColumn($this->lng->txt("actions"));
79 }
80
81 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
82 $this->setRowTemplate("tpl.skill_profile_level_row.html", "components/ILIAS/Skill");
83
84 if ($access_manager->hasManageProfilesPermission()) {
85 $this->addMultiCommand("confirmLevelAssignmentRemoval", $this->lng->txt("skmg_remove_levels"));
86 if (count($this->skill_manager->getProfileManager()->getSkillLevels($this->profile->getId())) > 0) {
87 $this->addCommandButton("saveLevelOrder", $this->lng->txt("skmg_save_order"));
88 }
89 }
90 }
91
92 protected function fillRow(array $a_set): void
93 {
94 $tree_id = $this->tree_repo->getTreeIdForNodeId($a_set["base_skill_id"]);
95 $node_manager = $this->skill_manager->getTreeNodeManager($tree_id);
96 $this->tpl->setVariable(
97 "SKILL_TITLE",
98 $node_manager->getWrittenPath(
99 $a_set["base_skill_id"],
100 $a_set["tref_id"]
101 )
102 );
103
104 $this->tpl->setVariable("LEVEL_TITLE", ilBasicSkill::lookupLevelTitle($a_set["level_id"]));
105
106 $access_manager = $this->skill_manager->getTreeAccessManager($this->requested_ref_id);
107 if ($access_manager->hasManageProfilesPermission()) {
108 $this->tpl->setCurrentBlock("checkbox");
109 $this->tpl->setVariable(
110 "ID",
111 ($a_set["base_skill_id"]) . ":" . ($a_set["tref_id"]) . ":" . ($a_set["level_id"]) .
112 ":" . ($a_set["order_nr"])
113 );
114 $this->tpl->setVariable("SKILL_ID", $a_set["base_skill_id"]);
115 $this->tpl->setVariable("TREF_ID", $a_set["tref_id"]);
116 $this->tpl->parseCurrentBlock();
117
118 $this->tpl->setCurrentBlock("order");
119 $this->tpl->setVariable("ORDER_NR", $a_set["order_nr"]);
120 $this->tpl->parseCurrentBlock();
121
122 $this->tpl->setCurrentBlock("cmd");
123 $this->tpl->setVariable("CMD", $this->lng->txt("edit"));
124 $this->ctrl->setParameter($this->parent_obj, "cskill_id", $a_set["base_skill_id"] . ":" . $a_set["tref_id"]);
125 $this->tpl->setVariable("CMD_HREF", $this->ctrl->getLinkTarget($this->parent_obj, "updateLevelOfSelectedSkill"));
126 $this->tpl->parseCurrentBlock();
127 }
128 }
129}
Request wrapper for guis in skill administration.
static lookupLevelTitle(int $a_id)
TableGUI class for skill profile levels.
fillRow(array $a_set)
Standard Version of Fill Row.
__construct( $a_parent_obj, string $a_parent_cmd, Profile\SkillProfile $a_profile)
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.
Interface ilSkillTreeRepository.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26