ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilSamlIdpTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once 'Services/Table/classes/class.ilTable2GUI.php';
5 require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
6 require_once 'Services/Saml/classes/class.ilSamlIdp.php';
7 
13 {
15  protected $mayEdit = true;
16 
24  public function __construct($a_parent_obj, $a_parent_cmd = "", $mayEdit = true)
25  {
26  global $DIC;
27 
28  $f = $DIC->ui()->factory();
29  $renderer = $DIC->ui()->renderer();
30  $this->mayEdit = $mayEdit;
31 
32  $this->setId('saml_idp_list');
33  parent::__construct($a_parent_obj, $a_parent_cmd, '');
34 
35  $this->ctrl = $GLOBALS['DIC']->ctrl();
36 
37  $this->setTitle($this->lng->txt('auth_saml_idps'));
38 
39  $federationMdUrl = rtrim(ILIAS_HTTP_PATH, '/') . '/Services/Saml/lib/metadata.php?client_id=' . CLIENT_ID;
40 
41  $this->setDescription(sprintf(
42  $this->lng->txt('auth_saml_idps_info'),
43  'auth/saml/config/config.php',
44  'auth/saml/config/authsources.php',
45  $renderer->render($f->link()->standard('https://simplesamlphp.org/docs/stable/simplesamlphp-sp', 'https://simplesamlphp.org/docs/stable/simplesamlphp-sp')),
46  $renderer->render($f->link()->standard($federationMdUrl, $federationMdUrl))
47  ));
48  $this->setRowTemplate('tpl.saml_idp_row.html', 'Services/Saml');
49 
50  $this->addColumn($this->lng->txt('saml_tab_head_idp'), '', '80%');
51  $this->addColumn($this->lng->txt('active'), '', '5%');
52  $this->addColumn($this->lng->txt('actions'), '', '15%');
53 
54  $this->getItems();
55  }
56 
60  protected function getItems()
61  {
62  $idp_data = array();
63 
64  foreach (ilSamlIdp::getAllIdps() as $idp) {
65  $idp_data[] = $idp->toArray();
66  }
67 
68  $this->setData($idp_data);
69  }
70 
74  protected function fillRow($a_set)
75  {
76  if ($a_set['is_active']) {
77  $this->tpl->setVariable('IMAGE_OK', ilUtil::getImagePath('icon_ok.svg'));
78  $this->tpl->setVariable('TXT_OK', $this->lng->txt('active'));
79  } else {
80  $this->tpl->setVariable('IMAGE_OK', ilUtil::getImagePath('icon_not_ok.svg'));
81  $this->tpl->setVariable('TXT_OK', $this->lng->txt('inactive'));
82  }
83 
84  $this->tpl->setVariable('NAME', $a_set['entity_id']);
85 
87  $list->setSelectionHeaderClass('small');
88  $list->setItemLinkClass('small');
89  $list->setId('actl_' . $a_set['idp_id']);
90  $list->setListTitle($this->lng->txt('actions'));
91 
92  $this->ctrl->setParameter($this->getParentObject(), 'saml_idp_id', $a_set['idp_id']);
93 
94  $list->addItem(
95  $this->lng->txt('edit'),
96  '',
97  $this->ctrl->getLinkTarget($this->getParentObject(), 'showIdpSettings')
98  );
99 
100  if ($a_set['is_active']) {
101  $list->addItem(
102  $this->lng->txt('deactivate'),
103  '',
104  $this->ctrl->getLinkTarget($this->getParentObject(), 'deactivateIdp')
105  );
106  } else {
107  $list->addItem(
108  $this->lng->txt('activate'),
109  '',
110  $this->ctrl->getLinkTarget($this->getParentObject(), 'activateIdp')
111  );
112  }
113 
114  $list->addItem(
115  $this->lng->txt('delete'),
116  '',
117  $this->ctrl->getLinkTarget($this->getParentObject(), 'confirmDeleteIdp')
118  );
119  $this->ctrl->setParameter($this->getParentObject(), 'saml_idp_id', '');
120 
121  if ($this->mayEdit) {
122  $this->tpl->setVariable('ACTIONS', $list->getHTML());
123  }
124  }
125 }
Class ilSamlIdpTableGUI.
setDescription($a_val)
Set description.
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
global $DIC
Definition: saml.php:7
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
getParentObject()
Get parent object.
setId($a_val)
Set id.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static getAllIdps()
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
User interface class for advanced drop-down selection lists.
$idp
Definition: prp.php:13
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.
__construct($a_parent_obj, $a_parent_cmd="", $mayEdit=true)
ilSamlIdpTableGUI constructor.