ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 require_once("./Services/Table/classes/class.ilTable2GUI.php");
11 
12 
13  public function __construct($parent_obj, $parent_cmd, $role_id, $template_context = ""){
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 
34  $this->setTableHeaders();
35  $this->setTopCommands(true);
36  $this->setEnableHeader(true);
37  $this->setShowRowsSelector(true);
38  $this->setShowTemplates(false);
39  $this->setEnableHeader(true);
40  $this->setDefaultOrderField("role");
41  $this->setEnableTitle(true);
42  $this->setTitle(ilObjRole::_lookupTitle($role_id));
43  $this->setRowTemplate("tpl.staff_row.html", "Modules/OrgUnit");
44  }
45 //
46 // public function getHTML(){
47 // $this->parseData();
48 // return parent::getHTML();
49 // }
50 
51  protected function setTableHeaders(){
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  $this->parseData();
59  }
60 
61  public function parseData(){
62  global $DIC;
63  $rbacreview = $DIC['rbacreview'];
64 
65  $data = $this->parseRows($rbacreview->assignedUsers($this->getRoleId()));
66 
67  $this->setData($data);
68  }
69 
70  protected function parseRows($user_ids){
71  $data = array();
72  foreach($user_ids as $user_id){
73  $set = array();
74  $this->setRowForUser($set, $user_id);
75  $data[] = $set;
76  }
77  return $data;
78  }
79 
83  public function setRoleId($role_id)
84  {
85  $this->role_id = $role_id;
86  }
87 
91  public function getRoleId()
92  {
93  return $this->role_id;
94  }
95 
96  protected function setRowForUser(&$set, $user_id){
97  $user = new ilObjUser($user_id);
98  $set["first_name"] = $user->getFirstname();
99  $set["last_name"] = $user->getLastname();
100  $set["user_object"] = $user;
101  $set["user_id"] = $user_id;
102  }
103 
104  function fillRow($set){
105  global $DIC;
106  $ilUser = $DIC['ilUser'];
107  $ilAccess = $DIC['ilAccess'];
108  $lng = $DIC['lng'];
109  $ilAccess = $DIC['ilAccess'];
110  $this->tpl->setVariable("FIRST_NAME", $set["first_name"]);
111  $this->tpl->setVariable("LAST_NAME", $set["last_name"]);
112 
113 
114  if($ilAccess->checkAccess("write", "", $_GET["ref_id"]) && !$this->recursive){
115  $this->ctrl->setParameterByClass("ilobjorgunitgui", "obj_id", $set["user_id"]);
116  $this->ctrl->setParameterByClass("ilObjOrgUnitGUI","role_id",$this->role_id);
117 
118  $selection = new ilAdvancedSelectionListGUI();
119  $selection->setListTitle($lng->txt("Actions"));
120  $selection->setId("selection_list_user_other_roles_".$set["user_id"]);
121  $selection->addItem($this->lng->txt("remove"), "delete_from_role", $this->ctrl->getLinkTargetByClass("ilOrgUnitStaffGUI", "confirmRemoveFromRole"));
122  }
123  $this->tpl->setVariable("ACTIONS", $selection->getHTML());
124 
125  }
126 
127 
128 
129 }
130 ?>
__construct($a_parent_obj, $a_parent_cmd="", $a_template_context="")
Constructor.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
$_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.
global $lng
Definition: privfeed.php:17
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setEnableHeader($a_enableheader)
Set Enable Header.
global $DIC
setEnableTitle($a_enabletitle)
Set Enable Title.
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.