ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilContProfileTableGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2020 ILIAS open source, Extended GPL, see docs/LICENSE */
4
13{
17 protected $ctrl;
18
22 protected $lng;
23
27 protected $tpl;
28
32 protected $ui_factory;
33
37 protected $ui_renderer;
38
43
48
52 protected $skmg_settings;
53
57 public function __construct(
58 $a_parent_obj,
59 $a_parent_cmd,
60 ilContainerGlobalProfiles $a_cont_glb_profiles,
61 ilContainerLocalProfiles $a_cont_lcl_profiles
62 ) {
63 global $DIC;
64
65 $this->ctrl = $DIC->ctrl();
66 $this->lng = $DIC->language();
67 $this->tpl = $DIC["tpl"];
68 $this->ui_factory = $DIC->ui()->factory();
69 $this->ui_renderer = $DIC->ui()->renderer();
70
71 $this->container_global_profiles = $a_cont_glb_profiles;
72 $this->container_local_profiles = $a_cont_lcl_profiles;
73 $this->skmg_settings = new ilSkillManagementSettings();
74
75 parent::__construct($a_parent_obj, $a_parent_cmd);
76 $this->setData($this->getProfiles());
77 $this->setTitle($this->lng->txt("cont_skill_profiles"));
78
79 $this->addColumn("", "", "1", true);
80 $this->addColumn($this->lng->txt("cont_skill_profile"), "", "1");
81 $this->addColumn($this->lng->txt("context"), "", "1");
82 $this->addColumn($this->lng->txt("actions"), "", "1");
83
84 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
85 $this->setRowTemplate("tpl.cont_profile_row.html", "Services/Container/Skills");
86 $this->setSelectAllCheckbox("id");
87
88 if ($this->skmg_settings->getLocalAssignmentOfProfiles()) {
89 $this->addMultiCommand("confirmRemoveSelectedGlobalProfiles", $this->lng->txt("remove"));
90 }
91 if ($this->skmg_settings->getAllowLocalProfiles()) {
92 $this->addMultiCommand("confirmDeleteSelectedLocalProfiles", $this->lng->txt("delete"));
93 }
94 }
95
101 public function getProfiles()
102 {
103 $profiles = array();
104 if ($this->skmg_settings->getLocalAssignmentOfProfiles()) {
105 foreach ($this->container_global_profiles->getProfiles() as $gp) {
106 $profiles[$gp["profile_id"]] = array(
107 "profile_id" => $gp["profile_id"],
108 "title" => ilSkillProfile::lookupTitle($gp["profile_id"])
109 );
110 }
111 }
112 if ($this->skmg_settings->getAllowLocalProfiles()) {
113 foreach ($this->container_local_profiles->getProfiles() as $lp) {
114 $profiles[$lp["profile_id"]] = array(
115 "profile_id" => $lp["profile_id"],
116 "title" => ilSkillProfile::lookupTitle($lp["profile_id"])
117 );
118 }
119 }
120 ksort($profiles);
121
122 return $profiles;
123 }
124
128 protected function fillRow($a_set)
129 {
135
136 $tpl->setVariable("TITLE", $a_set["title"]);
137 $tpl->setVariable("ID", $a_set["profile_id"]);
138
139 if (ilSkillProfile::lookupRefId($a_set["profile_id"]) > 0) {
140 $tpl->setVariable("CONTEXT", $lng->txt("skmg_context_local"));
141 } else {
142 $tpl->setVariable("CONTEXT", $lng->txt("skmg_context_global"));
143 }
144
145 $ctrl->setParameter($this->parent_obj, "profile_id", $a_set["profile_id"]);
146 $ctrl->setParameterByClass("ilskillprofilegui", "sprof_id", $a_set["profile_id"]);
147 $ctrl->setParameterByClass("ilskillprofilegui", "local_context", true);
148
149 if (ilSkillProfile::lookupRefId($a_set["profile_id"]) > 0) {
150 $items = array(
151 $ui_factory->link()->standard(
152 $lng->txt("edit"),
153 $ctrl->getLinkTargetByClass("ilskillprofilegui", "showLevelsWithLocalContext")
154 ),
155 $ui_factory->link()->standard(
156 $lng->txt("delete"),
157 $ctrl->getLinkTarget($this->parent_obj, "confirmDeleteSingleLocalProfile")
158 )
159 );
160 } else {
161 $items = array(
162 $ui_factory->link()->standard(
163 $lng->txt("remove"),
164 $ctrl->getLinkTarget($this->parent_obj, "confirmRemoveSingleGlobalProfile")
165 )
166 );
167 }
168
169 $dropdown = $this->ui_factory->dropdown()->standard($items)->withLabel($lng->txt("actions"));
170 $tpl->setVariable("ACTIONS", $ui_renderer->render($dropdown));
171 }
172}
An exception for terminatinating execution or to throw for unit testing.
TableGUI class for competence profiles in containers.
__construct( $a_parent_obj, $a_parent_cmd, ilContainerGlobalProfiles $a_cont_glb_profiles, ilContainerLocalProfiles $a_cont_lcl_profiles)
Constructor.
Global competence profiles of a container.
Local competence profiles of a container.
static lookupRefId($a_id)
static lookupTitle($a_id)
Lookup title.
Class ilTable2GUI.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc