ILIAS  release_7 Revision v7.30-3-g800a261c036
ilPersonalSettingsGUI Class Reference

GUI class for personal profile. More...

+ Collaboration diagram for ilPersonalSettingsGUI:

Public Member Functions

 __construct ()
 constructor More...
 
 executeCommand ()
 execute command More...
 
 setHeader ()
 Set header. More...
 
 showPassword ($a_no_init=false, $hide_form=false)
 
 initPasswordForm ()
 Init password form. More...
 
 savePassword ()
 Save password form. More...
 
 workWithUserSetting (string $setting)
 
 userSettingVisible (string $setting)
 
 userSettingEnabled (string $setting)
 
 showGeneralSettings ($a_no_init=false)
 General settings form. More...
 
 initGeneralSettingsForm ()
 Init general settings form. More...
 
 saveGeneralSettings ()
 Save general settings. More...
 

Data Fields

 $lng
 
 $ilias
 
 $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

 $tpl
 
 $user_settings_config
 

Private Member Functions

 checkPersonalStartingPoint ()
 

Detailed Description

GUI class for personal profile.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$ @ilCtrl_Calls ilPersonalSettingsGUI: ilMailOptionsGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilPersonalSettingsGUI::__construct ( )

constructor

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

32 {
33 global $DIC;
34
35 $ilias = $DIC['ilias'];
36
37 $this->user_defined_fields = ilUserDefinedFields::_getInstance();
38
39 $this->tpl = $DIC->ui()->mainTemplate();
40 $this->lng = $DIC->language();
41 $this->ilias = $ilias;
42 $this->ctrl = $DIC->ctrl();
43
44 $this->settings = $ilias->getAllSettings();
45 $this->upload_error = "";
46 $this->password_error = "";
47 $this->lng->loadLanguageModule("user");
48 $this->ctrl->saveParameter($this, "user_page");
49
50 $this->user_settings_config = new ilUserSettingsConfig();
51 }
static _getInstance()
Get instance.
User settings configuration (what preferences can be visible/changed/...)
global $DIC
Definition: goto.php:24
redirection script todo: (a better solution should control the processing via a xml file)
settings()
Definition: settings.php:2

References $DIC, $ilias, ilUserDefinedFields\_getInstance(), and settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ abortDeleteOwnAccount()

ilPersonalSettingsGUI::abortDeleteOwnAccount ( )
protected

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

877 {
878 global $DIC;
879
880 $ilCtrl = $DIC['ilCtrl'];
881 $ilUser = $DIC['ilUser'];
882
883 $ilUser->removeDeletionFlag();
884
885 ilUtil::sendInfo($this->lng->txt("user_delete_own_account_aborted"), true);
886 $ilCtrl->redirect($this, "showGeneralSettings");
887 }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$ilUser
Definition: imgupload.php:18

References $DIC, $ilUser, and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ allowPasswordChange()

ilPersonalSettingsGUI::allowPasswordChange ( )
protected

Check, whether password change is allowed for user.

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

277 {
278 global $DIC;
279
280 $ilUser = $DIC['ilUser'];
281
282 if (\ilSession::get('used_external_auth')) {
283 return false;
284 }
285
286 $status = ilAuthUtils::isPasswordModificationEnabled($ilUser->getAuthMode(true));
287 if ($status) {
288 return true;
289 }
290
291 return \ilAuthUtils::isPasswordModificationHidden() && ($ilUser->isPasswordChangeDemanded() || $ilUser->isPasswordExpired());
292 }
static isPasswordModificationEnabled($a_authmode)
Check if password modification is enabled.
static get($a_var)
Get a value.

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

Referenced by initPasswordForm(), and savePassword().

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

◆ checkPersonalStartingPoint()

ilPersonalSettingsGUI::checkPersonalStartingPoint ( )
private

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

797 : bool
798 {
800 || (int) $this->form->getInput('usr_start') !== ilUserUtil::START_REPOSITORY_OBJ) {
801 return true;
802 }
803
804 $ref_id = $this->form->getInput('usr_start_ref_id');
805 if (!is_numeric($ref_id) || !ilObject::_exists($ref_id, true)) {
806 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('obj_ref_id_not_exist'), true);
807 return false;
808 }
809
810 return true;
811 }
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
static hasPersonalStartingPoint()
Can starting point be personalized?
const START_REPOSITORY_OBJ

References ilObject\_exists(), ilUserUtil\hasPersonalStartingPoint(), 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 816 of file class.ilPersonalSettingsGUI.php.

817 {
818 global $DIC;
819
820 $ilTabs = $DIC['ilTabs'];
821 $ilToolbar = $DIC['ilToolbar'];
822 $ilUser = $DIC['ilUser'];
823 $ilSetting = $DIC['ilSetting'];
824
825 if (!(bool) $ilSetting->get('user_delete_own_account') ||
826 $ilUser->getId() == SYSTEM_USER_ID) {
827 $this->ctrl->redirect($this, "showGeneralSettings");
828 }
829
830 // too make sure
831 $ilUser->removeDeletionFlag();
832
833 $this->setHeader();
834 $this->__initSubTabs("deleteOwnAccount");
835 $ilTabs->activateTab("delacc");
836
837 ilUtil::sendInfo($this->lng->txt('user_delete_own_account_info'));
838 $ilToolbar->addButton(
839 $this->lng->txt('btn_next'),
840 $this->ctrl->getLinkTarget($this, 'deleteOwnAccount2')
841 );
842
843 $this->tpl->printToStdout();
844 }
const SYSTEM_USER_ID
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: constants.php:24
global $ilSetting
Definition: privfeed.php:17

References $DIC, $ilSetting, $ilUser, ilUtil\sendInfo(), setHeader(), 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 849 of file class.ilPersonalSettingsGUI.php.

850 {
851 global $DIC;
852
853 $ilTabs = $DIC['ilTabs'];
854 $ilUser = $DIC['ilUser'];
855 $ilSetting = $DIC['ilSetting'];
856
857 if (!(bool) $ilSetting->get('user_delete_own_account') ||
858 $ilUser->getId() == SYSTEM_USER_ID) {
859 $this->ctrl->redirect($this, "showGeneralSettings");
860 }
861
862 $this->setHeader();
863 $this->__initSubTabs("deleteOwnAccount");
864 $ilTabs->activateTab("delacc");
865
866 include_once "Services/Utilities/classes/class.ilConfirmationGUI.php";
867 $cgui = new ilConfirmationGUI();
868 $cgui->setHeaderText($this->lng->txt('user_delete_own_account_logout_confirmation'));
869 $cgui->setFormAction($this->ctrl->getFormAction($this));
870 $cgui->setCancel($this->lng->txt("cancel"), "abortDeleteOwnAccount");
871 $cgui->setConfirm($this->lng->txt("user_delete_own_account_logout_button"), "deleteOwnAccountLogout");
872 $this->tpl->setContent($cgui->getHTML());
873 $this->tpl->printToStdout();
874 }
Confirmation screen class.

References $DIC, $ilSetting, $ilUser, setHeader(), 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 909 of file class.ilPersonalSettingsGUI.php.

910 {
911 global $DIC;
912
913 $ilTabs = $DIC['ilTabs'];
914 $ilUser = $DIC['ilUser'];
915 $ilSetting = $DIC['ilSetting'];
916
917 if (!(bool) $ilSetting->get('user_delete_own_account') ||
918 $ilUser->getId() == SYSTEM_USER_ID ||
919 !$ilUser->hasDeletionFlag()) {
920 $this->ctrl->redirect($this, "showGeneralSettings");
921 }
922
923 $this->setHeader();
924 $this->__initSubTabs("deleteOwnAccount");
925 $ilTabs->activateTab("delacc");
926
927 include_once "Services/Utilities/classes/class.ilConfirmationGUI.php";
928 $cgui = new ilConfirmationGUI();
929 $cgui->setHeaderText($this->lng->txt('user_delete_own_account_final_confirmation'));
930 $cgui->setFormAction($this->ctrl->getFormAction($this));
931 $cgui->setCancel($this->lng->txt("cancel"), "abortDeleteOwnAccount");
932 $cgui->setConfirm($this->lng->txt("confirm"), "deleteOwnAccount4");
933 $this->tpl->setContent($cgui->getHTML());
934 $this->tpl->printToStdout();
935 }

References $DIC, $ilSetting, $ilUser, setHeader(), and SYSTEM_USER_ID.

+ Here is the call graph for this function:

◆ deleteOwnAccountLogout()

ilPersonalSettingsGUI::deleteOwnAccountLogout ( )
protected

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

890 {
891 global $DIC;
892
893 $ilUser = $DIC['ilUser'];
894
895 // we are setting the flag and ending the session in the same step
896
897 $ilUser->activateDeletionFlag();
898
899 // see ilStartupGUI::doLogout()
901 $GLOBALS['DIC']['ilAuthSession']->logout();
902
903 ilUtil::redirect("login.php?cmd=force_login&target=usr_" . md5("usrdelown"));
904 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
const SESSION_CLOSE_USER
static setClosingContext($a_context)
set closing context (for statistics)
static redirect($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 56 of file class.ilPersonalSettingsGUI.php.

57 {
58 global $DIC;
59
60 $next_class = $this->ctrl->getNextClass();
61
62 switch ($next_class) {
63 case 'ilmailoptionsgui':
64 require_once 'Services/Mail/classes/class.ilMailGlobalServices.php';
65 if (!$DIC->rbac()->system()->checkAccess('internal_mail', ilMailGlobalServices::getMailObjectRefId())) {
66 $this->ilias->raiseError($DIC->language()->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
67 }
68
69 $this->__initSubTabs('showMailOptions');
70 $DIC->tabs()->activateTab('mail_settings');
71 $this->setHeader();
72
73 require_once 'Services/Mail/classes/class.ilMailOptionsGUI.php';
74 $this->ctrl->forwardCommand(new ilMailOptionsGUI());
75 break;
76
77 default:
78 $cmd = $this->ctrl->getCmd("showGeneralSettings");
79 $this->$cmd();
80 break;
81 }
82 return true;
83 }
static getMailObjectRefId()
Determines the reference id of the mail object and stores this information in a local cache variable.

References $DIC, ilMailGlobalServices\getMailObjectRefId(), and setHeader().

+ Here is the call graph for this function:

◆ initGeneralSettingsForm()

ilPersonalSettingsGUI::initGeneralSettingsForm ( )

Init general settings form.

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

435 {
436 global $DIC;
437
438 $lng = $DIC['lng'];
439 $ilUser = $DIC['ilUser'];
440 $styleDefinition = $DIC['styleDefinition'];
441 $ilSetting = $DIC['ilSetting'];
442
443
444 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
445 $this->form = new ilPropertyFormGUI();
446
447 // language
448 if ($this->userSettingVisible("language")) {
449 $languages = $this->lng->getInstalledLanguages();
450 $options = array();
451 foreach ($languages as $lang_key) {
452 $options[$lang_key] = ilLanguage::_lookupEntry($lang_key, "meta", "meta_l_" . $lang_key);
453 }
454
455 $si = new ilSelectInputGUI($this->lng->txt("language"), "language");
456 $si->setOptions($options);
457 $si->setValue($ilUser->getLanguage());
458 $si->setDisabled($ilSetting->get("usr_settings_disable_language"));
459 $this->form->addItem($si);
460 }
461
462 // skin/style
463 if ($this->userSettingVisible("skin_style")) {
464 $skins = $styleDefinition->getAllSkins();
465 if (is_array($skins)) {
466 $si = new ilSelectInputGUI($this->lng->txt("skin_style"), "skin_style");
467
468 $options = array();
469 foreach ($skins as $skin) {
470 foreach ($skin->getStyles() as $style) {
471 include_once("./Services/Style/System/classes/class.ilSystemStyleSettings.php");
472 if (!ilSystemStyleSettings::_lookupActivatedStyle($skin->getId(), $style->getId()) || $style->isSubstyle()) {
473 continue;
474 }
475
476 $options[$skin->getId() . ":" . $style->getId()] = $skin->getName() . " / " . $style->getName();
477 }
478 }
479 $si->setOptions($options);
480 $si->setValue($ilUser->skin . ":" . $ilUser->prefs["style"]);
481 $si->setDisabled($ilSetting->get("usr_settings_disable_skin_style"));
482 $this->form->addItem($si);
483 }
484 }
485
486 // screen reader optimization
487 if ($this->userSettingVisible("screen_reader_optimization")) {
488 $cb = new ilCheckboxInputGUI($this->lng->txt("user_screen_reader_optimization"), "screen_reader_optimization");
489 $cb->setChecked($ilUser->prefs["screen_reader_optimization"]);
490 $cb->setDisabled($ilSetting->get("usr_settings_disable_screen_reader_optimization"));
491 $cb->setInfo($this->lng->txt("user_screen_reader_optimization_info"));
492 $this->form->addItem($cb);
493 }
494
495 // help tooltips
496 $module_id = (int) $ilSetting->get("help_module");
497 if ((OH_REF_ID > 0 || $module_id > 0) && $ilUser->getLanguage() == "de" &&
498 $ilSetting->get("help_mode") != "1") {
499 $this->lng->loadLanguageModule("help");
500 $cb = new ilCheckboxInputGUI($this->lng->txt("help_toggle_tooltips"), "help_tooltips");
501 $cb->setChecked(!$ilUser->prefs["hide_help_tt"]);
502 $cb->setInfo($this->lng->txt("help_toggle_tooltips_info"));
503 $this->form->addItem($cb);
504 }
505
506 // hits per page
507 if ($this->userSettingVisible("hits_per_page")) {
508 $si = new ilSelectInputGUI($this->lng->txt("hits_per_page"), "hits_per_page");
509
510 $hits_options = array(10,15,20,30,40,50,100,9999);
511 $options = array();
512
513 foreach ($hits_options as $hits_option) {
514 $hstr = ($hits_option == 9999)
515 ? $this->lng->txt("no_limit")
516 : $hits_option;
517 $options[$hits_option] = $hstr;
518 }
519 $si->setOptions($options);
520 $si->setValue($ilUser->prefs["hits_per_page"]);
521 $si->setDisabled($ilSetting->get("usr_settings_disable_hits_per_page"));
522 $this->form->addItem($si);
523 }
524
525 // Users Online
526 /*
527 if ($this->userSettingVisible("show_users_online"))
528 {
529 $si = new ilSelectInputGUI($this->lng->txt("show_users_online"), "show_users_online");
530
531 $options = array(
532 "y" => $this->lng->txt("users_online_show_y"),
533 "associated" => $this->lng->txt("users_online_show_associated"),
534 "n" => $this->lng->txt("users_online_show_n"));
535 $si->setOptions($options);
536 $si->setValue($ilUser->prefs["show_users_online"]);
537 $si->setDisabled($ilSetting->get("usr_settings_disable_show_users_online"));
538 $this->form->addItem($si);
539 }*/
540
541 // Store last visited
542 $lv = new ilSelectInputGUI($this->lng->txt("user_store_last_visited"), "store_last_visited");
543 $options = array(
544 0 => $this->lng->txt("user_lv_keep_entries"),
545 1 => $this->lng->txt("user_lv_keep_only_for_session"),
546 2 => $this->lng->txt("user_lv_do_not_store"));
547 $lv->setOptions($options);
548 $lv->setValue((int) $ilUser->prefs["store_last_visited"]);
549 $this->form->addItem($lv);
550
551
552 include_once 'Services/Authentication/classes/class.ilSessionReminder.php';
553 if (ilSessionReminder::isGloballyActivated()) {
554 $cb = new ilCheckboxInputGUI($this->lng->txt('session_reminder'), 'session_reminder_enabled');
555 $cb->setInfo($this->lng->txt('session_reminder_info'));
556 $cb->setValue(1);
557 $cb->setChecked((int) $ilUser->getPref('session_reminder_enabled'));
558
560 $lead_time_gui = new ilNumberInputGUI($this->lng->txt('session_reminder_lead_time'), 'session_reminder_lead_time');
561 $lead_time_gui->setInfo(sprintf($this->lng->txt('session_reminder_lead_time_info'), ilDatePresentation::secondsToString($expires, true)));
562
564 $max_value = max($min_value, ((int) $expires / 60) - 1);
565
566 $current_user_value = $ilUser->getPref('session_reminder_lead_time');
567 if ($current_user_value < $min_value ||
568 $current_user_value > $max_value) {
569 $current_user_value = ilSessionReminder::SUGGESTED_LEAD_TIME;
570 }
571 $value = min(
572 max(
573 $min_value,
574 $current_user_value
575 ),
576 $max_value
577 );
578
579 $lead_time_gui->setValue($value);
580 $lead_time_gui->setSize(3);
581 $lead_time_gui->setMinValue($min_value);
582 $lead_time_gui->setMaxValue($max_value);
583 $cb->addSubItem($lead_time_gui);
584
585 $this->form->addItem($cb);
586 }
587
588 // calendar settings (copied here to be reachable when calendar is inactive)
589 // they cannot be hidden/deactivated
590
591 include_once('Services/Calendar/classes/class.ilCalendarUserSettings.php');
592 include_once('Services/Calendar/classes/class.ilCalendarUtil.php');
593 $lng->loadLanguageModule("dateplaner");
594 $user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
595
596 $select = new ilSelectInputGUI($lng->txt('cal_user_timezone'), 'timezone');
597 $select->setOptions(ilCalendarUtil::_getShortTimeZoneList());
598 $select->setInfo($lng->txt('cal_timezone_info'));
599 $select->setValue($user_settings->getTimeZone());
600 $this->form->addItem($select);
601
602 $year = date("Y");
603 $select = new ilSelectInputGUI($lng->txt('cal_user_date_format'), 'date_format');
604 $select->setOptions(array(
605 ilCalendarSettings::DATE_FORMAT_DMY => '31.10.' . $year,
606 ilCalendarSettings::DATE_FORMAT_YMD => $year . "-10-31",
607 ilCalendarSettings::DATE_FORMAT_MDY => "10/31/" . $year));
608 $select->setInfo($lng->txt('cal_date_format_info'));
609 $select->setValue($user_settings->getDateFormat());
610 $this->form->addItem($select);
611
612 $select = new ilSelectInputGUI($lng->txt('cal_user_time_format'), 'time_format');
613 $select->setOptions(array(
616 $select->setInfo($lng->txt('cal_time_format_info'));
617 $select->setValue($user_settings->getTimeFormat());
618 $this->form->addItem($select);
619
620
621 // starting point
622 include_once "Services/User/classes/class.ilUserUtil.php";
624 $this->lng->loadLanguageModule("administration");
625 $si = new ilRadioGroupInputGUI($this->lng->txt("adm_user_starting_point"), "usr_start");
626 $si->setRequired(true);
627 $si->setInfo($this->lng->txt("adm_user_starting_point_info"));
628 $def_opt = new ilRadioOption($this->lng->txt("adm_user_starting_point_inherit"), 0);
629 $def_opt->setInfo($this->lng->txt("adm_user_starting_point_inherit_info"));
630 $si->addOption($def_opt);
631 foreach (ilUserUtil::getPossibleStartingPoints() as $value => $caption) {
632 $si->addOption(new ilRadioOption($caption, $value));
633 }
636 : 0);
637 $this->form->addItem($si);
638
639 // starting point: repository object
640 $repobj = new ilRadioOption($lng->txt("adm_user_starting_point_object"), ilUserUtil::START_REPOSITORY_OBJ);
641 $repobj_id = new ilTextInputGUI($lng->txt("adm_user_starting_point_ref_id"), "usr_start_ref_id");
642 $repobj_id->setInfo($lng->txt("adm_user_starting_point_ref_id_info"));
643 $repobj_id->setRequired(true);
644 $repobj_id->setSize(5);
645 if ($si->getValue() == ilUserUtil::START_REPOSITORY_OBJ) {
647 $repobj_id->setValue($start_ref_id);
648 if ($start_ref_id) {
649 $start_obj_id = ilObject::_lookupObjId($start_ref_id);
650 if ($start_obj_id) {
651 $repobj_id->setInfo($lng->txt("obj_" . ilObject::_lookupType($start_obj_id)) .
652 ": " . ilObject::_lookupTitle($start_obj_id));
653 }
654 }
655 }
656 $repobj->addSubItem($repobj_id);
657 $si->addOption($repobj);
658 }
659
660 // selector for unicode characters
661 global $DIC;
662
663 $ilSetting = $DIC['ilSetting'];
664 if ($ilSetting->get('char_selector_availability') > 0) {
665 require_once 'Services/UIComponent/CharSelector/classes/class.ilCharSelectorGUI.php';
667 $char_selector->getConfig()->setAvailability($ilUser->getPref('char_selector_availability'));
668 $char_selector->getConfig()->setDefinition($ilUser->getPref('char_selector_definition'));
669 $char_selector->addFormProperties($this->form);
670 $char_selector->setFormValues($this->form);
671 }
672
673 $this->form->addCommandButton("saveGeneralSettings", $lng->txt("save"));
674 $this->form->setTitle($lng->txt("general_settings"));
675 $this->form->setFormAction($this->ctrl->getFormAction($this));
676 }
static _getInstanceByUserId($a_user_id)
get singleton instance
static _getShortTimeZoneList()
get short timezone list
This shows a character selector.
This class represents a checkbox property in a property form.
static secondsToString($seconds, $force_with_seconds=false, $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
static _lookupEntry($a_lang_key, $a_mod, $a_id)
This class represents a number property in a property form.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _lookupType($a_id, $a_reference=false)
lookup object type
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a selection list property in a property form.
static getSessionExpireValue()
Returns the session expiration value.
static _lookupActivatedStyle($a_skin, $a_style)
lookup if a style is activated
This class represents a text property in a property form.
static getPersonalStartingObject()
Get ref id of personal starting object.
static getPossibleStartingPoints($a_force_all=false)
Get all valid starting points.
static hasPersonalStartPointPref()
Did user set any personal starting point (yet)?
static getPersonalStartingPoint()
Get current personal starting point.

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

Referenced by saveGeneralSettings(), and showGeneralSettings().

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

◆ initPasswordForm()

ilPersonalSettingsGUI::initPasswordForm ( )

Init password form.

Parameters
int$a_modeEdit Mode

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

207 {
208 global $DIC;
209
210 $lng = $DIC['lng'];
211 $ilUser = $DIC['ilUser'];
212 $ilSetting = $DIC['ilSetting'];
213
214 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
215 $this->form = new ilPropertyFormGUI();
216
217 // Check whether password change is allowed
218 if ($this->allowPasswordChange()) {
219 // The current password needs to be checked for verification
220 // unless the user uses Shibboleth authentication with additional
221 // local authentication for WebDAV.
222 //if (
223 // ($ilUser->getAuthMode(true) != AUTH_SHIBBOLETH || !$ilSetting->get("shib_auth_allow_local"))
224 //)
225 $pw_info_set = false;
226 if ($ilUser->getAuthMode(true) == AUTH_LOCAL) {
227 // current password
228 $cpass = new ilPasswordInputGUI($lng->txt("current_password"), "current_password");
229 $cpass->setInfo(ilUtil::getPasswordRequirementsInfo());
230 $cpass->setRetype(false);
231 $cpass->setSkipSyntaxCheck(true);
232 $pw_info_set = true;
233 // only if a password exists.
234 if ($ilUser->getPasswd()) {
235 $cpass->setRequired(true);
236 }
237 $this->form->addItem($cpass);
238 }
239
240 // new password
241 $ipass = new ilPasswordInputGUI($lng->txt("desired_password"), "new_password");
242 if ($pw_info_set === false) {
243 $ipass->setInfo(ilUtil::getPasswordRequirementsInfo());
244 }
245 $ipass->setRequired(true);
246 $ipass->setUseStripSlashes(false);
247
248 $this->form->addItem($ipass);
249 $this->form->addCommandButton("savePassword", $lng->txt("save"));
250
251 switch ($ilUser->getAuthMode(true)) {
252 case AUTH_LOCAL:
253 $this->form->setTitle($lng->txt("chg_password"));
254 break;
255
256 case AUTH_SHIBBOLETH:
257 case AUTH_CAS:
258 require_once('Services/WebDAV/classes/class.ilDAVActivationChecker.php');
260 $this->form->setTitle($lng->txt("chg_ilias_and_webfolder_password"));
261 } else {
262 $this->form->setTitle($lng->txt("chg_ilias_password"));
263 }
264 break;
265 default:
266 $this->form->setTitle($lng->txt("chg_ilias_password"));
267 break;
268 }
269 $this->form->setFormAction($this->ctrl->getFormAction($this));
270 }
271 }
const AUTH_SHIBBOLETH
const AUTH_LOCAL
const AUTH_CAS
This class represents a password property in a property form.
allowPasswordChange()
Check, whether password change is allowed for user.
static getPasswordRequirementsInfo()
infotext for ilPasswordInputGUI setInfo()

References $DIC, $ilSetting, $ilUser, $lng, ilDAVActivationChecker\_isActive(), allowPasswordChange(), AUTH_CAS, AUTH_LOCAL, AUTH_SHIBBOLETH, and ilUtil\getPasswordRequirementsInfo().

Referenced by savePassword(), and showPassword().

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

◆ saveGeneralSettings()

ilPersonalSettingsGUI::saveGeneralSettings ( )

Save general settings.

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

682 {
683 global $DIC;
684
685 $tpl = $DIC['tpl'];
686 $lng = $DIC['lng'];
687 $ilCtrl = $DIC['ilCtrl'];
688 $ilUser = $DIC['ilUser'];
689 $ilSetting = $DIC->settings();
690
692 if ($this->form->checkInput()
693 && $this->checkPersonalStartingPoint()) {
694 if ($this->workWithUserSetting("skin_style")) {
695 //set user skin and style
696 if ($_POST["skin_style"] != "") {
697 $sknst = explode(":", $_POST["skin_style"]);
698
699 if ($ilUser->getPref("style") != $sknst[1] ||
700 $ilUser->getPref("skin") != $sknst[0]) {
701 $ilUser->setPref("skin", $sknst[0]);
702 $ilUser->setPref("style", $sknst[1]);
703 }
704 }
705 }
706
707 // language
708 if ($this->workWithUserSetting("language")) {
709 $ilUser->setLanguage($_POST["language"]);
710 }
711
712 // hits per page
713 if ($this->workWithUserSetting("hits_per_page")) {
714 if ($_POST["hits_per_page"] != "") {
715 $ilUser->setPref("hits_per_page", $_POST["hits_per_page"]);
716 }
717 }
718
719 // help tooltips
720 $module_id = (int) $ilSetting->get("help_module");
721 if ((OH_REF_ID > 0 || $module_id > 0) && $ilUser->getLanguage() == "de" &&
722 $ilSetting->get("help_mode") != "1") {
723 $ilUser->setPref("hide_help_tt", (int) !$_POST["help_tooltips"]);
724 }
725
726 // set show users online
727 /*
728 if ($this->workWithUserSetting("show_users_online"))
729 {
730 $ilUser->setPref("show_users_online", $_POST["show_users_online"]);
731 }*/
732
733 // store last visited?
734 global $DIC;
735
736 $ilNavigationHistory = $DIC['ilNavigationHistory'];
737 $ilUser->setPref("store_last_visited", (int) $_POST["store_last_visited"]);
738 if ((int) $_POST["store_last_visited"] > 0) {
739 $ilNavigationHistory->deleteDBEntries();
740 if ((int) $_POST["store_last_visited"] == 2) {
741 $ilNavigationHistory->deleteSessionEntries();
742 }
743 }
744
745 // set show users online
746 if ($this->workWithUserSetting("screen_reader_optimization")) {
747 $ilUser->setPref("screen_reader_optimization", $_POST["screen_reader_optimization"]);
748 }
749
750 // session reminder
751 include_once 'Services/Authentication/classes/class.ilSessionReminder.php';
752 if (ilSessionReminder::isGloballyActivated()) {
753 $ilUser->setPref('session_reminder_enabled', (int) $this->form->getInput('session_reminder_enabled'));
754 $ilUser->setPref('session_reminder_lead_time', $this->form->getInput('session_reminder_lead_time'));
755 }
756
757 // starting point
758 include_once "Services/User/classes/class.ilUserUtil.php";
761 $this->form->getInput('usr_start'),
762 $this->form->getInput('usr_start_ref_id')
763 );
764 }
765
766 // selector for unicode characters
767 global $DIC;
768
769 $ilSetting = $DIC['ilSetting'];
770 if ($ilSetting->get('char_selector_availability') > 0) {
771 require_once 'Services/UIComponent/CharSelector/classes/class.ilCharSelectorGUI.php';
773 $char_selector->getFormValues($this->form);
774 $ilUser->setPref('char_selector_availability', $char_selector->getConfig()->getAvailability());
775 $ilUser->setPref('char_selector_definition', $char_selector->getConfig()->getDefinition());
776 }
777
778 $ilUser->update();
779
780 // calendar settings
781 include_once('Services/Calendar/classes/class.ilCalendarUserSettings.php');
782 $user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
783 $user_settings->setTimeZone($this->form->getInput("timezone"));
784 $user_settings->setDateFormat((int) $this->form->getInput("date_format"));
785 $user_settings->setTimeFormat((int) $this->form->getInput("time_format"));
786 $user_settings->save();
787
788 ilUtil::sendSuccess($lng->txtlng("common", "msg_obj_modified", $ilUser->getLanguage()), true);
789
790 $ilCtrl->redirect($this, "showGeneralSettings");
791 }
792
793 $this->form->setValuesByPost();
794 $this->showGeneralSettings(true);
795 }
$_POST["username"]
initGeneralSettingsForm()
Init general settings form.
showGeneralSettings($a_no_init=false)
General settings form.
static setPersonalStartingPoint($a_value, $a_ref_id=null)
Set personal starting point setting.

References $_POST, $DIC, $ilSetting, $ilUser, $lng, $tpl, ilCalendarUserSettings\_getInstanceByUserId(), ilCharSelectorConfig\CONTEXT_USER, ilUserUtil\hasPersonalStartingPoint(), initGeneralSettingsForm(), ilUserUtil\setPersonalStartingPoint(), showGeneralSettings(), and workWithUserSetting().

+ Here is the call graph for this function:

◆ savePassword()

ilPersonalSettingsGUI::savePassword ( )

Save password form.

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

299 {
300 global $DIC;
301
302 $tpl = $DIC['tpl'];
303 $lng = $DIC['lng'];
304 $ilCtrl = $DIC['ilCtrl'];
305 $ilUser = $DIC['ilUser'];
306 $ilSetting = $DIC['ilSetting'];
307
308 // normally we should not end up here
309 if (!$this->allowPasswordChange()) {
310 $ilCtrl->redirect($this, "showPersonalData");
311 return;
312 }
313
314 $this->initPasswordForm();
315 if ($this->form->checkInput()) {
316 $cp = $this->form->getItemByPostVar("current_password");
317 $np = $this->form->getItemByPostVar("new_password");
318 $error = false;
319
320 // The old password needs to be checked for verification
321 // unless the user uses Shibboleth authentication with additional
322 // local authentication for WebDAV.
323 if ($ilUser->getAuthMode(true) == AUTH_LOCAL) {
324 require_once 'Services/User/classes/class.ilUserPasswordManager.php';
325 if (!ilUserPasswordManager::getInstance()->verifyPassword($ilUser, ilUtil::stripSlashes($_POST['current_password']))) {
326 $error = true;
327 $cp->setAlert($this->lng->txt('passwd_wrong'));
328 }
329 }
330
331 if (!ilUtil::isPassword($_POST["new_password"], $custom_error)) {
332 $error = true;
333 if ($custom_error != '') {
334 $np->setAlert($custom_error);
335 } else {
336 $np->setAlert($this->lng->txt("passwd_invalid"));
337 }
338 }
339 $error_lng_var = '';
340 if (!ilUtil::isPasswordValidForUserContext($_POST["new_password"], $ilUser, $error_lng_var)) {
341 ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
342 $np->setAlert($this->lng->txt($error_lng_var));
343 $error = true;
344 }
345 if (
346 ($ilUser->isPasswordExpired() || $ilUser->isPasswordChangeDemanded()) &&
347 $_POST["current_password"] == $_POST["new_password"]) {
348 $error = true;
349 $np->setAlert($this->lng->txt("new_pass_equals_old_pass"));
350 }
351
352 if (!$error) {
353 $ilUser->resetPassword($_POST["new_password"], $_POST["new_password"]);
354 if ($_POST["current_password"] != $_POST["new_password"]) {
355 $ilUser->setLastPasswordChangeToNow();
356 $ilUser->setPasswordPolicyResetStatus(false);
357 $ilUser->update();
358 }
359
360 if (ilSession::get('orig_request_target')) {
361 ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
362 $target = ilSession::get('orig_request_target');
363 ilSession::set('orig_request_target', '');
364 ilUtil::redirect($target);
365 } else {
366 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
367 $this->showPassword(true, true);
368 return;
369 }
370 }
371 }
372 $this->form->setValuesByPost();
373 $this->showPassword(true);
374 }
initPasswordForm()
Init password form.
showPassword($a_no_init=false, $hide_form=false)
static set($a_var, $a_val)
Set a value.
static getInstance()
Single method to reduce footprint (included files, created instances)
static isPassword($a_passwd, &$customError=null)
validates a password @access public
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static isPasswordValidForUserContext($clear_text_password, $user, &$error_language_variable=null)

References $_POST, $DIC, $ilSetting, $ilUser, $lng, $tpl, allowPasswordChange(), AUTH_LOCAL, ilSession\get(), ilUserPasswordManager\getInstance(), initPasswordForm(), ilUtil\isPassword(), ilUtil\isPasswordValidForUserContext(), ilUtil\redirect(), ilUtil\sendFailure(), ilSession\set(), showPassword(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ setHeader()

ilPersonalSettingsGUI::setHeader ( )

Set header.

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

157 {
158 $this->tpl->setTitle($this->lng->txt('personal_settings'));
159 }

Referenced by deleteOwnAccount1(), deleteOwnAccount2(), deleteOwnAccount3(), executeCommand(), showGeneralSettings(), and showPassword().

+ Here is the caller graph for this function:

◆ showGeneralSettings()

ilPersonalSettingsGUI::showGeneralSettings (   $a_no_init = false)

General settings form.

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

413 {
414 global $DIC;
415
416 $ilTabs = $DIC['ilTabs'];
417
418 $this->__initSubTabs("showPersonalData");
419 $ilTabs->activateTab("general_settings");
420
421 $this->setHeader();
422
423 if (!$a_no_init) {
425 }
426 $this->tpl->setContent($this->form->getHTML());
427 $this->tpl->printToStdout();
428 }

References $DIC, initGeneralSettingsForm(), and setHeader().

Referenced by saveGeneralSettings().

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

◆ showPassword()

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

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

172 {
173 global $DIC;
174
175 $ilTabs = $DIC['ilTabs'];
176 $ilUser = $DIC['ilUser'];
177
178 $this->__initSubTabs("showPersonalData");
179 $ilTabs->activateTab("password");
180
181 $this->setHeader();
182 // check whether password of user have to be changed
183 // due to first login or password of user is expired
184 if ($ilUser->isPasswordChangeDemanded()) {
186 $this->lng->txt('password_change_on_first_login_demand')
187 );
188 } elseif ($ilUser->isPasswordExpired()) {
189 $msg = $this->lng->txt('password_expired');
190 $password_age = $ilUser->getPasswordAge();
191 ilUtil::sendInfo(sprintf($msg, $password_age));
192 }
193
194 if (!$a_no_init && !$hide_form) {
195 $this->initPasswordForm();
196 }
197 $this->tpl->setContent(!$hide_form ? $this->form->getHTML() : '');
198 $this->tpl->printToStdout();
199 }

References $DIC, $ilUser, initPasswordForm(), ilUtil\sendInfo(), and setHeader().

Referenced by savePassword().

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

◆ userSettingEnabled()

ilPersonalSettingsGUI::userSettingEnabled ( string  $setting)
Parameters
string$setting
Returns
bool

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

404 : bool
405 {
406 return $this->user_settings_config->isChangeable($setting);
407 }

◆ userSettingVisible()

ilPersonalSettingsGUI::userSettingVisible ( string  $setting)
Parameters
string$setting
Returns
bool

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

395 : bool
396 {
397 return $this->user_settings_config->isVisible($setting);
398 }

Referenced by initGeneralSettingsForm().

+ Here is the caller graph for this function:

◆ workWithUserSetting()

ilPersonalSettingsGUI::workWithUserSetting ( string  $setting)
Parameters
string$setting
Returns
bool

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

386 : bool
387 {
388 return $this->user_settings_config->isVisibleAndChangeable($setting);
389 }

Referenced by saveGeneralSettings().

+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilPersonalSettingsGUI::$ctrl

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

◆ $ilias

ilPersonalSettingsGUI::$ilias

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

Referenced by __construct().

◆ $lng

ilPersonalSettingsGUI::$lng

◆ $tpl

ilPersonalSettingsGUI::$tpl
protected

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

Referenced by saveGeneralSettings(), and savePassword().

◆ $user_settings_config

ilPersonalSettingsGUI::$user_settings_config
protected

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


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