ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 */
10 {
11  public function __construct($parent_obj, $parent_cmd, $role_id, $template_context = "")
12  {
13  parent::__construct($parent_obj, $parent_cmd, $template_context);
14 
15  global $DIC;
16  $lng = $DIC['lng'];
17  $ilCtrl = $DIC['ilCtrl'];
18  $ilTabs = $DIC['ilTabs'];
23  $this->ctrl = $ilCtrl;
24  $this->tabs = $ilTabs;
25  $this->lng = $lng;
26 
27  $this->setPrefix("sr_other_role_" . $role_id);
28  $this->setFormName('sr_other_role_' . $role_id);
29  $this->setId("sr_other_role_" . $role_id);
30  $this->setRoleId($role_id);
31 
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  public function readData()
58  {
59  $this->parseData();
60  }
61 
62  public function parseData()
63  {
64  global $DIC;
65  $rbacreview = $DIC['rbacreview'];
66 
67  $data = $this->parseRows($rbacreview->assignedUsers($this->getRoleId()));
68 
69  $this->setData($data);
70  }
71 
72  protected function parseRows($user_ids)
73  {
74  $data = array();
75  foreach ($user_ids as $user_id) {
76  $set = array();
77  $this->setRowForUser($set, $user_id);
78  $data[] = $set;
79  }
80  return $data;
81  }
82 
86  public function setRoleId($role_id)
87  {
88  $this->role_id = $role_id;
89  }
90 
94  public function getRoleId()
95  {
96  return $this->role_id;
97  }
98 
99  protected function setRowForUser(&$set, $user_id)
100  {
101  $user = new ilObjUser($user_id);
102  $set["first_name"] = $user->getFirstname();
103  $set["last_name"] = $user->getLastname();
104  $set["user_object"] = $user;
105  $set["user_id"] = $user_id;
106  }
107 
108  public function fillRow($set)
109  {
110  global $DIC;
111  $ilUser = $DIC['ilUser'];
112  $ilAccess = $DIC['ilAccess'];
113  $lng = $DIC['lng'];
114  $ilAccess = $DIC['ilAccess'];
115  $this->tpl->setVariable("FIRST_NAME", $set["first_name"]);
116  $this->tpl->setVariable("LAST_NAME", $set["last_name"]);
117 
118 
119  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]) && !$this->recursive) {
120  $this->ctrl->setParameterByClass("ilobjorgunitgui", "obj_id", $set["user_id"]);
121  $this->ctrl->setParameterByClass("ilObjOrgUnitGUI", "role_id", $this->role_id);
122 
123  $selection = new ilAdvancedSelectionListGUI();
124  $selection->setListTitle($lng->txt("Actions"));
125  $selection->setId("selection_list_user_other_roles_" . $set["user_id"]);
126  $selection->addItem($this->lng->txt("remove"), "delete_from_role", $this->ctrl->getLinkTargetByClass("ilOrgUnitStaffGUI", "confirmRemoveFromRole"));
127  }
128  $this->tpl->setVariable("ACTIONS", $selection->getHTML());
129  }
130 }
__construct($a_parent_obj, $a_parent_cmd="", $a_template_context="")
ilTable2GUI constructor.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
global $DIC
Definition: saml.php:7
$_GET["client_id"]
setShowTemplates($a_value)
Toggle templates.
static _lookupTitle($a_id)
lookup object title
setId($a_val)
Set id.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setTopCommands($a_val)
Set top commands (display command buttons on top of table, too)
Class ilTable2GUI.
setPrefix($a_prefix)
$ilUser
Definition: imgupload.php:18
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
User interface class for advanced drop-down selection lists.
Class ilOrgUnitOtherRolesTableGUI.
setFormName($a_formname="")
Set Form name.
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.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setEnableHeader($a_enableheader)
Set Enable Header.
setEnableTitle($a_enabletitle)
Set Enable Title.