31 public function __construct(
object $a_parent_obj,
string $a_parent_cmd,
int $a_ref_id)
38 $this->positionRepo =
$dic[
"repo.Positions"];
39 $this->permissionRepo =
$dic[
"repo.Permissions"];
40 $this->operationRepo =
$dic[
"repo.Operations"];
42 $this->
lng->loadLanguageModule(
'rbac');
43 $this->
lng->loadLanguageModule(
"orgu");
45 $this->ref_id = $a_ref_id;
47 $this->
setId(
'objpositionperm_' . $this->ref_id);
49 $tpl->addJavaScript(
'assets/js/ilPermSelect.js');
51 $this->
setTitle($this->
lng->txt(
'org_permission_settings'));
54 $this->
setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
56 $this->
setRowTemplate(
"tpl.obj_position_perm_row.html",
"components/ILIAS/OrgUnit");
85 public function fillRow(array $a_set): void
88 if (isset($a_set[
'show_select_all'])) {
93 if (isset($a_set[
'header_command'])) {
99 $objdefinition = $this->
dic()[
'objDefinition'];
100 $is_plugin = $objdefinition->isPlugin($this->
getObjType());
102 foreach ($a_set as $permission) {
103 $position = $permission[
"position"];
104 $op_id = $permission[
"op_id"];
105 $operation = $permission[
"operation"];
106 $this->tpl->setCurrentBlock(
'position_td');
107 $this->tpl->setVariable(
'POSITION_ID', $position->getId());
108 $this->tpl->setVariable(
'PERM_ID', $op_id);
113 $label = $this->
dic()->language()->txt(
'org_op_' . $operation->getOperationString());
116 $this->tpl->setVariable(
'TXT_PERM', $label);
117 $this->tpl->setVariable(
'PERM_LONG', $op_id);
119 if ($permission[
'permission_set']) {
120 $this->tpl->setVariable(
'PERM_CHECKED',
'checked="checked"');
122 if ($permission[
'from_template']) {
123 $this->tpl->setVariable(
'PERM_DISABLED',
'disabled="disabled"');
126 $this->tpl->parseCurrentBlock();
132 $positions = $this->positionRepo->getAllPositions();
138 $operations = $this->operationRepo->getOperationsByContextName($this->
getObjType());
140 $from_templates = [];
141 foreach ($operations as $op) {
142 $ops_ids[] = $op->getOperationId();
145 foreach ($positions as $position) {
146 $ilOrgUnitPermission = $this->permissionRepo->getLocalorDefault(
151 $is_template = $ilOrgUnitPermission->isTemplate();
152 $from_templates[$position->getId()] = $is_template;
155 "op_id" => $op->getOperationId(),
157 "position" => $position,
158 "permission" => $ilOrgUnitPermission,
159 "permission_set" => $ilOrgUnitPermission->isOperationIdSelected($op->getOperationId()),
160 "from_template" => $is_template,
167 "show_select_all" =>
true,
168 "positions" => $positions,
170 "template" => $from_templates,
173 ->isPositionAccessActiveForObject($this->
getObjId())
176 "header_command" =>
true,
177 "positions" => $positions,
178 "template" => $from_templates,
187 foreach ($positions as $position) {
188 $this->
addColumn($position->getTitle(),
'',
'',
'',
false, $position->getDescription());
204 foreach ($row[
"positions"] as $position) {
206 $this->tpl->setCurrentBlock(
'position_select_all');
207 $id = $position->getId();
208 $this->tpl->setVariable(
'JS_ROLE_ID',
$id);
209 $this->tpl->setVariable(
'JS_SUBID', 0);
210 $this->tpl->setVariable(
'JS_ALL_PERMS',
"['" . implode(
"','", $row[
'ops']) .
"']");
211 $this->tpl->setVariable(
'JS_FORM_NAME', $this->
getFormName());
212 $this->tpl->setVariable(
'TXT_SEL_ALL', $this->
lng->txt(
'select_all'));
213 if ($row[
"template"][
$id]) {
214 $this->tpl->setVariable(
'ALL_DISABLED',
"disabled='disabled'");
216 $this->tpl->parseCurrentBlock();
225 foreach ($row[
"positions"] as $position) {
226 $this->tpl->setCurrentBlock(
'header_command');
227 $this->tpl->setVariable(
'POSITION_ID', $position->getId());
228 $this->tpl->setVariable(
'HEADER_COMMAND_TXT', $this->
dic()
230 ->txt(
'positions_override_operations'));
231 if ($this->permissionRepo->find($this->getRefId(), $position->getId())) {
232 $this->tpl->setVariable(
'HEADER_CHECKED',
"checked='checked'");
235 $this->tpl->parseCurrentBlock();
setNoEntriesText(string $a_text)
fillHeaderCommand(array $row)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setFormAction(string $a_form_action, bool $a_multipart=false)
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
Interface Observer Contains several chained tasks and infos about them.
setDisableFilterHiding(bool $a_val=true)
__construct(object $a_parent_obj, string $a_parent_cmd, int $a_ref_id)
ilOrgUnitPermissionDBRepository $permissionRepo
fillSelectAll(array $row)
static _lookupObjId(int $ref_id)
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
static lookupTxtById(string $plugin_id, string $lang_var)
ilOrgUnitOperationDBRepository $operationRepo
initColumns(array $positions)
__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)
disable(string $a_module_name)
language()
description: > Example for rendring a language glyph.
const CMD_SAVE_POSITIONS_PERMISSIONS
static _lookupType(int $id, bool $reference=false)
ilOrgUnitPositionDBRepository $positionRepo
setEnableHeader(bool $a_enableheader)