ILIAS  release_8 Revision v8.24
class.ilContributorTableGUI.php
Go to the documentation of this file.
1<?php
2
24{
26 protected array $local_roles = [];
27 protected array $contributor_ids = [];
28
29 public function __construct(
30 object $a_parent_obj,
31 string $a_parent_cmd,
32 array $a_roles
33 ) {
34 global $DIC;
35
36 $this->ctrl = $DIC->ctrl();
37 $this->rbacreview = $DIC->rbac()->review();
38 $ilCtrl = $DIC->ctrl();
39
40 $this->local_roles = $a_roles;
41
42 parent::__construct($a_parent_obj, $a_parent_cmd);
43
44 $this->addColumn("", "", 1);
45 $this->addColumn($this->lng->txt("name"), "name");
46 $this->addColumn($this->lng->txt("obj_role"), "role");
47
48 $this->setDefaultOrderField("name");
49
50 $this->setRowTemplate("tpl.contributor_row.html", "Modules/Blog");
51 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
52
53 $this->setSelectAllCheckbox("id"); // #16472
54
55 if ($this->contributor_ids) {
56 $this->setTitle($this->lng->txt("blog_contributor_container_add"));
57 $this->addMultiCommand("addContributorContainerAction", $this->lng->txt("add"));
58 } else {
59 $this->setTitle($this->lng->txt("blog_contributors"));
60 $this->addMultiCommand("confirmRemoveContributor", $this->lng->txt("remove"));
61 }
62
63 $this->getItems();
64 }
65
66 protected function getItems(): void
67 {
69
70 $user_map = $assigned = array();
71 foreach ($this->local_roles as $id => $title) {
72 $local = $rbacreview->assignedUsers($id);
73 $assigned = array_merge($assigned, $local);
74 foreach ($local as $user_id) {
75 $user_map[$user_id][] = $title;
76 }
77 }
78
79 $data = array();
80 foreach (array_unique($assigned) as $id) {
81 $data[] = array("id" => $id,
82 "name" => ilUserUtil::getNamePresentation($id, false, false, "", true),
83 "role" => $user_map[$id]);
84 }
85
86 $this->setData($data);
87 }
88
89 protected function fillRow(array $a_set): void
90 {
91 $this->tpl->setVariable("VAL_ID", $a_set["id"]);
92 $this->tpl->setVariable("TXT_NAME", $a_set["name"]);
93 $this->tpl->setVariable("TXT_ROLES", implode(", ", $a_set["role"]));
94 }
95}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
fillRow(array $a_set)
Standard Version of Fill Row.
__construct(object $a_parent_obj, string $a_parent_cmd, array $a_roles)
class ilRbacReview Contains Review functions of core Rbac.
assignedUsers(int $a_rol_id)
get all assigned users to a given role @access public
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="")
addMultiCommand(string $a_cmd, string $a_text)
setFormAction(string $a_form_action, bool $a_multipart=false)
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)
setDefaultOrderField(string $a_defaultorderfield)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setData(array $a_data)
Set table data.
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link="", bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc