19 declare(strict_types=1);
68 bool $a_call_by_reference =
false,
69 bool $a_prepare_output =
true 73 $this->
ctrl = $DIC[
'ilCtrl'];
74 $this->
tabs = $DIC[
'ilTabs'];
75 $this->
help = $DIC[
'ilHelp'];
76 $this->mail_sender_factory = $DIC->mail()->mime()->senderFactory();
80 $this->default_layout_and_style = $DIC[
'ilClientIniFile']->readVariable(
'layout',
'skin') .
81 ':' . $DIC[
'ilClientIniFile']->readVariable(
'layout',
'style');
87 $this->uploads = $DIC->upload();
88 $this->irss = $DIC->resourceStorage();
91 $this->
ctrl->saveParameter($this, [
'obj_id',
'letter']);
92 $this->
ctrl->setParameterByClass(
'ilobjuserfoldergui',
'letter', $this->requested_letter);
93 $this->
lng->loadLanguageModule(
'user');
100 $this->requested_letter = $this->user_request->
getLetter();
101 $this->requested_baseClass = $this->user_request->getBaseClass();
102 $this->requested_search = $this->user_request->getSearch();
103 $this->legal_documents = $DIC[
'legalDocuments'];
108 $next_class = $this->
ctrl->getNextClass($this);
109 $cmd = $this->
ctrl->getCmd();
113 switch ($next_class) {
114 case 'illearningprogressgui':
120 $this->
ctrl->forwardCommand($new_gui);
123 case 'ilobjectownershipmanagementgui':
125 $this->
ctrl->forwardCommand($gui);
129 if ($cmd ==
'' || $cmd ==
'view') {
140 if (strtolower(get_class($this->
object)) ==
'ilobjuser') {
141 $this->tpl->setTitle(
'[' . $this->
object->getLogin() .
'] ' . $this->
object->getTitle());
142 $this->tpl->setDescription($this->
object->getLongDescription());
143 $this->tpl->setTitleIcon(
145 $this->
lng->txt(
'obj_' . $this->object->getType())
148 parent::setTitleAndDescription();
156 if (strtolower($this->requested_baseClass) ==
'iladministrationgui') {
157 $this->
ctrl->redirectByClass(
'ilobjuserfoldergui',
'view');
159 $this->
ctrl->redirectByClass(
'ilobjcategorygui',
'listUsers');
170 $this->tabs_gui->clearTargets();
172 $this->
help->setScreenIdComponent(
'usr');
174 if ($this->requested_search) {
175 $this->tabs_gui->setBackTarget(
176 $this->
lng->txt(
'search_results'),
180 $this->tabs_gui->addTarget(
182 $this->
ctrl->getLinkTarget($this,
'edit'),
183 [
'edit',
'',
'view'],
189 $this->tabs_gui->addTarget(
191 $this->
ctrl->getLinkTarget($this,
'edit'),
192 [
'edit',
'',
'view'],
198 $this->tabs_gui->addTarget(
200 $this->
ctrl->getLinkTarget($this,
'roleassignment'),
207 if ($this->rbac_system->checkAccess(
'read', $this->ref_id) and
210 $this->tabs_gui->addTarget(
212 $this->
ctrl->getLinkTargetByClass(
'illearningprogressgui',
''),
214 [
'illplistofobjectsgui',
'illplistofsettingsgui',
'illearningprogressgui',
'illplistofprogressgui']
218 $this->tabs_gui->addTarget(
220 $this->
ctrl->getLinkTargetByClass(
'ilobjectownershipmanagementgui',
''),
222 'ilobjectownershipmanagementgui' 233 $this->back_target = [
'text' => $a_text,
'link' => $a_link];
240 $udfs = $this->user_request->getUDFs();
241 foreach ($this->user_defined_fields->getDefinitions() as $field_id => $definition) {
242 if ($definition[
'required'] and !strlen($udfs[$field_id])) {
251 $user_defined_data = null;
254 if ($this->
object->getType() ==
'usr') {
255 $user_defined_data = $this->
object->getUserDefinedData();
257 foreach ($this->user_defined_fields->getDefinitions() as $field_id => $definition) {
259 $old = $error_post_vars[
'udf'][$field_id] ?? $user_defined_data[$field_id];
262 $this->tpl->setCurrentBlock(
'field_text');
263 $this->tpl->setVariable(
'FIELD_NAME',
'udf[' . $definition[
'field_id'] .
']');
266 $this->tpl->setCurrentBlock(
'field_select');
267 $this->tpl->setVariable(
271 'udf[' . $definition[
'field_id'] .
']',
272 $this->user_defined_fields->fieldValuesToSelectArray(
273 $definition[
'field_values']
280 $this->tpl->parseCurrentBlock();
281 $this->tpl->setCurrentBlock(
'user_defined');
283 if ($definition[
'required']) {
284 $name = $definition[
'field_name'] .
'<span class="asterisk">*</span>';
286 $name = $definition[
'field_name'];
288 $this->tpl->setVariable(
'TXT_FIELD_NAME', $name);
289 $this->tpl->parseCurrentBlock();
296 $this->tabs_gui->clearTargets();
300 $obj_list = $this->rbac_review->getRoleListByObject(
ROLE_FOLDER_ID);
302 foreach ($obj_list as $obj_data) {
306 $this->rbac_review->assignedRoles($this->user->getId())
317 $this->rbac_review->assignedRoles($this->user->getId())
319 $rol[$obj_data[
'obj_id']] = $obj_data[
'title'];
325 $this->
ilias->raiseError(
326 $this->
lng->txt(
'msg_no_roles_users_can_be_assigned_to'),
327 $this->
ilias->error_obj->MESSAGE
331 $keys = array_keys($rol);
334 if (in_array(4, $keys)) {
335 $this->default_role = 4;
337 if (count($keys) > 1 && in_array(2, $keys)) {
339 foreach ($keys as
$key => $val) {
347 $this->default_role = array_shift($keys);
349 $this->selectable_roles = $rol;
357 if (!$this->rbac_system->checkAccess(
'create_usr', $this->usrf_ref_id)
358 && !$this->rbac_system->checkAccess(
'cat_administrate_users', $this->usrf_ref_id)) {
359 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
364 $this->tpl->setContent($this->form_gui->getHTML());
372 if (!$this->rbac_system->checkAccess(
'create_usr', $this->usrf_ref_id)
373 && !$this->
access->checkAccess(
'cat_administrate_users',
'', $this->usrf_ref_id)) {
374 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
381 $profile_maybe_incomplete =
false;
382 if ($this->form_gui->getInput(
'ignore_rf',
false)) {
386 if (!$this->form_gui->checkInput()) {
387 $this->form_gui->setValuesByPost();
388 $this->tpl->setContent($this->form_gui->getHTML());
395 || !in_array(
SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
396 || in_array(
SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
399 $user_object->setTitle($user_object->getFullname());
400 $user_object->setDescription($user_object->getEmail());
404 $user_object->create();
407 $user_object->setExternalAccount($this->form_gui->getInput(
'ext_account'));
412 $user_object->setLastPasswordChangeTS(time());
415 $user_object->saveAsNew();
419 $user_object->setLanguage($this->form_gui->getInput(
'language'));
424 $sknst = explode(
':', $this->form_gui->getInput(
'skin_style'));
426 if ($user_object->getPref(
'style') != $sknst[1] ||
427 $user_object->getPref(
'skin') != $sknst[0]) {
428 $user_object->setPref(
'skin', $sknst[0]);
429 $user_object->setPref(
'style', $sknst[1]);
433 $user_object->setPref(
'hits_per_page', $this->form_gui->getInput(
'hits_per_page'));
436 $user_object->setPref(
437 'hide_own_online_status',
438 $this->form_gui->getInput(
'hide_own_online_status')
442 $user_object->setPref(
443 'bs_allow_to_contact_me',
444 $this->form_gui->getInput(
'bs_allow_to_contact_me') ?
'y' :
'n' 448 $user_object->setPref(
449 'chat_osc_accept_msg',
450 $this->form_gui->getInput(
'chat_osc_accept_msg') ?
'y' :
'n' 454 $user_object->setPref(
455 'chat_broadcast_typing',
456 $this->form_gui->getInput(
'chat_broadcast_typing') ?
'y' :
'n' 459 if ($this->
settings->get(
'session_reminder_enabled') ===
'1') {
460 $user_object->setPref(
461 'session_reminder_enabled',
462 $this->form_gui->getInput(
'session_reminder_enabled')
465 $user_object->writePrefs();
468 $this->rbac_admin->assignUser(
469 (
int) $this->form_gui->getInput(
'default_role'),
470 $user_object->getId(),
474 $msg = $this->
lng->txt(
'user_added');
476 $this->
user->setPref(
478 ($this->form_gui->getInput(
'send_mail') ==
'y') ?
'y' :
'n' 480 $this->
user->writePrefs();
482 $this->
object = $user_object;
488 if ($profile_maybe_incomplete
489 && $this->user_profile->isProfileIncomplete($this->object)) {
490 $this->
object->setProfileIncomplete(
true);
491 $this->
object->update();
495 if ($this->form_gui->getInput(
'send_mail') ==
'y') {
497 $acc_mail->useLangVariablesAsFallback(
true);
498 $acc_mail->setAttachConfiguredFiles(
true);
499 $acc_mail->setUserPassword($this->form_gui->getInput(
'passwd'));
500 $acc_mail->setUser($user_object);
502 if ($acc_mail->send()) {
503 $msg .=
'<br />' . $this->
lng->txt(
'mail_sent');
504 $this->tpl->setOnScreenMessage(
'success', $msg,
true);
506 $msg .=
'<br />' . $this->
lng->txt(
'mail_not_sent');
507 $this->tpl->setOnScreenMessage(
'info', $msg,
true);
510 $this->tpl->setOnScreenMessage(
'success', $msg,
true);
513 if (strtolower($this->requested_baseClass) ==
'iladministrationgui') {
514 $this->
ctrl->redirectByClass(
'ilobjuserfoldergui',
'view');
518 $this->
ctrl->redirectByClass(
'ilobjcategorygui',
'listUsers');
526 $this->tabs_gui->clearTargets();
532 $this->tpl->setContent($this->form_gui->getHTML());
549 $from = $this->form_gui->getItemByPostVar(
'time_limit_from')->getDate();
554 $until = $this->form_gui->getItemByPostVar(
'time_limit_until')->getDate();
561 if ($a_mode ==
'create') {
565 $bd = $this->form_gui->getItemByPostVar(
'birthday');
566 $bd = $bd->getDate();
634 $general_interests = is_array($this->form_gui->getInput(
'interests_general'))
635 ? $this->form_gui->getInput(
'interests_general')
639 $offering_help = is_array($this->form_gui->getInput(
'interests_help_offered'))
640 ? $this->form_gui->getInput(
'interests_help_offered')
644 $looking_for_help = is_array($this->form_gui->getInput(
'interests_help_looking'))
645 ? $this->form_gui->getInput(
'interests_help_looking')
652 $zoom = (
int) $this->form_gui->getInput(
'loc_zoom');
681 foreach ($all_defs as $definition) {
682 $f =
"udf_" . $definition[
'field_id'];
683 $item = $this->form_gui->getItemByPostVar(
$f);
684 if ($item && !$item->getDisabled()) {
685 $udf[$definition[
'field_id']] = $this->form_gui->getInput(
$f);
697 $profile_maybe_incomplete =
false;
698 if ($this->form_gui->getInput(
'ignore_rf',
false)) {
702 if ($this->form_gui->checkInput()) {
707 ) && trim($this->form_gui->getInput(
'passwd')) !==
'' 709 || !in_array(
SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
710 || in_array(
SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId())))
715 if ((
int) $this->form_gui->getInput(
'active') == 1) {
716 $this->
object->setLoginAttempts(0);
724 $this->
object->updateLogin($this->form_gui->getInput(
'login'));
726 $this->tpl->setOnScreenMessage(
'failure', $e->getMessage());
727 $this->form_gui->setValuesByPost();
728 $this->tpl->setContent($this->form_gui->getHTML());
732 $this->
object->setTitle($this->
object->getFullname());
733 $this->
object->setDescription($this->
object->getEmail());
736 $this->
object->setLanguage($this->form_gui->getInput(
'language'));
741 $sknst = explode(
':', $this->form_gui->getInput(
'skin_style'));
743 if ($this->
object->getPref(
'style') != $sknst[1] ||
744 $this->
object->getPref(
'skin') != $sknst[0]) {
745 $this->
object->setPref(
'skin', $sknst[0]);
746 $this->
object->setPref(
'style', $sknst[1]);
750 $this->
object->setPref(
'hits_per_page', $this->form_gui->getInput(
'hits_per_page'));
753 $this->
object->setPref(
754 'hide_own_online_status',
755 ($this->form_gui->getInput(
'hide_own_online_status') ??
'0')
759 $this->
object->setPref(
760 'bs_allow_to_contact_me',
761 ($this->form_gui->getInput(
'bs_allow_to_contact_me') ??
false) ?
'y' :
'n' 765 $this->
object->setPref(
766 'chat_osc_accept_msg',
767 ($this->form_gui->getInput(
'chat_osc_accept_msg') ??
false) ?
'y' :
'n' 771 $this->
object->setPref(
772 'chat_broadcast_typing',
773 ($this->form_gui->getInput(
'chat_broadcast_typing') ??
false) ?
'y' :
'n' 779 $this->
object->setLastPasswordChangeTS(time());
781 if ($this->
settings->get(
'session_reminder_enabled') ===
'1') {
782 $this->
object->setPref(
783 'session_reminder_enabled',
784 $this->form_gui->getInput(
'session_reminder_enabled')
789 $this->
object->setProfileIncomplete(
false);
791 $this->update = $this->
object->update();
795 if ($this->
user->getId() == $this->
object->getId()) {
796 $this->
user->readPrefs();
798 $this->
user->setPref(
800 ($this->form_gui->getInput(
'send_mail') ===
'y') ?
'y' :
'n' 802 $this->
user->writePrefs();
805 $msg = $this->
lng->txt(
'saved_successfully') . $mail_message;
812 if ($profile_maybe_incomplete) {
815 if ($this->user_profile->isProfileIncomplete(
$user)) {
816 $this->
object->setProfileIncomplete(
true);
822 $this->tpl->setOnScreenMessage(
'success', $msg,
true);
824 if (strtolower($this->requested_baseClass) ==
'iladministrationgui') {
825 $this->
ctrl->redirectByClass(
'ilobjuserfoldergui',
'view');
827 $this->
ctrl->redirectByClass(
'ilobjcategorygui',
'listUsers');
830 $this->form_gui->setValuesByPost();
831 $this->tabs_gui->activateTab(
'properties');
832 $this->tpl->setContent($this->form_gui->getHtml());
841 $data[
'auth_mode'] = $this->
object->getAuthMode();
842 $data[
'login'] = $this->
object->getLogin();
843 $data[
'ext_account'] = $this->
object->getExternalAccount();
845 $this->
object->getCreateDate(),
849 $data[
'approve_date'] = ($this->
object->getApproveDate() !=
'')
853 $data[
'last_login'] = ($this->
object->getLastLogin() !=
'')
856 $data[
'active'] = $this->
object->getActive();
857 $data[
'time_limit_unlimited'] = $this->
object->getTimeLimitUnlimited() ?
'1' :
'0';
859 $data[
'time_limit_from'] = $this->
object->getTimeLimitFrom()
862 $data[
'time_limit_until'] = $this->
object->getTimeLimitUntil()
866 $data[
'gender'] = $this->
object->getGender();
867 $data[
'firstname'] = $this->
object->getFirstname();
868 $data[
'lastname'] = $this->
object->getLastname();
869 $data[
'title'] = $this->
object->getUTitle();
870 $data[
'birthday'] = $this->
object->getBirthday()
873 $data[
'institution'] = $this->
object->getInstitution();
874 $data[
'department'] = $this->
object->getDepartment();
875 $data[
'street'] = $this->
object->getStreet();
876 $data[
'city'] = $this->
object->getCity();
877 $data[
'zipcode'] = $this->
object->getZipcode();
878 $data[
'country'] = $this->
object->getCountry();
879 $data[
'sel_country'] = $this->
object->getSelectedCountry();
880 $data[
'phone_office'] = $this->
object->getPhoneOffice();
881 $data[
'phone_home'] = $this->
object->getPhoneHome();
882 $data[
'phone_mobile'] = $this->
object->getPhoneMobile();
883 $data[
'fax'] = $this->
object->getFax();
884 $data[
'email'] = $this->
object->getEmail();
885 $data[
'second_email'] = $this->
object->getSecondEmail();
886 $data[
'hobby'] = $this->
object->getHobby();
887 $data[
'referral_comment'] = $this->
object->getComment();
889 $data[
'interests_general'] = $this->
object->getGeneralInterests();
890 $data[
'interests_help_offered'] = $this->
object->getOfferingHelp();
891 $data[
'interests_help_looking'] = $this->
object->getLookingForHelp();
893 $data[
'matriculation'] = $this->
object->getMatriculation();
894 $data[
'client_ip'] = $this->
object->getClientIP();
897 $user_defined_data = $this->
object->getUserDefinedData();
898 foreach ($this->user_defined_fields->getDefinitions() as $field_id => $definition) {
899 $data[
'udf_' . $field_id] = $user_defined_data[
'f_' . $field_id] ??
'';
902 $data[
'language'] = $this->
object->getLanguage();
903 $data[
'skin_style'] = $this->
object->skin .
':' . $this->
object->prefs[
'style'];
904 $data[
'hits_per_page'] = $this->
object->prefs[
'hits_per_page'] ??
'';
905 $data[
'hide_own_online_status'] = $this->
object->prefs[
'hide_own_online_status'] ??
'';
906 $data[
'bs_allow_to_contact_me'] = ($this->
object->prefs[
'bs_allow_to_contact_me'] ??
'') ==
'y';
907 $data[
'chat_osc_accept_msg'] = ($this->
object->prefs[
'chat_osc_accept_msg'] ??
'') ==
'y';
908 $data[
'chat_broadcast_typing'] = ($this->
object->prefs[
'chat_broadcast_typing'] ??
'') ==
'y';
909 $data[
'session_reminder_enabled'] = (
int) ($this->
object->prefs[
'session_reminder_enabled'] ?? 0);
911 $data[
'send_mail'] = (($this->
object->prefs[
'send_info_mails'] ??
'') ==
'y');
913 $this->form_gui->setValuesByArray($data);
924 $this->form_gui->setFormAction($this->
ctrl->getFormAction($this));
925 if ($a_mode ==
'create') {
926 $this->form_gui->setTitle($this->
lng->txt(
'usr_new'));
928 $this->form_gui->setTitle($this->
lng->txt(
'usr_edit'));
933 $sec_l->setTitle($this->
lng->txt(
'login_data'));
934 $this->form_gui->addItem($sec_l);
940 foreach ($active_auth_modes as $auth_name => $auth_key) {
941 if ($auth_name ==
'default') {
946 $option[$auth_name] = $name;
949 $this->form_gui->addItem($am);
951 if ($a_mode ==
'edit') {
954 $this->form_gui->addItem(
$id);
959 if ($a_mode ==
'edit') {
960 $lo->setCurrentUserId($this->
object->getId());
965 $this->
lng->txt(
'usr_loginname_history_info'),
967 $last_history_entry[0]
974 $this->form_gui->addItem($lo);
977 || !in_array(
SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
978 || in_array(
SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
982 $pw->setMaxLength(80);
983 $pw->setValidateAuthPost(
'auth_mode');
984 if ($a_mode ==
'create') {
985 $pw->setRequiredOnAuth(
true);
988 && in_array(
SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
989 && !in_array(
SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
990 $pw->setDisabled(
true);
993 $this->form_gui->addItem($pw);
999 $ext->setMaxLength(250);
1000 $ext->setInfo($this->
lng->txt(
'user_ext_account_desc'));
1001 $this->form_gui->addItem($ext);
1005 $sec_si->setTitle($this->
lng->txt(
'system_information'));
1006 $this->form_gui->addItem($sec_si);
1009 if ($a_mode ==
'edit') {
1011 'create_date' =>
'',
1012 'approve_date' =>
'',
1013 ...$this->legal_documents->userManagementFields($this->
object),
1017 foreach ($sia as
$a => $v) {
1018 if (is_string($v)) {
1020 $siai->setValue($v);
1021 $this->form_gui->addItem($siai);
1023 $this->form_gui->addItem($v);
1029 $ac->setChecked(
true);
1030 $this->form_gui->addItem($ac);
1032 $this->
lng->loadLanguageModule(
'crs');
1036 $radg->setRequired(
true);
1038 $radg->addOption($op1);
1040 $radg->addOption($op2);
1044 $acfrom->setShowTime(
true);
1045 $acfrom->setMinuteStepSize(1);
1046 $op2->addSubItem($acfrom);
1050 $acto->setShowTime(
true);
1051 $acto->setMinuteStepSize(1);
1052 $op2->addSubItem($acto);
1054 $this->form_gui->addItem($radg);
1064 $sec_pd->setTitle($this->
lng->txt(
'personal_data'));
1065 $this->form_gui->addItem($sec_pd);
1072 $gndr->addOption($neutral);
1074 $gndr->addOption($female);
1076 $gndr->addOption($male);
1077 $this->form_gui->addItem($gndr);
1081 'firstname' =>
true,
1085 foreach ($fields as $field =>
$req) {
1086 $max_len = $field ===
'title' ? 32 : 128;
1089 $caption = ($field ==
'title')
1094 $inp->setMaxLength($max_len);
1095 $inp->setRequired(
$req);
1096 $this->form_gui->addItem($inp);
1103 if ($a_mode ==
'edit' || $a_mode ==
'upload') {
1111 $this->form_gui->addItem($pi);
1117 $this->form_gui->addItem($birthday);
1123 [
'institution', 40, 80],
1124 [
'department', 40, 80],
1127 [
'zipcode', 10, 10],
1128 [
'country', 40, 40],
1130 [
'phone_office', 30, 30],
1131 [
'phone_home', 30, 30],
1132 [
'phone_mobile', 30, 30],
1137 foreach ($fields as $field) {
1141 $sec_cd->setTitle($this->
lng->txt(
'contact_data'));
1142 $this->form_gui->addItem($sec_cd);
1145 if ($a_mode ==
'edit') {
1147 $orgus->setValue($this->
object->getOrgUnitsRepresentation());
1148 $this->form_gui->addItem($orgus);
1152 if ($field[0] !=
'sel_country') {
1154 $inp->setSize($field[1]);
1155 $inp->setMaxLength($field[2]);
1156 $inp->setRequired(isset(
$settings[
'require_' . $field[0]]) &&
1158 $this->form_gui->addItem($inp);
1164 $this->form_gui->addItem($cs);
1172 $em->setMaxLength(128);
1173 $this->form_gui->addItem($em);
1179 $this->form_gui->addItem($em);
1186 $hob->setRequired(isset(
$settings[
'require_hobby']) &&
1188 $this->form_gui->addItem($hob);
1195 $rc->setRequired(isset(
$settings[
'require_referral_comment']) &&
1197 $this->form_gui->addItem($rc);
1201 $sh->setTitle($this->
lng->txt(
'interests'));
1202 $this->form_gui->addItem($sh);
1204 $multi_fields = [
'interests_general',
'interests_help_offered',
'interests_help_looking'];
1205 foreach ($multi_fields as $multi_field) {
1209 $ti->setMulti(
true);
1210 $ti->setMaxLength(40);
1212 $ti->setRequired(isset(
$settings[
'require_' . $multi_field]) &&
1214 $this->form_gui->addItem($ti);
1220 $sec_oi->setTitle($this->
lng->txt(
'user_profile_other'));
1221 $this->form_gui->addItem($sec_oi);
1227 $mr->setMaxLength(40);
1228 $mr->setRequired(isset(
$settings[
'require_matriculation']) &&
1230 $this->form_gui->addItem($mr);
1235 $ip->setMaxLength(255);
1236 $ip->setInfo($this->
lng->txt(
'current_ip') .
' ' .
$_SERVER[
'REMOTE_ADDR'] .
' <br />' .
1237 '<span class="warning">' . $this->
lng->txt(
'current_ip_alert') .
'</span>');
1238 $this->form_gui->addItem($ip);
1248 foreach ($all_defs as $definition) {
1251 $this->form_gui->addItem($f_property);
1255 if ($a_mode ==
'create' 1265 $sec_st->setTitle($this->
lng->txt(
'settings'));
1266 $this->form_gui->addItem($sec_st);
1269 if ($a_mode ==
'create') {
1271 $this->
lng->txt(
'default_role'),
1275 $role->setValue($this->default_role);
1276 $role->setOptions($this->selectable_roles);
1277 $this->form_gui->addItem($role);
1281 $languages = $this->
lng->getInstalledLanguages();
1282 $this->
lng->loadLanguageModule(
'meta');
1284 foreach ($languages as $l) {
1285 $options[$l] = $this->
lng->txt(
'meta_l_' . $l);
1288 $this->
lng->txt(
'language'),
1291 $lang->setOptions($options);
1293 if (count($options) <= 1) {
1294 $lang->setDisabled(
true);
1296 $this->form_gui->addItem(
$lang);
1301 $this->
lng->txt(
'skin_style'),
1305 $skins = ilStyleDefinition::getAllSkins();
1308 if (is_array($skins)) {
1312 foreach ($skins as $skin) {
1313 foreach ($skin->getStyles() as $style) {
1318 $options[$skin->getId() .
':' . $style->getId()] = $skin->getName() .
' / ' . $style->getName();
1323 $sk->setValue($this->default_layout_and_style);
1325 $this->form_gui->addItem($sk);
1330 $this->
lng->txt(
'hits_per_page'),
1341 9999 => $this->
lng->txt(
'no_limit')
1344 $hpp->setValue($this->
settings->get(
'hits_per_page'));
1345 $this->form_gui->addItem($hpp);
1349 $this->
lng->loadLanguageModule(
'awrn');
1351 $default = ($this->
settings->get(
'hide_own_online_status') ==
'n')
1352 ? $this->
lng->txt(
'user_awrn_show')
1353 : $this->
lng->txt(
'user_awrn_hide');
1356 '' => $this->
lng->txt(
'user_awrn_default') .
' (' . $default .
')',
1357 'n' => $this->
lng->txt(
'user_awrn_show'),
1358 'y' => $this->
lng->txt(
'user_awrn_hide')
1362 $os->setDisabled((
bool) $this->
settings->get(
'usr_settings_disable_hide_own_online_status'));
1363 $os->setInfo($this->
lng->txt(
'awrn_hide_from_awareness_info'));
1364 $this->form_gui->addItem($os);
1368 $this->
lng->loadLanguageModule(
'buddysystem');
1369 $os =
new ilCheckboxInputGUI($this->
lng->txt(
'buddy_allow_to_contact_me'),
'bs_allow_to_contact_me');
1370 if ($a_mode ==
'create') {
1373 $this->form_gui->addItem($os);
1376 $this->
lng->loadLanguageModule(
'chatroom');
1377 $chat_osc_acm =
new ilCheckboxInputGUI($this->
lng->txt(
'chat_osc_accept_msg'),
'chat_osc_accept_msg');
1378 if ($a_mode ==
'create') {
1381 $this->form_gui->addItem($chat_osc_acm);
1384 if ((
int) $this->
settings->get(
'session_reminder_enabled')) {
1387 $this->form_gui->addItem($cb);
1392 $sec_op->setTitle($this->
lng->txt(
'options'));
1393 $this->form_gui->addItem($sec_op);
1397 $se->setInfo($this->
lng->txt(
'inform_user_mail_info'));
1399 $se->setChecked(($this->
user->getPref(
'send_info_mails') ==
'y'));
1400 $this->form_gui->addItem($se);
1403 $irf->setInfo($this->
lng->txt(
'ignore_required_fields_info'));
1404 $irf->setValue(
'1');
1405 $this->form_gui->addItem($irf);
1407 if ($a_mode ==
'create' || $a_mode ==
'save') {
1408 $this->form_gui->addCommandButton(
'save', $this->
lng->txt(
'save'));
1410 if ($a_mode ==
'edit' || $a_mode ==
'update') {
1411 $this->form_gui->addCommandButton(
'update', $this->
lng->txt(
'save'));
1413 $this->form_gui->addCommandButton(
'cancel', $this->
lng->txt(
'cancel'));
1427 return (
bool) (
$settings[
'usr_settings_changeable_lua_' . $a_field] ??
false);
1437 $userfile_input = $this->form_gui->getItemByPostVar(
'userfile');
1439 if ($_FILES[
'userfile'][
'tmp_name'] ==
'') {
1440 if ($userfile_input->getDeletionFlag()) {
1441 $this->
object->removeUserPicture();
1445 if ($_FILES[
'userfile'][
'size'] == 0) {
1446 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_no_file'));
1448 $store_file =
'usr_' . $this->
object->getId() .
'.' .
'jpg';
1452 if ($rid === null) {
1456 $this->
object->setAvatarRid($rid->serialize());
1459 $this->
object->setPref(
'profile_image', $store_file);
1460 $this->
object->update();
1467 $upload_tmp_name = $_FILES[
'userfile'][
'tmp_name'];
1468 $avatar_upload_result = $uploads[$upload_tmp_name] ?? null;
1470 $existing_rid = null;
1471 if ($this->
object->getAvatarRid() !== null) {
1472 $existing_rid = $this->irss->manage()->find($this->
object->getAvatarRid());
1475 $revision_title =
'Avatar for user ' . $this->
object->getLogin();
1476 $this->stakeholder->setOwner($this->
object->getId());
1478 if ($avatar_upload_result === null && file_exists($upload_tmp_name)) {
1479 $stream = Streams::ofResource(
1480 fopen($upload_tmp_name,
'r')
1483 if ($existing_rid === null) {
1484 return $this->irss->manage()->stream($stream, $this->stakeholder, $revision_title);
1487 $this->irss->manage()->appendNewRevisionFromStream(
1493 return $existing_rid;
1496 if ($avatar_upload_result === null) {
1500 if ($existing_rid === null) {
1501 return $this->irss->manage()->upload(
1502 $avatar_upload_result,
1508 $this->irss->manage()->replaceWithUpload(
1510 $avatar_upload_result,
1514 return $existing_rid;
1520 $image_dir = $webspace_dir .
'/usr_images';
1521 $file = $image_dir .
'/usr_' . $this->
object->getId() .
'.' .
'jpg';
1522 $thumb_file = $image_dir .
'/usr_' . $this->
object->getId() .
'_small.jpg';
1523 $xthumb_file = $image_dir .
'/usr_' . $this->
object->getId() .
'_xsmall.jpg';
1524 $xxthumb_file = $image_dir .
'/usr_' . $this->
object->getId() .
'_xxsmall.jpg';
1525 $upload_file = $image_dir .
'/upload_' . $this->
object->getId();
1528 $this->
object->setPref(
'profile_image',
'');
1529 $this->
object->update();
1530 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'user_image_removed'));
1532 if (is_file($file)) {
1535 if (is_file($thumb_file)) {
1536 unlink($thumb_file);
1538 if (is_file($xthumb_file)) {
1539 unlink($xthumb_file);
1541 if (is_file($xxthumb_file)) {
1542 unlink($xxthumb_file);
1544 if (is_file($upload_file)) {
1545 unlink($upload_file);
1553 if (!$this->rbac_system->checkAccess(
'edit_roleassignment', $this->usrf_ref_id)) {
1554 $this->
ilias->raiseError(
1555 $this->
lng->txt(
'msg_no_perm_assign_role_to_user'),
1556 $this->
ilias->error_obj->MESSAGE
1560 $selected_roles = $this->user_request->getRoleIds();
1561 $posted_roles = $this->user_request->getPostedRoleIds();
1568 $global_roles_all = $this->rbac_review->getGlobalRoles();
1569 $assigned_roles_all = $this->rbac_review->assignedRoles($this->
object->getId());
1570 $assigned_roles = array_intersect($assigned_roles_all, $posted_roles);
1571 $assigned_global_roles_all = array_intersect($assigned_roles_all, $global_roles_all);
1572 $assigned_global_roles = array_intersect($assigned_global_roles_all, $posted_roles);
1574 $user_not_allowed_to_change_admin_role_assginements =
1575 !in_array(
SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()));
1577 if ($user_not_allowed_to_change_admin_role_assginements
1582 $posted_global_roles = array_intersect($selected_roles, $global_roles_all);
1584 if (empty($selected_roles) && count($assigned_roles_all) === count($assigned_roles)
1585 || empty($posted_global_roles) && count($assigned_global_roles_all) === count($assigned_global_roles)) {
1586 $this->tpl->setOnScreenMessage(
1588 $this->
lng->txt(
'msg_min_one_role') .
'<br/>' . $this->
lng->txt(
'action_aborted'),
1591 $this->
ctrl->redirect($this,
'roleassignment');
1594 foreach (array_diff($assigned_roles, $selected_roles) as $role) {
1596 || $user_not_allowed_to_change_admin_role_assginements && $role ===
SYSTEM_ROLE_ID) {
1599 $this->rbac_admin->deassignUser($role, $this->
object->getId());
1602 foreach (array_diff($selected_roles, $assigned_roles) as $role) {
1604 || $user_not_allowed_to_change_admin_role_assginements && $role ===
SYSTEM_ROLE_ID) {
1607 $this->rbac_admin->assignUser($role, $this->
object->getId(),
false);
1610 $this->
object->update();
1612 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_roleassignment_changed'),
true);
1614 if (strtolower($this->requested_baseClass) ==
'iladministrationgui') {
1615 $this->
ctrl->redirect($this,
'roleassignment');
1617 $this->
ctrl->redirectByClass(
'ilobjcategorygui',
'listUsers');
1623 $this->
tabs->activateTab(
'role_assignment');
1626 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_no_perm_view_roles_of_user'),
true);
1627 $this->
ctrl->redirectByClass(self::class,
'edit');
1630 $req_filtered_roles = $this->user_request->getFilteredRoles();
1633 ($req_filtered_roles > 0) ? $req_filtered_roles :
ilSession::get(
'filtered_roles')
1637 if ($filtered_roles > 5) {
1641 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.usr_role_assignment.html',
'Services/User');
1646 $tab->parse($this->
object->getId());
1647 $this->tpl->setVariable(
'ROLES_TABLE', $tab->getHTML());
1653 $table_gui->writeFilterToSession();
1654 $table_gui->resetOffset();
1661 $table_gui->resetOffset();
1662 $table_gui->resetFilter();
1674 for ($i = 0; $i <= 60; $i++) {
1675 $days[$i] = $i < 10 ?
'0' . $i : $i;
1680 for ($i = 0; $i < 24; $i++) {
1681 $days[$i] = $i < 10 ?
'0' . $i : $i;
1686 for ($i = 1; $i < 32; $i++) {
1687 $days[$i] = $i < 10 ?
'0' . $i : $i;
1692 for ($i = 1; $i < 13; $i++) {
1693 $month[$i] = $i < 10 ?
'0' . $i : $i;
1698 if ($a_selected < date(
'Y')) {
1699 $start = $a_selected;
1704 for ($i = $start; $i < ((
int) date(
'Y') + 11); ++$i) {
1715 $a_time_arr[
'hour'],
1716 $a_time_arr[
'minute'],
1717 $a_time_arr[
'second'],
1718 $a_time_arr[
'month'],
1731 $action[0] = $this->
lng->txt(
'assigned_roles');
1732 $action[1] = $this->
lng->txt(
'all_roles');
1733 $action[2] = $this->
lng->txt(
'all_global_roles');
1734 $action[3] = $this->
lng->txt(
'all_local_roles');
1735 $action[4] = $this->
lng->txt(
'internal_local_roles_only');
1736 $action[5] = $this->
lng->txt(
'non_internal_local_roles_only');
1755 if ($this->admin_mode ==
'settings') {
1756 $this->
ctrl->setParameterByClass(
1757 'ilobjsystemfoldergui',
1762 $this->
lng->txt(
'administration'),
1763 $this->
ctrl->getLinkTargetByClass([
'iladministrationgui',
'ilobjsystemfoldergui'],
''),
1772 $this->
ctrl->getLinkTargetByClass(
'ilobjuserfoldergui',
'view')
1779 $this->
ctrl->getLinkTargetByClass(
'ilobjrolefoldergui',
'view')
1783 if ($this->obj_id > 0) {
1785 $this->
object->getTitle(),
1786 $this->
ctrl->getLinkTarget($this,
'view')
1794 if ($this->user_request->getSendMail() !=
'y') {
1797 if (!strlen($this->
object->getEmail())) {
1802 $usr_lang->loadLanguageModule(
'crs');
1803 $usr_lang->loadLanguageModule(
'registration');
1806 $mmail->From($this->mail_sender_factory->system());
1809 $mmail->To($mailOptions->getExternalEmailAddresses());
1811 $subject = $usr_lang->txt(
'profile_changed');
1812 $body = $usr_lang->txt(
'reg_mail_body_salutation')
1813 .
' ' . $this->
object->getFullname() .
",\n\n";
1815 $date = $this->
object->getApproveDate();
1817 if ($date !== null && (time() - strtotime($date)) < 10) {
1818 $body .= $usr_lang->txt(
'reg_mail_body_approve') .
"\n\n";
1820 $body .= $usr_lang->txt(
'reg_mail_body_profile_changed') .
"\n\n";
1824 if ($this->user_request->getPassword() !=
'') {
1825 $body .= $usr_lang->txt(
'reg_mail_body_text2') .
"\n" .
1826 ILIAS_HTTP_PATH .
'/login.php?client_id=' . $this->
ilias->client_id .
"\n" .
1827 $usr_lang->txt(
'login') .
': ' . $this->
object->getLogin() .
"\n" .
1828 $usr_lang->txt(
'passwd') .
': ' . $this->user_request->getPassword() .
"\n\n";
1830 $body .= $usr_lang->txt(
'reg_mail_body_text3') .
"\n";
1831 $body .= $this->
object->getProfileAsString($usr_lang);
1835 $mmail->Subject($subject,
true);
1836 $mmail->Body($body);
1839 return '<br/>' . $this->
lng->txt(
'mail_sent');
1845 public static function _goto(
string $a_target):
void 1849 $ilUser = $DIC[
'ilUser'];
1852 $ilCtrl = $DIC[
'ilCtrl'];
1856 $class = ilPersonalProfileGUI::class;
1858 $ilCtrl->clearParametersByClass($class);
1859 $ilCtrl->setParameterByClass($class,
'token', str_replace($cmd,
'', $a_target));
1860 $ilCtrl->redirectByClass([
'ildashboardgui', $class], $cmd);
1864 if ($a_target == md5(
'usrdelown')) {
1866 $ilUser->hasDeletionFlag()) {
1867 $ilCtrl->setTargetScript(
'ilias.php');
1868 $ilCtrl->redirectByClass([
'ildashboardgui',
'ilpersonalsettingsgui'],
'deleteOwnAccountStep2');
1870 exit(
'This account is not flagged for deletion.');
1874 if (substr($a_target, -4) ==
'_bdg') {
1875 $ilCtrl->redirectByClass(
'ilDashboardGUI',
'jumpToBadges');
1878 if (
'registration' == $a_target) {
1879 $ilCtrl->redirectByClass([
'ilStartUpGUI',
'ilAccountRegistrationGUI'],
'');
1880 } elseif (
'nameassist' == $a_target) {
1881 $ilCtrl->redirectByClass([
'ilStartUpGUI',
'ilPasswordAssistanceGUI'],
'showUsernameAssistanceForm');
1882 } elseif (
'pwassist' == $a_target) {
1883 $ilCtrl->redirectByClass([
'ilStartUpGUI',
'ilPasswordAssistanceGUI'],
'');
1885 $target = $DIC[
'legalDocuments']->findGotoLink($a_target);
1886 if ($target->isOK()) {
1887 $ilCtrl->setTargetScript(
'ilias.php');
1888 foreach ($target->value()->queryParams() as
$key => $value) {
1889 $ilCtrl->setParameterByClass($target->value()->guiName(), (string) $key, $value);
1891 $ilCtrl->redirectByClass($target->value()->guiPath(), $target->value()->command());
1895 if (strpos($a_target,
'n') === 0) {
1901 if (is_numeric($a_target)) {
1902 $target_user = (
int) $a_target;
1903 } elseif ($target_array = explode(
'_', $a_target, 3)) {
1904 $target_cmd = $target_array[2];
1905 $target_user = (
int) $target_array[0];
1908 if ($target_user > 0) {
1909 $ilCtrl->setParameterByClass(ilPublicUserProfileGUI::class,
'user_id', $target_user);
1913 if ($target_cmd ===
'contact_approved') {
1914 $cmd =
'approveContactRequest';
1915 } elseif ($target_cmd ===
'contact_ignored') {
1916 $cmd =
'ignoreContactRequest';
1918 $ilCtrl->redirectByClass([ilPublicUserProfileGUI::class], $cmd);
1927 $profile_maybe_incomplete =
false;
1929 foreach ($this->user_profile->getIgnorableRequiredSettings() as $fieldName) {
1930 $elm = $this->form_gui->getItemByPostVar($fieldName);
1936 if ($elm->getRequired()) {
1937 $profile_maybe_incomplete =
true;
1940 $elm->setRequired(
false);
1945 foreach ($user_defined_fields->
getDefinitions() as $definition) {
1946 $elm = $this->form_gui->getItemByPostVar(
'udf_' . $definition[
'field_id']);
1952 if ($elm->getRequired() && $definition[
'required']) {
1953 $profile_maybe_incomplete =
true;
1956 $elm->setRequired(
false);
1960 return $profile_maybe_incomplete;
1967 !$this->rbac_system->checkAccess(
'visible', $this->usrf_ref_id)
1968 || !$this->rbac_system->checkAccess(
'write', $this->usrf_ref_id)
1974 $this->
access->filterUserIdsByPositionOfCurrentUser(
1983 $this->
ilias->raiseError($this->
lng->txt(
'msg_no_perm_modify_user'), $this->
ilias->error_obj->MESSAGE);
1989 && !$this->rbac_system->checkAccess(
'cat_administrate_users', $this->object->getTimeLimitOwner())) {
1990 $this->
ilias->raiseError($this->
lng->txt(
'msg_no_perm_modify_user'), $this->
ilias->error_obj->MESSAGE);
1998 $this->rbac_system->checkAccess(
'edit_roleassignment', $this->usrf_ref_id)
2002 $this->
access->filterUserIdsByPositionOfCurrentUser(
__showUserDefinedFields()
static getWebspaceDir(string $mode="filesystem")
get webspace directory
setUTitle(string $a_str)
set user title (note: don't mix up this method with setTitle() that is derived from ilObject and sets...
string $default_layout_and_style
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static get(string $a_var)
ilMailMimeSenderFactory $mail_sender_factory
setTimeLimitUnlimited(bool $a_unlimited)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setClientIP(string $a_str)
ilUserDefinedFields $user_defined_fields
createObject()
Display user create form.
static getAuthModeTranslation(string $a_auth_key, string $auth_name='')
static _getAuthMode(?string $a_auth_mode)
string $requested_baseClass
static _lookupActivatedStyle(string $a_skin, string $a_style)
lookup if a style is activated
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
UserGUIRequest $user_request
handleIgnoredRequiredFields()
Handles ignored required fields by changing the required flag of form elements.
__construct($data, int $id=0, bool $call_by_reference=true, bool $prepare_output=true)
setMatriculation(string $a_str)
Additional user data fields definition.
prepareOutput(bool $show_sub_objects=true)
setPhoneOffice(string $a_str)
removeUserPictureObject()
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...
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
setSelectedCountry(string $a_val)
Set selected country (selection drop down)
setFullname()
builds a string with title + firstname + lastname method is used to build fullname in member variable...
loadUserDefinedDataFromForm(?ilObjUser $user=null)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
initForm(string $a_mode)
Init user form.
static _lookupId($a_user_str)
addAdminLocatorItems(bool $do_not_add_object=false)
should be overwritten to add object specific items (repository items are preloaded) ...
static _getActiveAuthModes()
__unsetSessionVariables()
Class ilObjectOwnershipManagementGUI.
setTimeLimitUntil(?int $a_until)
static _getAuthModeName($a_auth_key)
const LP_CONTEXT_USER_FOLDER
isSettingChangeable(string $a_field)
uploadUserPicture()
upload user image (original method by ratana ty)
setInstitution(string $a_str)
setBackTarget(string $a_text, string $a_link)
set back tab target
setLatitude(?string $a_latitude)
setComment(string $a_str)
static _allowPasswordModificationByAuthMode($a_auth_mode)
Allow password modification.
static _lookupObjId(int $ref_id)
setExternalAccount(string $a_str)
catch(\Exception $e) $req
setBirthday(?string $a_birthday)
static _getLastHistoryDataByUserId(int $a_usr_id)
Returns the last used loginname and the changedate of the passed user_id.
static _enabledUserRelatedData()
setActive(bool $a_active, int $a_owner=0)
set user active state and updates system fields appropriately
static _enabledLearningProgress()
__checkUserDefinedRequiredFields()
const ORG_OP_EDIT_USER_ACCOUNTS
loadValuesFromForm(string $a_mode='create')
setDepartment(string $a_str)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setOfferingHelp(?array $value=null)
Class ResourceIdentification.
ResourceStakeholder $stakeholder
setPhoneHome(string $a_str)
__toUnix(array $a_time_arr)
Class ilObjectGUI Basic methods of all Output classes.
const UDF_TYPE_TEXT
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Conductor $legal_documents
header include for all ilias files.
getResults()
Returns the results of the processing and moving operation of the uploaded files. ...
static _isExternalAccountEnabled()
Check if an external account name is required.
static getPasswordRequirementsInfo()
infotext for ilPasswordInputGUI setInfo()
setCountry(string $a_str)
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)
setPhoneMobile(string $a_str)
setLastname(string $a_str)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTimeLimitOwner(int $a_owner)
This class represents a text area property in a property form.
saveObject()
save user data
setSecondEmail(?string $second_email)
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
updateObject()
updates object entry in object_data
setLongitude(?string $a_longitude)
setLocationZoom(?int $a_locationzoom)
static yn2tf(string $a_yn)
setZipcode(string $a_str)
Interface ResourceStakeholder.
ilPropertyFormGUI $form_gui
setUserDefinedData(array $a_data)
static _getAssignUsersStatus(int $a_role_id)
static _lookupType(int $id, bool $reference=false)
setGeneralInterests(?array $value=null)
setTimeLimitFrom(?int $a_from)
setFirstname(string $a_str)
static clear(string $a_var)
getChangeableLocalUserAdministrationDefinitions()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static set(string $a_var, $a_val)
Set a value.
setAuthMode(?string $a_str)
ResourceStorageServices $irss
ilUserProfile $user_profile
__getDateSelect(string $a_type, string $a_varname, string $a_selected)
static _getInstallationSignature()
static _lookupLogin(int $a_user_id)
setLookingForHelp(?array $value=null)