19 declare(strict_types=1);
44 int $a_mode = self::MODE_USER_FOLDER,
45 bool $a_load_items =
true 50 $this->user_folder_id = $a_parent_obj->getObject()->getRefId();
53 || $DIC[
'rbacsystem']->checkAccess(
'write', $this->user_folder_id)
54 || $DIC[
'rbacsystem']->checkAccess(
'cat_administrate_users', $this->user_folder_id)) {
55 $this->with_write_access =
true;
77 if ($this->
getMode() == self::MODE_LOCAL_USER) {
78 $this->
addColumn($this->
lng->txt(
'context'),
'time_limit_owner');
88 $this->
setRowTemplate(
"tpl.user_list_row.html",
"components/ILIAS/User");
104 if ($this->
getMode() == self::MODE_USER_FOLDER) {
107 $cmds = $a_parent_obj->getUserMultiCommands();
108 foreach ($cmds as $cmd => $caption) {
122 $this->mode = $a_mode;
141 foreach ($user_defined_fields->getDefinitions() as $field => $definition) {
142 if ($this->mode === self::MODE_LOCAL_USER
143 && $definition[
'visib_lua'] ===
'0') {
147 $this->udf_fields[
"udf_" . $field] = [
148 "txt" => $definition[
"field_name"],
150 "options" => $definition[
"field_values"],
151 "type" => $definition[
"field_type"],
162 return $this->udf_fields[$a_key] ?? [];
167 if (strpos($a_key,
"udf_") === 0) {
180 $up->skipGroup(
"preferences");
181 $up->skipGroup(
"interests");
182 $up->skipGroup(
"settings");
188 $cols[
"firstname"] = [
189 "txt" =>
$lng->
txt(
"firstname"),
191 $cols[
"lastname"] = [
192 "txt" =>
$lng->
txt(
"lastname"),
195 $cols[
"access_until"] = [
196 "txt" =>
$lng->
txt(
"access_until"),
198 $cols[
"last_login"] = [
199 "txt" =>
$lng->
txt(
"last_login"),
203 $cols[
"create_date"] = [
204 "txt" =>
$lng->
txt(
"create_date")];
205 $cols[
"approve_date"] = [
206 "txt" =>
$lng->
txt(
"approve_date")];
207 $cols[
"agree_date"] = [
208 "txt" =>
$lng->
txt(
"agree_date")];
209 $cols[
'dpro_agreed_on'] = [
210 'txt' =>
$lng->
txt(
'dpro_agreed_on')];
211 if ($this->
getMode() === self::MODE_USER_FOLDER) {
212 $ufs = $up->getStandardFields();
214 $ufs = $up->getLocalUserAdministrationFields();
218 if (isset($ufs[
"email"])) {
223 if (isset($ufs[
"second_email"])) {
224 $cols[
"second_email"] = [
225 "txt" =>
$lng->
txt(
"second_email"),
229 foreach ($ufs as
$f => $fd) {
230 if (!isset($cols[
$f]) && (!isset($fd[
"lists_hide"]) || !$fd[
"lists_hide"])) {
232 $caption = $fd[
"lang_var"] ??
$f;
243 $cols[
"auth_mode"] = [
244 "txt" =>
$lng->
txt(
"auth_mode"),
247 foreach ($this->udf_fields as $k => $field) {
252 unset($cols[
"username"]);
261 $query->setLimit($this->
getLimit());
262 $query->setTextFilter($this->
filter[
'query'] ??
'');
263 $query->setActionFilter($this->
filter[
'activation'] ??
'');
264 $query->setLastLogin($this->
filter[
'last_login'] ??
null);
265 $query->setLimitedAccessFilter($this->
filter[
'limited_access'] ??
false);
266 $query->setNoCourseFilter($this->
filter[
'no_courses'] ??
false);
267 $query->setNoGroupFilter($this->
filter[
'no_groups'] ??
false);
268 $query->setCourseGroupFilter($this->
filter[
'course_group'] ?? 0);
269 $query->setRoleFilter((
int) ($this->
filter[
'global_role'] ?? 0));
270 $query->setUserFilter($this->
filter[
'user_ids'] ?? []);
271 $query->setFirstLetterLastname($this->user_request->getLetter());
272 $query->setAuthenticationFilter($this->
filter[
'authentication'] ??
'');
283 if ($this->
getMode() == self::MODE_USER_FOLDER) {
287 if ($this->
filter[
'time_limit_owner'] ??
null) {
288 $user_filter = [$this->
filter[
'time_limit_owner']];
298 if (!count($user_filter)) {
304 if (isset($this->
filter[
'user_ids']) && is_array($this->
filter[
'user_ids']) && $this->
filter[
'user_ids'] === []) {
312 $additional_fields[
"firstname"],
313 $additional_fields[
"lastname"],
314 $additional_fields[
"email"],
315 $additional_fields[
"second_email"],
316 $additional_fields[
"last_login"],
317 $additional_fields[
"access_until"],
318 $additional_fields[
'org_units']
322 foreach ($this->
filter as $k => $v) {
323 if (strpos($k,
"udf_") === 0) {
324 $udf_filter[$k] = $v;
331 $query->setOrderField($order_field);
334 $query->setAdditionalFields($additional_fields);
335 $query->setUserFolder($user_filter);
336 $query->setUdfFilter($udf_filter);
337 $usr_data = $query->query();
339 if (count($usr_data[
'set']) == 0 && $this->
getOffset() > 0) {
342 $usr_data = $query->query();
345 foreach ($usr_data[
'set'] as $k => $user) {
351 $current_time = time();
352 if ($user[
'active']) {
353 if ($user[
'time_limit_unlimited']) {
354 $txt_access =
$lng->
txt(
'access_unlimited');
355 $usr_data[
'set'][$k][
'access_class'] =
'smallgreen';
356 } elseif ($user[
'time_limit_until'] < $current_time) {
357 $txt_access =
$lng->
txt(
'access_expired');
358 $usr_data[
'set'][$k][
'access_class'] =
'smallred';
361 $usr_data[
'set'][$k][
'access_class'] =
'small';
364 $txt_access =
$lng->
txt(
'inactive');
365 $usr_data[
'set'][$k][
'access_class'] =
'smallred';
367 $usr_data[
'set'][$k][
'access_until'] = $txt_access;
371 $this->
setData($usr_data[
'set']);
381 if ($this->
getMode() == self::MODE_USER_FOLDER) {
385 if ($this->
filter[
'time_limit_owner']) {
386 $user_filter = [$this->
filter[
'time_limit_owner']];
393 if (!isset($this->
filter[
'user_ids'])) {
398 $query->setUserFolder($user_filter);
403 $usr_data = $query->query();
407 foreach ($usr_data[
"set"] as $item) {
410 $user_ids[] = $item[
"usr_id"];
421 $rbacreview = $DIC[
'rbacreview'];
422 $ilUser = $DIC[
'ilUser'];
423 $ilCtrl = $DIC[
'ilCtrl'];
427 if ($this->
getMode() == self::MODE_LOCAL_USER) {
430 if (count($parent_ids) > 1) {
435 $opt[0] = $this->
lng->txt(
'all_users');
438 foreach ($parent_ids as $parent_id) {
442 switch ($parent_id) {
452 $co->setOptions($opt);
454 $co->readFromSession();
455 $this->
filter[
'time_limit_owner'] = $co->getValue();
462 $ul->setDataSource($ilCtrl->getLinkTarget(
463 $this->getParentObject(),
464 "addUserAutoComplete",
469 $ul->setSubmitFormOnEnter(
true);
471 $ul->readFromSession();
472 $this->
filter[
"query"] = $ul->getValue();
478 "active" =>
$lng->
txt(
"active"),
479 "inactive" =>
$lng->
txt(
"inactive"),
484 $si->readFromSession();
485 $this->
filter[
"activation"] = $si->getValue();
490 $cb->readFromSession();
491 $this->
filter[
"limited_access"] = $cb->getChecked();
499 $di->readFromSession();
500 $this->
filter[
"last_login"] = $di->getDate();
502 if ($this->
getMode() == self::MODE_USER_FOLDER) {
506 $cb->readFromSession();
507 $this->
filter[
"no_courses"] = $cb->getChecked();
512 $ng->readFromSession();
513 $this->
filter[
'no_groups'] = $ng->getChecked();
518 $rs->setHeaderMessage(
$lng->
txt(
"user_please_select_course_group"));
519 $rs->setClickableTypes([
"crs",
"grp"]);
521 $rs->readFromSession();
522 $this->
filter[
"course_group"] = $rs->getValue();
529 foreach ($rbacreview->getRolesByFilter(2, $ilUser->getId()) as $role) {
530 $options[$role[
"rol_id"]] = $role[
"title"];
535 $si->readFromSession();
536 $this->
filter[
"global_role"] = $si->getValue();
543 foreach ($auth_methods as $method => $value) {
544 if ($method ==
'default') {
553 $si->readFromSession();
554 $this->
filter[
"authentication"] = $si->getValue();
557 foreach ($this->udf_fields as
$id =>
$f) {
568 bool $a_optional =
false,
569 ?
string $caption =
null,
570 array $a_options = []
583 $sel_options = [
"" => $this->
lng->txt(
"user_all")];
584 foreach ($a_options as $o) {
585 $sel_options[$o] = $o;
587 $item->setOptions($sel_options);
592 $item->setMaxLength(64);
603 $item->readFromSession();
609 protected function fillRow(array $a_set): void
613 $ilCtrl = $DIC[
'ilCtrl'];
616 $ilCtrl->setParameterByClass(
"ilobjusergui",
"letter", $this->user_request->getLetter());
619 if (
$c ==
"access_until") {
620 $this->tpl->setCurrentBlock(
"access_until");
621 $this->tpl->setVariable(
"VAL_ACCESS_UNTIL", $a_set[
"access_until"]);
622 $this->tpl->setVariable(
"CLASS_ACCESS_UNTIL", $a_set[
"access_class"]);
623 } elseif (
$c ==
"last_login") {
624 $this->tpl->setCurrentBlock(
"last_login");
625 $this->tpl->setVariable(
629 } elseif (in_array(
$c, [
"firstname",
"lastname"])) {
630 $this->tpl->setCurrentBlock(
$c);
631 $this->tpl->setVariable(
"VAL_" . strtoupper(
$c), (
string) $a_set[
$c]);
632 } elseif (
$c ==
'auth_mode') {
633 $this->tpl->setCurrentBlock(
'user_field');
635 $this->tpl->parseCurrentBlock();
637 $this->tpl->setCurrentBlock(
"user_field");
638 $val = (trim($a_set[
$c] ??
'') ==
"")
641 if ($a_set[$c] !=
"") {
648 $val =
$lng->
txt(
"gender_" . $a_set[$c]);
657 case 'dpro_agreed_on':
662 $this->tpl->setVariable(
"VAL_UF", $val);
665 $this->tpl->parseCurrentBlock();
668 if ($a_set[
"usr_id"] != 6
669 && ($this->
getMode() == self::MODE_USER_FOLDER || $a_set[
'time_limit_owner'] == $this->
getUserFolderId())) {
670 $this->tpl->setCurrentBlock(
"checkb");
671 $this->tpl->setVariable(
"ID", $a_set[
"usr_id"]);
672 $this->tpl->parseCurrentBlock();
675 if ($this->with_write_access
676 && ($this->
getMode() === self::MODE_USER_FOLDER
678 $this->tpl->setVariable(
"VAL_LOGIN", $a_set[
"login"]);
679 $ilCtrl->setParameterByClass(
"ilobjusergui",
"obj_id", $a_set[
"usr_id"]);
680 $this->tpl->setVariable(
682 $ilCtrl->getLinkTargetByClass(
"ilobjusergui",
"view")
684 $ilCtrl->setParameterByClass(
"ilobjusergui",
"obj_id",
"");
686 $this->tpl->setVariable(
'VAL_LOGIN_PLAIN', $a_set[
'login']);
689 if ($this->
getMode() == self::MODE_LOCAL_USER) {
690 $this->tpl->setCurrentBlock(
'context');
691 $this->tpl->setVariable(
695 $this->tpl->parseCurrentBlock();
697 $this->tpl->setCurrentBlock(
'roles');
698 $ilCtrl->setParameter($this->
getParentObject(),
'obj_id', $a_set[
'usr_id']);
699 $this->tpl->setVariable(
'ROLE_LINK', $ilCtrl->getLinkTarget($this->getParentObject(),
'assignRoles'));
700 $this->tpl->setVariable(
'TXT_ROLES', $this->
lng->txt(
'edit'));
702 $this->tpl->parseCurrentBlock();
setTopCommands(bool $a_val)
static getAuthModeTranslation(string $a_auth_key, string $auth_name='')
static _getAuthMode(?string $a_auth_mode)
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...
setFormAction(string $a_form_action, bool $a_multipart=false)
addFilterItem(ilTableFilterItem $a_input_item, bool $a_optional=false)
setEnableTitle(bool $a_enabletitle)
UserGUIRequest $user_request
addFilterItemValue($filter, $value)
getUserDefinedField(string $a_key)
Get user defined field.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
const SYSTEM_USER_ID
This file contains constants for PHPStan analyis, see: https://phpstan.org/config-reference#constants...
addFilterItemByUdfType(string $id, int $type, bool $a_optional=false, ?string $caption=null, array $a_options=[])
Add filter by standard type.
static _getActiveAuthModes()
static lookupOrgUnitsRepresentation(int $a_usr_id)
lookup org unit representation
static _getAuthModeName($a_auth_key)
static _lookupObjId(int $ref_id)
isUdfColumn(string $a_key)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
TableGUI class for user administration.
resetOffset(bool $a_in_determination=false)
setExternalSorting(bool $a_val)
const ORG_OP_EDIT_USER_ACCOUNTS
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
readUserDefinedFieldsDefinitions()
Read user defined fields definitions.
static _lookupTitle(int $obj_id)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setFilterCommand(string $a_val, string $a_caption="")
const UDF_TYPE_TEXT
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setDefaultOrderDirection(string $a_defaultorderdirection)
setEnableAllCommand(bool $a_value)
__construct(Container $dic, ilPlugin $plugin)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
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)
static _getFolderIds(bool $access_with_orgunit=false)
__construct(?object $a_parent_obj, string $a_parent_cmd="", string $a_template_context="")
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
addMultiCommand(string $a_cmd, string $a_text)
determineOffsetAndOrder(bool $a_omit_offset=false)
setEnableHeader(bool $a_enableheader)
setMaxCount(int $a_max_count)
set max.
setExternalSegmentation(bool $a_val)