3 require_once(
"./Services/User/classes/class.ilUserTableGUI.php");
4 require_once(
"./Services/User/classes/class.ilLocalUser.php");
5 require_once(
"./Services/User/classes/class.ilObjUserGUI.php");
6 require_once(
"./Services/User/classes/class.ilObjUserFolderGUI.php");
57 $this->parent_gui = $parent_gui;
58 $this->
object = $parent_gui->object;
59 $this->tabs_gui = $this->parent_gui->tabs_gui;
60 $this->toolbar = $ilToolbar;
63 $this->lng->loadLanguageModule(
'user');
64 if (! $rbacsystem->checkAccess(
"cat_administrate_users", $this->parent_gui->object->getRefId())) {
74 $cmd = $this->ctrl->getCmd();
78 $this->tabs_gui->clearTargets();
79 $this->tabs_gui->setBackTarget($this->lng->txt(
"back"),$this->ctrl->getLinkTargetByClass(
"illocalusergui",
'index'));
97 $table->resetOffset();
98 $table->resetFilter();
110 $table->resetOffset();
111 $table->writeFilterToSession();
116 function index($show_delete =
false) {
117 global
$ilUser, $rbacreview, $rbacsystem;
118 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.cat_admin_users.html',
120 if (count($rbacreview->getGlobalAssignableRoles())
121 or in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))
123 $this->toolbar->addButton(
124 $this->lng->txt(
'add_user'),
125 $this->ctrl->getLinkTargetByClass(
'ilobjusergui',
'create')
127 $this->toolbar->addButton(
128 $this->lng->txt(
'import_users'),
129 $this->ctrl->getLinkTargetByClass(
'ilobjuserfoldergui',
'importUserForm')
135 $this->tpl->setCurrentBlock(
"confirm_delete");
136 $this->tpl->setVariable(
"CONFIRM_FORMACTION", $this->ctrl->getFormAction($this));
137 $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
'cancel'));
138 $this->tpl->setVariable(
"CONFIRM_CMD",
'performDeleteUsers');
139 $this->tpl->setVariable(
"TXT_CONFIRM", $this->lng->txt(
'delete'));
140 $this->tpl->parseCurrentBlock();
143 $this->tpl->setVariable(
'USERS_TABLE', $table->getHTML());
153 include_once
'./Services/User/classes/class.ilUserAutoComplete.php';
155 $auto->setSearchFields(array(
'login',
'firstname',
'lastname',
'email' ));
156 $auto->enableFieldSearchableCheck(
true);
157 $auto->setMoreLinkAvailable(
true);
174 include_once
'./Services/User/classes/class.ilLocalUser.php';
176 foreach (
$_POST[
'user_ids'] as $user_id) {
178 $ilLog->write(__FILE__.
":".__LINE__.
" User with id $user_id could not be found.");
187 $this->ctrl->redirect($this,
'index');
195 if (! count(
$_POST[
'id'])) {
201 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
203 $confirm->setFormAction($this->ctrl->getFormAction($this));
204 $confirm->setHeaderText($this->lng->txt(
'sure_delete_selected_users'));
205 $confirm->setConfirm($this->lng->txt(
'delete'),
'performDeleteUsers');
206 $confirm->setCancel($this->lng->txt(
'cancel'),
'index');
207 foreach (
$_POST[
'id'] as $user) {
212 $name[
'lastname'] .
', ' . $name[
'firstname'] .
' [' . $name[
'login'] .
']'
215 $this->tpl->setContent($confirm->getHTML());
221 if (! $this->ilAccess->checkAccess(
"cat_administrate_users",
"",
$_GET[
"ref_id"])) {
223 $this->ctrl->redirect($this,
"");
225 $offset =
$_GET[
"offset"];
227 if (
$_GET[
"sort_by"] ==
"title" or empty(
$_GET[
"sort_by"])) {
228 $_GET[
"sort_by"] =
"login";
230 $order =
$_GET[
"sort_by"];
231 $direction =
$_GET[
"sort_order"];
232 include_once
'./Services/User/classes/class.ilLocalUser.php';
233 if (! isset(
$_GET[
'obj_id'])) {
240 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.cat_role_assignment.html',
242 $ass_roles = $rbacreview->assignedRoles(
$_GET[
'obj_id']);
244 foreach ($roles as $role) {
251 $f_result[$counter][] = $role_obj->getTitle();
252 $f_result[$counter][] = $role_obj->getDescription();
253 $f_result[$counter][] = $role[
'role_type'] ==
'global' ?
254 $this->lng->txt(
'global') :
255 $this->lng->txt(
'local');
264 global $rbacreview, $rbacadmin;
265 if (! $this->ilAccess->checkAccess(
"cat_administrate_users",
"",
$_GET[
"ref_id"])) {
267 $this->ctrl->redirect($this,
"");
269 include_once
'./Services/User/classes/class.ilLocalUser.php';
281 $this->assignRolesObject();
285 $new_role_ids =
$_POST[
'role_ids'] ?
$_POST[
'role_ids'] : array();
286 $assigned_roles = $rbacreview->assignedRoles((
int)
$_REQUEST[
'obj_id']);
287 foreach ($roles as $role) {
288 if (in_array($role[
'obj_id'], $new_role_ids) and ! in_array($role[
'obj_id'], $assigned_roles)) {
289 $rbacadmin->assignUser($role[
'obj_id'], (
int)$_REQUEST[
'obj_id']);
291 if (in_array($role[
'obj_id'], $assigned_roles) and ! in_array($role[
'obj_id'], $new_role_ids)) {
292 $rbacadmin->deassignUser($role[
'obj_id'], (
int)$_REQUEST[
'obj_id']);
304 if (! $this->ilAccess->checkAccess(
"cat_administrate_users",
"",
$_GET[
"ref_id"])) {
306 $this->ctrl->redirect($this,
"");
310 if ($tmp_obj->getTimeLimitOwner() != $this->
object->getRefId() and
311 ! in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))
316 $new_assigned = $new_assigned ? $new_assigned : array();
317 $assigned = $rbacreview->assignedRoles((
int)
$_GET[
'obj_id']);
319 if (! in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))) {
320 $ga = $rbacreview->getGlobalAssignableRoles();
322 $ga = $rbacreview->getGlobalRolesArray();
324 $global_assignable = array();
325 foreach ($ga as $role) {
326 $global_assignable[] = $role[
'obj_id'];
328 $new_visible_assigned_roles = array_intersect($new_assigned, $global_assignable);
329 $all_assigned_roles = array_intersect($assigned, $rbacreview->getGlobalRoles());
330 $main_assigned_roles = array_diff($all_assigned_roles, $global_assignable);
331 if (! count($new_visible_assigned_roles) and ! count($main_assigned_roles)) {
344 if (in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))) {
345 $global_roles = $rbacreview->getGlobalRolesArray();
346 } elseif ($tmp_obj->getTimeLimitOwner() == $this->
object->getRefId()) {
347 $global_roles = $rbacreview->getGlobalAssignableRoles();
349 $global_roles = array();
352 return $roles = array_merge($global_roles, $rbacreview->getAssignableChildRoles($this->object->getRefId()));
357 if (! $this->ilAccess->checkAccess(
"cat_administrate_users",
"",
$_GET[
"ref_id"])) {
359 $this->ctrl->redirect($this,
"");
361 $tbl =& $this->parent_gui->__initTableGUI();
362 $tpl =& $tbl->getTemplateObject();
364 $tpl->setCurrentBlock(
"tbl_form_header");
365 $this->ctrl->setParameter($this,
'obj_id',
$_GET[
'obj_id']);
366 $tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
367 $tpl->parseCurrentBlock();
369 $tpl->setVariable(
"COLUMN_COUNTS", 4);
371 $tpl->setCurrentBlock(
"tbl_action_button");
372 $tpl->setVariable(
"BTN_NAME",
"assignSave");
373 $tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"change_assignment"));
374 $tpl->parseCurrentBlock();
375 $tpl->setCurrentBlock(
"tbl_action_row");
376 $tpl->setVariable(
"TPLPATH", $this->tpl->tplPath);
377 $tpl->parseCurrentBlock();
379 $title = $this->lng->txt(
'role_assignment') .
' (' . $tmp_obj->getFullname() .
')';
380 $tbl->setTitle($title,
"icon_role.svg", $this->lng->txt(
"role_assignment"));
381 $tbl->setHeaderNames(array(
383 $this->lng->txt(
"title"),
384 $this->lng->txt(
'description'),
385 $this->lng->txt(
"type")
387 $tbl->setHeaderVars(array(
393 "ref_id" => $this->object->getRefId(),
394 "cmd" =>
"assignRoles",
395 "obj_id" =>
$_GET[
'obj_id'],
396 "cmdClass" =>
"ilobjcategorygui",
397 "cmdNode" =>
$_GET[
"cmdNode"]
399 $tbl->setColumnWidth(array(
"4%",
"35%",
"45%",
"16%" ));
400 $this->set_unlimited =
true;
401 $this->parent_gui->__setTableGUIBasicData($tbl, $a_result_set, $a_from,
true);
403 $this->tpl->setVariable(
"ROLES_TABLE", $tbl->tpl->get());
412 if (! $this->ilAccess->checkAccess($permission,
"",
$_GET[
"ref_id"])) {
414 $this->ctrl->redirect($this,
"");