ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilSkillProfileLevelsTableGUI.php
Go to the documentation of this file.
1 <?php
2 
24 
31 {
37  protected int $requested_ref_id = 0;
38 
39  public function __construct(
40  $a_parent_obj,
41  string $a_parent_cmd,
42  SkillProfile $a_profile
43  ) {
44  global $DIC;
45 
46  $this->ctrl = $DIC->ctrl();
47  $this->lng = $DIC->language();
48  $this->access = $DIC->access();
49  $ilCtrl = $DIC->ctrl();
50  $lng = $DIC->language();
51 
52  $this->skill_manager = $DIC->skills()->internal()->manager();
53  $this->tree_repo = $DIC->skills()->internal()->repo()->getTreeRepo();
54  $this->admin_gui_request = $DIC->skills()->internal()->gui()->admin_request();
55 
56  $this->profile = $a_profile;
57  $this->requested_ref_id = $this->admin_gui_request->getRefId();
58  parent::__construct($a_parent_obj, $a_parent_cmd);
59 
60  $this->setData($this->profile->getSkillLevels());
61  $this->setTitle($lng->txt("skmg_target_levels"));
62 
63  $access_manager = $this->skill_manager->getTreeAccessManager($this->requested_ref_id);
64  if ($access_manager->hasManageProfilesPermission()) {
65  $this->addColumn("", "", "1", true);
66  $this->addColumn($this->lng->txt("skmg_order"), "", "1px");
67  }
68  $this->addColumn($this->lng->txt("skmg_skill"));
69  $this->addColumn($this->lng->txt("skmg_level"));
70 
71  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
72  $this->setRowTemplate("tpl.skill_profile_level_row.html", "Services/Skill");
73 
74  if ($access_manager->hasManageProfilesPermission()) {
75  $this->addMultiCommand("confirmLevelAssignmentRemoval", $lng->txt("skmg_remove_levels"));
76  if (count($this->profile->getSkillLevels()) > 0) {
77  $this->addCommandButton("saveLevelOrder", $lng->txt("skmg_save_order"));
78  }
79  }
80  }
81 
82  protected function fillRow(array $a_set): void
83  {
84  $tree_id = $this->tree_repo->getTreeIdForNodeId($a_set["base_skill_id"]);
85  $node_manager = $this->skill_manager->getTreeNodeManager($tree_id);
86  $this->tpl->setVariable(
87  "SKILL_TITLE",
88  $node_manager->getWrittenPath(
89  $a_set["base_skill_id"],
90  $a_set["tref_id"]
91  )
92  );
93 
94  $this->tpl->setVariable("LEVEL_TITLE", ilBasicSkill::lookupLevelTitle($a_set["level_id"]));
95 
96  $access_manager = $this->skill_manager->getTreeAccessManager($this->requested_ref_id);
97  if ($access_manager->hasManageProfilesPermission()) {
98  $this->tpl->setCurrentBlock("checkbox");
99  $this->tpl->setVariable(
100  "ID",
101  ((int) $a_set["base_skill_id"]) . ":" . ((int) $a_set["tref_id"]) . ":" . ((int) $a_set["level_id"]) .
102  ":" . ((int) $a_set["order_nr"])
103  );
104  $this->tpl->setVariable("SKILL_ID", (int) $a_set["base_skill_id"]);
105  $this->tpl->setVariable("TREF_ID", (int) $a_set["tref_id"]);
106  $this->tpl->parseCurrentBlock();
107  $this->tpl->setCurrentBlock("order");
108  $this->tpl->setVariable("ORDER_NR", (int) $a_set["order_nr"]);
109  $this->tpl->parseCurrentBlock();
110  }
111  }
112 }
TableGUI class for skill profile levels.
setData(array $a_data)
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...
setFormAction(string $a_form_action, bool $a_multipart=false)
__construct( $a_parent_obj, string $a_parent_cmd, SkillProfile $a_profile)
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
Request wrapper for guis in skill administration.
static lookupLevelTitle(int $a_id)
ilLanguage $lng
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
__construct(Container $dic, ilPlugin $plugin)
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)
addMultiCommand(string $a_cmd, string $a_text)