ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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
 

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$ 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.

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

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  }
settings()
Definition: settings.php:2
static _getInstance()
Get instance.
redirection script todo: (a better solution should control the processing via a xml file) ...
$DIC
Definition: xapitoken.php:46
User settings configuration (what preferences can be visible/changed/...)
+ Here is the call graph for this function:

Member Function Documentation

◆ abortDeleteOwnAccount()

ilPersonalSettingsGUI::abortDeleteOwnAccount ( )
protected

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

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

880  {
881  global $DIC;
882 
883  $ilCtrl = $DIC['ilCtrl'];
884  $ilUser = $DIC['ilUser'];
885 
886  $ilUser->removeDeletionFlag();
887 
888  ilUtil::sendInfo($this->lng->txt("user_delete_own_account_aborted"), true);
889  $ilCtrl->redirect($this, "showGeneralSettings");
890  }
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ allowPasswordChange()

ilPersonalSettingsGUI::allowPasswordChange ( )
protected

Check, whether password change is allowed for user.

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

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

Referenced by executeCommand(), initPasswordForm(), and savePassword().

296  {
297  global $DIC;
298 
299  $ilUser = $DIC['ilUser'];
300 
301  if (\ilSession::get('used_external_auth')) {
302  return false;
303  }
304 
305  $status = ilAuthUtils::isPasswordModificationEnabled($ilUser->getAuthMode(true));
306  if ($status) {
307  return true;
308  }
309 
310  return \ilAuthUtils::isPasswordModificationHidden() && ($ilUser->isPasswordChangeDemanded() || $ilUser->isPasswordExpired());
311  }
static get($a_var)
Get a value.
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46
static isPasswordModificationEnabled($a_authmode)
Check if password modification is enabled.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteOwnAccount1()

ilPersonalSettingsGUI::deleteOwnAccount1 ( )
protected

Delete own account dialog - 1st confirmation.

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

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

