19declare(strict_types=1);
52 int $a_mode = self::MODE_USER_FOLDER,
53 bool $a_load_items =
true
57 $this->
lng = $DIC[
'lng'];
58 $this->rbac_review =
$DIC[
'rbacreview'];
59 $this->current_user =
$DIC[
'ilUser'];
61 $this->user_folder_id = $a_parent_obj->getObject()->getRefId();
62 $this->user_profile = LocalDIC::dic()[Profile::class];
65 ||
$DIC[
'rbacsystem']->checkAccess(
'write', $this->user_folder_id)
66 ||
$DIC[
'rbacsystem']->checkAccess(
'cat_administrate_users', $this->user_folder_id)) {
67 $this->with_write_access =
true;
71 $this->
setId(
"user{$this->getUserFolderId()}");
84 $this->selectable_columns[
$c][
'txt'] ?? $this->
lng->txt($c),
89 if ($this->
getMode() == self::MODE_LOCAL_USER) {
90 $this->
addColumn($this->
lng->txt(
'context'),
'time_limit_owner');
99 $this->
setFormAction($this->
ctrl->getFormAction($this->parent_obj,
'applyFilter'));
100 $this->
setRowTemplate(
'tpl.user_list_row.html',
'components/ILIAS/User');
115 if ($this->
getMode() == self::MODE_USER_FOLDER) {
118 $cmds = $a_parent_obj->getUserMultiCommands();
119 foreach ($cmds as $cmd => $caption) {
133 $this->mode = $a_mode;
155 $ufs = $this->user_profile->getVisibleFields($this->
getFormContext());
158 $cols = array_reduce(
160 function (array
$c, ProfileField $v) use (&$udfs): array {
161 $identifier = $v->getIdentifier();
162 if ($v->isCustom()) {
164 $identifier =
"udf_{$identifier}";
165 $c[$identifier] = null;
168 if (!array_key_exists($identifier,
$c)) {
173 'txt' => $v->getLabel($this->
lng),
181 'time_limit_until' => [
182 'txt' => $this->
lng->txt(
'access_until'),
186 'txt' => $this->
lng->txt(
'last_access'),
190 'txt' => $this->lng->txt(
'create_date'),
194 'txt' => $this->lng->txt(
'approve_date'),
198 'txt' => $this->lng->txt(
'agree_date'),
201 'dpro_agreed_on' => [
202 'txt' => $this->lng->txt(
'dpro_agreed_on'),
206 'second_email' =>
null,
210 'institution' =>
null,
211 'department' =>
null,
216 'phone_office' =>
null,
217 'phone_home' =>
null,
218 'phone_mobile' =>
null,
220 'matriculation' =>
null,
221 'interests_general' =>
null,
222 'interests_help_offered' =>
null,
223 'interests_help_looking' =>
null,
225 'txt' => $this->lng->txt(
'auth_mode'),
233 'selectable_columns' => array_filter($cols),
242 $query->setLimit($this->
getLimit());
243 $query->setTextFilter($this->
filter[
'query'] ??
'');
244 $query->setActionFilter($this->
filter[
'activation'] ??
'');
245 $query->setLastLogin($this->
filter[
'last_login'] ??
null);
246 $query->setLimitedAccessFilter($this->
filter[
'limited_access'] ??
false);
247 $query->setNoCourseFilter($this->
filter[
'no_courses'] ??
false);
248 $query->setNoGroupFilter($this->
filter[
'no_groups'] ??
false);
249 $query->setCourseGroupFilter($this->
filter[
'course_group'] ?? 0);
250 $query->setRoleFilter((
int) ($this->
filter[
'global_role'] ?? 0));
251 $query->setUserFilter($this->
filter[
'user_ids'] ?? []);
252 $query->setFirstLetterLastname($this->user_request->getLetter());
253 $query->setAuthenticationFilter($this->
filter[
'authentication'] ??
'');
260 if ($this->
getMode() == self::MODE_USER_FOLDER) {
264 if ($this->
filter[
'time_limit_owner'] ??
null) {
265 $user_filter = [$this->
filter[
'time_limit_owner']];
272 if ($user_filter === []) {
278 if (isset($this->
filter[
'user_ids']) && is_array($this->
filter[
'user_ids']) && $this->
filter[
'user_ids'] === []) {
286 $additional_fields[
'firstname'],
287 $additional_fields[
'lastname'],
288 $additional_fields[
'email'],
289 $additional_fields[
'second_email'],
290 $additional_fields[
'last_login'],
291 $additional_fields[
'access_until'],
292 $additional_fields[
'org_units']
296 foreach ($this->
filter as $k => $v) {
297 if (strpos($k,
'udf_') === 0) {
298 $udf_filter[$k] = $v;
308 $query->setAdditionalFields($additional_fields);
309 $query->setUserFolder($user_filter);
310 $query->setUdfFilter($udf_filter);
311 $usr_data = $query->query();
313 if (count($usr_data[
'set']) == 0 && $this->
getOffset() > 0) {
316 $usr_data = $query->query();
319 foreach ($usr_data[
'set'] as $k => $user) {
325 $current_time = time();
326 if ($user[
'active']) {
327 if ($user[
'time_limit_unlimited']) {
328 $txt_access = $this->
lng->txt(
'access_unlimited');
329 $usr_data[
'set'][$k][
'access_class'] =
'smallgreen';
330 } elseif ($user[
'time_limit_until'] < $current_time) {
331 $txt_access = $this->
lng->txt(
'access_expired');
332 $usr_data[
'set'][$k][
'access_class'] =
'smallred';
335 $usr_data[
'set'][$k][
'access_class'] =
'small';
338 $txt_access = $this->
lng->txt(
'inactive');
339 $usr_data[
'set'][$k][
'access_class'] =
'smallred';
341 $usr_data[
'set'][$k][
'access_until'] = $txt_access;
345 $this->
setData($usr_data[
'set']);
355 if ($this->
getMode() == self::MODE_USER_FOLDER) {
359 if ($this->
filter[
'time_limit_owner']) {
360 $user_filter = [$this->
filter[
'time_limit_owner']];
367 if (!isset($this->
filter[
'user_ids'])) {
368 $this->
filter[
'user_ids'] =
null;
372 $query->setUserFolder($user_filter);
377 $usr_data = $query->query();
381 foreach ($usr_data[
'set'] as $item) {
384 $user_ids[] = $item[
'usr_id'];
393 if ($this->
getMode() == self::MODE_LOCAL_USER) {
396 if (count($parent_ids) > 1) {
401 $opt[0] = $this->
lng->txt(
'all_users');
404 foreach ($parent_ids as $parent_id) {
408 switch ($parent_id) {
418 $co->setOptions($opt);
420 $co->readFromSession();
421 $this->
filter[
'time_limit_owner'] = $co->getValue();
426 $ul =
new ilTextInputGUI($this->
lng->txt(
'login') .
'/' . $this->lng->txt(
'email') .
'/' .
427 $this->lng->txt(
'name'),
'query');
428 $ul->setDataSource($this->
ctrl->getLinkTarget(
429 $this->getParentObject(),
430 'addUserAutoComplete',
435 $ul->setSubmitFormOnEnter(
true);
437 $ul->readFromSession();
438 $this->
filter[
'query'] = $ul->getValue();
443 '' => $this->
lng->txt(
'user_all'),
444 'active' => $this->
lng->txt(
'active'),
445 'inactive' => $this->
lng->txt(
'inactive'),
450 $si->readFromSession();
451 $this->
filter[
'activation'] = $si->getValue();
456 $cb->readFromSession();
457 $this->
filter[
'limited_access'] = $cb->getChecked();
463 $di->setDate($default_date);
465 $di->readFromSession();
466 $this->
filter[
'last_login'] = $di->getDate();
468 if ($this->
getMode() == self::MODE_USER_FOLDER) {
472 $cb->readFromSession();
473 $this->
filter[
'no_courses'] = $cb->getChecked();
478 $ng->readFromSession();
479 $this->
filter[
'no_groups'] = $ng->getChecked();
483 $rs->setSelectText($this->
lng->txt(
'user_select_course_group'));
484 $rs->setHeaderMessage($this->
lng->txt(
'user_please_select_course_group'));
485 $rs->setClickableTypes([
'crs',
'grp']);
487 $rs->readFromSession();
488 $this->
filter[
'course_group'] = $rs->getValue();
493 '' => $this->
lng->txt(
'user_any'),
495 foreach ($this->rbac_review->getRolesByFilter(2, $this->current_user->getId()) as $role) {
496 $options[$role[
'rol_id']] = $role[
'title'];
501 $si->readFromSession();
502 $this->
filter[
'global_role'] = $si->getValue();
507 '' => $this->
lng->txt(
'user_any'),
509 foreach ($auth_methods as $method => $value) {
510 if ($method ==
'default') {
519 $si->readFromSession();
520 $this->
filter[
'authentication'] = $si->getValue();
523 foreach ($this->udf_fields as
$f) {
534 $id =
"udf_{$field->getIdentifier()}";
536 $item->setRequired(
false);
540 $item->setPostVar(
$id);
542 $item->readFromSession();
547 protected function fillRow(array $a_set): void
549 $this->
ctrl->setParameterByClass(
'ilobjusergui',
'letter', $this->user_request->getLetter());
551 foreach ($this->getSelectedColumns() as
$c) {
552 if (
$c ==
'time_limit_until') {
553 $this->tpl->setCurrentBlock(
'access_until');
554 $this->tpl->setVariable(
'VAL_ACCESS_UNTIL', $a_set[
'access_until']);
555 $this->tpl->setVariable(
'CLASS_ACCESS_UNTIL', $a_set[
'access_class']);
556 } elseif (
$c ==
'last_login') {
557 $this->tpl->setCurrentBlock(
'last_login');
558 $this->tpl->setVariable(
562 } elseif (in_array(
$c, [
'firstname',
'lastname'])) {
563 $this->tpl->setCurrentBlock(
$c);
564 $this->tpl->setVariable(
'VAL_' . strtoupper(
$c), (
string) $a_set[
$c]);
565 } elseif (
$c ==
'auth_mode') {
566 $this->tpl->setCurrentBlock(
'user_field');
568 $this->tpl->parseCurrentBlock();
570 $this->tpl->setCurrentBlock(
'user_field');
571 $this->tpl->setVariable(
'VAL_UF', $this->buildUserFieldValue(
$c, $a_set[
$c] ??
''));
574 $this->tpl->parseCurrentBlock();
577 if ($a_set[
'usr_id'] != 6
578 && ($this->getMode() == self::MODE_USER_FOLDER || $a_set[
'time_limit_owner'] == $this->getUserFolderId())) {
579 $this->tpl->setCurrentBlock(
'checkb');
580 $this->tpl->setVariable(
'ID', $a_set[
'usr_id']);
581 $this->tpl->parseCurrentBlock();
584 if ($this->with_write_access
585 && ($this->getMode() === self::MODE_USER_FOLDER
586 || $a_set[
'time_limit_owner'] == $this->getUserFolderId())) {
587 $this->tpl->setVariable(
'VAL_LOGIN', $a_set[
'login']);
588 $this->
ctrl->setParameterByClass(
'ilobjusergui',
'obj_id', $a_set[
'usr_id']);
589 $this->tpl->setVariable(
591 $this->
ctrl->getLinkTargetByClass(
'ilobjusergui',
'view')
593 $this->
ctrl->setParameterByClass(
'ilobjusergui',
'obj_id',
'');
595 $this->tpl->setVariable(
'VAL_LOGIN_PLAIN', $a_set[
'login']);
598 if ($this->getMode() == self::MODE_LOCAL_USER) {
599 $this->tpl->setCurrentBlock(
'context');
600 $this->tpl->setVariable(
604 $this->tpl->parseCurrentBlock();
606 $this->tpl->setCurrentBlock(
'roles');
607 $this->
ctrl->setParameter($this->getParentObject(),
'obj_id', $a_set[
'usr_id']);
608 $this->tpl->setVariable(
'ROLE_LINK', $this->
ctrl->getLinkTarget($this->getParentObject(),
'assignRoles'));
609 $this->tpl->setVariable(
'TXT_ROLES', $this->
lng->txt(
'edit'));
610 $this->
ctrl->clearParameters($this->getParentObject());
611 $this->tpl->parseCurrentBlock();
622 return $value ===
'' ?
'' : $this->
lng->txt(
'gender_' . $value);
629 case 'dpro_agreed_on':
633 if (is_array($value)) {
634 return implode(
', ', $value);
637 if (trim($value) ===
'') {
646 if ($this->getMode() === self::MODE_USER_FOLDER) {
647 return ProfileContext::UserAdministration;
649 return ProfileContext::LocalUserAdministration;
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
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)
class ilRbacReview Contains Review functions of core Rbac.
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)
array $selectable_columns
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
ilRbacReview $rbac_review
buildSelectableColumnsAndUdfs()
addFilterItemByUdfType(ProfileField $field)
Add filter by standard type.
addFilterItemValue($filter, $value)
getSelectableColumns()
Get selectable columns.
buildUserFieldValue(string $key, array|string $value)
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
filter(string $filter_id, array $class_path, string $cmd, bool $activated=true, bool $expanded=true)
if(!file_exists('../ilias.ini.php'))