19 declare(strict_types=1);
70 bool $a_call_by_reference =
false,
71 bool $a_prepare_output =
true 75 $this->
ctrl = $DIC[
'ilCtrl'];
76 $this->
tabs = $DIC[
'ilTabs'];
77 $this->
help = $DIC[
'ilHelp'];
78 $this->repository_guis = $DIC->repository()->gui();
79 $this->mail_sender_factory = $DIC->mail()->mime()->senderFactory();
83 $this->default_layout_and_style = $DIC[
'ilClientIniFile']->readVariable(
'layout',
'skin') .
84 ':' . $DIC[
'ilClientIniFile']->readVariable(
'layout',
'style');
90 $this->uploads = $DIC->upload();
91 $this->irss = $DIC->resourceStorage();
94 $this->
ctrl->saveParameter($this, [
'obj_id',
'letter']);
95 $this->
ctrl->setParameterByClass(
'ilobjuserfoldergui',
'letter', $this->requested_letter);
96 $this->
lng->loadLanguageModule(
'user');
103 $this->requested_letter = $this->user_request->
getLetter();
104 $this->requested_baseClass = $this->user_request->getBaseClass();
105 $this->requested_search = $this->user_request->getSearch();
106 $this->legal_documents = $DIC[
'legalDocuments'];
111 $next_class = $this->
ctrl->getNextClass($this);
112 $cmd = $this->
ctrl->getCmd();
116 switch ($next_class) {
117 case 'illearningprogressgui':
123 $this->
ctrl->forwardCommand($new_gui);
126 case strtolower(ilObjectOwnershipManagementGUI::class):
127 $this->
ctrl->forwardCommand(
128 $this->repository_guis->ownershipManagementGUI(
129 $this->object->getId()
135 if ($cmd ==
'' || $cmd ==
'view') {
146 if (strtolower(get_class($this->
object)) ==
'ilobjuser') {
147 $this->tpl->setTitle(
'[' . $this->
object->getLogin() .
'] ' . $this->
object->getTitle());
148 $this->tpl->setDescription($this->
object->getLongDescription());
149 $this->tpl->setTitleIcon(
151 $this->
lng->txt(
'obj_' . $this->object->getType())
154 parent::setTitleAndDescription();
162 if (strtolower($this->requested_baseClass) ==
'iladministrationgui') {
163 $this->
ctrl->redirectByClass(
'ilobjuserfoldergui',
'view');
165 $this->
ctrl->redirectByClass(
'ilobjcategorygui',
'listUsers');
176 $this->tabs_gui->clearTargets();
178 $this->
help->setScreenIdComponent(
'usr');
180 if ($this->requested_search) {
181 $this->tabs_gui->setBackTarget(
182 $this->
lng->txt(
'search_results'),
186 $this->tabs_gui->addTarget(
188 $this->
ctrl->getLinkTarget($this,
'edit'),
189 [
'edit',
'',
'view'],
195 $this->tabs_gui->addTarget(
197 $this->
ctrl->getLinkTarget($this,
'edit'),
198 [
'edit',
'',
'view'],
204 $this->tabs_gui->addTarget(
206 $this->
ctrl->getLinkTarget($this,
'roleassignment'),
213 if ($this->rbac_system->checkAccess(
'read', $this->ref_id) and
216 $this->tabs_gui->addTarget(
218 $this->
ctrl->getLinkTargetByClass(
'illearningprogressgui',
''),
220 [
'illplistofobjectsgui',
'illplistofsettingsgui',
'illearningprogressgui',
'illplistofprogressgui']
224 $this->tabs_gui->addTarget(
226 $this->
ctrl->getLinkTargetByClass(
'ilobjectownershipmanagementgui',
''),
228 'ilobjectownershipmanagementgui' 239 $this->back_target = [
'text' => $a_text,
'link' => $a_link];
246 $udfs = $this->user_request->getUDFs();
247 foreach ($this->user_defined_fields->getDefinitions() as $field_id => $definition) {
248 if ($definition[
'required'] and !strlen($udfs[$field_id])) {
257 $user_defined_data =
null;
260 if ($this->
object->getType() ==
'usr') {
261 $user_defined_data = $this->
object->getUserDefinedData();
263 foreach ($this->user_defined_fields->getDefinitions() as $field_id => $definition) {
265 $old = $error_post_vars[
'udf'][$field_id] ?? $user_defined_data[$field_id];
268 $this->tpl->setCurrentBlock(
'field_text');
269 $this->tpl->setVariable(
'FIELD_NAME',
'udf[' . $definition[
'field_id'] .
']');
272 $this->tpl->setCurrentBlock(
'field_select');
273 $this->tpl->setVariable(
277 'udf[' . $definition[
'field_id'] .
']',
278 $this->user_defined_fields->fieldValuesToSelectArray(
279 $definition[
'field_values']
286 $this->tpl->parseCurrentBlock();
287 $this->tpl->setCurrentBlock(
'user_defined');
289 if ($definition[
'required']) {
290 $name = $definition[
'field_name'] .
'<span class="asterisk">*</span>';
292 $name = $definition[
'field_name'];
294 $this->tpl->setVariable(
'TXT_FIELD_NAME', $name);
295 $this->tpl->parseCurrentBlock();
302 $this->tabs_gui->clearTargets();
306 $obj_list = $this->rbac_review->getRoleListByObject(
ROLE_FOLDER_ID);
308 foreach ($obj_list as $obj_data) {
312 $this->rbac_review->assignedRoles($this->user->getId())
323 $this->rbac_review->assignedRoles($this->user->getId())
325 $rol[$obj_data[
'obj_id']] = $obj_data[
'title'];
331 $this->
ilias->raiseError(
332 $this->
lng->txt(
'msg_no_roles_users_can_be_assigned_to'),
333 $this->
ilias->error_obj->MESSAGE
337 $keys = array_keys($rol);
340 if (in_array(4, $keys)) {
341 $this->default_role = 4;
343 if (count($keys) > 1 && in_array(2, $keys)) {
345 foreach ($keys as $key => $val) {
353 $this->default_role = array_shift($keys);
355 $this->selectable_roles = $rol;
363 if (!$this->rbac_system->checkAccess(
'create_usr', $this->usrf_ref_id)
364 && !$this->rbac_system->checkAccess(
'cat_administrate_users', $this->usrf_ref_id)) {
365 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
378 if (!$this->rbac_system->checkAccess(
'create_usr', $this->usrf_ref_id)
379 && !$this->
access->checkAccess(
'cat_administrate_users',
'', $this->usrf_ref_id)) {
380 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
387 $profile_maybe_incomplete =
false;
388 if ($this->form_gui->getInput(
'ignore_rf',
false)) {
392 if (!$this->form_gui->checkInput()) {
393 $this->form_gui->setValuesByPost();
401 || !in_array(
SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
402 || in_array(
SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
405 $user_object->setTitle($user_object->getFullname());
406 $user_object->setDescription($user_object->getEmail());
410 $user_object->create();
413 $user_object->setExternalAccount($this->form_gui->getInput(
'ext_account'));
418 $user_object->setLastPasswordChangeTS(time());
421 $user_object->saveAsNew();
425 $user_object->setLanguage($this->form_gui->getInput(
'language'));
430 $sknst = explode(
':', $this->form_gui->getInput(
'skin_style'));
432 if ($user_object->getPref(
'style') != $sknst[1] ||
433 $user_object->getPref(
'skin') != $sknst[0]) {
434 $user_object->setPref(
'skin', $sknst[0]);
435 $user_object->setPref(
'style', $sknst[1]);
439 $user_object->setPref(
'session_reminder_lead_time', (
string) $this->form_gui->getInput(
'session_reminder_lead_time'));
442 $user_object->setPref(
443 'hide_own_online_status',
444 $this->form_gui->getInput(
'hide_own_online_status')
448 $user_object->setPref(
449 'bs_allow_to_contact_me',
450 $this->form_gui->getInput(
'bs_allow_to_contact_me') ?
'y' :
'n' 454 $user_object->setPref(
455 'chat_osc_accept_msg',
456 $this->form_gui->getInput(
'chat_osc_accept_msg') ?
'y' :
'n' 460 $user_object->setPref(
461 'chat_broadcast_typing',
462 $this->form_gui->getInput(
'chat_broadcast_typing') ?
'y' :
'n' 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();
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();
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]);
751 $this->
object->setPref(
'session_reminder_lead_time', (
string) $this->form_gui->getInput(
'session_reminder_lead_time'));
755 $this->
object->setPref(
756 'hide_own_online_status',
757 ($this->form_gui->getInput(
'hide_own_online_status') ??
'0')
761 $this->
object->setPref(
762 'bs_allow_to_contact_me',
763 ($this->form_gui->getInput(
'bs_allow_to_contact_me') ??
false) ?
'y' :
'n' 767 $this->
object->setPref(
768 'chat_osc_accept_msg',
769 ($this->form_gui->getInput(
'chat_osc_accept_msg') ??
false) ?
'y' :
'n' 773 $this->
object->setPref(
774 'chat_broadcast_typing',
775 ($this->form_gui->getInput(
'chat_broadcast_typing') ??
false) ?
'y' :
'n' 781 $this->
object->setLastPasswordChangeTS(time());
784 $this->
object->setProfileIncomplete(
false);
786 $this->update = $this->
object->update();
790 if ($this->
user->getId() == $this->
object->getId()) {
791 $this->
user->readPrefs();
793 $this->
user->setPref(
795 ($this->form_gui->getInput(
'send_mail') ===
'y') ?
'y' :
'n' 797 $this->
user->writePrefs();
800 $msg = $this->
lng->txt(
'saved_successfully') . $mail_message;
807 if ($profile_maybe_incomplete) {
810 if ($this->user_profile->isProfileIncomplete(
$user)) {
811 $this->
object->setProfileIncomplete(
true);
817 $this->tpl->setOnScreenMessage(
'success', $msg,
true);
819 if (strtolower($this->requested_baseClass) ==
'iladministrationgui') {
820 $this->
ctrl->redirectByClass(
'ilobjuserfoldergui',
'view');
822 $this->
ctrl->redirectByClass(
'ilobjcategorygui',
'listUsers');
825 $this->form_gui->setValuesByPost();
826 $this->tabs_gui->activateTab(
'properties');
827 $this->tpl->setContent($this->form_gui->getHtml());
836 $data[
'auth_mode'] = $this->
object->getAuthMode();
837 $data[
'login'] = $this->
object->getLogin();
838 $data[
'ext_account'] = $this->
object->getExternalAccount();
840 $this->
object->getCreateDate(),
844 $data[
'approve_date'] = ($this->
object->getApproveDate() !=
'')
848 $data[
'last_login'] = ($this->
object->getLastLogin() !=
'')
851 $data[
'active'] = $this->
object->getActive();
852 $data[
'time_limit_unlimited'] = $this->
object->getTimeLimitUnlimited() ?
'1' :
'0';
854 $data[
'time_limit_from'] = $this->
object->getTimeLimitFrom()
857 $data[
'time_limit_until'] = $this->
object->getTimeLimitUntil()
861 $data[
'gender'] = $this->
object->getGender();
862 $data[
'firstname'] = $this->
object->getFirstname();
863 $data[
'lastname'] = $this->
object->getLastname();
864 $data[
'title'] = $this->
object->getUTitle();
865 $data[
'birthday'] = $this->
object->getBirthday()
868 $data[
'institution'] = $this->
object->getInstitution();
869 $data[
'department'] = $this->
object->getDepartment();
870 $data[
'street'] = $this->
object->getStreet();
871 $data[
'city'] = $this->
object->getCity();
872 $data[
'zipcode'] = $this->
object->getZipcode();
873 $data[
'country'] = $this->
object->getCountry();
874 $data[
'sel_country'] = $this->
object->getSelectedCountry();
875 $data[
'phone_office'] = $this->
object->getPhoneOffice();
876 $data[
'phone_home'] = $this->
object->getPhoneHome();
877 $data[
'phone_mobile'] = $this->
object->getPhoneMobile();
878 $data[
'fax'] = $this->
object->getFax();
879 $data[
'email'] = $this->
object->getEmail();
880 $data[
'second_email'] = $this->
object->getSecondEmail();
881 $data[
'hobby'] = $this->
object->getHobby();
882 $data[
'referral_comment'] = $this->
object->getComment();
884 $data[
'interests_general'] = $this->
object->getGeneralInterests();
885 $data[
'interests_help_offered'] = $this->
object->getOfferingHelp();
886 $data[
'interests_help_looking'] = $this->
object->getLookingForHelp();
888 $data[
'matriculation'] = $this->
object->getMatriculation();
889 $data[
'client_ip'] = $this->
object->getClientIP();
892 $user_defined_data = $this->
object->getUserDefinedData();
893 foreach ($this->user_defined_fields->getDefinitions() as $field_id => $definition) {
894 $data[
'udf_' . $field_id] = $user_defined_data[
'f_' . $field_id] ??
'';
897 $data[
'language'] = $this->
object->getLanguage();
898 $data[
'skin_style'] = $this->
object->skin .
':' . $this->
object->prefs[
'style'];
899 $data[
'session_reminder_lead_time'] =
900 $this->
object->prefs[
'session_reminder_lead_time'] ??
902 $data[
'hide_own_online_status'] = $this->
object->prefs[
'hide_own_online_status'] ??
'';
903 $data[
'bs_allow_to_contact_me'] = ($this->
object->prefs[
'bs_allow_to_contact_me'] ??
'') ==
'y';
904 $data[
'chat_osc_accept_msg'] = ($this->
object->prefs[
'chat_osc_accept_msg'] ??
'') ==
'y';
905 $data[
'chat_broadcast_typing'] = ($this->
object->prefs[
'chat_broadcast_typing'] ??
'') ==
'y';
907 $data[
'send_mail'] = (($this->
object->prefs[
'send_info_mails'] ??
'') ==
'y');
909 $this->form_gui->setValuesByArray($data);
920 $this->form_gui->setFormAction($this->
ctrl->getFormAction($this));
921 if ($a_mode ==
'create') {
922 $this->form_gui->setTitle($this->
lng->txt(
'usr_new'));
924 $this->form_gui->setTitle($this->
lng->txt(
'usr_edit'));
929 $sec_l->setTitle($this->
lng->txt(
'login_data'));
930 $this->form_gui->addItem($sec_l);
936 foreach ($active_auth_modes as $auth_name => $auth_key) {
937 if ($auth_name ==
'default') {
942 $option[$auth_name] = $name;
945 $this->form_gui->addItem($am);
947 if ($a_mode ==
'edit') {
950 $this->form_gui->addItem(
$id);
955 if ($a_mode ==
'edit') {
956 $lo->setCurrentUserId($this->
object->getId());
961 $this->
lng->txt(
'usr_loginname_history_info'),
963 $last_history_entry[0]
970 $this->form_gui->addItem($lo);
973 || !in_array(
SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
974 || in_array(
SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
978 $pw->setMaxLength(80);
979 $pw->setValidateAuthPost(
'auth_mode');
980 if ($a_mode ==
'create') {
981 $pw->setRequiredOnAuth(
true);
984 && in_array(
SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
985 && !in_array(
SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
986 $pw->setDisabled(
true);
989 $this->form_gui->addItem($pw);
995 $ext->setMaxLength(250);
996 $ext->setInfo($this->
lng->txt(
'user_ext_account_desc'));
997 $this->form_gui->addItem($ext);
1001 $sec_si->setTitle($this->
lng->txt(
'system_information'));
1002 $this->form_gui->addItem($sec_si);
1005 if ($a_mode ==
'edit') {
1007 'create_date' =>
'',
1008 'approve_date' =>
'',
1009 ...$this->legal_documents->userManagementFields($this->
object),
1013 foreach ($sia as
$a => $v) {
1014 if (is_string($v)) {
1016 $siai->setValue($v);
1017 $this->form_gui->addItem($siai);
1019 $this->form_gui->addItem($v);
1025 $ac->setChecked(
true);
1026 $this->form_gui->addItem($ac);
1028 $this->
lng->loadLanguageModule(
'crs');
1032 $radg->setRequired(
true);
1034 $radg->addOption($op1);
1036 $radg->addOption($op2);
1040 $acfrom->setShowTime(
true);
1041 $acfrom->setMinuteStepSize(1);
1042 $op2->addSubItem($acfrom);
1046 $acto->setShowTime(
true);
1047 $acto->setMinuteStepSize(1);
1048 $op2->addSubItem($acto);
1050 $this->form_gui->addItem($radg);
1060 $sec_pd->setTitle($this->
lng->txt(
'personal_data'));
1061 $this->form_gui->addItem($sec_pd);
1068 $gndr->addOption($neutral);
1070 $gndr->addOption($female);
1072 $gndr->addOption($male);
1073 $this->form_gui->addItem($gndr);
1077 'firstname' =>
true,
1081 foreach ($fields as $field =>
$req) {
1082 $max_len = $field ===
'title' ? 32 : 128;
1085 $caption = ($field ==
'title')
1090 $inp->setMaxLength($max_len);
1091 $inp->setRequired(
$req);
1092 $this->form_gui->addItem($inp);
1099 if ($a_mode ==
'edit' || $a_mode ==
'upload') {
1107 $this->form_gui->addItem($pi);
1113 $this->form_gui->addItem($birthday);
1119 [
'institution', 40, 80],
1120 [
'department', 40, 80],
1123 [
'zipcode', 10, 10],
1124 [
'country', 40, 40],
1126 [
'phone_office', 30, 30],
1127 [
'phone_home', 30, 30],
1128 [
'phone_mobile', 30, 30],
1133 foreach ($fields as $field) {
1137 $sec_cd->setTitle($this->
lng->txt(
'contact_data'));
1138 $this->form_gui->addItem($sec_cd);
1141 if ($a_mode ==
'edit') {
1143 $orgus->setValue($this->
object->getOrgUnitsRepresentation());
1144 $this->form_gui->addItem($orgus);
1148 if ($field[0] !=
'sel_country') {
1150 $inp->setSize($field[1]);
1151 $inp->setMaxLength($field[2]);
1152 $inp->setRequired(isset(
$settings[
'require_' . $field[0]]) &&
1154 $this->form_gui->addItem($inp);
1160 $this->form_gui->addItem($cs);
1168 $em->setMaxLength(128);
1169 $this->form_gui->addItem($em);
1175 $this->form_gui->addItem($em);
1182 $hob->setRequired(isset(
$settings[
'require_hobby']) &&
1184 $this->form_gui->addItem($hob);
1191 $rc->setRequired(isset(
$settings[
'require_referral_comment']) &&
1193 $this->form_gui->addItem($rc);
1197 $sh->setTitle($this->
lng->txt(
'interests'));
1198 $this->form_gui->addItem($sh);
1200 $multi_fields = [
'interests_general',
'interests_help_offered',
'interests_help_looking'];
1201 foreach ($multi_fields as $multi_field) {
1205 $ti->setMulti(
true);
1206 $ti->setMaxLength(40);
1208 $ti->setRequired(isset(
$settings[
'require_' . $multi_field]) &&
1210 $this->form_gui->addItem($ti);
1216 $sec_oi->setTitle($this->
lng->txt(
'user_profile_other'));
1217 $this->form_gui->addItem($sec_oi);
1223 $mr->setMaxLength(40);
1224 $mr->setRequired(isset(
$settings[
'require_matriculation']) &&
1226 $this->form_gui->addItem($mr);
1231 $ip->setMaxLength(255);
1232 $ip->setInfo($this->
lng->txt(
'current_ip') .
' ' .
$_SERVER[
'REMOTE_ADDR'] .
' <br />' .
1233 '<span class="warning">' . $this->
lng->txt(
'current_ip_alert') .
'</span>');
1234 $this->form_gui->addItem($ip);
1244 foreach ($all_defs as $definition) {
1247 $this->form_gui->addItem($f_property);
1251 if ($a_mode ==
'create' 1261 $sec_st->setTitle($this->
lng->txt(
'settings'));
1262 $this->form_gui->addItem($sec_st);
1265 if ($a_mode ==
'create') {
1267 $this->
lng->txt(
'default_role'),
1271 $role->setValue($this->default_role);
1272 $role->setOptions($this->selectable_roles);
1273 $this->form_gui->addItem($role);
1277 $languages = $this->
lng->getInstalledLanguages();
1278 $this->
lng->loadLanguageModule(
'meta');
1280 foreach ($languages as $l) {
1281 $options[$l] = $this->
lng->txt(
'meta_l_' . $l);
1284 $this->
lng->txt(
'language'),
1287 $lang->setOptions($options);
1289 if (count($options) <= 1) {
1290 $lang->setDisabled(
true);
1292 $this->form_gui->addItem(
$lang);
1297 $this->
lng->txt(
'skin_style'),
1301 $skins = ilStyleDefinition::getAllSkins();
1304 if (is_array($skins)) {
1308 foreach ($skins as $skin) {
1309 foreach ($skin->getStyles() as $style) {
1314 $options[$skin->getId() .
':' . $style->getId()] = $skin->getName() .
' / ' . $style->getName();
1319 $sk->setValue($this->default_layout_and_style);
1321 $this->form_gui->addItem($sk);
1325 $this->
lng->loadLanguageModule(
'awrn');
1327 $default = ($this->
settings->get(
'hide_own_online_status') ==
'n')
1328 ? $this->
lng->txt(
'user_awrn_show')
1329 : $this->
lng->txt(
'user_awrn_hide');
1332 '' => $this->
lng->txt(
'user_awrn_default') .
' (' . $default .
')',
1333 'n' => $this->
lng->txt(
'user_awrn_show'),
1334 'y' => $this->
lng->txt(
'user_awrn_hide')
1338 $os->setDisabled((
bool) $this->
settings->get(
'usr_settings_disable_hide_own_online_status'));
1339 $os->setInfo($this->
lng->txt(
'awrn_hide_from_awareness_info'));
1340 $this->form_gui->addItem($os);
1344 $this->
lng->loadLanguageModule(
'buddysystem');
1345 $os =
new ilCheckboxInputGUI($this->
lng->txt(
'buddy_allow_to_contact_me'),
'bs_allow_to_contact_me');
1346 if ($a_mode ==
'create') {
1349 $this->form_gui->addItem($os);
1352 $this->
lng->loadLanguageModule(
'chatroom');
1353 $chat_osc_acm =
new ilCheckboxInputGUI($this->
lng->txt(
'chat_osc_accept_msg'),
'chat_osc_accept_msg');
1354 if ($a_mode ==
'create') {
1357 $this->form_gui->addItem($chat_osc_acm);
1362 $this->
lng->txt(
'session_reminder_input'),
1363 'session_reminder_lead_time' 1367 $session_reminder->setInfo(
1369 $this->
lng->txt(
'session_reminder_lead_time_info'),
1375 $session_reminder->setValue(
1376 (
string) $session_reminder_object->getGlobalSessionReminderLeadTime()
1378 $session_reminder->setSize(3);
1380 $session_reminder->setMaxValue($session_reminder_object->getMaxPossibleLeadTime());
1381 $this->form_gui->addItem($session_reminder);
1386 $sec_op->setTitle($this->
lng->txt(
'options'));
1387 $this->form_gui->addItem($sec_op);
1391 $se->setInfo($this->
lng->txt(
'inform_user_mail_info'));
1393 $se->setChecked(($this->
user->getPref(
'send_info_mails') ==
'y'));
1394 $this->form_gui->addItem($se);
1397 $irf->setInfo($this->
lng->txt(
'ignore_required_fields_info'));
1398 $irf->setValue(
'1');
1399 $this->form_gui->addItem($irf);
1401 if ($a_mode ==
'create' || $a_mode ==
'save') {
1402 $this->form_gui->addCommandButton(
'save', $this->
lng->txt(
'save'));
1404 if ($a_mode ==
'edit' || $a_mode ==
'update') {
1405 $this->form_gui->addCommandButton(
'update', $this->
lng->txt(
'save'));
1407 $this->form_gui->addCommandButton(
'cancel', $this->
lng->txt(
'cancel'));
1421 return (
bool) (
$settings[
'usr_settings_changeable_lua_' . $a_field] ??
false);
1430 $userfile_input = $this->form_gui->getItemByPostVar(
'userfile');
1431 if ($_FILES[
'userfile'][
'tmp_name'] ==
'') {
1432 if ($userfile_input->getDeletionFlag()) {
1433 $this->
object->removeUserPicture();
1437 if ($_FILES[
'userfile'][
'size'] == 0) {
1438 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_no_file'));
1440 $store_file =
'usr_' . $this->
object->getId() .
'.' .
'jpg';
1444 if ($rid ===
null) {
1448 $this->
object->setAvatarRid($rid->serialize());
1451 $this->
object->setPref(
'profile_image', $store_file);
1452 $this->
object->update();
1459 $upload_tmp_name = $_FILES[
'userfile'][
'tmp_name'];
1460 $avatar_upload_result = $uploads[$upload_tmp_name] ??
null;
1462 $existing_rid =
null;
1463 if ($this->
object->getAvatarRid() !==
null) {
1464 $existing_rid = $this->irss->manage()->find($this->
object->getAvatarRid());
1467 $revision_title =
'Avatar for user ' . $this->
object->getLogin();
1468 $this->stakeholder->setOwner($this->
object->getId());
1470 if ($avatar_upload_result === null && file_exists($upload_tmp_name)) {
1471 $stream = Streams::ofResource(
1472 fopen($upload_tmp_name,
'r')
1475 if ($existing_rid === null) {
1476 return $this->irss->manage()->stream($stream, $this->stakeholder, $revision_title);
1479 $this->irss->manage()->appendNewRevisionFromStream(
1485 return $existing_rid;
1488 if ($avatar_upload_result === null) {
1492 if ($existing_rid === null) {
1493 return $this->irss->manage()->upload(
1494 $avatar_upload_result,
1500 $this->irss->manage()->replaceWithUpload(
1502 $avatar_upload_result,
1506 return $existing_rid;
1512 $image_dir = $webspace_dir .
'/usr_images';
1513 $file = $image_dir .
'/usr_' . $this->
object->getId() .
'.' .
'jpg';
1514 $thumb_file = $image_dir .
'/usr_' . $this->
object->getId() .
'_small.jpg';
1515 $xthumb_file = $image_dir .
'/usr_' . $this->
object->getId() .
'_xsmall.jpg';
1516 $xxthumb_file = $image_dir .
'/usr_' . $this->
object->getId() .
'_xxsmall.jpg';
1517 $upload_file = $image_dir .
'/upload_' . $this->
object->getId();
1520 $this->
object->setPref(
'profile_image',
'');
1521 $this->
object->update();
1522 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'user_image_removed'));
1524 if (is_file($file)) {
1527 if (is_file($thumb_file)) {
1528 unlink($thumb_file);
1530 if (is_file($xthumb_file)) {
1531 unlink($xthumb_file);
1533 if (is_file($xxthumb_file)) {
1534 unlink($xxthumb_file);
1536 if (is_file($upload_file)) {
1537 unlink($upload_file);
1545 if (!$this->rbac_system->checkAccess(
'edit_roleassignment', $this->usrf_ref_id)) {
1546 $this->
ilias->raiseError(
1547 $this->
lng->txt(
'msg_no_perm_assign_role_to_user'),
1548 $this->
ilias->error_obj->MESSAGE
1552 $selected_roles = $this->user_request->getRoleIds();
1553 $posted_roles = $this->user_request->getPostedRoleIds();
1560 $global_roles_all = $this->rbac_review->getGlobalRoles();
1561 $assigned_roles_all = $this->rbac_review->assignedRoles($this->
object->getId());
1562 $assigned_roles = array_intersect($assigned_roles_all, $posted_roles);
1563 $assigned_global_roles_all = array_intersect($assigned_roles_all, $global_roles_all);
1564 $assigned_global_roles = array_intersect($assigned_global_roles_all, $posted_roles);
1566 $user_not_allowed_to_change_admin_role_assginements =
1567 !in_array(
SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()));
1569 if ($user_not_allowed_to_change_admin_role_assginements
1574 $posted_global_roles = array_intersect($selected_roles, $global_roles_all);
1576 if (empty($selected_roles) && count($assigned_roles_all) === count($assigned_roles)
1577 || empty($posted_global_roles) && count($assigned_global_roles_all) === count($assigned_global_roles)) {
1578 $this->tpl->setOnScreenMessage(
1580 $this->
lng->txt(
'msg_min_one_role') .
'<br/>' . $this->
lng->txt(
'action_aborted'),
1583 $this->
ctrl->redirect($this,
'roleassignment');
1586 foreach (array_diff($assigned_roles, $selected_roles) as $role) {
1588 || $user_not_allowed_to_change_admin_role_assginements && $role ===
SYSTEM_ROLE_ID) {
1591 $this->rbac_admin->deassignUser($role, $this->
object->getId());
1594 foreach (array_diff($selected_roles, $assigned_roles) as $role) {
1596 || $user_not_allowed_to_change_admin_role_assginements && $role ===
SYSTEM_ROLE_ID) {
1599 $this->rbac_admin->assignUser($role, $this->
object->getId(),
false);
1602 $this->
object->update();
1604 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_roleassignment_changed'),
true);
1606 if (strtolower($this->requested_baseClass) ==
'iladministrationgui') {
1607 $this->
ctrl->redirect($this,
'roleassignment');
1609 $this->
ctrl->redirectByClass(
'ilobjcategorygui',
'listUsers');
1615 $this->
tabs->activateTab(
'role_assignment');
1618 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_no_perm_view_roles_of_user'),
true);
1619 $this->
ctrl->redirectByClass(self::class,
'edit');
1622 $req_filtered_roles = $this->user_request->getFilteredRoles();
1625 ($req_filtered_roles > 0) ? $req_filtered_roles :
ilSession::get(
'filtered_roles')
1629 if ($filtered_roles > 5) {
1633 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.usr_role_assignment.html',
'components/ILIAS/User');
1638 $tab->parse($this->
object->getId());
1639 $this->tpl->setVariable(
'ROLES_TABLE', $tab->getHTML());
1645 $table_gui->writeFilterToSession();
1646 $table_gui->resetOffset();
1653 $table_gui->resetOffset();
1654 $table_gui->resetFilter();
1666 for ($i = 0; $i <= 60; $i++) {
1667 $days[$i] = $i < 10 ?
'0' . $i : $i;
1672 for ($i = 0; $i < 24; $i++) {
1673 $days[$i] = $i < 10 ?
'0' . $i : $i;
1678 for ($i = 1; $i < 32; $i++) {
1679 $days[$i] = $i < 10 ?
'0' . $i : $i;
1684 for ($i = 1; $i < 13; $i++) {
1685 $month[$i] = $i < 10 ?
'0' . $i : $i;
1690 if ($a_selected < date(
'Y')) {
1691 $start = $a_selected;
1696 for ($i = $start; $i < ((
int) date(
'Y') + 11); ++$i) {
1707 $a_time_arr[
'hour'],
1708 $a_time_arr[
'minute'],
1709 $a_time_arr[
'second'],
1710 $a_time_arr[
'month'],
1723 $action[0] = $this->
lng->txt(
'assigned_roles');
1724 $action[1] = $this->
lng->txt(
'all_roles');
1725 $action[2] = $this->
lng->txt(
'all_global_roles');
1726 $action[3] = $this->
lng->txt(
'all_local_roles');
1727 $action[4] = $this->
lng->txt(
'internal_local_roles_only');
1728 $action[5] = $this->
lng->txt(
'non_internal_local_roles_only');
1747 if ($this->admin_mode ==
'settings') {
1748 $this->
ctrl->setParameterByClass(
1749 'ilobjsystemfoldergui',
1754 $this->
lng->txt(
'administration'),
1755 $this->
ctrl->getLinkTargetByClass([
'iladministrationgui',
'ilobjsystemfoldergui'],
''),
1764 $this->
ctrl->getLinkTargetByClass(
'ilobjuserfoldergui',
'view')
1771 $this->
ctrl->getLinkTargetByClass(
'ilobjrolefoldergui',
'view')
1775 if ($this->obj_id > 0) {
1777 $this->
object->getTitle(),
1778 $this->
ctrl->getLinkTarget($this,
'view')
1786 if ($this->user_request->getSendMail() !=
'y') {
1789 if (!strlen($this->
object->getEmail())) {
1794 $usr_lang->loadLanguageModule(
'crs');
1795 $usr_lang->loadLanguageModule(
'registration');
1798 $mmail->From($this->mail_sender_factory->system());
1801 $mmail->To($mailOptions->getExternalEmailAddresses());
1803 $subject = $usr_lang->txt(
'profile_changed');
1804 $body = $usr_lang->txt(
'reg_mail_body_salutation')
1805 .
' ' . $this->
object->getFullname() .
",\n\n";
1807 $date = $this->
object->getApproveDate();
1809 if ($date !==
null && (time() - strtotime($date)) < 10) {
1810 $body .= $usr_lang->txt(
'reg_mail_body_approve') .
"\n\n";
1812 $body .= $usr_lang->txt(
'reg_mail_body_profile_changed') .
"\n\n";
1816 if ($this->user_request->getPassword() !=
'') {
1817 $body .= $usr_lang->txt(
'reg_mail_body_text2') .
"\n" .
1818 ILIAS_HTTP_PATH .
'/login.php?client_id=' . $this->
ilias->client_id .
"\n" .
1819 $usr_lang->txt(
'login') .
': ' . $this->
object->getLogin() .
"\n" .
1820 $usr_lang->txt(
'passwd') .
': ' . $this->user_request->getPassword() .
"\n\n";
1822 $body .= $usr_lang->txt(
'reg_mail_body_text3') .
"\n";
1823 $body .= $this->
object->getProfileAsString($usr_lang);
1827 $mmail->Subject($subject,
true);
1828 $mmail->Body($body);
1831 return '<br/>' . $this->
lng->txt(
'mail_sent');
1837 public static function _goto(
string $a_target):
void 1841 $ilUser = $DIC[
'ilUser'];
1844 $ilCtrl = $DIC[
'ilCtrl'];
1847 if ($a_target == md5(
'usrdelown')) {
1849 $ilUser->hasDeletionFlag()) {
1850 $ilCtrl->setTargetScript(
'ilias.php');
1851 $ilCtrl->redirectByClass([
'ildashboardgui',
'ilpersonalsettingsgui'],
'deleteOwnAccountStep2');
1853 exit(
'This account is not flagged for deletion.');
1857 if (substr($a_target, -4) ==
'_bdg') {
1858 $ilCtrl->redirectByClass(
'ilDashboardGUI',
'jumpToBadges');
1861 if (
'registration' == $a_target) {
1862 $ilCtrl->redirectByClass([
'ilStartUpGUI',
'ilAccountRegistrationGUI'],
'');
1863 } elseif (
'nameassist' == $a_target) {
1864 $ilCtrl->redirectByClass([
'ilStartUpGUI',
'ilPasswordAssistanceGUI'],
'showUsernameAssistanceForm');
1865 } elseif (
'pwassist' == $a_target) {
1866 $ilCtrl->redirectByClass([
'ilStartUpGUI',
'ilPasswordAssistanceGUI'],
'');
1868 $target = $DIC[
'legalDocuments']->findGotoLink($a_target);
1869 if ($target->isOK()) {
1870 $ilCtrl->setTargetScript(
'ilias.php');
1871 foreach ($target->value()->queryParams() as $key => $value) {
1872 $ilCtrl->setParameterByClass($target->value()->guiName(), (string) $key, $value);
1874 $ilCtrl->redirectByClass($target->value()->guiPath(), $target->value()->command());
1878 if (strpos($a_target,
'n') === 0) {
1884 if (is_numeric($a_target)) {
1885 $target_user = (
int) $a_target;
1886 } elseif ($target_array = explode(
'_', $a_target, 3)) {
1887 $target_cmd = $target_array[2];
1888 $target_user = (
int) $target_array[0];
1891 if ($target_user > 0) {
1892 $ilCtrl->setParameterByClass(ilPublicUserProfileGUI::class,
'user_id', $target_user);
1896 if ($target_cmd ===
'contact_approved') {
1897 $cmd =
'approveContactRequest';
1898 } elseif ($target_cmd ===
'contact_ignored') {
1899 $cmd =
'ignoreContactRequest';
1901 $ilCtrl->redirectByClass([ilPublicUserProfileGUI::class], $cmd);
1910 $profile_maybe_incomplete =
false;
1912 foreach ($this->user_profile->getIgnorableRequiredSettings() as $fieldName) {
1913 $elm = $this->form_gui->getItemByPostVar($fieldName);
1919 if ($elm->getRequired()) {
1920 $profile_maybe_incomplete =
true;
1923 $elm->setRequired(
false);
1928 foreach ($user_defined_fields->
getDefinitions() as $definition) {
1929 $elm = $this->form_gui->getItemByPostVar(
'udf_' . $definition[
'field_id']);
1935 if ($elm->getRequired() && $definition[
'required']) {
1936 $profile_maybe_incomplete =
true;
1939 $elm->setRequired(
false);
1943 return $profile_maybe_incomplete;
1950 !$this->rbac_system->checkAccess(
'visible,read', $this->usrf_ref_id)
1951 || !$this->rbac_system->checkAccess(
'write', $this->usrf_ref_id)
1957 $this->
access->filterUserIdsByPositionOfCurrentUser(
1966 $this->
ilias->raiseError($this->
lng->txt(
'msg_no_perm_modify_user'), $this->
ilias->error_obj->MESSAGE);
1972 && !$this->rbac_system->checkAccess(
'cat_administrate_users', $this->object->getTimeLimitOwner())) {
1973 $this->
ilias->raiseError($this->
lng->txt(
'msg_no_perm_modify_user'), $this->
ilias->error_obj->MESSAGE);
1979 $this->tpl->setContent($this->legal_documents->userManagementModals() . $this->form_gui->getHTML());
1986 $this->rbac_system->checkAccess(
'edit_roleassignment', $this->usrf_ref_id)
1990 $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 class represents an option in a radio group.
setClientIP(string $a_str)
ilUserDefinedFields $user_defined_fields
RepositoryGUIs $repository_guis
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()
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
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
const int SUGGESTED_LEAD_TIME
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)
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.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
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()
Class ilObjUserTrackingGUI.
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()
const int LEAD_TIME_DISABLED
static _lookupLogin(int $a_user_id)
setLookingForHelp(?array $value=null)