19 declare(strict_types=1);
69 bool $a_call_by_reference =
false,
70 bool $a_prepare_output =
true 74 $this->
ctrl = $DIC[
'ilCtrl'];
75 $this->
tabs = $DIC[
'ilTabs'];
76 $this->
help = $DIC[
'ilHelp'];
77 $this->mail_sender_factory = $DIC->mail()->mime()->senderFactory();
81 $this->default_layout_and_style = $DIC[
'ilClientIniFile']->readVariable(
'layout',
'skin') .
82 ':' . $DIC[
'ilClientIniFile']->readVariable(
'layout',
'style');
88 $this->uploads = $DIC->upload();
89 $this->irss = $DIC->resourceStorage();
92 $this->
ctrl->saveParameter($this, [
'obj_id',
'letter']);
93 $this->
ctrl->setParameterByClass(
'ilobjuserfoldergui',
'letter', $this->requested_letter);
94 $this->
lng->loadLanguageModule(
'user');
101 $this->requested_letter = $this->user_request->
getLetter();
102 $this->requested_baseClass = $this->user_request->getBaseClass();
103 $this->requested_search = $this->user_request->getSearch();
104 $this->legal_documents = $DIC[
'legalDocuments'];
109 $next_class = $this->
ctrl->getNextClass($this);
110 $cmd = $this->
ctrl->getCmd();
114 switch ($next_class) {
115 case 'illearningprogressgui':
121 $this->
ctrl->forwardCommand($new_gui);
124 case 'ilobjectownershipmanagementgui':
126 $this->
ctrl->forwardCommand($gui);
130 if ($cmd ==
'' || $cmd ==
'view') {
141 if (strtolower(get_class($this->
object)) ==
'ilobjuser') {
142 $this->tpl->setTitle(
'[' . $this->
object->getLogin() .
'] ' . $this->
object->getTitle());
143 $this->tpl->setDescription($this->
object->getLongDescription());
144 $this->tpl->setTitleIcon(
146 $this->
lng->txt(
'obj_' . $this->object->getType())
149 parent::setTitleAndDescription();
157 if (strtolower($this->requested_baseClass) ==
'iladministrationgui') {
158 $this->
ctrl->redirectByClass(
'ilobjuserfoldergui',
'view');
160 $this->
ctrl->redirectByClass(
'ilobjcategorygui',
'listUsers');
171 $this->tabs_gui->clearTargets();
173 $this->
help->setScreenIdComponent(
'usr');
175 if ($this->requested_search) {
176 $this->tabs_gui->setBackTarget(
177 $this->
lng->txt(
'search_results'),
181 $this->tabs_gui->addTarget(
183 $this->
ctrl->getLinkTarget($this,
'edit'),
184 [
'edit',
'',
'view'],
190 $this->tabs_gui->addTarget(
192 $this->
ctrl->getLinkTarget($this,
'edit'),
193 [
'edit',
'',
'view'],
199 $this->tabs_gui->addTarget(
201 $this->
ctrl->getLinkTarget($this,
'roleassignment'),
208 if ($this->rbac_system->checkAccess(
'read', $this->ref_id) and
211 $this->tabs_gui->addTarget(
213 $this->
ctrl->getLinkTargetByClass(
'illearningprogressgui',
''),
215 [
'illplistofobjectsgui',
'illplistofsettingsgui',
'illearningprogressgui',
'illplistofprogressgui']
219 $this->tabs_gui->addTarget(
221 $this->
ctrl->getLinkTargetByClass(
'ilobjectownershipmanagementgui',
''),
223 'ilobjectownershipmanagementgui' 234 $this->back_target = [
'text' => $a_text,
'link' => $a_link];
241 $udfs = $this->user_request->getUDFs();
242 foreach ($this->user_defined_fields->getDefinitions() as $field_id => $definition) {
243 if ($definition[
'required'] and !strlen($udfs[$field_id])) {
252 $user_defined_data = null;
255 if ($this->
object->getType() ==
'usr') {
256 $user_defined_data = $this->
object->getUserDefinedData();
258 foreach ($this->user_defined_fields->getDefinitions() as $field_id => $definition) {
260 $old = $error_post_vars[
'udf'][$field_id] ?? $user_defined_data[$field_id];
263 $this->tpl->setCurrentBlock(
'field_text');
264 $this->tpl->setVariable(
'FIELD_NAME',
'udf[' . $definition[
'field_id'] .
']');
267 $this->tpl->setCurrentBlock(
'field_select');
268 $this->tpl->setVariable(
272 'udf[' . $definition[
'field_id'] .
']',
273 $this->user_defined_fields->fieldValuesToSelectArray(
274 $definition[
'field_values']
281 $this->tpl->parseCurrentBlock();
282 $this->tpl->setCurrentBlock(
'user_defined');
284 if ($definition[
'required']) {
285 $name = $definition[
'field_name'] .
'<span class="asterisk">*</span>';
287 $name = $definition[
'field_name'];
289 $this->tpl->setVariable(
'TXT_FIELD_NAME', $name);
290 $this->tpl->parseCurrentBlock();
297 $this->tabs_gui->clearTargets();
301 $obj_list = $this->rbac_review->getRoleListByObject(
ROLE_FOLDER_ID);
303 foreach ($obj_list as $obj_data) {
307 $this->rbac_review->assignedRoles($this->user->getId())
318 $this->rbac_review->assignedRoles($this->user->getId())
320 $rol[$obj_data[
'obj_id']] = $obj_data[
'title'];
326 $this->
ilias->raiseError(
327 $this->
lng->txt(
'msg_no_roles_users_can_be_assigned_to'),
328 $this->
ilias->error_obj->MESSAGE
332 $keys = array_keys($rol);
335 if (in_array(4, $keys)) {
336 $this->default_role = 4;
338 if (count($keys) > 1 && in_array(2, $keys)) {
340 foreach ($keys as $key => $val) {
348 $this->default_role = array_shift($keys);
350 $this->selectable_roles = $rol;
358 if (!$this->rbac_system->checkAccess(
'create_usr', $this->usrf_ref_id)
359 && !$this->rbac_system->checkAccess(
'cat_administrate_users', $this->usrf_ref_id)) {
360 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
373 if (!$this->rbac_system->checkAccess(
'create_usr', $this->usrf_ref_id)
374 && !$this->
access->checkAccess(
'cat_administrate_users',
'', $this->usrf_ref_id)) {
375 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
382 $profile_maybe_incomplete =
false;
383 if ($this->form_gui->getInput(
'ignore_rf',
false)) {
387 if (!$this->form_gui->checkInput()) {
388 $this->form_gui->setValuesByPost();
396 || !in_array(
SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
397 || in_array(
SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
400 $user_object->setTitle($user_object->getFullname());
401 $user_object->setDescription($user_object->getEmail());
405 $user_object->create();
408 $user_object->setExternalAccount($this->form_gui->getInput(
'ext_account'));
413 $user_object->setLastPasswordChangeTS(time());
416 $user_object->saveAsNew();
420 $user_object->setLanguage($this->form_gui->getInput(
'language'));
425 $sknst = explode(
':', $this->form_gui->getInput(
'skin_style'));
427 if ($user_object->getPref(
'style') != $sknst[1] ||
428 $user_object->getPref(
'skin') != $sknst[0]) {
429 $user_object->setPref(
'skin', $sknst[0]);
430 $user_object->setPref(
'style', $sknst[1]);
434 $user_object->setPref(
'session_reminder_lead_time', (
string) $this->form_gui->getInput(
'session_reminder_lead_time'));
437 $user_object->setPref(
438 'hide_own_online_status',
439 $this->form_gui->getInput(
'hide_own_online_status')
443 $user_object->setPref(
444 'bs_allow_to_contact_me',
445 $this->form_gui->getInput(
'bs_allow_to_contact_me') ?
'y' :
'n' 449 $user_object->setPref(
450 'chat_osc_accept_msg',
451 $this->form_gui->getInput(
'chat_osc_accept_msg') ?
'y' :
'n' 455 $user_object->setPref(
456 'chat_broadcast_typing',
457 $this->form_gui->getInput(
'chat_broadcast_typing') ?
'y' :
'n' 460 $user_object->writePrefs();
463 $this->rbac_admin->assignUser(
464 (
int) $this->form_gui->getInput(
'default_role'),
465 $user_object->getId(),
469 $msg = $this->
lng->txt(
'user_added');
471 $this->
user->setPref(
473 ($this->form_gui->getInput(
'send_mail') ==
'y') ?
'y' :
'n' 475 $this->
user->writePrefs();
477 $this->
object = $user_object;
483 if ($profile_maybe_incomplete
484 && $this->user_profile->isProfileIncomplete($this->object)) {
485 $this->
object->setProfileIncomplete(
true);
486 $this->
object->update();
490 if ($this->form_gui->getInput(
'send_mail') ==
'y') {
492 $acc_mail->useLangVariablesAsFallback(
true);
493 $acc_mail->setAttachConfiguredFiles(
true);
494 $acc_mail->setUserPassword($this->form_gui->getInput(
'passwd'));
495 $acc_mail->setUser($user_object);
497 if ($acc_mail->send()) {
498 $msg .=
'<br />' . $this->
lng->txt(
'mail_sent');
499 $this->tpl->setOnScreenMessage(
'success', $msg,
true);
501 $msg .=
'<br />' . $this->
lng->txt(
'mail_not_sent');
502 $this->tpl->setOnScreenMessage(
'info', $msg,
true);
505 $this->tpl->setOnScreenMessage(
'success', $msg,
true);
508 if (strtolower($this->requested_baseClass) ==
'iladministrationgui') {
509 $this->
ctrl->redirectByClass(
'ilobjuserfoldergui',
'view');
513 $this->
ctrl->redirectByClass(
'ilobjcategorygui',
'listUsers');
521 $this->tabs_gui->clearTargets();
544 $from = $this->form_gui->getItemByPostVar(
'time_limit_from')->getDate();
549 $until = $this->form_gui->getItemByPostVar(
'time_limit_until')->getDate();
556 if ($a_mode ==
'create') {
560 $bd = $this->form_gui->getItemByPostVar(
'birthday');
561 $bd = $bd->getDate();
629 $general_interests = is_array($this->form_gui->getInput(
'interests_general'))
630 ? $this->form_gui->getInput(
'interests_general')
634 $offering_help = is_array($this->form_gui->getInput(
'interests_help_offered'))
635 ? $this->form_gui->getInput(
'interests_help_offered')
639 $looking_for_help = is_array($this->form_gui->getInput(
'interests_help_looking'))
640 ? $this->form_gui->getInput(
'interests_help_looking')
647 $zoom = (
int) $this->form_gui->getInput(
'loc_zoom');
676 foreach ($all_defs as $definition) {
677 $f =
"udf_" . $definition[
'field_id'];
678 $item = $this->form_gui->getItemByPostVar(
$f);
679 if ($item && !$item->getDisabled()) {
680 $udf[$definition[
'field_id']] = $this->form_gui->getInput(
$f);
692 $profile_maybe_incomplete =
false;
693 if ($this->form_gui->getInput(
'ignore_rf',
false)) {
697 if ($this->form_gui->checkInput()) {
702 ) && trim($this->form_gui->getInput(
'passwd')) !==
'' 704 || !in_array(
SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
705 || in_array(
SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId())))
710 if ((
int) $this->form_gui->getInput(
'active') == 1) {
711 $this->
object->setLoginAttempts(0);
719 $this->
object->updateLogin($this->form_gui->getInput(
'login'));
721 $this->tpl->setOnScreenMessage(
'failure', $e->getMessage());
722 $this->form_gui->setValuesByPost();
727 $this->
object->setTitle($this->
object->getFullname());
728 $this->
object->setDescription($this->
object->getEmail());
731 $this->
object->setLanguage($this->form_gui->getInput(
'language'));
736 $sknst = explode(
':', $this->form_gui->getInput(
'skin_style'));
738 if ($this->
object->getPref(
'style') != $sknst[1] ||
739 $this->
object->getPref(
'skin') != $sknst[0]) {
740 $this->
object->setPref(
'skin', $sknst[0]);
741 $this->
object->setPref(
'style', $sknst[1]);
746 $this->
object->setPref(
'session_reminder_lead_time', (
string) $this->form_gui->getInput(
'session_reminder_lead_time'));
750 $this->
object->setPref(
751 'hide_own_online_status',
752 ($this->form_gui->getInput(
'hide_own_online_status') ??
'0')
756 $this->
object->setPref(
757 'bs_allow_to_contact_me',
758 ($this->form_gui->getInput(
'bs_allow_to_contact_me') ??
false) ?
'y' :
'n' 762 $this->
object->setPref(
763 'chat_osc_accept_msg',
764 ($this->form_gui->getInput(
'chat_osc_accept_msg') ??
false) ?
'y' :
'n' 768 $this->
object->setPref(
769 'chat_broadcast_typing',
770 ($this->form_gui->getInput(
'chat_broadcast_typing') ??
false) ?
'y' :
'n' 776 $this->
object->setLastPasswordChangeTS(time());
779 $this->
object->setProfileIncomplete(
false);
781 $this->update = $this->
object->update();
785 if ($this->
user->getId() == $this->
object->getId()) {
786 $this->
user->readPrefs();
788 $this->
user->setPref(
790 ($this->form_gui->getInput(
'send_mail') ===
'y') ?
'y' :
'n' 792 $this->
user->writePrefs();
795 $msg = $this->
lng->txt(
'saved_successfully') . $mail_message;
802 if ($profile_maybe_incomplete) {
805 if ($this->user_profile->isProfileIncomplete(
$user)) {
806 $this->
object->setProfileIncomplete(
true);
812 $this->tpl->setOnScreenMessage(
'success', $msg,
true);
814 if (strtolower($this->requested_baseClass) ==
'iladministrationgui') {
815 $this->
ctrl->redirectByClass(
'ilobjuserfoldergui',
'view');
817 $this->
ctrl->redirectByClass(
'ilobjcategorygui',
'listUsers');
820 $this->form_gui->setValuesByPost();
821 $this->tabs_gui->activateTab(
'properties');
822 $this->tpl->setContent($this->form_gui->getHtml());
831 $data[
'auth_mode'] = $this->
object->getAuthMode();
832 $data[
'login'] = $this->
object->getLogin();
833 $data[
'ext_account'] = $this->
object->getExternalAccount();
835 $this->
object->getCreateDate(),
839 $data[
'approve_date'] = ($this->
object->getApproveDate() !=
'')
843 $data[
'last_login'] = ($this->
object->getLastLogin() !=
'')
846 $data[
'active'] = $this->
object->getActive();
847 $data[
'time_limit_unlimited'] = $this->
object->getTimeLimitUnlimited() ?
'1' :
'0';
849 $data[
'time_limit_from'] = $this->
object->getTimeLimitFrom()
852 $data[
'time_limit_until'] = $this->
object->getTimeLimitUntil()
856 $data[
'gender'] = $this->
object->getGender();
857 $data[
'firstname'] = $this->
object->getFirstname();
858 $data[
'lastname'] = $this->
object->getLastname();
859 $data[
'title'] = $this->
object->getUTitle();
860 $data[
'birthday'] = $this->
object->getBirthday()
863 $data[
'institution'] = $this->
object->getInstitution();
864 $data[
'department'] = $this->
object->getDepartment();
865 $data[
'street'] = $this->
object->getStreet();
866 $data[
'city'] = $this->
object->getCity();
867 $data[
'zipcode'] = $this->
object->getZipcode();
868 $data[
'country'] = $this->
object->getCountry();
869 $data[
'sel_country'] = $this->
object->getSelectedCountry();
870 $data[
'phone_office'] = $this->
object->getPhoneOffice();
871 $data[
'phone_home'] = $this->
object->getPhoneHome();
872 $data[
'phone_mobile'] = $this->
object->getPhoneMobile();
873 $data[
'fax'] = $this->
object->getFax();
874 $data[
'email'] = $this->
object->getEmail();
875 $data[
'second_email'] = $this->
object->getSecondEmail();
876 $data[
'hobby'] = $this->
object->getHobby();
877 $data[
'referral_comment'] = $this->
object->getComment();
879 $data[
'interests_general'] = $this->
object->getGeneralInterests();
880 $data[
'interests_help_offered'] = $this->
object->getOfferingHelp();
881 $data[
'interests_help_looking'] = $this->
object->getLookingForHelp();
883 $data[
'matriculation'] = $this->
object->getMatriculation();
884 $data[
'client_ip'] = $this->
object->getClientIP();
887 $user_defined_data = $this->
object->getUserDefinedData();
888 foreach ($this->user_defined_fields->getDefinitions() as $field_id => $definition) {
889 $data[
'udf_' . $field_id] = $user_defined_data[
'f_' . $field_id] ??
'';
892 $data[
'language'] = $this->
object->getLanguage();
893 $data[
'skin_style'] = $this->
object->skin .
':' . $this->
object->prefs[
'style'];
894 $data[
'session_reminder_lead_time'] =
895 $this->
object->prefs[
'session_reminder_lead_time'] ??
897 $data[
'hide_own_online_status'] = $this->
object->prefs[
'hide_own_online_status'] ??
'';
898 $data[
'bs_allow_to_contact_me'] = ($this->
object->prefs[
'bs_allow_to_contact_me'] ??
'') ==
'y';
899 $data[
'chat_osc_accept_msg'] = ($this->
object->prefs[
'chat_osc_accept_msg'] ??
'') ==
'y';
900 $data[
'chat_broadcast_typing'] = ($this->
object->prefs[
'chat_broadcast_typing'] ??
'') ==
'y';
902 $data[
'send_mail'] = (($this->
object->prefs[
'send_info_mails'] ??
'') ==
'y');
904 $this->form_gui->setValuesByArray($data);
915 $this->form_gui->setFormAction($this->
ctrl->getFormAction($this));
916 if ($a_mode ==
'create') {
917 $this->form_gui->setTitle($this->
lng->txt(
'usr_new'));
919 $this->form_gui->setTitle($this->
lng->txt(
'usr_edit'));
924 $sec_l->setTitle($this->
lng->txt(
'login_data'));
925 $this->form_gui->addItem($sec_l);
931 foreach ($active_auth_modes as $auth_name => $auth_key) {
932 if ($auth_name ==
'default') {
937 $option[$auth_name] = $name;
940 $this->form_gui->addItem($am);
942 if ($a_mode ==
'edit') {
945 $this->form_gui->addItem(
$id);
950 if ($a_mode ==
'edit') {
951 $lo->setCurrentUserId($this->
object->getId());
956 $this->
lng->txt(
'usr_loginname_history_info'),
958 $last_history_entry[0]
965 $this->form_gui->addItem($lo);
968 || !in_array(
SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
969 || in_array(
SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
973 $pw->setMaxLength(80);
974 $pw->setValidateAuthPost(
'auth_mode');
975 if ($a_mode ==
'create') {
976 $pw->setRequiredOnAuth(
true);
979 && in_array(
SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
980 && !in_array(
SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
981 $pw->setDisabled(
true);
984 $this->form_gui->addItem($pw);
990 $ext->setMaxLength(250);
991 $ext->setInfo($this->
lng->txt(
'user_ext_account_desc'));
992 $this->form_gui->addItem($ext);
996 $sec_si->setTitle($this->
lng->txt(
'system_information'));
997 $this->form_gui->addItem($sec_si);
1000 if ($a_mode ==
'edit') {
1002 'create_date' =>
'',
1003 'approve_date' =>
'',
1004 ...$this->legal_documents->userManagementFields($this->
object),
1008 foreach ($sia as
$a => $v) {
1009 if (is_string($v)) {
1011 $siai->setValue($v);
1012 $this->form_gui->addItem($siai);
1014 $this->form_gui->addItem($v);
1020 $ac->setChecked(
true);
1021 $this->form_gui->addItem($ac);
1023 $this->
lng->loadLanguageModule(
'crs');
1027 $radg->setRequired(
true);
1029 $radg->addOption($op1);
1031 $radg->addOption($op2);
1035 $acfrom->setShowTime(
true);
1036 $acfrom->setMinuteStepSize(1);
1037 $op2->addSubItem($acfrom);
1041 $acto->setShowTime(
true);
1042 $acto->setMinuteStepSize(1);
1043 $op2->addSubItem($acto);
1045 $this->form_gui->addItem($radg);
1055 $sec_pd->setTitle($this->
lng->txt(
'personal_data'));
1056 $this->form_gui->addItem($sec_pd);
1063 $gndr->addOption($neutral);
1065 $gndr->addOption($female);
1067 $gndr->addOption($male);
1068 $this->form_gui->addItem($gndr);
1072 'firstname' =>
true,
1076 foreach ($fields as $field =>
$req) {
1077 $max_len = $field ===
'title' ? 32 : 128;
1080 $caption = ($field ==
'title')
1085 $inp->setMaxLength($max_len);
1086 $inp->setRequired(
$req);
1087 $this->form_gui->addItem($inp);
1094 if ($a_mode ==
'edit' || $a_mode ==
'upload') {
1102 $this->form_gui->addItem($pi);
1108 $this->form_gui->addItem($birthday);
1114 [
'institution', 40, 80],
1115 [
'department', 40, 80],
1118 [
'zipcode', 10, 10],
1119 [
'country', 40, 40],
1121 [
'phone_office', 30, 30],
1122 [
'phone_home', 30, 30],
1123 [
'phone_mobile', 30, 30],
1128 foreach ($fields as $field) {
1132 $sec_cd->setTitle($this->
lng->txt(
'contact_data'));
1133 $this->form_gui->addItem($sec_cd);
1136 if ($a_mode ==
'edit') {
1138 $orgus->setValue($this->
object->getOrgUnitsRepresentation());
1139 $this->form_gui->addItem($orgus);
1143 if ($field[0] !=
'sel_country') {
1145 $inp->setSize($field[1]);
1146 $inp->setMaxLength($field[2]);
1147 $inp->setRequired(isset(
$settings[
'require_' . $field[0]]) &&
1149 $this->form_gui->addItem($inp);
1155 $this->form_gui->addItem($cs);
1163 $em->setMaxLength(128);
1164 $this->form_gui->addItem($em);
1170 $this->form_gui->addItem($em);
1177 $hob->setRequired(isset(
$settings[
'require_hobby']) &&
1179 $this->form_gui->addItem($hob);
1186 $rc->setRequired(isset(
$settings[
'require_referral_comment']) &&
1188 $this->form_gui->addItem($rc);
1192 $sh->setTitle($this->
lng->txt(
'interests'));
1193 $this->form_gui->addItem($sh);
1195 $multi_fields = [
'interests_general',
'interests_help_offered',
'interests_help_looking'];
1196 foreach ($multi_fields as $multi_field) {
1200 $ti->setMulti(
true);
1201 $ti->setMaxLength(40);
1203 $ti->setRequired(isset(
$settings[
'require_' . $multi_field]) &&
1205 $this->form_gui->addItem($ti);
1211 $sec_oi->setTitle($this->
lng->txt(
'user_profile_other'));
1212 $this->form_gui->addItem($sec_oi);
1218 $mr->setMaxLength(40);
1219 $mr->setRequired(isset(
$settings[
'require_matriculation']) &&
1221 $this->form_gui->addItem($mr);
1226 $ip->setMaxLength(255);
1227 $ip->setInfo($this->
lng->txt(
'current_ip') .
' ' .
$_SERVER[
'REMOTE_ADDR'] .
' <br />' .
1228 '<span class="warning">' . $this->
lng->txt(
'current_ip_alert') .
'</span>');
1229 $this->form_gui->addItem($ip);
1239 foreach ($all_defs as $definition) {
1242 $this->form_gui->addItem($f_property);
1246 if ($a_mode ==
'create' 1256 $sec_st->setTitle($this->
lng->txt(
'settings'));
1257 $this->form_gui->addItem($sec_st);
1260 if ($a_mode ==
'create') {
1262 $this->
lng->txt(
'default_role'),
1266 $role->setValue($this->default_role);
1267 $role->setOptions($this->selectable_roles);
1268 $this->form_gui->addItem($role);
1272 $languages = $this->
lng->getInstalledLanguages();
1273 $this->
lng->loadLanguageModule(
'meta');
1275 foreach ($languages as $l) {
1276 $options[$l] = $this->
lng->txt(
'meta_l_' . $l);
1279 $this->
lng->txt(
'language'),
1283 $lang->setValue($this->
settings->get(
'language'));
1284 if (count($options) <= 1) {
1285 $lang->setDisabled(
true);
1287 $this->form_gui->addItem($lang);
1292 $this->
lng->txt(
'skin_style'),
1296 $skins = ilStyleDefinition::getAllSkins();
1299 if (is_array($skins)) {
1303 foreach ($skins as $skin) {
1304 foreach ($skin->getStyles() as $style) {
1309 $options[$skin->getId() .
':' . $style->getId()] = $skin->getName() .
' / ' . $style->getName();
1314 $sk->setValue($this->default_layout_and_style);
1316 $this->form_gui->addItem($sk);
1320 $this->
lng->loadLanguageModule(
'awrn');
1322 $default = ($this->
settings->get(
'hide_own_online_status') ==
'n')
1323 ? $this->
lng->txt(
'user_awrn_show')
1324 : $this->
lng->txt(
'user_awrn_hide');
1327 '' => $this->
lng->txt(
'user_awrn_default') .
' (' . $default .
')',
1328 'n' => $this->
lng->txt(
'user_awrn_show'),
1329 'y' => $this->
lng->txt(
'user_awrn_hide')
1333 $os->setDisabled((
bool) $this->
settings->get(
'usr_settings_disable_hide_own_online_status'));
1334 $os->setInfo($this->
lng->txt(
'awrn_hide_from_awareness_info'));
1335 $this->form_gui->addItem($os);
1339 $this->
lng->loadLanguageModule(
'buddysystem');
1340 $os =
new ilCheckboxInputGUI($this->
lng->txt(
'buddy_allow_to_contact_me'),
'bs_allow_to_contact_me');
1341 if ($a_mode ==
'create') {
1344 $this->form_gui->addItem($os);
1347 $this->
lng->loadLanguageModule(
'chatroom');
1348 $chat_osc_acm =
new ilCheckboxInputGUI($this->
lng->txt(
'chat_osc_accept_msg'),
'chat_osc_accept_msg');
1349 if ($a_mode ==
'create') {
1352 $this->form_gui->addItem($chat_osc_acm);
1357 $this->
lng->txt(
'session_reminder_input'),
1358 'session_reminder_lead_time' 1362 $session_reminder->setInfo(
1364 $this->
lng->txt(
'session_reminder_lead_time_info'),
1370 $session_reminder->setValue(
1371 (
string) $session_reminder_object->getGlobalSessionReminderLeadTime()
1373 $session_reminder->setSize(3);
1375 $session_reminder->setMaxValue($session_reminder_object->getMaxPossibleLeadTime());
1376 $this->form_gui->addItem($session_reminder);
1381 $sec_op->setTitle($this->
lng->txt(
'options'));
1382 $this->form_gui->addItem($sec_op);
1386 $se->setInfo($this->
lng->txt(
'inform_user_mail_info'));
1388 $se->setChecked(($this->
user->getPref(
'send_info_mails') ==
'y'));
1389 $this->form_gui->addItem($se);
1392 $irf->setInfo($this->
lng->txt(
'ignore_required_fields_info'));
1393 $irf->setValue(
'1');
1394 $this->form_gui->addItem($irf);
1396 if ($a_mode ==
'create' || $a_mode ==
'save') {
1397 $this->form_gui->addCommandButton(
'save', $this->
lng->txt(
'save'));
1399 if ($a_mode ==
'edit' || $a_mode ==
'update') {
1400 $this->form_gui->addCommandButton(
'update', $this->
lng->txt(
'save'));
1402 $this->form_gui->addCommandButton(
'cancel', $this->
lng->txt(
'cancel'));
1416 return (
bool) (
$settings[
'usr_settings_changeable_lua_' . $a_field] ??
false);
1425 $userfile_input = $this->form_gui->getItemByPostVar(
'userfile');
1426 if ($_FILES[
'userfile'][
'tmp_name'] ==
'') {
1427 if ($userfile_input->getDeletionFlag()) {
1428 $this->
object->removeUserPicture();
1432 if ($_FILES[
'userfile'][
'size'] == 0) {
1433 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_no_file'));
1435 $store_file =
'usr_' . $this->
object->getId() .
'.' .
'jpg';
1439 if ($rid === null) {
1443 $this->
object->setAvatarRid($rid->serialize());
1446 $this->
object->setPref(
'profile_image', $store_file);
1447 $this->
object->update();
1454 $upload_tmp_name = $_FILES[
'userfile'][
'tmp_name'];
1455 $avatar_upload_result = $uploads[$upload_tmp_name] ?? null;
1457 $existing_rid = null;
1458 if ($this->
object->getAvatarRid() !== null) {
1459 $existing_rid = $this->irss->manage()->find($this->
object->getAvatarRid());
1462 $revision_title =
'Avatar for user ' . $this->
object->getLogin();
1463 $this->stakeholder->setOwner($this->
object->getId());
1465 if ($avatar_upload_result === null && file_exists($upload_tmp_name)) {
1466 $stream = Streams::ofResource(
1467 fopen($upload_tmp_name,
'r')
1470 if ($existing_rid === null) {
1471 return $this->irss->manage()->stream($stream, $this->stakeholder, $revision_title);
1474 $this->irss->manage()->appendNewRevisionFromStream(
1480 return $existing_rid;
1483 if ($avatar_upload_result === null) {
1487 if ($existing_rid === null) {
1488 return $this->irss->manage()->upload(
1489 $avatar_upload_result,
1495 $this->irss->manage()->replaceWithUpload(
1497 $avatar_upload_result,
1501 return $existing_rid;
1507 $image_dir = $webspace_dir .
'/usr_images';
1508 $file = $image_dir .
'/usr_' . $this->
object->getId() .
'.' .
'jpg';
1509 $thumb_file = $image_dir .
'/usr_' . $this->
object->getId() .
'_small.jpg';
1510 $xthumb_file = $image_dir .
'/usr_' . $this->
object->getId() .
'_xsmall.jpg';
1511 $xxthumb_file = $image_dir .
'/usr_' . $this->
object->getId() .
'_xxsmall.jpg';
1512 $upload_file = $image_dir .
'/upload_' . $this->
object->getId();
1515 $this->
object->setPref(
'profile_image',
'');
1516 $this->
object->update();
1517 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'user_image_removed'));
1519 if (is_file($file)) {
1522 if (is_file($thumb_file)) {
1523 unlink($thumb_file);
1525 if (is_file($xthumb_file)) {
1526 unlink($xthumb_file);
1528 if (is_file($xxthumb_file)) {
1529 unlink($xxthumb_file);
1531 if (is_file($upload_file)) {
1532 unlink($upload_file);
1540 if (!$this->rbac_system->checkAccess(
'edit_roleassignment', $this->usrf_ref_id)) {
1541 $this->
ilias->raiseError(
1542 $this->
lng->txt(
'msg_no_perm_assign_role_to_user'),
1543 $this->
ilias->error_obj->MESSAGE
1547 $selected_roles = $this->user_request->getRoleIds();
1548 $posted_roles = $this->user_request->getPostedRoleIds();
1555 $global_roles_all = $this->rbac_review->getGlobalRoles();
1556 $assigned_roles_all = $this->rbac_review->assignedRoles($this->
object->getId());
1557 $assigned_roles = array_intersect($assigned_roles_all, $posted_roles);
1558 $assigned_global_roles_all = array_intersect($assigned_roles_all, $global_roles_all);
1559 $assigned_global_roles = array_intersect($assigned_global_roles_all, $posted_roles);
1561 $user_not_allowed_to_change_admin_role_assginements =
1562 !in_array(
SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()));
1564 if ($user_not_allowed_to_change_admin_role_assginements
1569 $posted_global_roles = array_intersect($selected_roles, $global_roles_all);
1571 if (empty($selected_roles) && count($assigned_roles_all) === count($assigned_roles)
1572 || empty($posted_global_roles) && count($assigned_global_roles_all) === count($assigned_global_roles)) {
1573 $this->tpl->setOnScreenMessage(
1575 $this->
lng->txt(
'msg_min_one_role') .
'<br/>' . $this->
lng->txt(
'action_aborted'),
1578 $this->
ctrl->redirect($this,
'roleassignment');
1581 foreach (array_diff($assigned_roles, $selected_roles) as $role) {
1583 || $user_not_allowed_to_change_admin_role_assginements && $role ===
SYSTEM_ROLE_ID) {
1586 $this->rbac_admin->deassignUser($role, $this->
object->getId());
1589 foreach (array_diff($selected_roles, $assigned_roles) as $role) {
1591 || $user_not_allowed_to_change_admin_role_assginements && $role ===
SYSTEM_ROLE_ID) {
1594 $this->rbac_admin->assignUser($role, $this->
object->getId(),
false);
1597 $this->
object->update();
1599 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_roleassignment_changed'),
true);
1601 if (strtolower($this->requested_baseClass) ==
'iladministrationgui') {
1602 $this->
ctrl->redirect($this,
'roleassignment');
1604 $this->
ctrl->redirectByClass(
'ilobjcategorygui',
'listUsers');
1610 $this->
tabs->activateTab(
'role_assignment');
1613 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_no_perm_view_roles_of_user'),
true);
1614 $this->
ctrl->redirectByClass(self::class,
'edit');
1617 $req_filtered_roles = $this->user_request->getFilteredRoles();
1620 ($req_filtered_roles > 0) ? $req_filtered_roles :
ilSession::get(
'filtered_roles')
1624 if ($filtered_roles > 5) {
1628 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.usr_role_assignment.html',
'components/ILIAS/User');
1633 $tab->parse($this->
object->getId());
1634 $this->tpl->setVariable(
'ROLES_TABLE', $tab->getHTML());
1640 $table_gui->writeFilterToSession();
1641 $table_gui->resetOffset();
1648 $table_gui->resetOffset();
1649 $table_gui->resetFilter();
1661 for ($i = 0; $i <= 60; $i++) {
1662 $days[$i] = $i < 10 ?
'0' . $i : $i;
1667 for ($i = 0; $i < 24; $i++) {
1668 $days[$i] = $i < 10 ?
'0' . $i : $i;
1673 for ($i = 1; $i < 32; $i++) {
1674 $days[$i] = $i < 10 ?
'0' . $i : $i;
1679 for ($i = 1; $i < 13; $i++) {
1680 $month[$i] = $i < 10 ?
'0' . $i : $i;
1685 if ($a_selected < date(
'Y')) {
1686 $start = $a_selected;
1691 for ($i = $start; $i < ((
int) date(
'Y') + 11); ++$i) {
1702 $a_time_arr[
'hour'],
1703 $a_time_arr[
'minute'],
1704 $a_time_arr[
'second'],
1705 $a_time_arr[
'month'],
1718 $action[0] = $this->
lng->txt(
'assigned_roles');
1719 $action[1] = $this->
lng->txt(
'all_roles');
1720 $action[2] = $this->
lng->txt(
'all_global_roles');
1721 $action[3] = $this->
lng->txt(
'all_local_roles');
1722 $action[4] = $this->
lng->txt(
'internal_local_roles_only');
1723 $action[5] = $this->
lng->txt(
'non_internal_local_roles_only');
1742 if ($this->admin_mode ==
'settings') {
1743 $this->
ctrl->setParameterByClass(
1744 'ilobjsystemfoldergui',
1749 $this->
lng->txt(
'administration'),
1750 $this->
ctrl->getLinkTargetByClass([
'iladministrationgui',
'ilobjsystemfoldergui'],
''),
1759 $this->
ctrl->getLinkTargetByClass(
'ilobjuserfoldergui',
'view')
1766 $this->
ctrl->getLinkTargetByClass(
'ilobjrolefoldergui',
'view')
1770 if ($this->obj_id > 0) {
1772 $this->
object->getTitle(),
1773 $this->
ctrl->getLinkTarget($this,
'view')
1781 if ($this->user_request->getSendMail() !=
'y') {
1784 if (!strlen($this->
object->getEmail())) {
1789 $usr_lang->loadLanguageModule(
'crs');
1790 $usr_lang->loadLanguageModule(
'registration');
1793 $mmail->From($this->mail_sender_factory->system());
1796 $mmail->To($mailOptions->getExternalEmailAddresses());
1798 $subject = $usr_lang->txt(
'profile_changed');
1799 $body = $usr_lang->txt(
'reg_mail_body_salutation')
1800 .
' ' . $this->
object->getFullname() .
",\n\n";
1802 $date = $this->
object->getApproveDate();
1804 if ($date !== null && (time() - strtotime($date)) < 10) {
1805 $body .= $usr_lang->txt(
'reg_mail_body_approve') .
"\n\n";
1807 $body .= $usr_lang->txt(
'reg_mail_body_profile_changed') .
"\n\n";
1811 if ($this->user_request->getPassword() !=
'') {
1812 $body .= $usr_lang->txt(
'reg_mail_body_text2') .
"\n" .
1813 ILIAS_HTTP_PATH .
'/login.php?client_id=' . $this->
ilias->client_id .
"\n" .
1814 $usr_lang->txt(
'login') .
': ' . $this->
object->getLogin() .
"\n" .
1815 $usr_lang->txt(
'passwd') .
': ' . $this->user_request->getPassword() .
"\n\n";
1817 $body .= $usr_lang->txt(
'reg_mail_body_text3') .
"\n";
1818 $body .= $this->
object->getProfileAsString($usr_lang);
1822 $mmail->Subject($subject,
true);
1823 $mmail->Body($body);
1826 return '<br/>' . $this->
lng->txt(
'mail_sent');
1832 public static function _goto(
string $a_target):
void 1836 $ilUser = $DIC[
'ilUser'];
1839 $ilCtrl = $DIC[
'ilCtrl'];
1842 if ($a_target == md5(
'usrdelown')) {
1844 $ilUser->hasDeletionFlag()) {
1845 $ilCtrl->setTargetScript(
'ilias.php');
1846 $ilCtrl->redirectByClass([
'ildashboardgui',
'ilpersonalsettingsgui'],
'deleteOwnAccountStep2');
1848 exit(
'This account is not flagged for deletion.');
1852 if (substr($a_target, -4) ==
'_bdg') {
1853 $ilCtrl->redirectByClass(
'ilDashboardGUI',
'jumpToBadges');
1856 if (
'registration' == $a_target) {
1857 $ilCtrl->redirectByClass([
'ilStartUpGUI',
'ilAccountRegistrationGUI'],
'');
1858 } elseif (
'nameassist' == $a_target) {
1859 $ilCtrl->redirectByClass([
'ilStartUpGUI',
'ilPasswordAssistanceGUI'],
'showUsernameAssistanceForm');
1860 } elseif (
'pwassist' == $a_target) {
1861 $ilCtrl->redirectByClass([
'ilStartUpGUI',
'ilPasswordAssistanceGUI'],
'');
1863 $target = $DIC[
'legalDocuments']->findGotoLink($a_target);
1864 if ($target->isOK()) {
1865 $ilCtrl->setTargetScript(
'ilias.php');
1866 foreach ($target->value()->queryParams() as $key => $value) {
1867 $ilCtrl->setParameterByClass($target->value()->guiName(), (string) $key, $value);
1869 $ilCtrl->redirectByClass($target->value()->guiPath(), $target->value()->command());
1873 if (strpos($a_target,
'n') === 0) {
1879 if (is_numeric($a_target)) {
1880 $target_user = (
int) $a_target;
1881 } elseif ($target_array = explode(
'_', $a_target, 3)) {
1882 $target_cmd = $target_array[2];
1883 $target_user = (
int) $target_array[0];
1886 if ($target_user > 0) {
1887 $ilCtrl->setParameterByClass(ilPublicUserProfileGUI::class,
'user_id', $target_user);
1891 if ($target_cmd ===
'contact_approved') {
1892 $cmd =
'approveContactRequest';
1893 } elseif ($target_cmd ===
'contact_ignored') {
1894 $cmd =
'ignoreContactRequest';
1896 $ilCtrl->redirectByClass([ilPublicUserProfileGUI::class], $cmd);
1905 $profile_maybe_incomplete =
false;
1907 foreach ($this->user_profile->getIgnorableRequiredSettings() as $fieldName) {
1908 $elm = $this->form_gui->getItemByPostVar($fieldName);
1914 if ($elm->getRequired()) {
1915 $profile_maybe_incomplete =
true;
1918 $elm->setRequired(
false);
1923 foreach ($user_defined_fields->
getDefinitions() as $definition) {
1924 $elm = $this->form_gui->getItemByPostVar(
'udf_' . $definition[
'field_id']);
1930 if ($elm->getRequired() && $definition[
'required']) {
1931 $profile_maybe_incomplete =
true;
1934 $elm->setRequired(
false);
1938 return $profile_maybe_incomplete;
1945 !$this->rbac_system->checkAccess(
'visible,read', $this->usrf_ref_id)
1946 || !$this->rbac_system->checkAccess(
'write', $this->usrf_ref_id)
1952 $this->
access->filterUserIdsByPositionOfCurrentUser(
1961 $this->
ilias->raiseError($this->
lng->txt(
'msg_no_perm_modify_user'), $this->
ilias->error_obj->MESSAGE);
1967 && !$this->rbac_system->checkAccess(
'cat_administrate_users', $this->object->getTimeLimitOwner())) {
1968 $this->
ilias->raiseError($this->
lng->txt(
'msg_no_perm_modify_user'), $this->
ilias->error_obj->MESSAGE);
1974 $this->tpl->setContent($this->legal_documents->userManagementModals() . $this->form_gui->getHTML());
1981 $this->rbac_system->checkAccess(
'edit_roleassignment', $this->usrf_ref_id)
1985 $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
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
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ilObjUser $user=null,)
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.
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...
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)
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
static secondsToString(int $seconds, bool $force_with_seconds=false, ?ilLanguage $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
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...
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
Conductor $legal_documents
Class ilObjForumAdministration.
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)
setPhoneMobile(string $a_str)
setLastname(string $a_str)
const SUGGESTED_LEAD_TIME
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
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 getSessionExpireValue()
Returns the session expiration value.
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)