ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilAssignedUsersTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Table/classes/class.ilTable2GUI.php");
5 
15 {
16  protected $role_id;
17 
21  function __construct($a_parent_obj, $a_parent_cmd, $a_role_id)
22  {
23  global $ilCtrl, $lng, $ilAccess, $lng, $rbacsystem;
24 
25  $this->setId("rbac_ua_".$a_role_id);
26  $this->role_id = $a_role_id;
27 
28  parent::__construct($a_parent_obj, $a_parent_cmd);
29 // $this->setTitle($this->lng->txt("users"));
30 
31  $this->addColumn("", "", "1", true);
32  $this->addColumn($this->lng->txt("login"), "login", "29%");
33  $this->addColumn($this->lng->txt("firstname"), "firstname", "29%");
34  $this->addColumn($this->lng->txt("lastname"), "lastname", "29%");
35  $this->addColumn($this->lng->txt('actions'),'','13%');
36 
37  $this->setExternalSorting(true);
38  $this->setExternalSegmentation(true);
39  $this->setEnableHeader(true);
40  $this->setFormAction($ilCtrl->getFormAction($this->parent_obj, $a_parent_cmd));
41  $this->setRowTemplate("tpl.user_assignment_row.html", "Services/AccessControl");
42 
43  $this->setEnableTitle(true);
44  $this->setDefaultOrderField("login");
45  $this->setDefaultOrderDirection("asc");
46 
47  $this->setSelectAllCheckbox("user_id[]");
48 
49  $this->addMultiCommand("deassignUser", $lng->txt("delete"));
50  $this->getItems();
51  }
52 
57  public function getRoleId()
58  {
59  return $this->role_id;
60  }
61 
65  function getItems()
66  {
67  global $lng,$rbacreview;
68 
69  $this->determineOffsetAndOrder();
70 
71  include_once("./Services/User/classes/class.ilUserQuery.php");
72 
73  $usr_data = ilUserQuery::getUserListData(
78  '',
79  '',
80  null,
81  false,
82  false,
83  0,
84  $this->getRoleId()
85  );
86 
87  if($rbacreview->isAssigned(SYSTEM_USER_ID, $this->getRoleId()))
88  {
89  $this->setMaxCount($usr_data["cnt"] - 1);
90  }
91  else
92  {
93  $this->setMaxCount($usr_data["cnt"]);
94  }
95  $this->setData($usr_data["set"]);
96  }
97 
98 
99 
103  protected function fillRow($user)
104  {
105  global $ilCtrl, $lng;
106 
107  $this->tpl->setVariable("VAL_LOGIN", $user["login"]);
108  $this->tpl->setVariable("VAL_FIRSTNAME", $user["firstname"]);
109  $this->tpl->setVariable("VAL_LASTNAME", $user["lastname"]);
110 
111  if($user['usr_id'] != SYSTEM_USER_ID and
112  ($user['usr_id'] != ANONYMOUS_USER_ID or $this->getRoleId() != ANONYMOUS_ROLE_ID))
113  {
114  $this->tpl->setVariable("ID", $user["usr_id"]);
115  }
116 
117  include_once("./Services/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
118  $actions = new ilAdvancedSelectionListGUI();
119  $actions->setSelectionHeaderClass("small");
120  $actions->setItemLinkClass("small");
121 
122  $actions->setListTitle($lng->txt('actions'));
123  $actions->setId($user['usr_id']);
124 
125  $link_contact = "ilias.php?baseClass=ilMailGUI&type=new&rcp_to=".urlencode($user["login"]);
126  $actions->addItem(
127  $lng->txt('message'),
128  '',
129  $link_contact
130  );
131 
132  if(strtolower($_GET["baseClass"]) == 'iladministrationgui' && $_GET["admin_mode"] == "settings")
133  {
134  $ilCtrl->setParameterByClass("ilobjusergui", "ref_id", 7);
135  $ilCtrl->setParameterByClass("ilobjusergui", "obj_id", $user["usr_id"]);
136  $link_change = $ilCtrl->getLinkTargetByClass(array("iladministrationgui", "ilobjusergui"), "view");
137  $actions->addItem(
138  $this->lng->txt("edit"),
139  '',
140  $link_change
141  );
142  }
143 
144  if(($this->getRoleId() != SYSTEM_ROLE_ID or $user['usr_id'] != SYSTEM_USER_ID) and
145  ($this->getRoleId() != ANONYMOUS_ROLE_ID or $user['usr_id'] != ANONYMOUS_USER_ID))
146  {
147  $ilCtrl->setParameter($this->getParentObject(), "user_id", $user["usr_id"]);
148  $link_leave = $ilCtrl->getLinkTarget($this->getParentObject(),"deassignUser");
149 
150  $actions->addItem(
151  $this->lng->txt('remove'),
152  '',
153  $link_leave
154  );
155  }
156 
157  $this->tpl->setVariable('VAL_ACTIONS',$actions->getHTML());
158  }
159 
160 }
161 ?>