19declare(strict_types=1);
47 int $a_mode = self::MODE_USER_FOLDER,
48 bool $a_load_items =
true
53 $this->user_folder_id = $a_parent_obj->getObject()->getRefId();
56 ||
$DIC[
'rbacsystem']->checkAccess(
'write', $this->user_folder_id)
57 ||
$DIC[
'rbacsystem']->checkAccess(
'cat_administrate_users', $this->user_folder_id)) {
58 $this->with_write_access =
true;
62 $this->
setId(
"user{$this->getUserFolderId()}");
74 if ($this->
getMode() == self::MODE_LOCAL_USER) {
75 $this->
addColumn($this->
lng->txt(
'context'),
'time_limit_owner');
85 $this->
setRowTemplate(
"tpl.user_list_row.html",
"components/ILIAS/User");
101 if ($this->
getMode() == self::MODE_USER_FOLDER) {
104 $cmds = $a_parent_obj->getUserMultiCommands();
105 foreach ($cmds as $cmd => $caption) {
119 $this->mode = $a_mode;
138 $up = LocalDIC::dic()[Profile::class];
144 $cols[
"firstname"] = [
145 "txt" =>
$lng->
txt(
"firstname"),
147 $cols[
"lastname"] = [
148 "txt" =>
$lng->
txt(
"lastname"),
151 $cols[
"access_until"] = [
152 "txt" =>
$lng->
txt(
"access_until"),
154 $cols[
"last_login"] = [
155 "txt" =>
$lng->
txt(
"last_login"),
159 $cols[
"create_date"] = [
160 "txt" =>
$lng->
txt(
"create_date")];
161 $cols[
"approve_date"] = [
162 "txt" =>
$lng->
txt(
"approve_date")];
163 $cols[
"agree_date"] = [
164 "txt" =>
$lng->
txt(
"agree_date")];
165 $cols[
'dpro_agreed_on'] = [
166 'txt' =>
$lng->
txt(
'dpro_agreed_on')];
168 $context = ProfileContext::LocalUserAdministration;
169 if ($this->
getMode() === self::MODE_USER_FOLDER) {
170 $context = ProfileContext::UserAdministration;
173 $ufs = $up->getVisibleFields(
$context);
176 if (isset($ufs[
'email'])) {
181 if (isset($ufs[
'second_email'])) {
182 $cols[
'second_email'] = [
183 'txt' =>
$lng->
txt(
'second_email'),
187 foreach ($ufs as
$f => $fd) {
188 if (isset($cols[
$f])) {
192 'txt' => $fd->getLabel($this->
lng),
196 $cols[
'auth_mode'] = [
197 'txt' =>
$lng->
txt(
'auth_mode'),
200 foreach ($this->udf_fields as $k => $field) {
201 if ($field->hiddenInLists()) {
208 unset($cols[
'username']);
217 $query->setLimit($this->
getLimit());
218 $query->setTextFilter($this->
filter[
'query'] ??
'');
219 $query->setActionFilter($this->
filter[
'activation'] ??
'');
220 $query->setLastLogin($this->
filter[
'last_login'] ??
null);
221 $query->setLimitedAccessFilter($this->
filter[
'limited_access'] ??
false);
222 $query->setNoCourseFilter($this->
filter[
'no_courses'] ??
false);
223 $query->setNoGroupFilter($this->
filter[
'no_groups'] ??
false);
224 $query->setCourseGroupFilter($this->
filter[
'course_group'] ?? 0);
225 $query->setRoleFilter((
int) ($this->
filter[
'global_role'] ?? 0));
226 $query->setUserFilter($this->
filter[
'user_ids'] ?? []);
227 $query->setFirstLetterLastname($this->user_request->getLetter());
228 $query->setAuthenticationFilter($this->
filter[
'authentication'] ??
'');
239 if ($this->
getMode() == self::MODE_USER_FOLDER) {
243 if ($this->
filter[
'time_limit_owner'] ??
null) {
244 $user_filter = [$this->
filter[
'time_limit_owner']];
254 if (!count($user_filter)) {
260 if (isset($this->
filter[
'user_ids']) && is_array($this->
filter[
'user_ids']) && $this->
filter[
'user_ids'] === []) {
268 $additional_fields[
"firstname"],
269 $additional_fields[
"lastname"],
270 $additional_fields[
"email"],
271 $additional_fields[
"second_email"],
272 $additional_fields[
"last_login"],
273 $additional_fields[
"access_until"],
274 $additional_fields[
'org_units']
278 foreach ($this->
filter as $k => $v) {
279 if (strpos($k,
"udf_") === 0) {
280 $udf_filter[$k] = $v;
290 $query->setAdditionalFields($additional_fields);
291 $query->setUserFolder($user_filter);
292 $query->setUdfFilter($udf_filter);
293 $usr_data = $query->query();
295 if (count($usr_data[
'set']) == 0 && $this->
getOffset() > 0) {
298 $usr_data = $query->query();
301 foreach ($usr_data[
'set'] as $k => $user) {
307 $current_time = time();
308 if ($user[
'active']) {
309 if ($user[
'time_limit_unlimited']) {
310 $txt_access =
$lng->
txt(
'access_unlimited');
311 $usr_data[
'set'][$k][
'access_class'] =
'smallgreen';
312 } elseif ($user[
'time_limit_until'] < $current_time) {
313 $txt_access =
$lng->
txt(
'access_expired');
314 $usr_data[
'set'][$k][
'access_class'] =
'smallred';
317 $usr_data[
'set'][$k][
'access_class'] =
'small';
320 $txt_access =
$lng->
txt(
'inactive');
321 $usr_data[
'set'][$k][
'access_class'] =
'smallred';
323 $usr_data[
'set'][$k][
'access_until'] = $txt_access;
327 $this->
setData($usr_data[
'set']);
337 if ($this->
getMode() == self::MODE_USER_FOLDER) {
341 if ($this->
filter[
'time_limit_owner']) {
342 $user_filter = [$this->
filter[
'time_limit_owner']];
349 if (!isset($this->
filter[
'user_ids'])) {
350 $this->
filter[
'user_ids'] =
null;
354 $query->setUserFolder($user_filter);
359 $usr_data = $query->query();
363 foreach ($usr_data[
"set"] as $item) {
366 $user_ids[] = $item[
"usr_id"];
377 $rbacreview =
$DIC[
'rbacreview'];
378 $ilUser =
$DIC[
'ilUser'];
379 $ilCtrl =
$DIC[
'ilCtrl'];
383 if ($this->
getMode() == self::MODE_LOCAL_USER) {
386 if (count($parent_ids) > 1) {
391 $opt[0] = $this->
lng->txt(
'all_users');
394 foreach ($parent_ids as $parent_id) {
398 switch ($parent_id) {
408 $co->setOptions($opt);
410 $co->readFromSession();
411 $this->
filter[
'time_limit_owner'] = $co->getValue();
418 $ul->setDataSource($ilCtrl->getLinkTarget(
419 $this->getParentObject(),
420 "addUserAutoComplete",
425 $ul->setSubmitFormOnEnter(
true);
427 $ul->readFromSession();
428 $this->
filter[
"query"] = $ul->getValue();
434 "active" =>
$lng->
txt(
"active"),
435 "inactive" =>
$lng->
txt(
"inactive"),
438 $si->setOptions($options);
440 $si->readFromSession();
441 $this->
filter[
"activation"] = $si->getValue();
446 $cb->readFromSession();
447 $this->
filter[
"limited_access"] = $cb->getChecked();
453 $di->setDate($default_date);
455 $di->readFromSession();
456 $this->
filter[
"last_login"] = $di->getDate();
458 if ($this->
getMode() == self::MODE_USER_FOLDER) {
462 $cb->readFromSession();
463 $this->
filter[
"no_courses"] = $cb->getChecked();
468 $ng->readFromSession();
469 $this->
filter[
'no_groups'] = $ng->getChecked();
473 $rs->setSelectText(
$lng->
txt(
"user_select_course_group"));
474 $rs->setHeaderMessage(
$lng->
txt(
"user_please_select_course_group"));
475 $rs->setClickableTypes([
"crs",
"grp"]);
477 $rs->readFromSession();
478 $this->
filter[
"course_group"] = $rs->getValue();
485 foreach ($rbacreview->getRolesByFilter(2, $ilUser->getId()) as $role) {
486 $options[$role[
"rol_id"]] = $role[
"title"];
489 $si->setOptions($options);
491 $si->readFromSession();
492 $this->
filter[
"global_role"] = $si->getValue();
499 foreach ($auth_methods as $method => $value) {
500 if ($method ==
'default') {
507 $si->setOptions($options);
509 $si->readFromSession();
510 $this->
filter[
"authentication"] = $si->getValue();
513 foreach ($this->udf_fields as
$id =>
$f) {
524 bool $a_optional =
false,
525 ?
string $caption =
null,
526 array $a_options = []
537 case UDF_TYPE_SELECT:
539 $sel_options = [
"" => $this->
lng->txt(
"user_all")];
540 foreach ($a_options as $o) {
541 $sel_options[$o] = $o;
543 $item->setOptions($sel_options);
548 $item->setMaxLength(64);
559 $item->readFromSession();
565 protected function fillRow(array $a_set): void
569 $ilCtrl =
$DIC[
'ilCtrl'];
572 $ilCtrl->setParameterByClass(
"ilobjusergui",
"letter", $this->user_request->getLetter());
574 foreach ($this->getSelectedColumns() as
$c) {
575 if (
$c ==
"access_until") {
576 $this->tpl->setCurrentBlock(
"access_until");
577 $this->tpl->setVariable(
"VAL_ACCESS_UNTIL", $a_set[
"access_until"]);
578 $this->tpl->setVariable(
"CLASS_ACCESS_UNTIL", $a_set[
"access_class"]);
579 } elseif (
$c ==
"last_login") {
580 $this->tpl->setCurrentBlock(
"last_login");
581 $this->tpl->setVariable(
585 } elseif (in_array(
$c, [
"firstname",
"lastname"])) {
586 $this->tpl->setCurrentBlock(
$c);
587 $this->tpl->setVariable(
"VAL_" . strtoupper(
$c), (
string) $a_set[
$c]);
588 } elseif (
$c ==
'auth_mode') {
589 $this->tpl->setCurrentBlock(
'user_field');
591 $this->tpl->parseCurrentBlock();
593 $this->tpl->setCurrentBlock(
"user_field");
594 $val = (trim($a_set[
$c] ??
'') ==
"")
597 if ($a_set[
$c] !=
"") {
604 $val =
$lng->txt(
"gender_" . $a_set[
$c]);
613 case 'dpro_agreed_on':
618 $this->tpl->setVariable(
"VAL_UF", $val);
621 $this->tpl->parseCurrentBlock();
624 if ($a_set[
"usr_id"] != 6
625 && ($this->getMode() == self::MODE_USER_FOLDER || $a_set[
'time_limit_owner'] == $this->getUserFolderId())) {
626 $this->tpl->setCurrentBlock(
"checkb");
627 $this->tpl->setVariable(
"ID", $a_set[
"usr_id"]);
628 $this->tpl->parseCurrentBlock();
631 if ($this->with_write_access
632 && ($this->getMode() === self::MODE_USER_FOLDER
633 || $a_set[
'time_limit_owner'] == $this->getUserFolderId())) {
634 $this->tpl->setVariable(
"VAL_LOGIN", $a_set[
"login"]);
635 $ilCtrl->setParameterByClass(
"ilobjusergui",
"obj_id", $a_set[
"usr_id"]);
636 $this->tpl->setVariable(
638 $ilCtrl->getLinkTargetByClass(
"ilobjusergui",
"view")
640 $ilCtrl->setParameterByClass(
"ilobjusergui",
"obj_id",
"");
642 $this->tpl->setVariable(
'VAL_LOGIN_PLAIN', $a_set[
'login']);
645 if ($this->getMode() == self::MODE_LOCAL_USER) {
646 $this->tpl->setCurrentBlock(
'context');
647 $this->tpl->setVariable(
651 $this->tpl->parseCurrentBlock();
653 $this->tpl->setCurrentBlock(
'roles');
654 $ilCtrl->setParameter($this->getParentObject(),
'obj_id', $a_set[
'usr_id']);
655 $this->tpl->setVariable(
'ROLE_LINK', $ilCtrl->getLinkTarget($this->getParentObject(),
'assignRoles'));
656 $this->tpl->setVariable(
'TXT_ROLES', $this->
lng->txt(
'edit'));
657 $ilCtrl->clearParameters($this->getParentObject());
658 $this->tpl->parseCurrentBlock();
static _getActiveAuthModes()
static getAuthModeTranslation(string $a_auth_key, string $auth_name='')
static _getAuthMode(?string $a_auth_mode)
static _getAuthModeName($a_auth_key)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _getFolderIds(bool $access_with_orgunit=false)
const ORG_OP_EDIT_USER_ACCOUNTS
static lookupOrgUnitsRepresentation(int $a_usr_id)
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(?object $a_parent_obj, string $a_parent_cmd="", string $a_template_context="")
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
setFilterCommand(string $a_val, string $a_caption="")
setEnableAllCommand(bool $a_value)
determineOffsetAndOrder(bool $a_omit_offset=false)
setExternalSegmentation(bool $a_val)
addFilterItem(ilTableFilterItem $a_input_item, bool $a_optional=false)
setEnableTitle(bool $a_enabletitle)
addMultiCommand(string $a_cmd, string $a_text)
setFormAction(string $a_form_action, bool $a_multipart=false)
resetOffset(bool $a_in_determination=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setEnableHeader(bool $a_enableheader)
setDefaultOrderField(string $a_defaultorderfield)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
setTopCommands(bool $a_val)
setExternalSorting(bool $a_val)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setDefaultOrderDirection(string $a_defaultorderdirection)
setData(array $a_data)
Set table data.
setMaxCount(int $a_max_count)
set max.
This class represents a text property in a property form.
TableGUI class for user administration.
fillRow(array $a_set)
Standard Version of Fill Row.
UserGUIRequest $user_request
addFilterItemValue($filter, $value)
getSelectableColumns()
Get selectable columns.
addFilterItemByUdfType(string $id, string $type, bool $a_optional=false, ?string $caption=null, array $a_options=[])
Add filter by standard type.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
const SYSTEM_USER_ID
This file contains constants for PHPStan analyis, see: https://phpstan.org/config-reference#constants...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)