ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
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 $lng, $ilCtrl, $ilTabs;
21  $this->ctrl = $ilCtrl;
22  $this->tabs = $ilTabs;
23  $this->lng = $lng;
24 
25  $this->setPrefix("sr_other_role_".$role_id);
26  $this->setFormName('sr_other_role_'.$role_id);
27  $this->setId("sr_other_role_".$role_id);
28  $this->setRoleId($role_id);
29 
30 
31  $this->setTableHeaders();
32  $this->setTopCommands(true);
33  $this->setEnableHeader(true);
34  $this->setShowRowsSelector(true);
35  $this->setShowTemplates(false);
36  $this->setEnableHeader(true);
37  $this->setDefaultOrderField("role");
38  $this->setEnableTitle(true);
39  $this->setTitle(ilObjRole::_lookupTitle($role_id));
40  $this->setRowTemplate("tpl.staff_row.html", "Modules/OrgUnit");
41  }
42 //
43 // public function getHTML(){
44 // $this->parseData();
45 // return parent::getHTML();
46 // }
47 
48  protected function setTableHeaders(){
49  $this->addColumn($this->lng->txt("firstname"), "first_name");
50  $this->addColumn($this->lng->txt("lastname"), "last_name");
51  $this->addColumn($this->lng->txt("action"));
52  }
53 
54  public function readData(){
55  $this->parseData();
56  }
57 
58  public function parseData(){
59  global $rbacreview;
60 
61  $data = $this->parseRows($rbacreview->assignedUsers($this->getRoleId()));
62 
63  $this->setData($data);
64  }
65 
66  protected function parseRows($user_ids){
67  $data = array();
68  foreach($user_ids as $user_id){
69  $set = array();
70  $this->setRowForUser($set, $user_id);
71  $data[] = $set;
72  }
73  return $data;
74  }
75 
79  public function setRoleId($role_id)
80  {
81  $this->role_id = $role_id;
82  }
83 
87  public function getRoleId()
88  {
89  return $this->role_id;
90  }
91 
92  protected function setRowForUser(&$set, $user_id){
93  $user = new ilObjUser($user_id);
94  $set["first_name"] = $user->getFirstname();
95  $set["last_name"] = $user->getLastname();
96  $set["user_object"] = $user;
97  $set["user_id"] = $user_id;
98  }
99 
100  function fillRow($set){
101  global $ilUser, $Access, $lng, $ilAccess;
102  $this->tpl->setVariable("FIRST_NAME", $set["first_name"]);
103  $this->tpl->setVariable("LAST_NAME", $set["last_name"]);
104 
105 
106  if($ilAccess->checkAccess("write", "", $_GET["ref_id"]) && !$this->recursive){
107  $this->ctrl->setParameterByClass("ilobjorgunitgui", "obj_id", $set["user_id"]);
108  $this->ctrl->setParameterByClass("ilObjOrgUnitGUI","role_id",$this->role_id);
109 
110  $selection = new ilAdvancedSelectionListGUI();
111  $selection->setListTitle($lng->txt("Actions"));
112  $selection->setId("selection_list_user_other_roles_".$set["user_id"]);
113  $selection->addItem($this->lng->txt("remove"), "delete_from_role", $this->ctrl->getLinkTargetByClass("ilOrgUnitStaffGUI", "confirmRemoveFromRole"));
114  }
115  $this->tpl->setVariable("ACTIONS", $selection->getHTML());
116 
117  }
118 
119 
120 
121 }
122 ?>
setFormName($a_formname)
Set Form name.
__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)
setRowTemplate($a_template, $a_template_dir="")
Set row template.
User interface class for advanced drop-down selection lists.
Class ilOrgUnitOtherRolesTableGUI.
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setEnableHeader($a_enableheader)
Set Enable Header.
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.