ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilShibbolethRoleAssignmentTableGUI.php
Go to the documentation of this file.
1 <?php
2 /******************************************************************************
3  *
4  * This file is part of ILIAS, a powerful learning management system.
5  *
6  * ILIAS is licensed with the GPL-3.0, you should have received a copy
7  * of said license along with the source code.
8  *
9  * If this is not the case or you just want to try ILIAS, you'll find
10  * us at:
11  * https://www.ilias.de
12  * https://github.com/ILIAS-eLearning
13  *
14  *****************************************************************************/
25 {
26  public function __construct(ilAuthShibbolethSettingsGUI $a_parent_obj, string $a_parent_cmd = '')
27  {
28  global $DIC;
29  $lng = $DIC['lng'];
30  $ilCtrl = $DIC['ilCtrl'];
31  $this->lng = $lng;
32  $this->ctrl = $ilCtrl;
33  parent::__construct($a_parent_obj, $a_parent_cmd);
34  $this->addColumn('', 'f', 1);
35  $this->addColumn($this->lng->txt('shib_rule_type'), 'type', "20%");
36  $this->addColumn($this->lng->txt('shib_ilias_role'), 'role', "30%");
37  $this->addColumn($this->lng->txt('shib_rule_condition'), 'condition', "20%");
38  $this->addColumn($this->lng->txt('shib_add_remove'), 'add_remove', "30%");
39  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
40  $this->setRowTemplate("tpl.show_role_assignment_row.html", "Services/AuthShibboleth");
41  $this->setDefaultOrderField('type');
42  $this->setDefaultOrderDirection("desc");
43  }
44 
45  protected function fillRow(array $a_set): void
46  {
47  $this->tpl->setVariable('VAL_ID', $a_set['id']);
48  $this->tpl->setVariable('VAL_TYPE', $a_set['type']);
49  $this->tpl->setVariable('VAL_CONDITION', $a_set['condition']);
50  $this->tpl->setVariable('VAL_ROLE', $a_set['role']);
51  $this->tpl->setVariable('TXT_EDIT', $this->lng->txt('edit'));
52  if ($a_set['add']) {
53  $this->tpl->setVariable('STATA_SRC', ilUtil::getImagePath('icon_ok.svg'));
54  $this->tpl->setVariable('STATA_ALT', $this->lng->txt('yes'));
55  } else {
56  $this->tpl->setVariable('STATA_SRC', ilUtil::getImagePath('icon_not_ok.svg'));
57  $this->tpl->setVariable('STATA_ALT', $this->lng->txt('no'));
58  }
59  if ($a_set['remove']) {
60  $this->tpl->setVariable('STATB_SRC', ilUtil::getImagePath('icon_ok.svg'));
61  $this->tpl->setVariable('STATB_ALT', $this->lng->txt('yes'));
62  } else {
63  $this->tpl->setVariable('STATB_SRC', ilUtil::getImagePath('icon_not_ok.svg'));
64  $this->tpl->setVariable('STATB_ALT', $this->lng->txt('no'));
65  }
66  $this->ctrl->setParameter($this->getParentObject(), 'rule_id', $a_set['id']);
67  $this->tpl->setVariable('EDIT_LINK', $this->ctrl->getLinkTarget($this->getParentObject(), 'editRoleAssignment'));
68  }
69 
70 
71  public function parse(array $rule_objs): void
72  {
73  $records_arr = [];
74  foreach ($rule_objs as $rule) {
75  $tmp_arr['id'] = $rule->getRuleId();
76  $tmp_arr['type'] = $rule->isPluginActive() ? $this->lng->txt('shib_role_by_plugin') : $this->lng->txt('shib_role_by_attribute');
77  $tmp_arr['add'] = $rule->isAddOnUpdateEnabled();
78  $tmp_arr['remove'] = $rule->isRemoveOnUpdateEnabled();
79  $tmp_arr['condition'] = $rule->conditionToString();
80  $tmp_arr['role'] = ilObject::_lookupTitle($rule->getRoleId());
81  $records_arr[] = $tmp_arr;
82  }
83  $this->setData($records_arr);
84  }
85 }
setData(array $a_data)
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)
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
ilLanguage $lng
global $DIC
Definition: feed.php:28
static _lookupTitle(int $obj_id)
setDefaultOrderField(string $a_defaultorderfield)
__construct(ilAuthShibbolethSettingsGUI $a_parent_obj, string $a_parent_cmd='')
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setDefaultOrderDirection(string $a_defaultorderdirection)
__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)