ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 ?>