32 protected \ILIAS\User\StandardGUIRequest
$request;
44 $this->tpl =
$DIC->ui()->mainTemplate();
45 $this->
lng = $DIC->language();
46 $this->
ctrl = $DIC->ctrl();
47 $this->upload_error =
"";
48 $this->password_error =
"";
49 $this->
lng->loadLanguageModule(
"user");
50 $this->
ctrl->saveParameter($this,
"user_page");
53 $this->request = new \ILIAS\User\StandardGUIRequest(
57 $this->entered_new_password = $this->request->getNewPassword();
58 $this->entered_current_password = $this->request->getCurrentPassword();
68 $next_class = $this->
ctrl->getNextClass();
70 switch ($next_class) {
71 case 'ilmailoptionsgui':
77 $DIC->tabs()->activateTab(
'mail_settings');
83 $cmd = $this->
ctrl->getCmd(
"showGeneralSettings");
94 $ilTabs =
$DIC[
'ilTabs'];
96 $ilHelp =
$DIC[
'ilHelp'];
97 $rbacsystem =
$DIC[
'rbacsystem'];
100 $ilHelp->setScreenIdComponent(
"user");
102 $showPassword = $a_cmd ==
'showPassword';
103 $showGeneralSettings = $a_cmd ==
'showGeneralSettings';
110 $this->
ctrl->getLinkTarget($this,
"showGeneralSettings"),
121 $this->
ctrl->getLinkTarget($this,
"showPassword"),
130 $this->
ctrl->setParameter($this,
'referrer',
'ilPersonalSettingsGUI');
134 $this->
ctrl->getLinkTargetByClass(
'ilMailOptionsGUI'),
136 array(
'ilMailOptionsGUI')
140 if (
$ilSetting->get(
'user_delete_own_account') &&
144 $this->
lng->txt(
'user_delete_own_account'),
145 $this->ctrl->getLinkTarget($this,
"deleteOwnAccount1")
155 $this->tpl->setTitle($this->
lng->txt(
'personal_settings'));
165 bool $a_no_init =
false,
166 bool $hide_form =
false
170 $ilTabs =
$DIC[
'ilTabs'];
174 $ilTabs->activateTab(
"password");
179 if (
$ilUser->isPasswordChangeDemanded()) {
180 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'password_change_on_first_login_demand'));
181 } elseif (
$ilUser->isPasswordExpired()) {
182 $msg = $this->
lng->txt(
'password_expired');
183 $password_age =
$ilUser->getPasswordAge();
184 $this->tpl->setOnScreenMessage(
'info', sprintf($msg, $password_age));
187 if (!$a_no_init && !$hide_form) {
190 $this->tpl->setContent(!$hide_form ? $this->
form->getHTML() :
'');
191 $this->tpl->printToStdout();
205 if ($this->allowPasswordChange()) {
212 $pw_info_set =
false;
217 $cpass->setRetype(
false);
218 $cpass->setSkipSyntaxCheck(
true);
222 $cpass->setRequired(
true);
224 $this->
form->addItem($cpass);
229 if ($pw_info_set ===
false) {
232 $ipass->setRequired(
true);
233 $ipass->setUseStripSlashes(
false);
235 $this->
form->addItem($ipass);
236 $this->
form->addCommandButton(
"savePassword", $lng->
txt(
"save"));
238 switch (
$ilUser->getAuthMode(
true)) {
240 $this->
form->setTitle($lng->
txt(
"chg_password"));
246 $this->
form->setTitle($lng->
txt(
"chg_ilias_and_webfolder_password"));
248 $this->
form->setTitle($lng->
txt(
"chg_ilias_password"));
252 $this->
form->setTitle($lng->
txt(
"chg_ilias_password"));
255 $this->
form->setFormAction($this->
ctrl->getFormAction($this));
277 return \ilAuthUtils::isPasswordModificationHidden() && (
$ilUser->isPasswordChangeDemanded() ||
$ilUser->isPasswordExpired());
284 $ilCtrl =
$DIC[
'ilCtrl'];
288 if (!$this->allowPasswordChange()) {
289 $ilCtrl->redirect($this,
"showPersonalData");
293 $this->initPasswordForm();
294 if ($this->
form->checkInput()) {
295 $cp = $this->
form->getItemByPostVar(
"current_password");
296 $np = $this->
form->getItemByPostVar(
"new_password");
302 #if ($ilUser->getAuthMode(true) != ilAuthUtils::AUTH_SHIBBOLETH || ! $ilSetting->get("shib_auth_allow_local"))
306 $cp->setAlert($this->
lng->txt(
'passwd_wrong'));
312 if ($custom_error !=
'') {
313 $np->setAlert($custom_error);
315 $np->setAlert($this->
lng->txt(
"passwd_invalid"));
320 $this->entered_new_password,
324 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'form_input_not_valid'));
325 $np->setAlert($this->
lng->txt($error_lng_var));
329 (
$ilUser->isPasswordExpired() ||
$ilUser->isPasswordChangeDemanded()) &&
330 $this->entered_current_password == $this->entered_new_password) {
332 $np->setAlert($this->
lng->txt(
"new_pass_equals_old_pass"));
336 $ilUser->resetPassword($this->entered_new_password, $this->entered_new_password);
337 if ($this->entered_current_password != $this->entered_new_password) {
338 $ilUser->setLastPasswordChangeToNow();
339 $ilUser->setPasswordPolicyResetStatus(
false);
344 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'saved_successfully'),
true);
349 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'saved_successfully'));
350 $this->showPassword(
true,
true);
355 $this->
form->setValuesByPost();
356 $this->showPassword(
true);
367 return $this->user_settings_config->isVisibleAndChangeable($setting);
372 return $this->user_settings_config->isVisible($setting);
377 return $this->user_settings_config->isChangeable($setting);
384 $ilTabs =
$DIC[
'ilTabs'];
386 $this->__initSubTabs(
"showPersonalData");
387 $ilTabs->activateTab(
"general_settings");
392 $this->initGeneralSettingsForm();
394 $this->tpl->setContent($this->
form->getHTML());
395 $this->tpl->printToStdout();
404 $styleDefinition =
$DIC[
'styleDefinition'];
410 if ($this->userSettingVisible(
"language")) {
411 $languages = $this->
lng->getInstalledLanguages();
413 foreach ($languages as $lang_key) {
418 $si->setOptions($options);
419 $si->setValue(
$ilUser->getLanguage());
421 $ilSetting->get(
"usr_settings_disable_language") ===
'1'
422 || count($options) <= 1
424 $this->
form->addItem($si);
428 if ($this->userSettingVisible(
"skin_style")) {
429 $skins = $styleDefinition->getAllSkins();
430 if (is_array($skins)) {
434 foreach ($skins as $skin) {
435 foreach ($skin->getStyles() as $style) {
440 $options[$skin->getId() .
":" . $style->getId()] = $skin->getName() .
" / " . $style->getName();
443 $si->setOptions($options);
445 $si->setDisabled((
bool)
$ilSetting->get(
"usr_settings_disable_skin_style"));
446 $this->
form->addItem($si);
452 if (((
int) OH_REF_ID > 0 || $module_id > 0) &&
$ilUser->getLanguage() ==
"de" &&
454 $this->
lng->loadLanguageModule(
"help");
456 $cb->setChecked(!(
$ilUser->prefs[
"hide_help_tt"] ??
false));
457 $cb->setInfo($this->
lng->txt(
"help_toggle_tooltips_info"));
458 $this->
form->addItem($cb);
462 if ($this->userSettingVisible(
"hits_per_page")) {
465 $hits_options = array(10,15,20,30,40,50,100,9999);
468 foreach ($hits_options as $hits_option) {
469 $hstr = ($hits_option == 9999)
470 ? $this->
lng->txt(
"no_limit")
472 $options[$hits_option] = $hstr;
474 $si->setOptions($options);
475 $si->setValue(
$ilUser->prefs[
"hits_per_page"]);
476 $si->setDisabled((
bool)
$ilSetting->get(
"usr_settings_disable_hits_per_page"));
477 $this->
form->addItem($si);
481 $lv =
new ilSelectInputGUI($this->
lng->txt(
"user_store_last_visited"),
"store_last_visited");
483 0 => $this->
lng->txt(
"user_lv_keep_entries"),
484 1 => $this->lng->txt(
"user_lv_keep_only_for_session"),
485 2 => $this->lng->txt(
"user_lv_do_not_store"));
486 $lv->setOptions($options);
487 $last_visited = (
int) (
$ilUser->prefs[
"store_last_visited"] ?? 0);
488 $lv->setValue($last_visited);
489 $this->
form->addItem($lv);
492 if (ilSessionReminder::isGloballyActivated()) {
494 $cb->setInfo($this->
lng->txt(
'session_reminder_info'));
496 $cb->setChecked((
bool)
$ilUser->getPref(
'session_reminder_enabled'));
499 $lead_time_gui =
new ilNumberInputGUI($this->
lng->txt(
'session_reminder_lead_time'),
'session_reminder_lead_time');
503 $max_value = max($min_value, ($expires / 60) - 1);
505 $current_user_value =
$ilUser->getPref(
'session_reminder_lead_time');
506 if ($current_user_value < $min_value ||
507 $current_user_value > $max_value) {
518 $lead_time_gui->setValue($value);
519 $lead_time_gui->setSize(3);
520 $lead_time_gui->setMinValue($min_value);
521 $lead_time_gui->setMaxValue($max_value);
522 $cb->addSubItem($lead_time_gui);
524 $this->
form->addItem($cb);
530 $lng->loadLanguageModule(
"dateplaner");
535 $select->setInfo(
$lng->txt(
'cal_timezone_info'));
536 $select->setValue($user_settings->getTimeZone());
537 $this->
form->addItem($select);
541 $select->setOptions(array(
545 $select->setInfo(
$lng->txt(
'cal_date_format_info'));
546 $select->setValue($user_settings->getDateFormat());
547 $this->
form->addItem($select);
550 $select->setOptions(array(
553 $select->setInfo(
$lng->txt(
'cal_time_format_info'));
554 $select->setValue($user_settings->getTimeFormat());
555 $this->
form->addItem($select);
560 $this->
lng->loadLanguageModule(
"administration");
562 $si->setRequired(
true);
563 $si->setInfo($this->
lng->txt(
"adm_user_starting_point_info"));
564 $def_opt =
new ilRadioOption($this->
lng->txt(
"adm_user_starting_point_inherit"), 0);
565 $def_opt->setInfo($this->
lng->txt(
"adm_user_starting_point_inherit_info"));
566 $si->addOption($def_opt);
576 $this->
form->addItem($si);
580 $repobj_id =
new ilTextInputGUI(
$lng->txt(
"adm_user_starting_point_ref_id"),
"usr_start_ref_id");
581 $repobj_id->setInfo(
$lng->txt(
"adm_user_starting_point_ref_id_info"));
582 $repobj_id->setRequired(
true);
583 $repobj_id->setSize(5);
586 $repobj_id->setValue($start_ref_id);
595 $repobj->addSubItem($repobj_id);
596 $si->addOption($repobj);
603 if (
$ilSetting->get(
'char_selector_availability') > 0) {
605 $char_selector->getConfig()->setAvailability((
int)
$ilUser->getPref(
'char_selector_availability'));
606 $char_selector->getConfig()->setDefinition((
string)
$ilUser->getPref(
'char_selector_definition'));
607 $char_selector->addFormProperties($this->
form);
608 $char_selector->setFormValues($this->
form);
611 $this->
form->addCommandButton(
"saveGeneralSettings", $lng->
txt(
"save"));
612 $this->
form->setTitle($lng->
txt(
"general_settings"));
613 $this->
form->setFormAction($this->
ctrl->getFormAction($this));
625 $ilCtrl =
$DIC[
'ilCtrl'];
629 $this->initGeneralSettingsForm();
630 if ($this->
form->checkInput()
631 && $this->checkPersonalStartingPoint()) {
632 if ($this->workWithUserSetting(
"skin_style")) {
634 if ($this->
form->getInput(
"skin_style") !=
"") {
635 $sknst = explode(
":", $this->
form->getInput(
"skin_style"));
637 if (
$ilUser->getPref(
"style") != $sknst[1] ||
638 $ilUser->getPref(
"skin") != $sknst[0]) {
639 $ilUser->setPref(
"skin", $sknst[0]);
640 $ilUser->setPref(
"style", $sknst[1]);
646 if ($this->workWithUserSetting(
"language")) {
647 $ilUser->setLanguage($this->
form->getInput(
"language"));
651 if ($this->workWithUserSetting(
"hits_per_page")) {
652 if ($this->
form->getInput(
"hits_per_page") !=
"") {
653 $ilUser->setPref(
"hits_per_page", $this->
form->getInput(
"hits_per_page"));
659 if (((
int) OH_REF_ID > 0 || $module_id > 0) &&
$ilUser->getLanguage() ==
"de" &&
661 $ilUser->setPref(
"hide_help_tt", (
int) !$this->
form->getInput(
"help_tooltips"));
667 $ilNavigationHistory =
$DIC[
'ilNavigationHistory'];
668 $ilUser->setPref(
"store_last_visited", (
int) $this->
form->getInput(
"store_last_visited"));
669 if ((
int) $this->
form->getInput(
"store_last_visited") > 0) {
670 $ilNavigationHistory->deleteDBEntries();
671 if ((
int) $this->
form->getInput(
"store_last_visited") == 2) {
672 $ilNavigationHistory->deleteSessionEntries();
677 if (ilSessionReminder::isGloballyActivated()) {
678 $ilUser->setPref(
'session_reminder_enabled', (
int) $this->
form->getInput(
'session_reminder_enabled'));
679 $ilUser->setPref(
'session_reminder_lead_time', $this->
form->getInput(
'session_reminder_lead_time'));
684 $s_ref_id = $this->
form->getInput(
'usr_start_ref_id');
685 $s_ref_id = ($s_ref_id ==
"")
689 (
int) $this->
form->getInput(
'usr_start'),
698 if (
$ilSetting->get(
'char_selector_availability') > 0) {
700 $char_selector->getFormValues($this->
form);
701 $ilUser->setPref(
'char_selector_availability', $char_selector->getConfig()->getAvailability());
702 $ilUser->setPref(
'char_selector_definition', $char_selector->getConfig()->getDefinition());
709 $user_settings->setTimeZone($this->
form->getInput(
"timezone"));
710 $user_settings->setDateFormat((
int) $this->
form->getInput(
"date_format"));
711 $user_settings->setTimeFormat((
int) $this->
form->getInput(
"time_format"));
712 $user_settings->save();
714 $this->tpl->setOnScreenMessage(
'success',
$lng->txtlng(
"common",
"msg_obj_modified",
$ilUser->getLanguage()),
true);
716 $ilCtrl->redirect($this,
"showGeneralSettings");
719 $this->
form->setValuesByPost();
720 $this->showGeneralSettings(
true);
730 $ref_id = $this->
form->getInput(
'usr_start_ref_id');
732 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'obj_ref_id_not_exist'),
true);
746 $ilTabs =
$DIC[
'ilTabs'];
747 $ilToolbar =
$DIC[
'ilToolbar'];
751 if (!(
bool)
$ilSetting->get(
'user_delete_own_account') ||
753 $this->
ctrl->redirect($this,
"showGeneralSettings");
760 $this->__initSubTabs(
"deleteOwnAccount");
761 $ilTabs->activateTab(
"delacc");
763 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'user_delete_own_account_info'));
764 $ilToolbar->addButton(
765 $this->
lng->txt(
'btn_next'),
766 $this->ctrl->getLinkTarget($this,
'deleteOwnAccount2')
769 $this->tpl->printToStdout();
779 $ilTabs =
$DIC[
'ilTabs'];
783 if (!(
bool)
$ilSetting->get(
'user_delete_own_account') ||
785 $this->
ctrl->redirect($this,
"showGeneralSettings");
789 $this->__initSubTabs(
"deleteOwnAccount");
790 $ilTabs->activateTab(
"delacc");
793 $cgui->setHeaderText($this->
lng->txt(
'user_delete_own_account_logout_confirmation'));
794 $cgui->setFormAction($this->
ctrl->getFormAction($this));
795 $cgui->setCancel($this->
lng->txt(
"cancel"),
"abortDeleteOwnAccount");
796 $cgui->setConfirm($this->
lng->txt(
"user_delete_own_account_logout_button"),
"deleteOwnAccountLogout");
797 $this->tpl->setContent($cgui->getHTML());
798 $this->tpl->printToStdout();
805 $ilCtrl =
$DIC[
'ilCtrl'];
810 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"user_delete_own_account_aborted"),
true);
811 $ilCtrl->redirect($this,
"showGeneralSettings");
822 $ilUser->activateDeletionFlag();
826 $GLOBALS[
'DIC'][
'ilAuthSession']->logout();
828 ilUtil::redirect(
"login.php?cmd=force_login&target=usr_" . md5(
"usrdelown"));
838 $ilTabs =
$DIC[
'ilTabs'];
842 if (!(
bool)
$ilSetting->get(
'user_delete_own_account') ||
845 $this->
ctrl->redirect($this,
"showGeneralSettings");
849 $this->__initSubTabs(
"deleteOwnAccount");
850 $ilTabs->activateTab(
"delacc");
853 $cgui->setHeaderText($this->
lng->txt(
'user_delete_own_account_final_confirmation'));
854 $cgui->setFormAction($this->
ctrl->getFormAction($this));
855 $cgui->setCancel($this->
lng->txt(
"cancel"),
"abortDeleteOwnAccount");
856 $cgui->setConfirm($this->
lng->txt(
"confirm"),
"deleteOwnAccount4");
857 $this->tpl->setContent($cgui->getHTML());
858 $this->tpl->printToStdout();
864 protected function deleteOwnAccount4(): void
870 $ilLog =
$DIC[
'ilLog'];
872 if (!(
bool)
$ilSetting->get(
'user_delete_own_account') ||
875 $this->
ctrl->redirect($this,
"showGeneralSettings");
881 $ntf->setLangModules(array(
"user"));
882 $ntf->addAdditionalInfo(
"profile",
$ilUser->getProfileAsString($this->lng),
true);
886 $ntf->setIntroductionDirect(
888 $this->
lng->txt(
"user_delete_own_account_email_body"),
895 $message = $ntf->composeAndGetMessage(
$ilUser->getId(),
null,
'read',
true);
896 $subject = $this->
lng->txt(
"user_delete_own_account_email_subject");
900 $user_email =
$ilUser->getEmail();
901 $admin_mail =
$ilSetting->get(
"user_delete_own_account_email");
903 $senderFactory =
$GLOBALS[
"DIC"][
"mail.mime.sender.factory"];
906 $mmail->From($senderFactory->system());
909 $mmail->To($user_email);
910 $mmail->Bcc($admin_mail);
911 $mmail->Subject($subject,
true);
916 elseif ($admin_mail) {
917 $mmail->To($admin_mail);
918 $mmail->Subject($subject,
true);
923 $ilLog->write(
"Account deleted: " .
$ilUser->getLogin() .
" (" .
$ilUser->getId() .
")");
928 $GLOBALS[
'DIC'][
'ilAuthSession']->logout();
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
static isPasswordModificationEnabled($a_authmode)
Check if password modification is enabled.
static _getInstanceByUserId(int $a_user_id)
static _getShortTimeZoneList()
get short timezone list
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilCtrl provides processing control methods.
static setUseRelativeDates(bool $a_status)
set use relative dates
static secondsToString(int $seconds, bool $force_with_seconds=false, ?ilLanguage $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
@classDescription Date and time handling
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _lookupEntry(string $a_lang_key, string $a_mod, string $a_id)
static getMailObjectRefId()
static _lookupType(int $id, bool $reference=false)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initGeneralSettingsForm()
ilGlobalTemplateInterface $tpl
ilUserDefinedFields $user_defined_fields
showGeneralSettings(bool $a_no_init=false)
deleteOwnAccount1()
Delete own account dialog - 1st confirmation.
string $entered_new_password
deleteOwnAccount2()
Delete own account dialog - login redirect.
userSettingVisible(string $setting)
string $entered_current_password
deleteOwnAccount3()
Delete own account dialog - final confirmation.
ILIAS User StandardGUIRequest $request
allowPasswordChange()
Check, whether password change is allowed for user.
workWithUserSetting(string $setting)
ilUserSettingsConfig $user_settings_config
showPassword(bool $a_no_init=false, bool $hide_form=false)
checkPersonalStartingPoint()
userSettingEnabled(string $setting)
saveGeneralSettings()
Save general settings.
executeCommand()
execute command
__initSubTabs(string $a_cmd)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static isPassword(string $a_passwd, ?string &$customError=null)
static isPasswordValidForUserContext(string $clear_text_password, $user, ?string &$error_language_variable=null)
static getPasswordRequirementsInfo()
infotext for ilPasswordInputGUI setInfo()
const SUGGESTED_LEAD_TIME
static get(string $a_var)
static setClosingContext(int $a_context)
set closing context (for statistics)
static getSessionExpireValue()
Returns the session expiration value.
static set(string $a_var, $a_val)
Set a value.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupActivatedStyle(string $a_skin, string $a_style)
lookup if a style is activated
This class represents a text property in a property form.
Additional user data fields definition.
static getInstance()
Singleton method to reduce footprint (included files, created instances)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getPossibleStartingPoints(bool $a_force_all=false)
Get all valid starting points.
static getPersonalStartingObject()
Get ref id of personal starting object.
static hasPersonalStartPointPref()
Did user set any personal starting point (yet)?
static hasPersonalStartingPoint()
Can starting point be personalized?
static getPersonalStartingPoint()
Get current personal starting point.
const START_REPOSITORY_OBJ
static setPersonalStartingPoint(int $a_value, int $a_ref_id=null)
Set personal starting point setting.
static redirect(string $a_script)
const SYSTEM_USER_ID
This file contains constants for PHPStan analyis, see: https://phpstan.org/config-reference#constants...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
form( $class_path, string $cmd)