53 $ilCtrl = $DIC[
'ilCtrl'];
54 $ilTabs = $DIC[
'ilTabs'];
55 $ilToolbar = $DIC[
'ilToolbar'];
57 $rbacsystem = $DIC[
'rbacsystem'];
60 $this->ctrl = $ilCtrl;
61 $this->parent_gui = $parent_gui;
62 $this->
object = $parent_gui->object;
63 $this->tabs_gui = $this->parent_gui->tabs_gui;
64 $this->toolbar = $ilToolbar;
67 $this->lng->loadLanguageModule(
'user');
68 if (!$rbacsystem->checkAccess(
"cat_administrate_users", $this->parent_gui->object->getRefId())) {
79 $cmd = $this->ctrl->getCmd();
83 $this->tabs_gui->clearTargets();
84 $this->tabs_gui->setBackTarget($this->lng->txt(
"back"), $this->ctrl->getLinkTargetByClass(
"illocalusergui",
'index'));
103 $table->resetOffset();
104 $table->resetFilter();
117 $table->resetOffset();
118 $table->writeFilterToSession();
123 public function index($show_delete =
false)
127 $rbacreview = $DIC[
'rbacreview'];
128 $rbacsystem = $DIC[
'rbacsystem'];
129 $this->tpl->addBlockfile(
132 'tpl.cat_admin_users.html',
135 if (count($rbacreview->getGlobalAssignableRoles())
138 $this->toolbar->addButton(
139 $this->lng->txt(
'add_user'),
140 $this->ctrl->getLinkTargetByClass(
'ilobjusergui',
'create')
142 $this->toolbar->addButton(
143 $this->lng->txt(
'import_users'),
144 $this->ctrl->getLinkTargetByClass(
'ilobjuserfoldergui',
'importUserForm')
150 $this->tpl->setCurrentBlock(
"confirm_delete");
151 $this->tpl->setVariable(
"CONFIRM_FORMACTION", $this->ctrl->getFormAction($this));
152 $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
'cancel'));
153 $this->tpl->setVariable(
"CONFIRM_CMD",
'performDeleteUsers');
154 $this->tpl->setVariable(
"TXT_CONFIRM", $this->lng->txt(
'delete'));
155 $this->tpl->parseCurrentBlock();
158 $this->tpl->setVariable(
'USERS_TABLE', $table->getHTML());
170 $auto->setSearchFields(array(
'login',
'firstname',
'lastname',
'email'));
171 $auto->enableFieldSearchableCheck(
true);
172 $auto->setMoreLinkAvailable(
true);
174 if (($_REQUEST[
'fetchall'])) {
178 echo $auto->getList($_REQUEST[
'term']);
189 $ilLog = $DIC[
'ilLog'];
191 foreach (
$_POST[
'user_ids'] as $user_id) {
193 $ilLog->write(__FILE__ .
":" . __LINE__ .
" User with id $user_id could not be found.");
201 ilUtil::sendSuccess($this->lng->txt(
'deleted_users'),
true);
202 $this->ctrl->redirect($this,
'index');
211 if (!count(
$_POST[
'id'])) {
218 $confirm->setFormAction($this->ctrl->getFormAction($this));
219 $confirm->setHeaderText($this->lng->txt(
'sure_delete_selected_users'));
220 $confirm->setConfirm($this->lng->txt(
'delete'),
'performDeleteUsers');
221 $confirm->setCancel($this->lng->txt(
'cancel'),
'index');
222 foreach (
$_POST[
'id'] as $user) {
227 $name[
'lastname'] .
', ' .
$name[
'firstname'] .
' [' .
$name[
'login'] .
']' 230 $this->tpl->setContent($confirm->getHTML());
237 $rbacreview = $DIC[
'rbacreview'];
238 if (!$this->
ilAccess->checkAccess(
"cat_administrate_users",
"",
$_GET[
"ref_id"])) {
240 $this->ctrl->redirect($this,
"");
242 $offset =
$_GET[
"offset"];
244 if (
$_GET[
"sort_by"] ==
"title" or empty(
$_GET[
"sort_by"])) {
245 $_GET[
"sort_by"] =
"login";
247 $order =
$_GET[
"sort_by"];
248 $direction =
$_GET[
"sort_order"];
249 if (!isset(
$_GET[
'obj_id'])) {
256 $this->tpl->addBlockfile(
259 'tpl.cat_role_assignment.html',
262 $ass_roles = $rbacreview->assignedRoles(
$_GET[
'obj_id']);
264 foreach ($roles as $role) {
268 in_array($role[
'obj_id'], $ass_roles) ? 1 : 0,
273 $f_result[$counter][] = $role_obj->getTitle();
274 $f_result[$counter][] = $role_obj->getDescription() ? $role_obj->getDescription() :
'';
275 $f_result[$counter][] = $role[
'role_type'] ==
'global' 277 $this->lng->txt(
'global')
279 $this->lng->txt(
'local');
290 $rbacreview = $DIC[
'rbacreview'];
291 $rbacadmin = $DIC[
'rbacadmin'];
292 if (!$this->
ilAccess->checkAccess(
"cat_administrate_users",
"",
$_GET[
"ref_id"])) {
294 $this->ctrl->redirect($this,
"");
307 $this->assignRolesObject();
311 $new_role_ids =
$_POST[
'role_ids'] ?
$_POST[
'role_ids'] : array();
312 $assigned_roles = $rbacreview->assignedRoles((
int) $_REQUEST[
'obj_id']);
313 foreach ($roles as $role) {
314 if (in_array($role[
'obj_id'], $new_role_ids) and !in_array($role[
'obj_id'], $assigned_roles)) {
315 $rbacadmin->assignUser($role[
'obj_id'], (
int) $_REQUEST[
'obj_id']);
317 if (in_array($role[
'obj_id'], $assigned_roles) and !in_array($role[
'obj_id'], $new_role_ids)) {
318 $rbacadmin->deassignUser($role[
'obj_id'], (
int) $_REQUEST[
'obj_id']);
321 ilUtil::sendSuccess($this->lng->txt(
'role_assignment_updated'));
331 $rbacreview = $DIC[
'rbacreview'];
333 if (!$this->
ilAccess->checkAccess(
"cat_administrate_users",
"",
$_GET[
"ref_id"])) {
335 $this->ctrl->redirect($this,
"");
339 if ($tmp_obj->getTimeLimitOwner() != $this->
object->getRefId() and
345 $new_assigned = $new_assigned ? $new_assigned : array();
346 $assigned = $rbacreview->assignedRoles((
int)
$_GET[
'obj_id']);
349 $ga = $rbacreview->getGlobalAssignableRoles();
351 $ga = $rbacreview->getGlobalRolesArray();
353 $global_assignable = array();
354 foreach ($ga as $role) {
355 $global_assignable[] = $role[
'obj_id'];
357 $new_visible_assigned_roles = array_intersect($new_assigned, $global_assignable);
358 $all_assigned_roles = array_intersect($assigned, $rbacreview->getGlobalRoles());
359 $main_assigned_roles = array_diff($all_assigned_roles, $global_assignable);
360 if (!count($new_visible_assigned_roles) and !count($main_assigned_roles)) {
371 $rbacreview = $DIC[
'rbacreview'];
377 $global_roles = $rbacreview->getGlobalRolesArray();
378 } elseif ($tmp_obj->getTimeLimitOwner() == $this->
object->getRefId()) {
379 $global_roles = $rbacreview->getGlobalAssignableRoles();
381 $global_roles = array();
384 return $roles = array_merge($global_roles, $rbacreview->getAssignableChildRoles($this->object->getRefId()));
390 if (!$this->
ilAccess->checkAccess(
"cat_administrate_users",
"",
$_GET[
"ref_id"])) {
392 $this->ctrl->redirect($this,
"");
394 $tbl = &$this->parent_gui->__initTableGUI();
395 $tpl = &$tbl->getTemplateObject();
397 $tpl->setCurrentBlock(
"tbl_form_header");
398 $this->ctrl->setParameter($this,
'obj_id',
$_GET[
'obj_id']);
399 $tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
400 $tpl->parseCurrentBlock();
403 $tpl->setVariable(
"BTN_NAME",
"assignSave");
404 $tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"change_assignment"));
405 $tpl->setCurrentBlock(
"tbl_action_row");
406 $tpl->setVariable(
"TPLPATH", $this->tpl->tplPath);
407 $tpl->parseCurrentBlock();
409 $title = $this->lng->txt(
'role_assignment') .
' (' . $tmp_obj->getFullname() .
')';
410 $tbl->setTitle($title,
"icon_role.svg", $this->lng->txt(
"role_assignment"));
411 $tbl->setHeaderNames(array(
413 $this->lng->txt(
"title"),
414 $this->lng->txt(
'description'),
415 $this->lng->txt(
"type"),
417 $tbl->setHeaderVars(array(
422 ), (get_class($this->parent_gui) ==
'ilObjOrgUnitGUI')
424 "ref_id" => $this->object->getRefId(),
425 "cmd" =>
"assignRoles",
426 "obj_id" =>
$_GET[
'obj_id'],
427 "cmdNode" =>
$_GET[
"cmdNode"],
428 "baseClass" =>
'ilAdministrationGUI',
429 "admin_mode" =>
"settings",
432 "ref_id" => $this->object->getRefId(),
433 "cmd" =>
"assignRoles",
434 "obj_id" =>
$_GET[
'obj_id'],
435 "cmdClass" =>
"ilobjcategorygui",
436 "baseClass" =>
'ilRepositoryGUI',
437 "cmdNode" =>
$_GET[
"cmdNode"],
439 $tbl->setColumnWidth(array(
"4%",
"35%",
"45%",
"16%"));
440 $this->set_unlimited =
true;
441 $this->parent_gui->__setTableGUIBasicData($tbl, $a_result_set, $a_from,
true);
443 $this->tpl->setVariable(
'OBJECTS', $tbl->getTemplateObject()->get());
454 if (!$this->
ilAccess->checkAccess($permission,
"",
$_GET[
"ref_id"])) {
456 $this->ctrl->redirect($this,
"");
static _lookupName($a_user_id)
lookup user name
__showRolesTable($a_result_set, $a_from="")
performDeleteUsers()
Delete User.
Auto completion class for user lists.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
__checkGlobalRoles($new_assigned)
TableGUI class for user administration.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _getAllUserIds($a_filter=0)
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
index($show_delete=false)
applyFilter()
Apply filter.
resetFilter()
Reset filter (note: this function existed before data table filter has been introduced.
addUserAutoCompleteObject()
Show auto complete results.
checkPermission($permission)
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public
Confirmation screen class.