ILIAS  eassessment Revision 61809
 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 require_once 'Services/Mail/classes/class.ilMailFormCall.php';
6 
16 {
17  protected $role_id;
18 
22  function __construct($a_parent_obj, $a_parent_cmd, $a_role_id)
23  {
24  global $ilCtrl, $lng, $ilAccess, $lng, $rbacsystem;
25 
26  $this->setId("rbac_ua_".$a_role_id);
27  $this->role_id = $a_role_id;
28 
29  parent::__construct($a_parent_obj, $a_parent_cmd);
30 // $this->setTitle($this->lng->txt("users"));
31 
32  $this->addColumn("", "", "1", true);
33  $this->addColumn($this->lng->txt("login"), "login", "29%");
34  $this->addColumn($this->lng->txt("firstname"), "firstname", "29%");
35  $this->addColumn($this->lng->txt("lastname"), "lastname", "29%");
36  $this->addColumn($this->lng->txt('actions'),'','13%');
37 
38  $this->setExternalSorting(true);
39  $this->setExternalSegmentation(true);
40  $this->setEnableHeader(true);
41  $this->setFormAction($ilCtrl->getFormAction($this->parent_obj, $a_parent_cmd));
42  $this->setRowTemplate("tpl.user_assignment_row.html", "Services/AccessControl");
43 
44  $this->setEnableTitle(true);
45  $this->setDefaultOrderField("login");
46  $this->setDefaultOrderDirection("asc");
47 
48  $this->setSelectAllCheckbox("user_id[]");
49 
50  $this->addMultiCommand("deassignUser", $lng->txt("remove"));
51  $this->getItems();
52 
53  // mjansen: Used for mail referer link (@see fillRow). I don't want to create a new instance in each fillRow call.
54  include_once './Services/Administration/classes/class.ilAdministrationGUI.php';
55  #$this->topGuiObj = new ilAdministrationGUI();
56  }
57 
62  public function getRoleId()
63  {
64  return $this->role_id;
65  }
66 
70  function getItems()
71  {
72  global $lng,$rbacreview;
73 
74  $this->determineOffsetAndOrder();
75 
76  include_once("./Services/User/classes/class.ilUserQuery.php");
77 
78  $usr_data = ilUserQuery::getUserListData(
83  '',
84  '',
85  null,
86  false,
87  false,
88  0,
89  $this->getRoleId()
90  );
91 
92  if($rbacreview->isAssigned(SYSTEM_USER_ID, $this->getRoleId()))
93  {
94  $this->setMaxCount($usr_data["cnt"] - 1);
95  }
96  else
97  {
98  $this->setMaxCount($usr_data["cnt"]);
99  }
100  $this->setData($usr_data["set"]);
101  }
102 
103 
104 
108  protected function fillRow($user)
109  {
110  global $ilCtrl, $lng;
111 
112  $this->tpl->setVariable("VAL_FIRSTNAME", $user["firstname"]);
113  $this->tpl->setVariable("VAL_LASTNAME", $user["lastname"]);
114 
115  if($user['usr_id'] != SYSTEM_USER_ID and
116  ($user['usr_id'] != ANONYMOUS_USER_ID or $this->getRoleId() != ANONYMOUS_ROLE_ID))
117  {
118  $this->tpl->setVariable("ID", $user["usr_id"]);
119  }
120 
121  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
122  $actions = new ilAdvancedSelectionListGUI();
123  $actions->setSelectionHeaderClass("small");
124  $actions->setItemLinkClass("small");
125 
126  $actions->setListTitle($lng->txt('actions'));
127  $actions->setId($user['usr_id']);
128 
129  #$link_contact = ilMailFormCall::_getLinkTarget(
130  # $this->topGuiObj, 'frameset',
131  # array('fr' => rawurlencode(base64_encode($ilCtrl->getLinkTarget($this->getParentObject(), 'userassignment', '', false, false)))),
132  # array('type' => 'new', 'rcp_to' => urlencode($user['login']))
133  #);
134  $actions->addItem(
135  $lng->txt('message'),
136  '',
137  $link_contact
138  );
139 
140  if(strtolower($_GET["baseClass"]) == 'iladministrationgui' && $_GET["admin_mode"] == "settings")
141  {
142  $ilCtrl->setParameterByClass("ilobjusergui", "ref_id", 7);
143  $ilCtrl->setParameterByClass("ilobjusergui", "obj_id", $user["usr_id"]);
144 
145  $link_change = $ilCtrl->getLinkTargetByClass(array("iladministrationgui", "ilobjusergui"), "view");
146 
147  $this->tpl->setVariable('VAL_LOGIN',$user['login']);
148  $this->tpl->setVariable('HREF_LOGIN',$link_change);
149  $actions->addItem(
150  $this->lng->txt("edit"),
151  '',
152  $link_change
153  );
154  }
155  else
156  {
157  $this->tpl->setVariable('VAL_PLAIN_LOGIN',$user['login']);
158  }
159 
160  if(($this->getRoleId() != SYSTEM_ROLE_ID or $user['usr_id'] != SYSTEM_USER_ID) and
161  ($this->getRoleId() != ANONYMOUS_ROLE_ID or $user['usr_id'] != ANONYMOUS_USER_ID))
162  {
163  $ilCtrl->setParameter($this->getParentObject(), "user_id", $user["usr_id"]);
164  $link_leave = $ilCtrl->getLinkTarget($this->getParentObject(),"deassignUser");
165 
166  $actions->addItem(
167  $this->lng->txt('remove'),
168  '',
169  $link_leave
170  );
171  }
172 
173  $this->tpl->setVariable('VAL_ACTIONS',$actions->getHTML());
174  }
175 
176 }
177 ?>