30 private static int $mode = self::MODE_DESKTOP;
61 "method" =>
"getLogin",
62 "course_export_fix_value" => 1,
63 "group_export_fix_value" => 1,
64 "changeable_hide" =>
true,
65 "required_hide" =>
true,
66 "group" =>
"personal_data"),
68 "input" =>
"password",
69 "required_hide" =>
true,
70 "visib_reg_hide" =>
true,
71 'visib_lua_fix_value' => 0,
72 "course_export_hide" =>
true,
73 "export_hide" =>
false,
74 "group_export_hide" =>
true,
76 "group" =>
"personal_data"),
81 "method" =>
"getFirstname",
82 "required_fix_value" => 1,
83 "visib_reg_fix_value" => 1,
84 'visib_lua_fix_value' => 1,
85 "course_export_fix_value" => 1,
86 "group_export_fix_value" => 1,
87 "group" =>
"personal_data"),
92 "method" =>
"getLastname",
93 "required_fix_value" => 1,
94 "visib_reg_fix_value" => 1,
95 'visib_lua_fix_value' => 1,
96 "course_export_fix_value" => 1,
97 "group_export_fix_value" => 1,
98 "group" =>
"personal_data"),
101 "lang_var" =>
"person_title",
104 "method" =>
"getUTitle",
105 "group" =>
"personal_data"),
107 "input" =>
"birthday",
108 "lang_var" =>
"birthday",
111 "method" =>
"getBirthday",
112 "group" =>
"personal_data"),
115 "values" => array(
"n" =>
"salutation_n",
"f" =>
"salutation_f",
"m" =>
"salutation_m"),
116 "method" =>
"getGender",
117 "group" =>
"personal_data"),
119 "input" =>
"picture",
120 "required_hide" =>
true,
121 "visib_reg_hide" =>
true,
122 "course_export_hide" =>
true,
123 "group_export_hide" =>
true,
124 "lists_hide" =>
true,
125 "lang_var" =>
"personal_picture",
126 "group" =>
"personal_data"),
129 "changeable_hide" =>
true,
130 "required_hide" =>
true,
131 "visib_reg_hide" =>
true,
132 "export_hide" =>
true,
133 "course_export_hide" =>
true,
134 "group_export_hide" =>
true,
135 "lists_hide" =>
true,
136 "group" =>
"personal_data"),
137 "interests_general" => array(
138 "input" =>
"multitext",
141 "method" =>
"getGeneralInterests",
142 "course_export_hide" =>
true,
143 "group_export_hide" =>
true,
144 "lists_hide" =>
true,
145 "group" =>
"interests"),
146 "interests_help_offered" => array(
147 "input" =>
"multitext",
150 "method" =>
"getOfferingHelp",
151 "course_export_hide" =>
true,
152 "group_export_hide" =>
true,
153 "lists_hide" =>
true,
154 "group" =>
"interests"),
155 "interests_help_looking" => array(
156 "input" =>
"multitext",
159 "method" =>
"getLookingForHelp",
160 "course_export_hide" =>
true,
161 "group_export_hide" =>
true,
162 "lists_hide" =>
true,
163 "group" =>
"interests"),
164 "org_units" => array(
165 "input" =>
"noneditable",
166 "lang_var" =>
"objs_orgu",
167 "required_hide" =>
true,
168 "visib_reg_hide" =>
true,
169 "course_export_hide" =>
false,
170 "group_export_hide" =>
false,
171 "export_hide" =>
true,
172 "changeable_hide" =>
true,
173 "changeable_fix_value" => 0,
174 "changeable_lua_hide" =>
true,
175 "changeable_lua_fix_value" => 0,
176 "method" =>
"getOrgUnitsRepresentation",
177 "group" =>
"contact_data"),
178 "institution" => array(
182 "method" =>
"getInstitution",
183 "group" =>
"contact_data"),
184 "department" => array(
188 "method" =>
"getDepartment",
189 "group" =>
"contact_data"),
194 "method" =>
"getStreet",
195 "group" =>
"contact_data"),
200 "method" =>
"getZipcode",
201 "group" =>
"contact_data"),
206 "method" =>
"getCity",
207 "group" =>
"contact_data"),
212 "method" =>
"getCountry",
213 "group" =>
"contact_data"),
214 "sel_country" => array(
215 "input" =>
"sel_country",
216 "method" =>
"getSelectedCountry",
217 "group" =>
"contact_data"),
218 "phone_office" => array(
222 "method" =>
"getPhoneOffice",
223 "group" =>
"contact_data"),
224 "phone_home" => array(
228 "method" =>
"getPhoneHome",
229 "group" =>
"contact_data"),
230 "phone_mobile" => array(
234 "method" =>
"getPhoneMobile",
235 "group" =>
"contact_data"),
240 "method" =>
"getFax",
241 "group" =>
"contact_data"),
246 "method" =>
"getEmail",
247 "group" =>
"contact_data"),
248 "second_email" => array(
249 "input" =>
"second_email",
252 "method" =>
"getSecondEmail",
253 "group" =>
"contact_data",
254 "change_listeners" => [
255 ilMailUserFieldChangeListener::class,
258 "input" =>
"textarea",
261 "method" =>
"getHobby",
262 "lists_hide" =>
true,
263 "group" =>
"contact_data"),
264 "referral_comment" => array(
265 "input" =>
"textarea",
268 "method" =>
"getComment",
269 "course_export_hide" =>
true,
270 "group_export_hide" =>
true,
271 "lists_hide" =>
true,
272 "group" =>
"contact_data"),
273 "matriculation" => array(
277 "method" =>
"getMatriculation",
280 "input" =>
"language",
281 "method" =>
"getLanguage",
282 "required_hide" =>
true,
283 "visib_reg_hide" =>
true,
284 "course_export_hide" =>
true,
285 "group_export_hide" =>
true,
286 "group" =>
"settings"),
287 "skin_style" => array(
288 "input" =>
"skinstyle",
289 "required_hide" =>
true,
290 "visib_reg_hide" =>
true,
291 "course_export_hide" =>
true,
292 "group_export_hide" =>
true,
293 "group" =>
"settings"),
294 "hits_per_page" => array(
295 "input" =>
"hitsperpage",
298 10 => 10, 15 => 15, 20 => 20, 30 => 30, 40 => 40,
299 50 => 50, 100 => 100, 9999 => 9999),
300 "required_hide" =>
true,
301 "visib_reg_hide" =>
true,
302 "course_export_hide" =>
true,
303 "group_export_hide" =>
true,
304 "group" =>
"settings"),
317 "hide_own_online_status" => array(
318 "input" =>
"selection",
319 "lang_var" =>
"awrn_user_show",
320 "required_hide" =>
true,
321 "visib_reg_hide" =>
true,
322 "course_export_hide" =>
true,
323 "group_export_hide" =>
true,
324 "group" =>
"settings",
327 "y" =>
"user_awrn_hide",
328 "n" =>
"user_awrn_show" 330 "bs_allow_to_contact_me" => array(
331 "input" =>
"selection",
332 "lang_var" =>
"buddy_allow_to_contact_me",
333 "required_hide" =>
true,
334 "visib_reg_hide" =>
true,
335 "course_export_hide" =>
true,
336 "group_export_hide" =>
true,
337 "group" =>
"settings",
340 "n" =>
"buddy_allow_to_contact_me_no",
341 "y" =>
"buddy_allow_to_contact_me_yes" 344 "chat_osc_accept_msg" => array(
345 "input" =>
"selection",
346 "lang_var" =>
"chat_osc_accept_msg",
347 "required_hide" =>
true,
348 "visib_reg_hide" =>
true,
349 "course_export_hide" =>
true,
350 "group_export_hide" =>
true,
351 "group" =>
"settings",
354 "n" =>
"chat_osc_accepts_messages_no",
355 "y" =>
"chat_osc_accepts_messages_yes" 358 "chat_broadcast_typing" => array(
359 "input" =>
"selection",
360 "lang_var" =>
"chat_broadcast_typing",
361 "required_hide" =>
true,
362 "visib_reg_hide" =>
true,
363 "course_export_hide" =>
true,
364 "group_export_hide" =>
true,
365 "group" =>
"settings",
368 "n" =>
"chat_no_use_typing_broadcast",
369 "y" =>
"chat_use_typing_broadcast" 372 "preferences" => array(
373 "visible_fix_value" => 1,
374 "changeable_fix_value" => 1,
375 "required_hide" =>
true,
376 "visib_reg_hide" =>
true,
377 "course_export_hide" =>
true,
378 "group_export_hide" =>
true,
379 "group" =>
"preferences"),
380 "mail_incoming_mail" => array(
381 "input" =>
"selection",
387 "required_hide" =>
true,
388 "visib_reg_hide" =>
true,
389 "course_export_hide" =>
true,
390 "group_export_hide" =>
true,
391 "export_hide" =>
true,
392 "search_hide" =>
true,
393 "group" =>
"settings")
406 $lng = $DIC->language();
408 $this->skip_groups = array();
409 $this->skip_fields = array();
413 $lng->loadLanguageModule(
"awrn");
414 $lng->loadLanguageModule(
"buddysystem");
425 foreach (self::$user_field as
$f => $p) {
427 if (in_array($p[
"group"], $this->skip_groups) ||
428 in_array(
$f, $this->skip_fields)) {
447 if (
$ilSetting->get(
'usr_settings_visib_lua_' . $field,
'1')) {
448 $fields[$field] = $info;
449 } elseif ($info[
'visib_lua_fix_value'] ??
false) {
450 $fields[$field] = $info;
462 $this->skip_groups[] = $a_group;
470 $this->skip_fields[] = $a_field;
479 array $custom_fields = null
485 $rbacreview = $DIC[
'rbacreview'];
487 $registration_settings = null;
490 if (self::$mode == self::MODE_REGISTRATION) {
493 self::$user_field[
"username"][
"group"] =
"login_data";
494 self::$user_field[
"password"][
"group"] =
"login_data";
495 self::$user_field[
"language"][
"default"] =
$lng->lang_key;
498 $roles = self::$user_field[
"roles"];
499 unset(self::$user_field[
"roles"]);
500 self::$user_field[
"roles"] = $roles;
501 self::$user_field[
"roles"][
"group"] =
"settings";
506 $custom_fields_done =
false;
507 foreach ($fields as
$f => $p) {
509 if (($p[
"group"] != $current_group) &&
510 self::userSettingVisible(
$f)) {
511 if (is_array($custom_fields) && $custom_fields !== [] && !$custom_fields_done) {
513 if ($current_group ==
"other" || $p[
"group"] ==
"settings") {
515 if ($current_group !=
"other") {
517 $sh->setTitle(
$lng->txt(
"other"));
520 foreach ($custom_fields as $custom_field) {
521 $a_form->
addItem($custom_field);
523 $custom_fields_done =
true;
528 $sh->setTitle(
$lng->txt($p[
"group"]));
530 $current_group = $p[
"group"];
533 $m = $p[
"method"] ??
"";
535 $lv = (isset($p[
"lang_var"]) && $p[
"lang_var"] !=
"")
539 switch ($p[
"input"]) {
541 if ((
int)
$ilSetting->get(
'allow_change_loginname') || self::$mode == self::MODE_REGISTRATION) {
544 $val->setValue($a_user->getLogin());
546 $val->setMaxLength((
int) $p[
'maxlength']);
548 $val->setRequired(
true);
553 $val->
setValue($a_user->getLogin());
560 if (self::userSettingVisible(
$f)) {
564 $value = $a_user->$m() ??
'';
567 $ti->setMaxLength($p[
"maxlength"]);
568 $ti->setSize($p[
"size"]);
569 $ti->setRequired((
bool)
$ilSetting->get(
"require_" .
$f));
570 if (!$ti->getRequired() || $ti->getValue()) {
571 $ti->setDisabled((
bool)
$ilSetting->get(
"usr_settings_disable_" .
$f));
578 if (self::userSettingVisible(
$f)) {
583 $ci->setRequired((
bool)
$ilSetting->get(
"require_" .
$f));
584 if (!$ci->getRequired() || $ci->getValue()) {
585 $ci->setDisabled((
bool)
$ilSetting->get(
"usr_settings_disable_" .
$f));
592 if (self::userSettingVisible(
$f)) {
595 if ($a_user && strlen($a_user->$m())) {
599 $bi->setRequired((
bool)
$ilSetting->get(
"require_" .
$f));
600 if (!$bi->getRequired() || $date) {
601 $bi->setDisabled((
bool)
$ilSetting->get(
"usr_settings_disable_" .
$f));
608 if (self::userSettingVisible(
$f)) {
613 foreach ($p[
"values"] as $k => $v) {
617 $rg->setRequired((
bool)
$ilSetting->get(
"require_" .
$f));
618 if (!$rg->getRequired() || $rg->getValue()) {
626 if (self::userSettingVisible(
"upload") && $a_user) {
629 $ii->setDisabled((
bool)
$ilSetting->get(
"usr_settings_disable_upload"));
632 if ($upload[
"name"] ??
false) {
633 $ii->setPending($upload[
"name"]);
643 $ii->setAlt(
$lng->txt(
"personal_picture"));
653 if (self::$mode == self::MODE_DESKTOP) {
654 if (self::userSettingVisible(
"roles")) {
655 $global_roles = $rbacreview->getGlobalRoles();
656 foreach ($global_roles as $role_id) {
657 if (in_array($role_id, $rbacreview->assignedRoles($a_user->getId()))) {
659 $role_names .= $roleObj->getTitle() .
", ";
664 $dr->
setValue(substr($role_names, 0, -2));
667 } elseif (self::$mode == self::MODE_REGISTRATION) {
668 if ($registration_settings->roleSelectionEnabled()) {
671 $options[$role[
"id"]] = $role[
"title"];
675 if (count($options) > 1) {
677 $ta->setOptions($options);
678 $ta->setRequired((
bool)
$ilSetting->get(
"require_" .
$f));
679 if (!$ta->getRequired()) {
680 $ta->setDisabled((
bool)
$ilSetting->get(
"usr_settings_disable_" .
$f));
686 $keys = array_keys($options);
687 $ta->setValue(array_shift(
$keys));
697 if (self::userSettingVisible(
$f)) {
702 $em->setRequired((
bool)
$ilSetting->get(
"require_" .
$f));
703 if (!$em->getRequired() || $em->getValue()) {
704 $em->setDisabled((
bool)
$ilSetting->get(
"usr_settings_disable_" .
$f));
706 if (self::MODE_REGISTRATION == self::$mode) {
707 $em->setRetype(
true);
709 $em->setMaxLength((
int) $p[
'maxlength']);
714 if (self::userSettingVisible(
$f)) {
719 $ta->setRows($p[
"rows"]);
720 $ta->setCols($p[
"cols"]);
721 $ta->setRequired((
bool)
$ilSetting->get(
"require_" .
$f));
722 if (!$ta->getRequired() || $ta->getValue()) {
723 $ta->setDisabled((
bool)
$ilSetting->get(
"usr_settings_disable_" .
$f));
730 if (self::$mode == self::MODE_REGISTRATION) {
731 if (!$registration_settings->passwordGenerationEnabled()) {
734 $ta->setRequired(
true);
746 if (self::userSettingVisible(
$f)) {
749 $ta->setValue($a_user->$m());
752 $lng->loadLanguageModule(
"meta");
753 foreach (
$lng->getInstalledLanguages() as $lang_key) {
754 $options[$lang_key] =
$lng->txt(
"meta_l_" . $lang_key);
757 $ta->setOptions($options);
758 $ta->setRequired((
bool)
$ilSetting->get(
"require_" .
$f));
759 if (!$ta->getRequired() || $ta->getValue()) {
762 || count($options) <= 1
770 if (self::userSettingVisible(
$f)) {
774 $ti->setValue($a_user->$m());
776 $ti->setMaxLength($p[
"maxlength"]);
777 $ti->setSize($p[
"size"]);
778 $ti->setRequired((
bool)
$ilSetting->get(
"require_" .
$f));
779 if (!$ti->getRequired() || $ti->getValue()) {
780 $ti->setDisabled((
bool)
$ilSetting->get(
"usr_settings_disable_" .
$f));
782 if ($this->ajax_href) {
784 $ti->setDataSource($this->ajax_href .
"&f=" .
$f);
790 if (self::$mode == self::MODE_DESKTOP && self::userSettingVisible(
$f)) {
800 if (is_array($custom_fields) && $custom_fields !== [] && !$custom_fields_done) {
802 if ($current_group !=
"other") {
804 $sh->setTitle(
$lng->txt(
"other"));
807 foreach ($custom_fields as $custom_field) {
808 $a_form->
addItem($custom_field);
815 $this->ajax_href = $a_href;
830 if (self::$mode == self::MODE_DESKTOP) {
831 return ($user_settings_config->
isVisible($a_setting));
833 if (isset(self::$user_field[$a_setting][
"visib_reg_hide"]) && self::$user_field[$a_setting][
"visib_reg_hide"] ===
true) {
836 return (
$ilSetting->get(
"usr_settings_visib_reg_" . $a_setting,
"1") ||
$ilSetting->get(
"require_" . $a_setting,
"0"));
840 public static function setMode(
int $mode): bool
842 if (in_array($mode, array(self::MODE_DESKTOP, self::MODE_REGISTRATION))) {
859 bool $a_include_udf =
true,
860 bool $a_personal_data_only =
true 869 foreach (self::$user_field as $field => $definition) {
871 if ($a_personal_data_only && !$user_settings_config->
isVisible($field)) {
875 if (
$ilSetting->get(
"require_" . $field) && $definition[
"method"]) {
876 $value = $a_user->{$definition[
"method"]}();
884 if ($a_include_udf) {
888 foreach ($user_defined_fields->getRequiredDefinitions() as $field => $definition) {
890 if ($a_personal_data_only && !$definition[
"visible"]) {
894 if (!($user_defined_data[
"f_" . $field] ??
false)) {
922 $ignorableSettings = array();
924 foreach (self::$user_field as $field => $definition) {
926 if (
'username' == $field ||
927 'password' == $field) {
936 if (self::isEditableByUser($field)) {
937 $ignorableSettings[] = $field;
941 return $ignorableSettings;
static userSettingVisible(string $a_setting)
Checks whether user setting is visible.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static isProfileIncomplete(ilObjUser $a_user, bool $a_include_udf=true, bool $a_personal_data_only=true)
Check if all required personal data fields are set.
static getLogger(string $a_component_id)
Get component logger.
getLocalUserAdministrationFields()
Get visible fields in local user administration.
static _lookupRegisterAllowed()
get all roles that are activated in user registration
setDisabled(bool $a_disabled)
isVisible(string $field)
Is setting visible to user?
getStandardFields()
Get standard user fields array.
static getIgnorableRequiredSettings()
Returns an array of all ignorable profiel fields.
setValue(string $a_value)
skipField(string $a_field)
Skip a field.
isVisibleAndChangeable(string $field)
Is field visible and changeable by user?
static setMode(int $mode)
static isEditableByUser(string $setting)
Returns whether a profile setting is editable by an user in the profile gui.
static getPasswordRequirementsInfo()
infotext for ilPasswordInputGUI setInfo()
static _getPersonalPicturePath(int $a_usr_id, string $a_size="small", bool $a_force_pic=false, bool $a_prevent_no_photo_image=false, bool $html_export=false)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
Class ilObjAuthSettingsGUI.
ilUserSettingsConfig $user_settings_config
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text area property in a property form.
setAjaxCallback(string $a_href)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
skipGroup(string $a_group)
Skip a group.
addStandardFieldsToForm(ilPropertyFormGUI $a_form, ?ilObjUser $a_user=null, array $custom_fields=null)
Add standard fields to form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...