820  {
821  global $DIC;
822 
823  $ilTabs = $DIC['ilTabs'];
824  $ilToolbar = $DIC['ilToolbar'];
825  $ilUser = $DIC['ilUser'];
826  $ilSetting = $DIC['ilSetting'];
827 
828  if (!(bool) $ilSetting->get('user_delete_own_account') ||
829  $ilUser->getId() == SYSTEM_USER_ID) {
830  $this->ctrl->redirect($this, "showGeneralSettings");
831  }
832 
833  // too make sure
834  $ilUser->removeDeletionFlag();
835 
836  $this->setHeader();
837  $this->__initSubTabs("deleteOwnAccount");
838  $ilTabs->activateTab("delacc");
839 
840  ilUtil::sendInfo($this->lng->txt('user_delete_own_account_info'));
841  $ilToolbar->addButton(
842  $this->lng->txt('btn_next'),
843  $this->ctrl->getLinkTarget($this, 'deleteOwnAccount2')
844  );
845 
846  $this->tpl->printToStdout();
847  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$ilUser
Definition: imgupload.php:18
global $ilSetting
Definition: privfeed.php:17
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ deleteOwnAccount2()

ilPersonalSettingsGUI::deleteOwnAccount2 ( )
protected

Delete own account dialog - login redirect.

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

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

853  {
854  global $DIC;
855 
856  $ilTabs = $DIC['ilTabs'];
857  $ilUser = $DIC['ilUser'];
858  $ilSetting = $DIC['ilSetting'];
859 
860  if (!(bool) $ilSetting->get('user_delete_own_account') ||
861  $ilUser->getId() == SYSTEM_USER_ID) {
862  $this->ctrl->redirect($this, "showGeneralSettings");
863  }
864 
865  $this->setHeader();
866  $this->__initSubTabs("deleteOwnAccount");
867  $ilTabs->activateTab("delacc");
868 
869  include_once "Services/Utilities/classes/class.ilConfirmationGUI.php";
870  $cgui = new ilConfirmationGUI();
871  $cgui->setHeaderText($this->lng->txt('user_delete_own_account_logout_confirmation'));
872  $cgui->setFormAction($this->ctrl->getFormAction($this));
873  $cgui->setCancel($this->lng->txt("cancel"), "abortDeleteOwnAccount");
874  $cgui->setConfirm($this->lng->txt("user_delete_own_account_logout_button"), "deleteOwnAccountLogout");
875  $this->tpl->setContent($cgui->getHTML());
876  $this->tpl->printToStdout();
877  }
$ilUser
Definition: imgupload.php:18
global $ilSetting
Definition: privfeed.php:17
$DIC
Definition: xapitoken.php:46
Confirmation screen class.
+ Here is the call graph for this function:

◆ deleteOwnAccount3()

ilPersonalSettingsGUI::deleteOwnAccount3 ( )
protected

Delete own account dialog - final confirmation.

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

References $DIC, $GLOBALS, $ilLog, $ilSetting, $ilUser, $message, ilDatePresentation\formatDate(), IL_CAL_UNIX, ILIAS_HTTP_PATH, ilUtil\redirect(), setHeader(), and ilDatePresentation\setUseRelativeDates().

913  {
914  global $DIC;
915 
916  $ilTabs = $DIC['ilTabs'];
917  $ilUser = $DIC['ilUser'];
918  $ilSetting = $DIC['ilSetting'];
919 
920  if (!(bool) $ilSetting->get('user_delete_own_account') ||
921  $ilUser->getId() == SYSTEM_USER_ID ||
922  !$ilUser->hasDeletionFlag()) {
923  $this->ctrl->redirect($this, "showGeneralSettings");
924  }
925 
926  $this->setHeader();
927  $this->__initSubTabs("deleteOwnAccount");
928  $ilTabs->activateTab("delacc");
929 
930  include_once "Services/Utilities/classes/class.ilConfirmationGUI.php";
931  $cgui = new ilConfirmationGUI();
932  $cgui->setHeaderText($this->lng->txt('user_delete_own_account_final_confirmation'));
933  $cgui->setFormAction($this->ctrl->getFormAction($this));
934  $cgui->setCancel($this->lng->txt("cancel"), "abortDeleteOwnAccount");
935  $cgui->setConfirm($this->lng->txt("confirm"), "deleteOwnAccount4");
936  $this->tpl->setContent($cgui->getHTML());
937  $this->tpl->printToStdout();
938  }
$ilUser
Definition: imgupload.php:18
global $ilSetting
Definition: privfeed.php:17
$DIC
Definition: xapitoken.php:46
Confirmation screen class.
+ Here is the call graph for this function:

◆ deleteOwnAccountLogout()

ilPersonalSettingsGUI::deleteOwnAccountLogout ( )
protected

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

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

893  {
894  global $DIC;
895 
896  $ilUser = $DIC['ilUser'];
897 
898  // we are setting the flag and ending the session in the same step
899 
900  $ilUser->activateDeletionFlag();
901 
902  // see ilStartupGUI::doLogout()
904  $GLOBALS['DIC']['ilAuthSession']->logout();
905 
906  ilUtil::redirect("login.php?cmd=force_login&target=usr_" . md5("usrdelown"));
907  }
const SESSION_CLOSE_USER
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$ilUser
Definition: imgupload.php:18
static setClosingContext($a_context)
set closing context (for statistics)
$DIC
Definition: xapitoken.php:46
static redirect($a_script)
+ Here is the call graph for this function:

◆ executeCommand()

ilPersonalSettingsGUI::executeCommand ( )

execute command

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

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

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  case 'ilpersonalchatsettingsformgui':
78  $this->__initSubTabs($this->ctrl->getCmd());
79  $this->setHeader();
80 
81  $DIC->tabs()->activateTab('chat_settings');
82 
83  $chatSettingsGui = new ilPersonalChatSettingsFormGUI();
84  $this->ctrl->forwardCommand($chatSettingsGui);
85  break;
86 
87  default:
88  $cmd = $this->ctrl->getCmd("showGeneralSettings");
89  $this->$cmd();
90  break;
91  }
92  return true;
93  }
redirection script todo: (a better solution should control the processing via a xml file) ...
static getMailObjectRefId()
Determines the reference id of the mail object and stores this information in a local cache variable...
$DIC
Definition: xapitoken.php:46
Class ilPersonalChatSettingsFormGUI.
+ Here is the call graph for this function:

◆ initGeneralSettingsForm()

ilPersonalSettingsGUI::initGeneralSettingsForm ( )

Init general settings form.

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

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(), ilCheckboxInputGUI\setChecked(), ilRadioOption\setInfo(), ilFormPropertyGUI\setInfo(), ilRadioOption\setValue(), ilUserUtil\START_REPOSITORY_OBJ, ilSessionReminder\SUGGESTED_LEAD_TIME, ilCalendarSettings\TIME_FORMAT_12, ilCalendarSettings\TIME_FORMAT_24, and userSettingVisible().

Referenced by saveGeneralSettings(), and showGeneralSettings().

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

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

Referenced by savePassword(), and showPassword().

227  {
228  global $DIC;
229 
230  $lng = $DIC['lng'];
231  $ilUser = $DIC['ilUser'];
232  $ilSetting = $DIC['ilSetting'];
233 
234  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
235  $this->form = new ilPropertyFormGUI();
236 
237  // Check whether password change is allowed
238  if ($this->allowPasswordChange()) {
239  // The current password needs to be checked for verification
240  // unless the user uses Shibboleth authentication with additional
241  // local authentication for WebDAV.
242  //if (
243  // ($ilUser->getAuthMode(true) != AUTH_SHIBBOLETH || !$ilSetting->get("shib_auth_allow_local"))
244  //)
245  $pw_info_set = false;
246  if ($ilUser->getAuthMode(true) == AUTH_LOCAL) {
247  // current password
248  $cpass = new ilPasswordInputGUI($lng->txt("current_password"), "current_password");
250  $cpass->setRetype(false);
251  $cpass->setSkipSyntaxCheck(true);
252  $pw_info_set = true;
253  // only if a password exists.
254  if ($ilUser->getPasswd()) {
255  $cpass->setRequired(true);
256  }
257  $this->form->addItem($cpass);
258  }
259 
260  // new password
261  $ipass = new ilPasswordInputGUI($lng->txt("desired_password"), "new_password");
262  if($pw_info_set === false) {
264  }
265  $ipass->setRequired(true);
266 
267  $this->form->addItem($ipass);
268  $this->form->addCommandButton("savePassword", $lng->txt("save"));
269 
270  switch ($ilUser->getAuthMode(true)) {
271  case AUTH_LOCAL:
272  $this->form->setTitle($lng->txt("chg_password"));
273  break;
274 
275  case AUTH_SHIBBOLETH:
276  case AUTH_CAS:
277  require_once('Services/WebDAV/classes/class.ilDAVActivationChecker.php');
279  $this->form->setTitle($lng->txt("chg_ilias_and_webfolder_password"));
280  } else {
281  $this->form->setTitle($lng->txt("chg_ilias_password"));
282  }
283  break;
284  default:
285  $this->form->setTitle($lng->txt("chg_ilias_password"));
286  break;
287  }
288  $this->form->setFormAction($this->ctrl->getFormAction($this));
289  }
290  }
This class represents a property form user interface.
const AUTH_CAS
const AUTH_SHIBBOLETH
static _isActive()
Static getter.
static getPasswordRequirementsInfo()
infotext for ilPasswordInputGUI setInfo()
setInfo($a_info)
Set Information Text.
This class represents a password property in a property form.
$ilUser
Definition: imgupload.php:18
const AUTH_LOCAL
allowPasswordChange()
Check, whether password change is allowed for user.
global $ilSetting
Definition: privfeed.php:17
$DIC
Definition: xapitoken.php:46
+ 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 701 of file class.ilPersonalSettingsGUI.php.

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

702  {
703  global $DIC;
704 
705  $tpl = $DIC['tpl'];
706  $lng = $DIC['lng'];
707  $ilCtrl = $DIC['ilCtrl'];
708  $ilUser = $DIC['ilUser'];
709  $ilSetting = $DIC->settings();
710 
711  $this->initGeneralSettingsForm();
712  if ($this->form->checkInput()) {
713  if ($this->workWithUserSetting("skin_style")) {
714  //set user skin and style
715  if ($_POST["skin_style"] != "") {
716  $sknst = explode(":", $_POST["skin_style"]);
717 
718  if ($ilUser->getPref("style") != $sknst[1] ||
719  $ilUser->getPref("skin") != $sknst[0]) {
720  $ilUser->setPref("skin", $sknst[0]);
721  $ilUser->setPref("style", $sknst[1]);
722  }
723  }
724  }
725 
726  // language
727  if ($this->workWithUserSetting("language")) {
728  $ilUser->setLanguage($_POST["language"]);
729  }
730 
731  // hits per page
732  if ($this->workWithUserSetting("hits_per_page")) {
733  if ($_POST["hits_per_page"] != "") {
734  $ilUser->setPref("hits_per_page", $_POST["hits_per_page"]);
735  }
736  }
737 
738  // help tooltips
739  $module_id = (int) $ilSetting->get("help_module");
740  if ((OH_REF_ID > 0 || $module_id > 0) && $ilUser->getLanguage() == "de" &&
741  $ilSetting->get("help_mode") != "1") {
742  $ilUser->setPref("hide_help_tt", (int) !$_POST["help_tooltips"]);
743  }
744 
745  // set show users online
746  /*
747  if ($this->workWithUserSetting("show_users_online"))
748  {
749  $ilUser->setPref("show_users_online", $_POST["show_users_online"]);
750  }*/
751 
752  // store last visited?
753  global $DIC;
754 
755  $ilNavigationHistory = $DIC['ilNavigationHistory'];
756  $ilUser->setPref("store_last_visited", (int) $_POST["store_last_visited"]);
757  if ((int) $_POST["store_last_visited"] > 0) {
758  $ilNavigationHistory->deleteDBEntries();
759  if ((int) $_POST["store_last_visited"] == 2) {
760  $ilNavigationHistory->deleteSessionEntries();
761  }
762  }
763 
764  // set show users online
765  if ($this->workWithUserSetting("screen_reader_optimization")) {
766  $ilUser->setPref("screen_reader_optimization", $_POST["screen_reader_optimization"]);
767  }
768 
769  // session reminder
770  include_once 'Services/Authentication/classes/class.ilSessionReminder.php';
771  if (ilSessionReminder::isGloballyActivated()) {
772  $ilUser->setPref('session_reminder_enabled', (int) $this->form->getInput('session_reminder_enabled'));
773  $ilUser->setPref('session_reminder_lead_time', $this->form->getInput('session_reminder_lead_time'));
774  }
775 
776  // starting point
777  include_once "Services/User/classes/class.ilUserUtil.php";
780  $this->form->getInput('usr_start'),
781  $this->form->getInput('usr_start_ref_id')
782  );
783  }
784 
785  // selector for unicode characters
786  global $DIC;
787 
788  $ilSetting = $DIC['ilSetting'];
789  if ($ilSetting->get('char_selector_availability') > 0) {
790  require_once 'Services/UIComponent/CharSelector/classes/class.ilCharSelectorGUI.php';
792  $char_selector->getFormValues($this->form);
793  $ilUser->setPref('char_selector_availability', $char_selector->getConfig()->getAvailability());
794  $ilUser->setPref('char_selector_definition', $char_selector->getConfig()->getDefinition());
795  }
796 
797  $ilUser->update();
798 
799  // calendar settings
800  include_once('Services/Calendar/classes/class.ilCalendarUserSettings.php');
801  $user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
802  $user_settings->setTimeZone($this->form->getInput("timezone"));
803  $user_settings->setDateFormat((int) $this->form->getInput("date_format"));
804  $user_settings->setTimeFormat((int) $this->form->getInput("time_format"));
805  $user_settings->save();
806 
807  ilUtil::sendSuccess($lng->txtlng("common", "msg_obj_modified", $ilUser->getLanguage()), true);
808 
809  $ilCtrl->redirect($this, "showGeneralSettings");
810  }
811 
812  $this->form->setValuesByPost();
813  $this->showGeneralSettings(true);
814  }
This shows a character selector.
static _getInstanceByUserId($a_user_id)
get singleton instance
initGeneralSettingsForm()
Init general settings form.
static hasPersonalStartingPoint()
Can starting point be personalized?
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
showGeneralSettings($a_no_init=false)
General settings form.
global $ilSetting
Definition: privfeed.php:17
$DIC
Definition: xapitoken.php:46
$_POST["username"]
static setPersonalStartingPoint($a_value, $a_ref_id=null)
Set personal starting point setting.
+ Here is the call graph for this function:

◆ savePassword()

ilPersonalSettingsGUI::savePassword ( )

Save password form.

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

References $_POST, $DIC, $ilCtrl, $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().

318  {
319  global $DIC;
320 
321  $tpl = $DIC['tpl'];
322  $lng = $DIC['lng'];
323  $ilCtrl = $DIC['ilCtrl'];
324  $ilUser = $DIC['ilUser'];
325  $ilSetting = $DIC['ilSetting'];
326 
327  // normally we should not end up here
328  if (!$this->allowPasswordChange()) {
329  $ilCtrl->redirect($this, "showPersonalData");
330  return;
331  }
332 
333  $this->initPasswordForm();
334  if ($this->form->checkInput()) {
335  $cp = $this->form->getItemByPostVar("current_password");
336  $np = $this->form->getItemByPostVar("new_password");
337  $error = false;
338 
339  // The old password needs to be checked for verification
340  // unless the user uses Shibboleth authentication with additional
341  // local authentication for WebDAV.
342  #if ($ilUser->getAuthMode(true) != AUTH_SHIBBOLETH || ! $ilSetting->get("shib_auth_allow_local"))
343  if ($ilUser->getAuthMode(true) == AUTH_LOCAL) {
344  require_once 'Services/User/classes/class.ilUserPasswordManager.php';
345  if (!ilUserPasswordManager::getInstance()->verifyPassword($ilUser, ilUtil::stripSlashes($_POST['current_password']))) {
346  $error = true;
347  $cp->setAlert($this->lng->txt('passwd_wrong'));
348  }
349  }
350 
351  if (!ilUtil::isPassword($_POST["new_password"], $custom_error)) {
352  $error = true;
353  if ($custom_error != '') {
354  $np->setAlert($custom_error);
355  } else {
356  $np->setAlert($this->lng->txt("passwd_invalid"));
357  }
358  }
359  $error_lng_var = '';
360  if (!ilUtil::isPasswordValidForUserContext($_POST["new_password"], $ilUser, $error_lng_var)) {
361  ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
362  $np->setAlert($this->lng->txt($error_lng_var));
363  $error = true;
364  }
365  if (
366  ($ilUser->isPasswordExpired() || $ilUser->isPasswordChangeDemanded()) &&
367  $_POST["current_password"] == $_POST["new_password"]) {
368  $error = true;
369  $np->setAlert($this->lng->txt("new_pass_equals_old_pass"));
370  }
371 
372  if (!$error) {
373  $ilUser->resetPassword($_POST["new_password"], $_POST["new_password"]);
374  if ($_POST["current_password"] != $_POST["new_password"]) {
375  $ilUser->setLastPasswordChangeToNow();
376  $ilUser->setPasswordPolicyResetStatus(false);
377  $ilUser->update();
378  }
379 
380  if (ilSession::get('orig_request_target')) {
381  ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
382  $target = ilSession::get('orig_request_target');
383  ilSession::set('orig_request_target', '');
384  ilUtil::redirect($target);
385  } else {
386  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
387  $this->showPassword(true, true);
388  return;
389  }
390  }
391  }
392  $this->form->setValuesByPost();
393  $this->showPassword(true);
394  }
static isPasswordValidForUserContext($clear_text_password, $user, &$error_language_variable=null)
static get($a_var)
Get a value.
static set($a_var, $a_val)
Set a value.
showPassword($a_no_init=false, $hide_form=false)
static isPassword($a_passwd, &$customError=null)
validates a password public
global $ilCtrl
Definition: ilias.php:18
initPasswordForm()
Init password form.
$ilUser
Definition: imgupload.php:18
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
const AUTH_LOCAL
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
allowPasswordChange()
Check, whether password change is allowed for user.
global $ilSetting
Definition: privfeed.php:17
$DIC
Definition: xapitoken.php:46
static redirect($a_script)
$_POST["username"]
static getInstance()
Single method to reduce footprint (included files, created instances)
+ Here is the call graph for this function:

◆ setHeader()

ilPersonalSettingsGUI::setHeader ( )

Set header.

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

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

177  {
178  $this->tpl->setTitle($this->lng->txt('personal_settings'));
179  }
+ Here is the caller graph for this function:

◆ showGeneralSettings()

ilPersonalSettingsGUI::showGeneralSettings (   $a_no_init = false)

General settings form.

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

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

Referenced by saveGeneralSettings().

433  {
434  global $DIC;
435 
436  $ilTabs = $DIC['ilTabs'];
437 
438  $this->__initSubTabs("showPersonalData");
439  $ilTabs->activateTab("general_settings");
440 
441  $this->setHeader();
442 
443  if (!$a_no_init) {
444  $this->initGeneralSettingsForm();
445  }
446  $this->tpl->setContent($this->form->getHTML());
447  $this->tpl->printToStdout();
448  }
initGeneralSettingsForm()
Init general settings form.
$DIC
Definition: xapitoken.php:46
+ 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 191 of file class.ilPersonalSettingsGUI.php.

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

Referenced by savePassword().

192  {
193  global $DIC;
194 
195  $ilTabs = $DIC['ilTabs'];
196  $ilUser = $DIC['ilUser'];
197 
198  $this->__initSubTabs("showPersonalData");
199  $ilTabs->activateTab("password");
200 
201  $this->setHeader();
202  // check whether password of user have to be changed
203  // due to first login or password of user is expired
204  if ($ilUser->isPasswordChangeDemanded()) {
206  $this->lng->txt('password_change_on_first_login_demand')
207  );
208  } elseif ($ilUser->isPasswordExpired()) {
209  $msg = $this->lng->txt('password_expired');
210  $password_age = $ilUser->getPasswordAge();
211  ilUtil::sendInfo(sprintf($msg, $password_age));
212  }
213 
214  if (!$a_no_init && !$hide_form) {
215  $this->initPasswordForm();
216  }
217  $this->tpl->setContent(!$hide_form ? $this->form->getHTML() : '');
218  $this->tpl->printToStdout();
219  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
initPasswordForm()
Init password form.
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46
+ 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 424 of file class.ilPersonalSettingsGUI.php.

424  : bool
425  {
426  return $this->user_settings_config->isChangeable($setting);
427  }

◆ userSettingVisible()

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

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

Referenced by initGeneralSettingsForm().

415  : bool
416  {
417  return $this->user_settings_config->isVisible($setting);
418  }
+ Here is the caller graph for this function:

◆ workWithUserSetting()

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

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

Referenced by saveGeneralSettings().

406  : bool
407  {
408  return $this->user_settings_config->isVisibleAndChangeable($setting);
409  }
+ 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: