ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
class.ilLDAPServerTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25{
27 private int $ref_id = 0 ;
28
29 public function __construct(?object $a_parent_obj, string $a_parent_cmd = "", string $a_template_context = "")
30 {
31 parent::__construct($a_parent_obj, $a_parent_cmd, $a_template_context);
32
33 global $DIC;
34 $this->rbacSystem = $DIC->rbac()->system();
35
36 $http_wrapper = $DIC->http()->wrapper();
37 $refinery = $DIC->refinery();
38 if ($http_wrapper->query()->has('ref_id')) {
39 $this->ref_id = (int) $http_wrapper->query()->retrieve(
40 'ref_id',
41 $refinery->kindlyTo()->int()
42 );
43 }
44 $this->setId('ldap_server_list');
45
46 $this->setTitle($this->lng->txt('ldap_servers'));
47 $this->setRowTemplate('tpl.ldap_server_row.html', 'Services/LDAP');
48
49 $this->addColumn($this->lng->txt('active'), '', '1%');
50 $this->addColumn($this->lng->txt('title'), '', '80%');
51 $this->addColumn($this->lng->txt('user'), "", "4%");
52 $this->addColumn($this->lng->txt('actions'), '', '15%');
53
54 $this->importData();
55 }
56
57 private function importData(): void
58 {
60 $this->setData($data);
61 }
62
66 protected function fillRow(array $a_set): void
67 {
68 if ($a_set['active']) {
69 $this->tpl->setVariable('IMAGE_OK', ilUtil::getImagePath('icon_ok.svg'));
70 $this->tpl->setVariable('TXT_OK', $this->lng->txt('active'));
71 } else {
72 $this->tpl->setVariable('IMAGE_OK', ilUtil::getImagePath('icon_not_ok.svg'));
73 $this->tpl->setVariable('TXT_OK', $this->lng->txt('inactive'));
74 }
75
76 $this->tpl->setVariable('VAL_TITLE', $a_set["name"]);
77
78 //user
79 $user = count(ilObjUser::_getExternalAccountsByAuthMode("ldap_" . $a_set["server_id"]));
80 $this->tpl->setVariable('VAL_USER', $user);
81
82 $this->ctrl->setParameter($this->getParentObject(), 'ldap_server_id', $a_set['server_id']);
83 $this->tpl->setVariable('EDIT_LINK', $this->ctrl->getLinkTarget($this->getParentObject(), 'editServerSettings'));
84
85 //actions
86 if ($this->rbacSystem->checkAccess("write", $this->ref_id)) {
87 $list = new ilAdvancedSelectionListGUI();
88 $list->setSelectionHeaderClass('small');
89 $list->setItemLinkClass('small');
90 $list->setId('actl_' . $a_set['server_id']);
91 $list->setListTitle($this->lng->txt('actions'));
92 $list->addItem($this->lng->txt('edit'), '', $this->ctrl->getLinkTarget($this->getParentObject(), 'editServerSettings'));
93
94 if ($a_set['active']) {
95 $list->addItem(
96 $this->lng->txt('deactivate'),
97 '',
98 $this->ctrl->getLinkTarget($this->getParentObject(), 'deactivateServer')
99 );
100 } else {
101 $list->addItem(
102 $this->lng->txt('activate'),
103 '',
104 $this->ctrl->getLinkTarget($this->getParentObject(), 'activateServer')
105 );
106 }
107
108 $list->addItem(
109 $this->lng->txt('delete'),
110 '',
111 $this->ctrl->getLinkTarget($this->getParentObject(), 'confirmDeleteServerSettings')
112 );
113
114 $this->tpl->setVariable('ACTIONS', $list->getHTML());
115 }
116 }
117}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(?object $a_parent_obj, string $a_parent_cmd="", string $a_template_context="")
static _getAllServer()
Get list of all configured servers.
static _getExternalAccountsByAuthMode(string $a_auth_mode, bool $a_read_auth_default=false)
Get list of external account by authentication method Note: If login == ext_account for two user with...
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
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="")
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.
setId(string $a_val)
setData(array $a_data)
Set table data.
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
Refinery Factory $refinery