ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilContributorTableGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
11{
15 protected $rbacreview;
16
17 protected $local_roles; // [array]
18
26 public function __construct($a_parent_obj, $a_parent_cmd, array $a_roles)
27 {
28 global $DIC;
29
30 $this->ctrl = $DIC->ctrl();
31 $this->rbacreview = $DIC->rbac()->review();
32 $ilCtrl = $DIC->ctrl();
33
34 $this->local_roles = $a_roles;
35
36 parent::__construct($a_parent_obj, $a_parent_cmd);
37
38 $this->addColumn("", "", 1);
39 $this->addColumn($this->lng->txt("name"), "name");
40 $this->addColumn($this->lng->txt("obj_role"), "role");
41
42 $this->setDefaultOrderField("name");
43
44 $this->setRowTemplate("tpl.contributor_row.html", "Modules/Blog");
45 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
46
47 $this->setSelectAllCheckbox("id"); // #16472
48
49 if ($this->contributor_ids) {
50 $this->setTitle($this->lng->txt("blog_contributor_container_add"));
51 $this->addMultiCommand("addContributorContainerAction", $this->lng->txt("add"));
52 } else {
53 $this->setTitle($this->lng->txt("blog_contributors"));
54 $this->addMultiCommand("confirmRemoveContributor", $this->lng->txt("remove"));
55 }
56
57 $this->getItems();
58 }
59
60 protected function getItems()
61 {
63
64 $user_map = $assigned = array();
65 foreach ($this->local_roles as $id => $title) {
66 $local = $rbacreview->assignedUsers($id);
67 $assigned = array_merge($assigned, $local);
68 foreach ($local as $user_id) {
69 $user_map[$user_id][] = $title;
70 }
71 }
72
73 $data = array();
74 foreach (array_unique($assigned) as $id) {
75 $data[] = array("id" => $id,
76 "name" => ilUserUtil::getNamePresentation($id, false, false, "", true),
77 "role" => $user_map[$id]);
78 }
79
80 $this->setData($data);
81 }
82
88 protected function fillRow($a_set)
89 {
90 $this->tpl->setVariable("VAL_ID", $a_set["id"]);
91 $this->tpl->setVariable("TXT_NAME", $a_set["name"]);
92 $this->tpl->setVariable("TXT_ROLES", implode(", ", $a_set["role"]));
93 }
94}
An exception for terminatinating execution or to throw for unit testing.
List all contributors members of a blog.
__construct($a_parent_obj, $a_parent_cmd, array $a_roles)
Constructor.
fillRow($a_set)
Fill template row.
Class ilTable2GUI.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
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.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc