ILIAS  release_8 Revision v8.24
class.ilSkillProfileTableGUI.php
Go to the documentation of this file.
1<?php
2
23
30{
35 protected int $requested_ref_id = 0;
36 protected int $requested_sprof_id = 0;
37
38 public function __construct($a_parent_obj, string $a_parent_cmd, int $a_skill_tree_id)
39 {
40 global $DIC;
41
42 $this->ctrl = $DIC->ctrl();
43 $this->lng = $DIC->language();
44 $this->access = $DIC->access();
45 $this->admin_gui_request = $DIC->skills()->internal()->gui()->admin_request();
46 $ilCtrl = $DIC->ctrl();
47 $lng = $DIC->language();
48
49 $this->requested_ref_id = $this->admin_gui_request->getRefId();
50 $this->requested_sprof_id = $this->admin_gui_request->getSkillProfileId();
51
52 $this->tree_access_manager = $DIC->skills()->internal()->manager()->getTreeAccessManager($this->requested_ref_id);
53 $this->profile_manager = $DIC->skills()->internal()->manager()->getProfileManager();
54
55 parent::__construct($a_parent_obj, $a_parent_cmd);
56 if ($a_skill_tree_id == 0) {
57 $this->setData($this->getProfiles());
58 } else {
59 $this->setData($this->getProfilesForSkillTree($a_skill_tree_id));
60 }
61 $this->setTitle($lng->txt("skmg_skill_profiles"));
62
63 if ($this->tree_access_manager->hasManageProfilesPermission()) {
64 $this->addColumn("", "", "1px", true);
65 }
66 $this->addColumn($this->lng->txt("title"), "title");
67 $this->addColumn($this->lng->txt("context"));
68 $this->addColumn($this->lng->txt("users"));
69 $this->addColumn($this->lng->txt("roles"));
70 $this->addColumn($this->lng->txt("actions"));
71
72 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
73 $this->setRowTemplate("tpl.skill_profile_row.html", "Services/Skill");
74
75 if ($this->tree_access_manager->hasManageProfilesPermission()) {
76 $this->addMultiCommand("exportProfiles", $lng->txt("export"));
77 $this->addMultiCommand("confirmDeleteProfiles", $lng->txt("delete"));
78 }
79 //$this->addCommandButton("", $lng->txt(""));
80 }
81
82 public function getProfiles(): array
83 {
84 return $this->profile_manager->getProfilesForAllSkillTrees();
85 }
86
87 public function getProfilesForSkillTree(int $a_skill_tree_id): array
88 {
89 return $this->profile_manager->getProfilesForSkillTree($a_skill_tree_id);
90 }
91
92 protected function fillRow(array $a_set): void
93 {
95 $ilCtrl = $this->ctrl;
96
97 $this->tpl->setCurrentBlock("cmd");
98 if ($this->tree_access_manager->hasManageProfilesPermission()) {
99 $this->tpl->setVariable("CMD", $lng->txt("edit"));
100 } else {
101 $this->tpl->setVariable("CMD", $lng->txt("show"));
102 }
103 $ilCtrl->setParameter($this->parent_obj, "sprof_id", $a_set["id"]);
104 $this->tpl->setVariable("CMD_HREF", $ilCtrl->getLinkTarget($this->parent_obj, "showLevels"));
105 $ilCtrl->setParameter($this->parent_obj, "sprof_id", $this->requested_sprof_id);
106 $this->tpl->parseCurrentBlock();
107 if ($this->tree_access_manager->hasManageProfilesPermission()) {
108 $this->tpl->setCurrentBlock("checkbox");
109 $this->tpl->setVariable("ID", $a_set["id"]);
110 $this->tpl->parseCurrentBlock();
111 }
112 $this->tpl->setVariable("TITLE", $a_set["title"]);
113
114 $profile_ref_id = $this->profile_manager->lookupRefId($a_set["id"]);
115 $profile_obj_id = ilContainerReference::_lookupObjectId($profile_ref_id);
116 $profile_obj_title = ilObject::_lookupTitle($profile_obj_id);
117 if ($profile_ref_id > 0) {
118 $this->tpl->setVariable(
119 "CONTEXT",
120 $lng->txt("skmg_context_local") . " (" . $profile_obj_title . ")"
121 );
122 } else {
123 $this->tpl->setVariable("CONTEXT", $lng->txt("skmg_context_global"));
124 }
125
126 $this->tpl->setVariable("NUM_USERS", $this->profile_manager->countUsers($a_set["id"]));
127 $this->tpl->setVariable("NUM_ROLES", $this->profile_manager->countRoles($a_set["id"]));
128 }
129}
Request wrapper for guis in skill administration.
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
@inheritDoc
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 _lookupObjectId(int $ref_id)
static _lookupTitle(int $obj_id)
TableGUI class for skill profiles.
getProfilesForSkillTree(int $a_skill_tree_id)
SkillAdminGUIRequest $admin_gui_request
__construct($a_parent_obj, string $a_parent_cmd, int $a_skill_tree_id)
fillRow(array $a_set)
Standard Version of Fill Row.
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="")
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
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc