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