ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilContributorTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once './Services/Table/classes/class.ilTable2GUI.php';
5 
13 {
17  protected $rbacreview;
18 
19  protected $local_roles; // [array]
20 
28  public function __construct($a_parent_obj, $a_parent_cmd, array $a_roles)
29  {
30  global $DIC;
31 
32  $this->ctrl = $DIC->ctrl();
33  $this->rbacreview = $DIC->rbac()->review();
34  $ilCtrl = $DIC->ctrl();
35 
36  $this->local_roles = $a_roles;
37 
38  parent::__construct($a_parent_obj, $a_parent_cmd);
39 
40  $this->addColumn("", "", 1);
41  $this->addColumn($this->lng->txt("name"), "name");
42  $this->addColumn($this->lng->txt("obj_role"), "role");
43 
44  $this->setDefaultOrderField("name");
45 
46  $this->setRowTemplate("tpl.contributor_row.html", "Modules/Blog");
47  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
48 
49  $this->setSelectAllCheckbox("id"); // #16472
50 
51  if ($this->contributor_ids) {
52  $this->setTitle($this->lng->txt("blog_contributor_container_add"));
53  $this->addMultiCommand("addContributorContainerAction", $this->lng->txt("add"));
54  } else {
55  $this->setTitle($this->lng->txt("blog_contributors"));
56  $this->addMultiCommand("confirmRemoveContributor", $this->lng->txt("remove"));
57  }
58 
59  $this->getItems();
60  }
61 
62  protected function getItems()
63  {
65 
66  $user_map = $assigned = array();
67  foreach ($this->local_roles as $id => $title) {
68  $local = $rbacreview->assignedUsers($id);
69  $assigned = array_merge($assigned, $local);
70  foreach ($local as $user_id) {
71  $user_map[$user_id][] = $title;
72  }
73  }
74 
75  include_once "Services/User/classes/class.ilUserUtil.php";
76 
77  $data = array();
78  foreach (array_unique($assigned) as $id) {
79  $data[] = array("id" => $id,
80  "name" => ilUserUtil::getNamePresentation($id, false, false, "", true),
81  "role" => $user_map[$id]);
82  }
83 
84  $this->setData($data);
85  }
86 
92  protected function fillRow($a_set)
93  {
94  $this->tpl->setVariable("VAL_ID", $a_set["id"]);
95  $this->tpl->setVariable("TXT_NAME", $a_set["name"]);
96  $this->tpl->setVariable("TXT_ROLES", implode(", ", $a_set["role"]));
97  }
98 }
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
global $DIC
Definition: saml.php:7
if(!array_key_exists('StateId', $_REQUEST)) $id
fillRow($a_set)
Fill template row.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
addMultiCommand($a_cmd, $a_text)
Add Command button.
__construct($a_parent_obj, $a_parent_cmd, array $a_roles)
Constructor.
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:
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
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.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
List all contributors members of a blog.