ILIAS  release_8 Revision v8.24
class.ilSamlIdpTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26{
28 private bool $hasWriteAccess;
29
30 public function __construct(object $parent_gui, string $parent_cmd, bool $hasWriteAccess)
31 {
32 global $DIC;
33
34 $this->dic = $DIC;
35 $this->hasWriteAccess = $hasWriteAccess;
36
37 $f = $this->dic->ui()->factory();
38 $renderer = $this->dic->ui()->renderer();
39
40 $this->setId('saml_idp_list');
41 parent::__construct($parent_gui, $parent_cmd);
42
43 $this->setTitle($this->lng->txt('auth_saml_idps'));
44
45 $federationMdUrl = rtrim(ILIAS_HTTP_PATH, '/') . '/Services/Saml/lib/metadata.php?client_id=' . CLIENT_ID;
46
47 $this->setDescription(sprintf(
48 $this->lng->txt('auth_saml_idps_info'),
49 'auth/saml/config/config.php',
50 'auth/saml/config/authsources.php',
51 $renderer->render($f->link()->standard(
52 'https://simplesamlphp.org/docs/stable/simplesamlphp-sp',
53 'https://simplesamlphp.org/docs/stable/simplesamlphp-sp'
54 )),
55 $renderer->render($f->link()->standard($federationMdUrl, $federationMdUrl))
56 ));
57 $this->setRowTemplate('tpl.saml_idp_row.html', 'Services/Saml');
58
59 $this->addColumn($this->lng->txt('saml_tab_head_idp'), '', '80%');
60 $this->addColumn($this->lng->txt('active'), '', '5%');
61 $this->addColumn($this->lng->txt('actions'), '', '15%');
62
63 $this->getItems();
64 }
65
66 private function getItems(): void
67 {
68 $idp_data = [];
69
70 foreach (ilSamlIdp::getAllIdps() as $idp) {
71 $idp_data[] = $idp->toArray();
72 }
73
74 $this->setData($idp_data);
75 }
76
77 protected function fillRow(array $a_set): void
78 {
79 if ($a_set['is_active']) {
80 $this->tpl->setVariable('IMAGE_OK', ilUtil::getImagePath('icon_ok.svg'));
81 $this->tpl->setVariable('TXT_OK', $this->lng->txt('active'));
82 } else {
83 $this->tpl->setVariable('IMAGE_OK', ilUtil::getImagePath('icon_not_ok.svg'));
84 $this->tpl->setVariable('TXT_OK', $this->lng->txt('inactive'));
85 }
86
87 $this->tpl->setVariable('NAME', $a_set['entity_id']);
88
89 if ($this->hasWriteAccess) {
90 $list = new ilAdvancedSelectionListGUI();
91 $list->setSelectionHeaderClass('small');
92 $list->setItemLinkClass('small');
93 $list->setId('actl_' . $a_set['idp_id']);
94 $list->setListTitle($this->lng->txt('actions'));
95
96 $this->ctrl->setParameter($this->getParentObject(), 'saml_idp_id', $a_set['idp_id']);
97 $list->addItem(
98 $this->lng->txt('edit'),
99 '',
100 $this->ctrl->getLinkTarget($this->getParentObject(), 'showIdpSettings')
101 );
102 if ($a_set['is_active']) {
103 $list->addItem(
104 $this->lng->txt('deactivate'),
105 '',
106 $this->ctrl->getLinkTarget($this->getParentObject(), 'deactivateIdp')
107 );
108 } else {
109 $list->addItem(
110 $this->lng->txt('activate'),
111 '',
112 $this->ctrl->getLinkTarget($this->getParentObject(), 'activateIdp')
113 );
114 }
115 $list->addItem(
116 $this->lng->txt('delete'),
117 '',
118 $this->ctrl->getLinkTarget($this->getParentObject(), 'confirmDeleteIdp')
119 );
120 $this->ctrl->setParameter($this->getParentObject(), 'saml_idp_id', '');
121
122 $this->tpl->setVariable('ACTIONS', $list->getHTML());
123 }
124 }
125}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:32
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilSamlIdpTableGUI.
fillRow(array $a_set)
Standard Version of Fill Row.
__construct(object $parent_gui, string $parent_cmd, bool $hasWriteAccess)
ILIAS DI Container $dic
static getAllIdps()
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="")
setDescription(string $a_val)
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)
const CLIENT_ID
Definition: constants.php:41
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc