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);
166 include_once
'./Services/User/classes/class.ilLocalUser.php';
167 $this->checkPermission(
"cat_administrate_users");
168 foreach (
$_POST[
'user_ids'] as $user_id) {
170 die(
'user id not valid');
185 $this->checkPermission(
"cat_administrate_users");
186 if (! count(
$_POST[
'id'])) {
192 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
194 $confirm->setFormAction($this->ctrl->getFormAction($this));
195 $confirm->setHeaderText($this->lng->txt(
'sure_delete_selected_users'));
196 $confirm->setConfirm($this->lng->txt(
'delete'),
'performDeleteUsers');
197 $confirm->setCancel($this->lng->txt(
'cancel'),
'index');
198 foreach (
$_POST[
'id'] as $user) {
203 $name[
'lastname'] .
', ' . $name[
'firstname'] .
' [' . $name[
'login'] .
']'
206 $this->tpl->setContent($confirm->getHTML());
212 if (! $this->ilAccess->checkAccess(
"cat_administrate_users",
"",
$_GET[
"ref_id"])) {
214 $this->ctrl->redirect($this,
"");
216 $offset =
$_GET[
"offset"];
218 if (
$_GET[
"sort_by"] ==
"title" or empty(
$_GET[
"sort_by"])) {
219 $_GET[
"sort_by"] =
"login";
221 $order =
$_GET[
"sort_by"];
222 $direction =
$_GET[
"sort_order"];
223 include_once
'./Services/User/classes/class.ilLocalUser.php';
224 if (! isset(
$_GET[
'obj_id'])) {
231 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.cat_role_assignment.html',
233 $ass_roles = $rbacreview->assignedRoles(
$_GET[
'obj_id']);
235 foreach ($roles as $role) {
242 $f_result[$counter][] = $role_obj->getTitle();
243 $f_result[$counter][] = $role_obj->getDescription();
244 $f_result[$counter][] = $role[
'role_type'] ==
'global' ?
245 $this->lng->txt(
'global') :
246 $this->lng->txt(
'local');
255 global $rbacreview, $rbacadmin;
256 if (! $this->ilAccess->checkAccess(
"cat_administrate_users",
"",
$_GET[
"ref_id"])) {
258 $this->ctrl->redirect($this,
"");
260 include_once
'./Services/User/classes/class.ilLocalUser.php';
272 $this->assignRolesObject();
276 $new_role_ids =
$_POST[
'role_ids'] ?
$_POST[
'role_ids'] : array();
277 $assigned_roles = $rbacreview->assignedRoles((
int)
$_REQUEST[
'obj_id']);
278 foreach ($roles as $role) {
279 if (in_array($role[
'obj_id'], $new_role_ids) and ! in_array($role[
'obj_id'], $assigned_roles)) {
280 $rbacadmin->assignUser($role[
'obj_id'], (
int)$_REQUEST[
'obj_id']);
282 if (in_array($role[
'obj_id'], $assigned_roles) and ! in_array($role[
'obj_id'], $new_role_ids)) {
283 $rbacadmin->deassignUser($role[
'obj_id'], (
int)$_REQUEST[
'obj_id']);
295 if (! $this->ilAccess->checkAccess(
"cat_administrate_users",
"",
$_GET[
"ref_id"])) {
297 $this->ctrl->redirect($this,
"");
301 if ($tmp_obj->getTimeLimitOwner() != $this->
object->getRefId() and
302 ! in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))
307 $new_assigned = $new_assigned ? $new_assigned : array();
308 $assigned = $rbacreview->assignedRoles((
int)
$_GET[
'obj_id']);
310 if (! in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))) {
311 $ga = $rbacreview->getGlobalAssignableRoles();
313 $ga = $rbacreview->getGlobalRolesArray();
315 $global_assignable = array();
316 foreach ($ga as $role) {
317 $global_assignable[] = $role[
'obj_id'];
319 $new_visible_assigned_roles = array_intersect($new_assigned, $global_assignable);
320 $all_assigned_roles = array_intersect($assigned, $rbacreview->getGlobalRoles());
321 $main_assigned_roles = array_diff($all_assigned_roles, $global_assignable);
322 if (! count($new_visible_assigned_roles) and ! count($main_assigned_roles)) {
335 if (in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))) {
336 $global_roles = $rbacreview->getGlobalRolesArray();
337 } elseif ($tmp_obj->getTimeLimitOwner() == $this->
object->getRefId()) {
338 $global_roles = $rbacreview->getGlobalAssignableRoles();
340 $global_roles = array();
343 return $roles = array_merge($global_roles, $rbacreview->getAssignableChildRoles($this->object->getRefId()));
348 if (! $this->ilAccess->checkAccess(
"cat_administrate_users",
"",
$_GET[
"ref_id"])) {
350 $this->ctrl->redirect($this,
"");
352 $tbl =& $this->parent_gui->__initTableGUI();
353 $tpl =& $tbl->getTemplateObject();
355 $tpl->setCurrentBlock(
"tbl_form_header");
356 $this->ctrl->setParameter($this,
'obj_id',
$_GET[
'obj_id']);
357 $tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
358 $tpl->parseCurrentBlock();
360 $tpl->setVariable(
"COLUMN_COUNTS", 4);
362 $tpl->setCurrentBlock(
"tbl_action_button");
363 $tpl->setVariable(
"BTN_NAME",
"assignSave");
364 $tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"change_assignment"));
365 $tpl->parseCurrentBlock();
366 $tpl->setCurrentBlock(
"tbl_action_row");
367 $tpl->setVariable(
"TPLPATH", $this->tpl->tplPath);
368 $tpl->parseCurrentBlock();
370 $title = $this->lng->txt(
'role_assignment') .
' (' . $tmp_obj->getFullname() .
')';
371 $tbl->setTitle($title,
"icon_role.png", $this->lng->txt(
"role_assignment"));
372 $tbl->setHeaderNames(array(
374 $this->lng->txt(
"title"),
375 $this->lng->txt(
'description'),
376 $this->lng->txt(
"type")
378 $tbl->setHeaderVars(array(
384 "ref_id" => $this->object->getRefId(),
385 "cmd" =>
"assignRoles",
386 "obj_id" =>
$_GET[
'obj_id'],
387 "cmdClass" =>
"ilobjcategorygui",
388 "cmdNode" =>
$_GET[
"cmdNode"]
390 $tbl->setColumnWidth(array(
"4%",
"35%",
"45%",
"16%" ));
391 $this->set_unlimited =
true;
392 $this->parent_gui->__setTableGUIBasicData($tbl, $a_result_set, $a_from,
true);
394 $this->tpl->setVariable(
"ROLES_TABLE", $tbl->tpl->get());