ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  protected $roleAssignmentEditable = true;
19 
25  function __construct($a_parent_obj, $a_parent_cmd, $a_role_id, $a_editable = true)
26  {
27  global $ilCtrl, $lng, $ilAccess, $lng, $rbacsystem;
28 
29  $this->setId("rbac_ua_".$a_role_id);
30  $this->role_id = $a_role_id;
31  $this->roleAssignmentEditable = $a_editable;
32 
33  parent::__construct($a_parent_obj, $a_parent_cmd);
34 // $this->setTitle($this->lng->txt("users"));
35 
36  $this->addColumn("", "", "1", true);
37  $this->addColumn($this->lng->txt("login"), "login", "29%");
38  $this->addColumn($this->lng->txt("firstname"), "firstname", "29%");
39  $this->addColumn($this->lng->txt("lastname"), "lastname", "29%");
40  $this->addColumn($this->lng->txt('actions'),'','13%');
41 
42  $this->setExternalSorting(true);
43  $this->setExternalSegmentation(true);
44  $this->setEnableHeader(true);
45  $this->setFormAction($ilCtrl->getFormAction($this->parent_obj, $a_parent_cmd));
46  $this->setRowTemplate("tpl.user_assignment_row.html", "Services/AccessControl");
47 
48  $this->setEnableTitle(true);
49  $this->setDefaultOrderField("login");
50  $this->setDefaultOrderDirection("asc");
51 
52  $this->setShowRowsSelector(true);
53 
54  if($this->roleAssignmentEditable)
55  {
56  $this->addMultiCommand("deassignUser", $lng->txt("remove"));
57  }
58 
59  $this->setSelectAllCheckbox("user_id[]");
60  $lng->loadLanguageModule('user');
61  $this->addMultiCommand(
62  'addToClipboard',
63  $lng->txt('clipboard_add_btn')
64  );
65 
66 
67  $this->getItems();
68 
69  // mjansen: Used for mail referer link (@see fillRow). I don't want to create a new instance in each fillRow call.
70  include_once './Services/Administration/classes/class.ilAdministrationGUI.php';
71  #$this->topGuiObj = new ilAdministrationGUI();
72  }
73 
78  public function getRoleId()
79  {
80  return $this->role_id;
81  }
82 
87  public function isRoleAssignmentEditable()
88  {
90  }
91 
95  function getItems()
96  {
97  global $lng,$rbacreview;
98 
99  $this->determineOffsetAndOrder();
100 
101  include_once("./Services/User/classes/class.ilUserQuery.php");
102 
103  $usr_data = ilUserQuery::getUserListData(
107  ilUtil::stripSlashes($this->getLimit()),
108  '',
109  '',
110  null,
111  false,
112  false,
113  0,
114  $this->getRoleId()
115  );
116 
117  /*
118  if($rbacreview->isAssigned(SYSTEM_USER_ID, $this->getRoleId()))
119  {
120  $this->setMaxCount($usr_data["cnt"] - 1);
121  }
122  else
123  {
124  */
125  $this->setMaxCount($usr_data["cnt"]);
126  // }
127  $this->setData($usr_data["set"]);
128  }
129 
130 
131 
135  protected function fillRow($user)
136  {
137  global $ilCtrl, $lng;
138 
139  $this->tpl->setVariable("VAL_FIRSTNAME", $user["firstname"]);
140  $this->tpl->setVariable("VAL_LASTNAME", $user["lastname"]);
141 
142  if(
143  $user['usr_id'] != SYSTEM_USER_ID and
144  ($user['usr_id'] != ANONYMOUS_USER_ID or $this->getRoleId() != ANONYMOUS_ROLE_ID) and
145  $this->isRoleAssignmentEditable())
146  {
147  $this->tpl->setVariable("ID", $user["usr_id"]);
148  }
149 
150  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
151  $actions = new ilAdvancedSelectionListGUI();
152  $actions->setSelectionHeaderClass("small");
153  $actions->setItemLinkClass("small");
154 
155  $actions->setListTitle($lng->txt('actions'));
156  $actions->setId($user['usr_id']);
157 
158  $link_contact = ilMailFormCall::getLinkTarget(
159  $this->getParentObject(), $this->getParentCmd(),
160  array('fr' => rawurlencode(base64_encode($ilCtrl->getLinkTarget($this->getParentObject(), 'userassignment', '', false, false)))),
161  array('type' => 'new', 'rcp_to' => $user['login'])
162  );
163  $actions->addItem(
164  $lng->txt('message'),
165  '',
166  $link_contact
167  );
168 
169  if(strtolower($_GET["baseClass"]) == 'iladministrationgui' && $_GET["admin_mode"] == "settings")
170  {
171  $ilCtrl->setParameterByClass("ilobjusergui", "ref_id", 7);
172  $ilCtrl->setParameterByClass("ilobjusergui", "obj_id", $user["usr_id"]);
173 
174  $link_change = $ilCtrl->getLinkTargetByClass(array("iladministrationgui", "ilobjusergui"), "view");
175 
176  $this->tpl->setVariable('VAL_LOGIN',$user['login']);
177  $this->tpl->setVariable('HREF_LOGIN',$link_change);
178  $actions->addItem(
179  $this->lng->txt("edit"),
180  '',
181  $link_change
182  );
183  }
184  else
185  {
186  $this->tpl->setVariable('VAL_PLAIN_LOGIN',$user['login']);
187  }
188 
189  if(
190  ($this->getRoleId() != SYSTEM_ROLE_ID or $user['usr_id'] != SYSTEM_USER_ID) and
191  ($this->getRoleId() != ANONYMOUS_ROLE_ID or $user['usr_id'] != ANONYMOUS_USER_ID) and
192  $this->isRoleAssignmentEditable())
193  {
194  $ilCtrl->setParameter($this->getParentObject(), "user_id", $user["usr_id"]);
195  $link_leave = $ilCtrl->getLinkTarget($this->getParentObject(),"deassignUser");
196 
197  $actions->addItem(
198  $this->lng->txt('remove'),
199  '',
200  $link_leave
201  );
202  }
203 
204  $this->tpl->setVariable('VAL_ACTIONS',$actions->getHTML());
205  }
206 
207 }
208 ?>
setExternalSorting($a_val)
Set external sorting.
static getUserListData($a_order_field, $a_order_dir, $a_offset, $a_limit, $a_string_filter="", $a_activation_filter="", $a_last_login_filter=null, $a_limited_access_filter=false, $a_no_courses_filter=false, $a_course_group_filter=0, $a_role_filter=0, $a_user_folder_filter=null, $a_additional_fields='', $a_user_filter=null, $a_first_letter="")
Get data for user administration list.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
$_GET["client_id"]
setExternalSegmentation($a_val)
Set external segmentation.
getParentCmd()
Get parent command.
getOrderDirection()
Get order direction.
getParentObject()
Get parent object.
setId($a_val)
Set id.
global $ilCtrl
Definition: ilias.php:18
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
Class ilTable2GUI.
__construct($a_parent_obj, $a_parent_cmd, $a_role_id, $a_editable=true)
Constructor.
isRoleAssignmentEditable()
Check if role assignment is editable.
getOffset()
Get offset.
addMultiCommand($a_cmd, $a_text)
Add Command button.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
determineOffsetAndOrder($a_omit_offset=false)
Determine offset and order.
User interface class for advanced drop-down selection lists.
static getLinkTarget($gui, $cmd, Array $gui_params=array(), Array $mail_params=array(), $context_params=array())
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
global $lng
Definition: privfeed.php:17
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
TableGUI class for role administration.
setEnableHeader($a_enableheader)
Set Enable Header.
getLimit()
Get limit.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
setMaxCount($a_max_count)
set max.
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.