ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilRoleSelectionTableGUI.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
26 {
27  protected ilRbacReview $review;
28 
29  public function __construct(object $a_parent_obj, string $a_parent_cmd)
30  {
31  global $DIC;
32 
33  $this->review = $DIC->rbac()->review();
34 
35  parent::__construct($a_parent_obj, $a_parent_cmd);
36  $this->addColumn('', 'f', (string) 1);
37  $this->addColumn($this->lng->txt('title'), 'title', "70%");
38  $this->addColumn($this->lng->txt('context'), 'context', "30%");
39 
40  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
41  $this->setRowTemplate("tpl.show_role_selection_row.html", "Services/AccessControl");
42  $this->setDefaultOrderField('type');
43  $this->setDefaultOrderDirection("desc");
44  }
45 
46  protected function fillRow(array $a_set): void
47  {
48  $this->tpl->setVariable('VAL_ID', $a_set['id']);
49  $this->tpl->setVariable('VAL_TITLE', $a_set['title']);
50  if (strlen($a_set['description'])) {
51  $this->tpl->setVariable('VAL_DESC', $a_set['description']);
52  }
53  $this->tpl->setVariable('VAL_CONTEXT', $a_set['context']);
54  }
55 
56  public function parse(array $entries): void
57  {
58  $records_arr = [];
59  foreach ($entries as $entry) {
60  $tmp_arr['id'] = $entry['obj_id'];
61  $tmp_arr['title'] = ilObjRole::_getTranslation(ilObject::_lookupTitle($entry['obj_id']));
62  $tmp_arr['description'] = ilObject::_lookupDescription($entry['obj_id']);
63  $tmp_arr['context'] = ilObject::_lookupTitle($this->review->getObjectOfRole((int) $entry['obj_id']));
64 
65  $records_arr[] = $tmp_arr;
66  }
67  $this->setData($records_arr);
68  }
69 }
setData(array $a_data)
setFormAction(string $a_form_action, bool $a_multipart=false)
global $DIC
Definition: feed.php:28
static _lookupTitle(int $obj_id)
setDefaultOrderField(string $a_defaultorderfield)
static _getTranslation(string $a_role_title)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setDefaultOrderDirection(string $a_defaultorderdirection)
__construct(object $a_parent_obj, string $a_parent_cmd)
static _lookupDescription(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__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)