ILIAS  release_8 Revision v8.24
ilPersonalSettingsGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilPersonalSettingsGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 execute command More...
 
 __initSubTabs (string $a_cmd)
 
 setHeader ()
 Set header. More...
 
 showPassword (bool $a_no_init=false, bool $hide_form=false)
 
 initPasswordForm ()
 
 savePassword ()
 
 workWithUserSetting (string $setting)
 
 userSettingVisible (string $setting)
 
 userSettingEnabled (string $setting)
 
 showGeneralSettings (bool $a_no_init=false)
 
 initGeneralSettingsForm ()
 
 saveGeneralSettings ()
 Save general settings. More...
 

Data Fields

ilLanguage $lng
 
ilCtrl $ctrl
 

Protected Member Functions

 allowPasswordChange ()
 Check, whether password change is allowed for user. More...
 
 deleteOwnAccount1 ()
 Delete own account dialog - 1st confirmation. More...
 
 deleteOwnAccount2 ()
 Delete own account dialog - login redirect. More...
 
 abortDeleteOwnAccount ()
 
 deleteOwnAccountLogout ()
 
 deleteOwnAccount3 ()
 Delete own account dialog - final confirmation. More...
 

Protected Attributes

ilPropertyFormGUI $form
 
string $entered_new_password
 
string $entered_current_password
 
string $password_error
 
ilUserDefinedFields $user_defined_fields
 
string $upload_error
 
ILIAS User StandardGUIRequest $request
 
ilGlobalTemplateInterface $tpl
 
ilUserSettingsConfig $user_settings_config
 

Private Member Functions

 checkPersonalStartingPoint ()
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning GUI class for personal profile

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de @ilCtrl_Calls ilPersonalSettingsGUI: ilMailOptionsGUI

Definition at line 24 of file class.ilPersonalSettingsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPersonalSettingsGUI::__construct ( )

Definition at line 38 of file class.ilPersonalSettingsGUI.php.

39 {
40 global $DIC;
41
42 $this->user_defined_fields = ilUserDefinedFields::_getInstance();
43
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");
51
52 $this->user_settings_config = new ilUserSettingsConfig();
53 $this->request = new \ILIAS\User\StandardGUIRequest(
54 $DIC->http(),
55 $DIC->refinery()
56 );
57 $this->entered_new_password = $this->request->getNewPassword();
58 $this->entered_current_password = $this->request->getCurrentPassword();
59 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28

References $DIC, ilUserDefinedFields\_getInstance(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ __initSubTabs()

ilPersonalSettingsGUI::__initSubTabs ( string  $a_cmd)

Definition at line 90 of file class.ilPersonalSettingsGUI.php.

90 : void
91 {
92 global $DIC;
93
94 $ilTabs = $DIC['ilTabs'];
95 $ilSetting = $DIC['ilSetting'];
96 $ilHelp = $DIC['ilHelp'];
97 $rbacsystem = $DIC['rbacsystem'];
98 $ilUser = $DIC['ilUser'];
99
100 $ilHelp->setScreenIdComponent("user");
101
102 $showPassword = $a_cmd == 'showPassword';
103 $showGeneralSettings = $a_cmd == 'showGeneralSettings';
104
105 // old profile
106
107 // general settings
108 $ilTabs->addTarget(
109 "general_settings",
110 $this->ctrl->getLinkTarget($this, "showGeneralSettings"),
111 "",
112 "",
113 "",
114 $showGeneralSettings
115 );
116
117 // password
118 if ($this->allowPasswordChange()) {
119 $ilTabs->addTarget(
120 "password",
121 $this->ctrl->getLinkTarget($this, "showPassword"),
122 "",
123 "",
124 "",
125 $showPassword
126 );
127 }
128
129 if ($rbacsystem->checkAccess('internal_mail', ilMailGlobalServices::getMailObjectRefId()) && $ilSetting->get('show_mail_settings')) {
130 $this->ctrl->setParameter($this, 'referrer', 'ilPersonalSettingsGUI');
131
132 $ilTabs->addTarget(
133 "mail_settings",
134 $this->ctrl->getLinkTargetByClass('ilMailOptionsGUI'),
135 "",
136 array('ilMailOptionsGUI')
137 );
138 }
139
140 if ($ilSetting->get('user_delete_own_account') &&
141 $ilUser->getId() != SYSTEM_USER_ID) {
142 $ilTabs->addTab(
143 "delacc",
144 $this->lng->txt('user_delete_own_account'),
145 $this->ctrl->getLinkTarget($this, "deleteOwnAccount1")
146 );
147 }
148 }
allowPasswordChange()
Check, whether password change is allowed for user.
const SYSTEM_USER_ID
This file contains constants for PHPStan analyis, see: https://phpstan.org/config-reference#constants...
Definition: constants.php:26
$ilUser
Definition: imgupload.php:34
global $ilSetting
Definition: privfeed.php:17

References $DIC, $ilSetting, $ilUser, allowPasswordChange(), ILIAS\Repository\ctrl(), ilMailGlobalServices\getMailObjectRefId(), ILIAS\Repository\lng(), and SYSTEM_USER_ID.

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ abortDeleteOwnAccount()

ilPersonalSettingsGUI::abortDeleteOwnAccount ( )
protected

Definition at line 801 of file class.ilPersonalSettingsGUI.php.

801 : void
802 {
803 global $DIC;
804
805 $ilCtrl = $DIC['ilCtrl'];
806 $ilUser = $DIC['ilUser'];
807
808 $ilUser->removeDeletionFlag();
809
810 $this->tpl->setOnScreenMessage('info', $this->lng->txt("user_delete_own_account_aborted"), true);
811 $ilCtrl->redirect($this, "showGeneralSettings");
812 }

References $DIC, $ilUser, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ allowPasswordChange()

ilPersonalSettingsGUI::allowPasswordChange ( )
protected

Check, whether password change is allowed for user.

Definition at line 262 of file class.ilPersonalSettingsGUI.php.

262 : bool
263 {
264 global $DIC;
265
266 $ilUser = $DIC['ilUser'];
267
268 if (\ilSession::get('used_external_auth')) {
269 return false;
270 }
271
272 $status = ilAuthUtils::isPasswordModificationEnabled($ilUser->getAuthMode(true));
273 if ($status) {
274 return true;
275 }
276
277 return \ilAuthUtils::isPasswordModificationHidden() && ($ilUser->isPasswordChangeDemanded() || $ilUser->isPasswordExpired());
278 }
static isPasswordModificationEnabled($a_authmode)
Check if password modification is enabled.
static get(string $a_var)

References $DIC, $ilUser, ilSession\get(), and ilAuthUtils\isPasswordModificationEnabled().

Referenced by __initSubTabs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkPersonalStartingPoint()

ilPersonalSettingsGUI::checkPersonalStartingPoint ( )
private

Definition at line 723 of file class.ilPersonalSettingsGUI.php.

723 : bool
724 {
726 || (int) $this->form->getInput('usr_start') !== ilUserUtil::START_REPOSITORY_OBJ) {
727 return true;
728 }
729
730 $ref_id = $this->form->getInput('usr_start_ref_id');
731 if (!is_numeric($ref_id) || !ilObject::_exists($ref_id, true)) {
732 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('obj_ref_id_not_exist'), true);
733 return false;
734 }
735
736 return true;
737 }
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static hasPersonalStartingPoint()
Can starting point be personalized?
const START_REPOSITORY_OBJ
$ref_id
Definition: ltiauth.php:67
form( $class_path, string $cmd)

References $ref_id, ilObject\_exists(), ILIAS\Repository\form(), ilUserUtil\hasPersonalStartingPoint(), ILIAS\Repository\lng(), and ilUserUtil\START_REPOSITORY_OBJ.

+ Here is the call graph for this function:

◆ deleteOwnAccount1()

ilPersonalSettingsGUI::deleteOwnAccount1 ( )
protected

Delete own account dialog - 1st confirmation.

Definition at line 742 of file class.ilPersonalSettingsGUI.php.

742 : void
743 {
744 global $DIC;
745
746 $ilTabs = $DIC['ilTabs'];
747 $ilToolbar = $DIC['ilToolbar'];
748 $ilUser = $DIC['ilUser'];
749 $ilSetting = $DIC['ilSetting'];
750
751 if (!(bool) $ilSetting->get('user_delete_own_account') ||
752 $ilUser->getId() == SYSTEM_USER_ID) {
753 $this->ctrl->redirect($this, "showGeneralSettings");
754 }
755
756 // too make sure
757 $ilUser->removeDeletionFlag();
758
759 $this->setHeader();
760 $this->__initSubTabs("deleteOwnAccount");
761 $ilTabs->activateTab("delacc");
762
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')
767 );
768
769 $this->tpl->printToStdout();
770 }

References $DIC, $ilSetting, $ilUser, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and SYSTEM_USER_ID.

+ Here is the call graph for this function:

◆ deleteOwnAccount2()

ilPersonalSettingsGUI::deleteOwnAccount2 ( )
protected

Delete own account dialog - login redirect.

Definition at line 775 of file class.ilPersonalSettingsGUI.php.

775 : void
776 {
777 global $DIC;
778
779 $ilTabs = $DIC['ilTabs'];
780 $ilUser = $DIC['ilUser'];
781 $ilSetting = $DIC['ilSetting'];
782
783 if (!(bool) $ilSetting->get('user_delete_own_account') ||
784 $ilUser->getId() == SYSTEM_USER_ID) {
785 $this->ctrl->redirect($this, "showGeneralSettings");
786 }
787
788 $this->setHeader();
789 $this->__initSubTabs("deleteOwnAccount");
790 $ilTabs->activateTab("delacc");
791
792 $cgui = new ilConfirmationGUI();
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();
799 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $DIC, $ilSetting, $ilUser, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and SYSTEM_USER_ID.

+ Here is the call graph for this function:

◆ deleteOwnAccount3()

ilPersonalSettingsGUI::deleteOwnAccount3 ( )
protected

Delete own account dialog - final confirmation.

Definition at line 834 of file class.ilPersonalSettingsGUI.php.

834 : void
835 {
836 global $DIC;
837
838 $ilTabs = $DIC['ilTabs'];
839 $ilUser = $DIC['ilUser'];
840 $ilSetting = $DIC['ilSetting'];
841
842 if (!(bool) $ilSetting->get('user_delete_own_account') ||
843 $ilUser->getId() == SYSTEM_USER_ID ||
844 !$ilUser->hasDeletionFlag()) {
845 $this->ctrl->redirect($this, "showGeneralSettings");
846 }
847
848 $this->setHeader();
849 $this->__initSubTabs("deleteOwnAccount");
850 $ilTabs->activateTab("delacc");
851
852 $cgui = new ilConfirmationGUI();
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();
859 }

References $DIC, $ilSetting, $ilUser, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and SYSTEM_USER_ID.

+ Here is the call graph for this function:

◆ deleteOwnAccountLogout()

ilPersonalSettingsGUI::deleteOwnAccountLogout ( )
protected

Definition at line 814 of file class.ilPersonalSettingsGUI.php.

814 : void
815 {
816 global $DIC;
817
818 $ilUser = $DIC['ilUser'];
819
820 // we are setting the flag and ending the session in the same step
821
822 $ilUser->activateDeletionFlag();
823
824 // see ilStartupGUI::doLogout()
826 $GLOBALS['DIC']['ilAuthSession']->logout();
827
828 ilUtil::redirect("login.php?cmd=force_login&target=usr_" . md5("usrdelown"));
829 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
const SESSION_CLOSE_USER
static setClosingContext(int $a_context)
set closing context (for statistics)
static redirect(string $a_script)

References $DIC, $GLOBALS, $ilUser, ilUtil\redirect(), ilSession\SESSION_CLOSE_USER, and ilSession\setClosingContext().

+ Here is the call graph for this function:

◆ executeCommand()

ilPersonalSettingsGUI::executeCommand ( )

execute command

Definition at line 64 of file class.ilPersonalSettingsGUI.php.

64 : void
65 {
66 global $DIC;
67
68 $next_class = $this->ctrl->getNextClass();
69
70 switch ($next_class) {
71 case 'ilmailoptionsgui':
72 if (!$DIC->rbac()->system()->checkAccess('internal_mail', ilMailGlobalServices::getMailObjectRefId())) {
73 throw new ilPermissionException($DIC->language()->txt('permission_denied'));
74 }
75
76 $this->__initSubTabs('showMailOptions');
77 $DIC->tabs()->activateTab('mail_settings');
78 $this->setHeader();
79 $this->ctrl->forwardCommand(new ilMailOptionsGUI());
80 break;
81
82 default:
83 $cmd = $this->ctrl->getCmd("showGeneralSettings");
84 $this->$cmd();
85 break;
86 }
87 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $DIC, __initSubTabs(), ILIAS\Repository\ctrl(), ilMailGlobalServices\getMailObjectRefId(), and setHeader().

+ Here is the call graph for this function:

◆ initGeneralSettingsForm()

ilPersonalSettingsGUI::initGeneralSettingsForm ( )

Definition at line 398 of file class.ilPersonalSettingsGUI.php.

398 : void
399 {
400 global $DIC;
401
402 $lng = $DIC['lng'];
403 $ilUser = $DIC['ilUser'];
404 $styleDefinition = $DIC['styleDefinition'];
405 $ilSetting = $DIC['ilSetting'];
406
407 $this->form = new ilPropertyFormGUI();
408
409 // language
410 if ($this->userSettingVisible("language")) {
411 $languages = $this->lng->getInstalledLanguages();
412 $options = array();
413 foreach ($languages as $lang_key) {
414 $options[$lang_key] = ilLanguage::_lookupEntry($lang_key, "meta", "meta_l_" . $lang_key);
415 }
416
417 $si = new ilSelectInputGUI($this->lng->txt("language"), "language");
418 $si->setOptions($options);
419 $si->setValue($ilUser->getLanguage());
420 $si->setDisabled(
421 $ilSetting->get("usr_settings_disable_language") === '1'
422 || count($options) <= 1
423 );
424 $this->form->addItem($si);
425 }
426
427 // skin/style
428 if ($this->userSettingVisible("skin_style")) {
429 $skins = $styleDefinition->getAllSkins();
430 if (is_array($skins)) {
431 $si = new ilSelectInputGUI($this->lng->txt("skin_style"), "skin_style");
432
433 $options = array();
434 foreach ($skins as $skin) {
435 foreach ($skin->getStyles() as $style) {
436 if (!ilSystemStyleSettings::_lookupActivatedStyle($skin->getId(), $style->getId()) || $style->isSubstyle()) {
437 continue;
438 }
439
440 $options[$skin->getId() . ":" . $style->getId()] = $skin->getName() . " / " . $style->getName();
441 }
442 }
443 $si->setOptions($options);
444 $si->setValue($ilUser->skin . ":" . $ilUser->prefs["style"]);
445 $si->setDisabled((bool) $ilSetting->get("usr_settings_disable_skin_style"));
446 $this->form->addItem($si);
447 }
448 }
449
450 // help tooltips
451 $module_id = (int) $ilSetting->get("help_module");
452 if (((int) OH_REF_ID > 0 || $module_id > 0) && $ilUser->getLanguage() == "de" &&
453 $ilSetting->get("help_mode") != "1") {
454 $this->lng->loadLanguageModule("help");
455 $cb = new ilCheckboxInputGUI($this->lng->txt("help_toggle_tooltips"), "help_tooltips");
456 $cb->setChecked(!($ilUser->prefs["hide_help_tt"] ?? false));
457 $cb->setInfo($this->lng->txt("help_toggle_tooltips_info"));
458 $this->form->addItem($cb);
459 }
460
461 // hits per page
462 if ($this->userSettingVisible("hits_per_page")) {
463 $si = new ilSelectInputGUI($this->lng->txt("hits_per_page"), "hits_per_page");
464
465 $hits_options = array(10,15,20,30,40,50,100,9999);
466 $options = array();
467
468 foreach ($hits_options as $hits_option) {
469 $hstr = ($hits_option == 9999)
470 ? $this->lng->txt("no_limit")
471 : $hits_option;
472 $options[$hits_option] = $hstr;
473 }
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);
478 }
479
480 // Store last visited
481 $lv = new ilSelectInputGUI($this->lng->txt("user_store_last_visited"), "store_last_visited");
482 $options = array(
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);
490
491
492 if (ilSessionReminder::isGloballyActivated()) {
493 $cb = new ilCheckboxInputGUI($this->lng->txt('session_reminder'), 'session_reminder_enabled');
494 $cb->setInfo($this->lng->txt('session_reminder_info'));
495 $cb->setValue(1);
496 $cb->setChecked((bool) $ilUser->getPref('session_reminder_enabled'));
497
499 $lead_time_gui = new ilNumberInputGUI($this->lng->txt('session_reminder_lead_time'), 'session_reminder_lead_time');
500 $lead_time_gui->setInfo(sprintf($this->lng->txt('session_reminder_lead_time_info'), ilDatePresentation::secondsToString($expires, true)));
501
503 $max_value = max($min_value, ($expires / 60) - 1);
504
505 $current_user_value = $ilUser->getPref('session_reminder_lead_time');
506 if ($current_user_value < $min_value ||
507 $current_user_value > $max_value) {
508 $current_user_value = ilSessionReminder::SUGGESTED_LEAD_TIME;
509 }
510 $value = min(
511 max(
512 $min_value,
513 $current_user_value
514 ),
515 $max_value
516 );
517
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);
523
524 $this->form->addItem($cb);
525 }
526
527 // calendar settings (copied here to be reachable when calendar is inactive)
528 // they cannot be hidden/deactivated
529
530 $lng->loadLanguageModule("dateplaner");
531 $user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
532
533 $select = new ilSelectInputGUI($lng->txt('cal_user_timezone'), 'timezone');
534 $select->setOptions(ilCalendarUtil::_getShortTimeZoneList());
535 $select->setInfo($lng->txt('cal_timezone_info'));
536 $select->setValue($user_settings->getTimeZone());
537 $this->form->addItem($select);
538
539 $year = date("Y");
540 $select = new ilSelectInputGUI($lng->txt('cal_user_date_format'), 'date_format');
541 $select->setOptions(array(
542 ilCalendarSettings::DATE_FORMAT_DMY => '31.10.' . $year,
543 ilCalendarSettings::DATE_FORMAT_YMD => $year . "-10-31",
544 ilCalendarSettings::DATE_FORMAT_MDY => "10/31/" . $year));
545 $select->setInfo($lng->txt('cal_date_format_info'));
546 $select->setValue($user_settings->getDateFormat());
547 $this->form->addItem($select);
548
549 $select = new ilSelectInputGUI($lng->txt('cal_user_time_format'), 'time_format');
550 $select->setOptions(array(
553 $select->setInfo($lng->txt('cal_time_format_info'));
554 $select->setValue($user_settings->getTimeFormat());
555 $this->form->addItem($select);
556
557
558 // starting point
560 $this->lng->loadLanguageModule("administration");
561 $si = new ilRadioGroupInputGUI($this->lng->txt("adm_user_starting_point"), "usr_start");
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);
567 foreach (ilUserUtil::getPossibleStartingPoints() as $value => $caption) {
568 if ($value === ilUserUtil::START_REPOSITORY_OBJ) {
569 continue;
570 }
571 $si->addOption(new ilRadioOption($caption, $value));
572 }
575 : 0);
576 $this->form->addItem($si);
577
578 // starting point: repository object
579 $repobj = new ilRadioOption($lng->txt("adm_user_starting_point_object"), ilUserUtil::START_REPOSITORY_OBJ);
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);
584 if ($si->getValue() == ilUserUtil::START_REPOSITORY_OBJ) {
586 $repobj_id->setValue($start_ref_id);
587 if ($start_ref_id) {
588 $start_obj_id = ilObject::_lookupObjId($start_ref_id);
589 if ($start_obj_id) {
590 $repobj_id->setInfo($lng->txt("obj_" . ilObject::_lookupType($start_obj_id)) .
591 ": " . ilObject::_lookupTitle($start_obj_id));
592 }
593 }
594 }
595 $repobj->addSubItem($repobj_id);
596 $si->addOption($repobj);
597 }
598
599 // selector for unicode characters
600 global $DIC;
601
602 $ilSetting = $DIC['ilSetting'];
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);
609 }
610
611 $this->form->addCommandButton("saveGeneralSettings", $lng->txt("save"));
612 $this->form->setTitle($lng->txt("general_settings"));
613 $this->form->setFormAction($this->ctrl->getFormAction($this));
614 }
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 class represents a checkbox property in a property form.
static secondsToString(int $seconds, bool $force_with_seconds=false, ?ilLanguage $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
loadLanguageModule(string $a_module)
Load language module.
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)
This class represents a number property in a property form.
static _lookupType(int $id, bool $reference=false)
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
This class represents a property form user interface.
This class represents a property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a selection list property in a property form.
static getSessionExpireValue()
Returns the session expiration value.
static _lookupActivatedStyle(string $a_skin, string $a_style)
lookup if a style is activated
This class represents a text property in a property form.
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 getPersonalStartingPoint()
Get current personal starting point.

References $DIC, $ilSetting, $ilUser, $lng, ilCalendarUserSettings\_getInstanceByUserId(), ilCalendarUtil\_getShortTimeZoneList(), ilSystemStyleSettings\_lookupActivatedStyle(), ilLanguage\_lookupEntry(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ilCharSelectorConfig\CONTEXT_USER, ILIAS\Repository\ctrl(), ilCalendarSettings\DATE_FORMAT_DMY, ilCalendarSettings\DATE_FORMAT_MDY, ilCalendarSettings\DATE_FORMAT_YMD, ILIAS\Repository\form(), ilUserUtil\getPersonalStartingObject(), ilUserUtil\getPersonalStartingPoint(), ilUserUtil\getPossibleStartingPoints(), ilSession\getSessionExpireValue(), ilUserUtil\hasPersonalStartingPoint(), ilUserUtil\hasPersonalStartPointPref(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ilSessionReminder\MIN_LEAD_TIME, ilDatePresentation\secondsToString(), ilUserUtil\START_REPOSITORY_OBJ, ilSessionReminder\SUGGESTED_LEAD_TIME, ilCalendarSettings\TIME_FORMAT_12, ilCalendarSettings\TIME_FORMAT_24, and ilLanguage\txt().

+ Here is the call graph for this function:

◆ initPasswordForm()

ilPersonalSettingsGUI::initPasswordForm ( )

Definition at line 194 of file class.ilPersonalSettingsGUI.php.

194 : void
195 {
196 global $DIC;
197
198 $lng = $DIC['lng'];
199 $ilUser = $DIC['ilUser'];
200 $ilSetting = $DIC['ilSetting'];
201
202 $this->form = new ilPropertyFormGUI();
203
204 // Check whether password change is allowed
205 if ($this->allowPasswordChange()) {
206 // The current password needs to be checked for verification
207 // unless the user uses Shibboleth authentication with additional
208 // local authentication for WebDAV.
209 //if (
210 // ($ilUser->getAuthMode(true) != ilAuthUtils::AUTH_SHIBBOLETH || !$ilSetting->get("shib_auth_allow_local"))
211 //)
212 $pw_info_set = false;
213 if ($ilUser->getAuthMode(true) == ilAuthUtils::AUTH_LOCAL) {
214 // current password
215 $cpass = new ilPasswordInputGUI($lng->txt("current_password"), "current_password");
217 $cpass->setRetype(false);
218 $cpass->setSkipSyntaxCheck(true);
219 $pw_info_set = true;
220 // only if a password exists.
221 if ($ilUser->getPasswd()) {
222 $cpass->setRequired(true);
223 }
224 $this->form->addItem($cpass);
225 }
226
227 // new password
228 $ipass = new ilPasswordInputGUI($lng->txt("desired_password"), "new_password");
229 if ($pw_info_set === false) {
231 }
232 $ipass->setRequired(true);
233 $ipass->setUseStripSlashes(false);
234
235 $this->form->addItem($ipass);
236 $this->form->addCommandButton("savePassword", $lng->txt("save"));
237
238 switch ($ilUser->getAuthMode(true)) {
240 $this->form->setTitle($lng->txt("chg_password"));
241 break;
242
246 $this->form->setTitle($lng->txt("chg_ilias_and_webfolder_password"));
247 } else {
248 $this->form->setTitle($lng->txt("chg_ilias_password"));
249 }
250 break;
251 default:
252 $this->form->setTitle($lng->txt("chg_ilias_password"));
253 break;
254 }
255 $this->form->setFormAction($this->ctrl->getFormAction($this));
256 }
257 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getPasswordRequirementsInfo()
infotext for ilPasswordInputGUI setInfo()

References $DIC, $ilSetting, $ilUser, $lng, ilDAVActivationChecker\_isActive(), ilAuthUtils\AUTH_CAS, ilAuthUtils\AUTH_LOCAL, ilAuthUtils\AUTH_SHIBBOLETH, ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilSecuritySettingsChecker\getPasswordRequirementsInfo(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ saveGeneralSettings()

ilPersonalSettingsGUI::saveGeneralSettings ( )

Save general settings.

Definition at line 619 of file class.ilPersonalSettingsGUI.php.

619 : void
620 {
621 global $DIC;
622
623 $tpl = $DIC['tpl'];
624 $lng = $DIC['lng'];
625 $ilCtrl = $DIC['ilCtrl'];
626 $ilUser = $DIC['ilUser'];
627 $ilSetting = $DIC->settings();
628
630 if ($this->form->checkInput()
631 && $this->checkPersonalStartingPoint()) {
632 if ($this->workWithUserSetting("skin_style")) {
633 //set user skin and style
634 if ($this->form->getInput("skin_style") != "") {
635 $sknst = explode(":", $this->form->getInput("skin_style"));
636
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]);
641 }
642 }
643 }
644
645 // language
646 if ($this->workWithUserSetting("language")) {
647 $ilUser->setLanguage($this->form->getInput("language"));
648 }
649
650 // hits per page
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"));
654 }
655 }
656
657 // help tooltips
658 $module_id = (int) $ilSetting->get("help_module");
659 if (((int) OH_REF_ID > 0 || $module_id > 0) && $ilUser->getLanguage() == "de" &&
660 $ilSetting->get("help_mode") != "1") {
661 $ilUser->setPref("hide_help_tt", (int) !$this->form->getInput("help_tooltips"));
662 }
663
664 // store last visited?
665 global $DIC;
666
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();
673 }
674 }
675
676 // session reminder
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'));
680 }
681
682 // starting point
684 $s_ref_id = $this->form->getInput('usr_start_ref_id');
685 $s_ref_id = ($s_ref_id == "")
686 ? null
687 : (int) $s_ref_id;
689 (int) $this->form->getInput('usr_start'),
690 $s_ref_id
691 );
692 }
693
694 // selector for unicode characters
695 global $DIC;
696
697 $ilSetting = $DIC['ilSetting'];
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());
703 }
704
705 $ilUser->update();
706
707 // calendar settings
708 $user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
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();
713
714 $this->tpl->setOnScreenMessage('success', $lng->txtlng("common", "msg_obj_modified", $ilUser->getLanguage()), true);
715
716 $ilCtrl->redirect($this, "showGeneralSettings");
717 }
718
719 $this->form->setValuesByPost();
720 $this->showGeneralSettings(true);
721 }
txtlng(string $a_module, string $a_topic, string $a_language)
gets the text for a given topic in a given language if the topic is not in the list,...
ilGlobalTemplateInterface $tpl
showGeneralSettings(bool $a_no_init=false)
static setPersonalStartingPoint(int $a_value, int $a_ref_id=null)
Set personal starting point setting.

References $DIC, $ilSetting, $ilUser, $lng, $tpl, ilCalendarUserSettings\_getInstanceByUserId(), ilCharSelectorConfig\CONTEXT_USER, ILIAS\Repository\form(), ilUserUtil\hasPersonalStartingPoint(), ILIAS\Repository\int(), and ilUserUtil\setPersonalStartingPoint().

+ Here is the call graph for this function:

◆ savePassword()

ilPersonalSettingsGUI::savePassword ( )

Definition at line 280 of file class.ilPersonalSettingsGUI.php.

280 : void
281 {
282 global $DIC;
283
284 $ilCtrl = $DIC['ilCtrl'];
285 $ilUser = $DIC['ilUser'];
286
287 // normally we should not end up here
288 if (!$this->allowPasswordChange()) {
289 $ilCtrl->redirect($this, "showPersonalData");
290 return;
291 }
292
293 $this->initPasswordForm();
294 if ($this->form->checkInput()) {
295 $cp = $this->form->getItemByPostVar("current_password");
296 $np = $this->form->getItemByPostVar("new_password");
297 $error = false;
298
299 // The old password needs to be checked for verification
300 // unless the user uses Shibboleth authentication with additional
301 // local authentication for WebDAV.
302 #if ($ilUser->getAuthMode(true) != ilAuthUtils::AUTH_SHIBBOLETH || ! $ilSetting->get("shib_auth_allow_local"))
303 if ($ilUser->getAuthMode(true) == ilAuthUtils::AUTH_LOCAL) {
304 if (!ilUserPasswordManager::getInstance()->verifyPassword($ilUser, $this->entered_current_password)) {
305 $error = true;
306 $cp->setAlert($this->lng->txt('passwd_wrong'));
307 }
308 }
309
310 if (!ilSecuritySettingsChecker::isPassword($this->entered_new_password, $custom_error)) {
311 $error = true;
312 if ($custom_error != '') {
313 $np->setAlert($custom_error);
314 } else {
315 $np->setAlert($this->lng->txt("passwd_invalid"));
316 }
317 }
318 $error_lng_var = '';
320 $this->entered_new_password,
321 $ilUser,
322 $error_lng_var
323 )) {
324 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('form_input_not_valid'));
325 $np->setAlert($this->lng->txt($error_lng_var));
326 $error = true;
327 }
328 if (
329 ($ilUser->isPasswordExpired() || $ilUser->isPasswordChangeDemanded()) &&
330 $this->entered_current_password == $this->entered_new_password) {
331 $error = true;
332 $np->setAlert($this->lng->txt("new_pass_equals_old_pass"));
333 }
334
335 if (!$error) {
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);
340 $ilUser->update();
341 }
342
343 if (ilSession::get('orig_request_target')) {
344 $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'), true);
345 $target = ilSession::get('orig_request_target');
346 ilSession::set('orig_request_target', '');
347 ilUtil::redirect($target);
348 } else {
349 $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
350 $this->showPassword(true, true);
351 return;
352 }
353 }
354 }
355 $this->form->setValuesByPost();
356 $this->showPassword(true);
357 }
showPassword(bool $a_no_init=false, bool $hide_form=false)
static isPassword(string $a_passwd, ?string &$customError=null)
static isPasswordValidForUserContext(string $clear_text_password, $user, ?string &$error_language_variable=null)
static set(string $a_var, $a_val)
Set a value.
static getInstance()
Singleton method to reduce footprint (included files, created instances)

References $DIC, $ilUser, ilAuthUtils\AUTH_LOCAL, ILIAS\Repository\form(), ilSession\get(), ilUserPasswordManager\getInstance(), ilSecuritySettingsChecker\isPassword(), ilSecuritySettingsChecker\isPasswordValidForUserContext(), ILIAS\Repository\lng(), ilUtil\redirect(), and ilSession\set().

+ Here is the call graph for this function:

◆ setHeader()

ilPersonalSettingsGUI::setHeader ( )

Set header.

Definition at line 153 of file class.ilPersonalSettingsGUI.php.

153 : void
154 {
155 $this->tpl->setTitle($this->lng->txt('personal_settings'));
156 }

References ILIAS\Repository\lng().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showGeneralSettings()

ilPersonalSettingsGUI::showGeneralSettings ( bool  $a_no_init = false)

Definition at line 380 of file class.ilPersonalSettingsGUI.php.

380 : void
381 {
382 global $DIC;
383
384 $ilTabs = $DIC['ilTabs'];
385
386 $this->__initSubTabs("showPersonalData");
387 $ilTabs->activateTab("general_settings");
388
389 $this->setHeader();
390
391 if (!$a_no_init) {
393 }
394 $this->tpl->setContent($this->form->getHTML());
395 $this->tpl->printToStdout();
396 }

References $DIC, and ILIAS\Repository\form().

+ Here is the call graph for this function:

◆ showPassword()

ilPersonalSettingsGUI::showPassword ( bool  $a_no_init = false,
bool  $hide_form = false 
)

Definition at line 164 of file class.ilPersonalSettingsGUI.php.

167 : void {
168 global $DIC;
169
170 $ilTabs = $DIC['ilTabs'];
171 $ilUser = $DIC['ilUser'];
172
173 $this->__initSubTabs("showPersonalData");
174 $ilTabs->activateTab("password");
175
176 $this->setHeader();
177 // check whether password of user have to be changed
178 // due to first login or password of user is expired
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));
185 }
186
187 if (!$a_no_init && !$hide_form) {
188 $this->initPasswordForm();
189 }
190 $this->tpl->setContent(!$hide_form ? $this->form->getHTML() : '');
191 $this->tpl->printToStdout();
192 }

◆ userSettingEnabled()

ilPersonalSettingsGUI::userSettingEnabled ( string  $setting)

Definition at line 375 of file class.ilPersonalSettingsGUI.php.

375 : bool
376 {
377 return $this->user_settings_config->isChangeable($setting);
378 }

◆ userSettingVisible()

ilPersonalSettingsGUI::userSettingVisible ( string  $setting)

Definition at line 370 of file class.ilPersonalSettingsGUI.php.

370 : bool
371 {
372 return $this->user_settings_config->isVisible($setting);
373 }

◆ workWithUserSetting()

ilPersonalSettingsGUI::workWithUserSetting ( string  $setting)

Definition at line 365 of file class.ilPersonalSettingsGUI.php.

365 : bool
366 {
367 return $this->user_settings_config->isVisibleAndChangeable($setting);
368 }

Field Documentation

◆ $ctrl

ilCtrl ilPersonalSettingsGUI::$ctrl

Definition at line 35 of file class.ilPersonalSettingsGUI.php.

◆ $entered_current_password

string ilPersonalSettingsGUI::$entered_current_password
protected

Definition at line 28 of file class.ilPersonalSettingsGUI.php.

◆ $entered_new_password

string ilPersonalSettingsGUI::$entered_new_password
protected

Definition at line 27 of file class.ilPersonalSettingsGUI.php.

◆ $form

ilPropertyFormGUI ilPersonalSettingsGUI::$form
protected

Definition at line 26 of file class.ilPersonalSettingsGUI.php.

◆ $lng

ilLanguage ilPersonalSettingsGUI::$lng

Definition at line 34 of file class.ilPersonalSettingsGUI.php.

◆ $password_error

string ilPersonalSettingsGUI::$password_error
protected

Definition at line 29 of file class.ilPersonalSettingsGUI.php.

◆ $request

ILIAS User StandardGUIRequest ilPersonalSettingsGUI::$request
protected

Definition at line 32 of file class.ilPersonalSettingsGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilPersonalSettingsGUI::$tpl
protected

Definition at line 33 of file class.ilPersonalSettingsGUI.php.

◆ $upload_error

string ilPersonalSettingsGUI::$upload_error
protected

Definition at line 31 of file class.ilPersonalSettingsGUI.php.

◆ $user_defined_fields

ilUserDefinedFields ilPersonalSettingsGUI::$user_defined_fields
protected

Definition at line 30 of file class.ilPersonalSettingsGUI.php.

◆ $user_settings_config

ilUserSettingsConfig ilPersonalSettingsGUI::$user_settings_config
protected

Definition at line 36 of file class.ilPersonalSettingsGUI.php.


The documentation for this class was generated from the following file: