ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilOrgUnitOtherRolesTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
11{
12 public function __construct($parent_obj, $parent_cmd, $role_id, $template_context = "")
13 {
14 parent::__construct($parent_obj, $parent_cmd, $template_context);
15
16 global $DIC;
17 $lng = $DIC['lng'];
18 $ilCtrl = $DIC['ilCtrl'];
19 $ilTabs = $DIC['ilTabs'];
24 $this->ctrl = $ilCtrl;
25 $this->tabs = $ilTabs;
26 $this->lng = $lng;
27
28 $this->setPrefix("sr_other_role_" . $role_id);
29 $this->setFormName('sr_other_role_' . $role_id);
30 $this->setId("sr_other_role_" . $role_id);
31 $this->setRoleId($role_id);
32
33 $this->setTableHeaders();
34 $this->setTopCommands(true);
35 $this->setEnableHeader(true);
36 $this->setShowRowsSelector(true);
37 $this->setShowTemplates(false);
38 $this->setEnableHeader(true);
39 $this->setDefaultOrderField("role");
40 $this->setEnableTitle(true);
41 $this->setTitle(ilObjRole::_lookupTitle($role_id));
42 $this->setRowTemplate("tpl.staff_row.html", "Modules/OrgUnit");
43 }
44 //
45 // public function getHTML(){
46 // $this->parseData();
47 // return parent::getHTML();
48 // }
49
50 protected function setTableHeaders()
51 {
52 $this->addColumn($this->lng->txt("firstname"), "first_name");
53 $this->addColumn($this->lng->txt("lastname"), "last_name");
54 $this->addColumn($this->lng->txt("action"));
55 }
56
57
58 public function readData()
59 {
60 $this->parseData();
61 }
62
63
64 public function parseData()
65 {
66 global $DIC;
67 $rbacreview = $DIC['rbacreview'];
68
69 $data = $this->parseRows($rbacreview->assignedUsers($this->getRoleId()));
70
71 $this->setData($data);
72 }
73
74
75 protected function parseRows($user_ids)
76 {
77 $data = array();
78 foreach ($user_ids as $user_id) {
79 $set = array();
80 $this->setRowForUser($set, $user_id);
81 $data[] = $set;
82 }
83
84 return $data;
85 }
86
87
91 public function setRoleId($role_id)
92 {
93 $this->role_id = $role_id;
94 }
95
96
100 public function getRoleId()
101 {
102 return $this->role_id;
103 }
104
105
106 protected function setRowForUser(&$set, $user_id)
107 {
108 $user = new ilObjUser($user_id);
109 $set["first_name"] = $user->getFirstname();
110 $set["last_name"] = $user->getLastname();
111 $set["user_object"] = $user;
112 $set["user_id"] = $user_id;
113 }
114
115
116 public function fillRow($set)
117 {
118 global $DIC;
119 $ilUser = $DIC['ilUser'];
120 $ilAccess = $DIC['ilAccess'];
121 $lng = $DIC['lng'];
122 $ilAccess = $DIC['ilAccess'];
123 $this->tpl->setVariable("FIRST_NAME", $set["first_name"]);
124 $this->tpl->setVariable("LAST_NAME", $set["last_name"]);
125
126 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]) && !$this->recursive) {
127 $this->ctrl->setParameterByClass("ilobjorgunitgui", "obj_id", $set["user_id"]);
128 $this->ctrl->setParameterByClass("ilObjOrgUnitGUI", "role_id", $this->role_id);
129
130 $selection = new ilAdvancedSelectionListGUI();
131 $selection->setListTitle($lng->txt("Actions"));
132 $selection->setId("selection_list_user_other_roles_" . $set["user_id"]);
133 $selection->addItem($this->lng->txt("remove"), "delete_from_role", $this->ctrl->getLinkTargetByClass("ilOrgUnitStaffGUI", "confirmRemoveFromRole"));
134 }
135 $this->tpl->setVariable("ACTIONS", $selection->getHTML());
136 }
137}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
User interface class for advanced drop-down selection lists.
static _lookupTitle($a_id)
lookup object title
Class ilOrgUnitOtherRolesTableGUI.
fillRow($set)
Standard Version of Fill Row.
Class ilTable2GUI.
setTopCommands($a_val)
Set top commands (display command buttons on top of table, too)
setEnableHeader($a_enableheader)
Set Enable Header.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setPrefix($a_prefix)
set prefix for sort and offset fields (if you have two or more tables on a page that you want to sort...
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setData($a_data)
set table data @access public
__construct($a_parent_obj, $a_parent_cmd="", $a_template_context="")
ilTable2GUI constructor.
setEnableTitle($a_enabletitle)
Set Enable Title.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
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.
setId($a_val)
Set id.
setFormName($a_formname="")
Set Form name.
setShowTemplates($a_value)
Toggle templates.
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc