ILIAS  release_8 Revision v8.24
class.ilLDAPRoleAssignmentTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26{
27 public function __construct(object $a_parent_obj, string $a_parent_cmd = '')
28 {
29 global $DIC;
30
31 $lng = $DIC['lng'];
32 $ilCtrl = $DIC['ilCtrl'];
33
34 $this->lng = $lng;
35 $this->ctrl = $ilCtrl;
36
37 parent::__construct($a_parent_obj, $a_parent_cmd);
38 $this->addColumn('', '', '1');
39 $this->addColumn($this->lng->txt('ldap_rule_type'), 'type', "20%");
40 $this->addColumn($this->lng->txt('ldap_ilias_role'), 'role', "30%");
41 $this->addColumn($this->lng->txt('ldap_rule_condition'), 'condition', "20%");
42 $this->addColumn($this->lng->txt('ldap_add_remove'), '', '30%');
43
44 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
45 $this->setRowTemplate("tpl.show_role_assignment_row.html", "Services/LDAP");
46 $this->setDefaultOrderField('type');
47 $this->setDefaultOrderDirection("desc");
48 }
49
51 protected function fillRow(array $a_set): void
52 {
53 $this->tpl->setVariable('VAL_ID', $a_set['id']);
54 $this->tpl->setVariable('VAL_TYPE', $a_set['type']);
55 $this->tpl->setVariable('VAL_CONDITION', $a_set['condition']);
56 $this->tpl->setVariable('VAL_ROLE', $a_set['role']);
57 $this->tpl->setVariable('TXT_EDIT', $this->lng->txt('edit'));
58
59 if ($a_set['add']) {
60 $this->tpl->setVariable('STATA_SRC', ilUtil::getImagePath('icon_ok.svg'));
61 $this->tpl->setVariable('STATA_ALT', $this->lng->txt('yes'));
62 } else {
63 $this->tpl->setVariable('STATA_SRC', ilUtil::getImagePath('icon_not_ok.svg'));
64 $this->tpl->setVariable('STATA_ALT', $this->lng->txt('no'));
65 }
66 if ($a_set['remove']) {
67 $this->tpl->setVariable('STATB_SRC', ilUtil::getImagePath('icon_ok.svg'));
68 $this->tpl->setVariable('STATB_ALT', $this->lng->txt('yes'));
69 } else {
70 $this->tpl->setVariable('STATB_SRC', ilUtil::getImagePath('icon_not_ok.svg'));
71 $this->tpl->setVariable('STATB_ALT', $this->lng->txt('no'));
72 }
73
74
75 $this->ctrl->setParameter($this->getParentObject(), 'rule_id', $a_set['id']);
76 $this->tpl->setVariable('EDIT_LINK', $this->ctrl->getLinkTarget($this->getParentObject(), 'editRoleAssignment'));
77 }
78
85 public function parse($rule_objs): void
86 {
87 $records_arr = [];
88 foreach ($rule_objs as $rule) {
89 $tmp_arr['id'] = $rule->getRuleId();
90
91 switch ($rule->getType()) {
93 $tmp_arr['type'] = $this->lng->txt('ldap_role_by_attribute');
94 break;
96 $tmp_arr['type'] = $this->lng->txt('ldap_role_by_group');
97 break;
99 $tmp_arr['type'] = $this->lng->txt('ldap_role_by_plugin');
100 break;
101
102 }
103
104 $tmp_arr['condition'] = $rule->conditionToString();
105 $tmp_arr['add'] = $rule->isAddOnUpdateEnabled();
106 $tmp_arr['remove'] = $rule->isRemoveOnUpdateEnabled();
107
108 $tmp_arr['role'] = ilObject::_lookupTitle($rule->getRoleId());
109
110 $records_arr[] = $tmp_arr;
111 }
112
113 $this->setData($records_arr);
114 }
115}
__construct(object $a_parent_obj, string $a_parent_cmd='')
fillRow(array $a_set)
@noinspection DuplicatedCode
static _lookupTitle(int $obj_id)
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)
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)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setDefaultOrderDirection(string $a_defaultorderdirection)
setData(array $a_data)
Set table data.
ilLanguage $lng
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc