ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 {
14  protected $local_roles; // [array]
15 
23  public function __construct($a_parent_obj, $a_parent_cmd, array $a_roles)
24  {
25  global $ilCtrl;
26 
27  $this->local_roles = $a_roles;
28 
29  parent::__construct($a_parent_obj, $a_parent_cmd);
30 
31  $this->addColumn("", "", 1);
32  $this->addColumn($this->lng->txt("name"), "name");
33  $this->addColumn($this->lng->txt("obj_role"), "role");
34 
35  $this->setDefaultOrderField("name");
36 
37  $this->setRowTemplate("tpl.contributor_row.html", "Modules/Blog");
38  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
39 
40  $this->setSelectAllCheckbox("id"); // #16472
41 
42  if($this->contributor_ids)
43  {
44  $this->setTitle($this->lng->txt("blog_contributor_container_add"));
45  $this->addMultiCommand("addContributorContainerAction", $this->lng->txt("add"));
46  }
47  else
48  {
49  $this->setTitle($this->lng->txt("blog_contributors"));
50  $this->addMultiCommand("confirmRemoveContributor", $this->lng->txt("remove"));
51  }
52 
53  $this->getItems();
54  }
55 
56  protected function getItems()
57  {
58  global $rbacreview;
59 
60  $user_map = $assigned = array();
61  foreach($this->local_roles as $id => $title)
62  {
63  $local = $rbacreview->assignedUsers($id);
64  $assigned = array_merge($assigned, $local);
65  foreach($local as $user_id)
66  {
67  $user_map[$user_id][] = $title;
68  }
69  }
70 
71  include_once "Services/User/classes/class.ilUserUtil.php";
72 
73  $data = array();
74  foreach(array_unique($assigned) as $id)
75  {
76  $data[] = array("id" => $id,
77  "name" => ilUserUtil::getNamePresentation($id, false, false, "", true),
78  "role" => $user_map[$id]);
79  }
80 
81  $this->setData($data);
82  }
83 
89  protected function fillRow($a_set)
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 }
96 
97 ?>
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
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.
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)
Default behaviour is:
Class ilTable2GUI.
addMultiCommand($a_cmd, $a_text)
Add Command button.
__construct($a_parent_obj, $a_parent_cmd, array $a_roles)
Constructor.
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.
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.
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.