ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilPersonalSettingsGUI Class Reference

GUI class for personal profile. More...

+ Collaboration diagram for ilPersonalSettingsGUI:

Public Member Functions

 executeCommand ()
 execute command More...
 
 setHeader ()
 
 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 ()
 

Protected Member Functions

 allowPasswordChange ()
 Check, whether password change is allowed for user. More...
 
 deleteOwnAccountStep1 ()
 
 abortDeleteOwnAccount ()
 
 deleteOwnAccountLogout ()
 
 deleteOwnAccountStep2 ()
 
 deleteOwnAccountStep3 ()
 

Private Member Functions

 initSubTabs (string $a_cmd)
 
 checkPersonalStartingPoint ()
 

Private Attributes

ilPropertyFormGUI $form
 
string $entered_new_password
 
string $entered_current_password
 
string $password_error
 
ilUserDefinedFields $user_defined_fields
 
string $upload_error
 
UserGUIRequest $request
 
ilGlobalTemplateInterface $tpl
 
UIFactory $ui_factory
 
Renderer $ui_renderer
 
ilLanguage $lng
 
ilCtrl $ctrl
 
LoggingServices $log
 
ilMailMimeSenderFactory $mail_sender_factory
 
ilHelpGUI $help
 
ilTabsGUI $tabs
 
ilToolbarGUI $toolbar
 
ilObjUser $user
 
ilSetting $settings
 
ilAuthSession $auth_session
 
ilRbacSystem $rbac_system
 
ilStyleDefinition $style_definition
 
ilNavigationHistory $navigation_history
 
ilUserSettingsConfig $user_settings_config
 
ilUserStartingPointRepository $starting_point_repository
 

Detailed Description

GUI class for personal profile.

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

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

Member Function Documentation

◆ abortDeleteOwnAccount()

ilPersonalSettingsGUI::abortDeleteOwnAccount ( )
protected

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

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

695  : void
696  {
697  $this->user->removeDeletionFlag();
698 
699  $this->tpl->setOnScreenMessage('info', $this->lng->txt('user_delete_own_account_aborted'), true);
700  $this->ctrl->redirect($this, 'showGeneralSettings');
701  }
+ Here is the call graph for this function:

◆ allowPasswordChange()

ilPersonalSettingsGUI::allowPasswordChange ( )
protected

Check, whether password change is allowed for user.

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

References ilSession\get(), ilAuthUtils\isPasswordModificationEnabled(), and ILIAS\Repository\user().

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

267  : bool
268  {
269  if (\ilSession::get('used_external_auth_mode')) {
270  return false;
271  }
272 
273  $status = ilAuthUtils::isPasswordModificationEnabled($this->user->getAuthMode(true));
274  if ($status) {
275  return true;
276  }
277 
278  return \ilAuthUtils::isPasswordModificationHidden()
279  && ($this->user->isPasswordChangeDemanded() || $this->user->isPasswordExpired());
280  }
static get(string $a_var)
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:

◆ checkPersonalStartingPoint()

ilPersonalSettingsGUI::checkPersonalStartingPoint ( )
private

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

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

Referenced by saveGeneralSettings().

646  : bool
647  {
648  if (!$this->starting_point_repository->isPersonalStartingPointEnabled()
649  || (int) $this->form->getInput('usr_start') !== ilUserStartingPointRepository::START_REPOSITORY_OBJ) {
650  return true;
651  }
652 
653  $ref_id = $this->form->getInput('usr_start_ref_id');
654  if (!is_numeric($ref_id) || !ilObject::_exists((int) $ref_id, true)) {
655  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('obj_ref_id_not_exist'), true);
656  return false;
657  }
658 
659  return true;
660  }
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
$ref_id
Definition: ltiauth.php:67
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteOwnAccountLogout()

ilPersonalSettingsGUI::deleteOwnAccountLogout ( )
protected

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

References ILIAS\Repository\ctrl(), ilSession\SESSION_CLOSE_USER, ilSession\setClosingContext(), and ILIAS\Repository\user().

703  : void
704  {
705  $this->user->activateDeletionFlag();
706 
708  $this->auth_session->logout();
709 
710  $this->ctrl->redirectToURL('login.php?cmd=force_login&target=usr_' . md5('usrdelown'));
711  }
const SESSION_CLOSE_USER
static setClosingContext(int $a_context)
set closing context (for statistics)
+ Here is the call graph for this function:

◆ deleteOwnAccountStep1()

ilPersonalSettingsGUI::deleteOwnAccountStep1 ( )
protected

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

References ILIAS\Repository\ctrl(), initSubTabs(), ILIAS\Repository\lng(), setHeader(), ILIAS\Repository\settings(), SYSTEM_USER_ID, ILIAS\Repository\tabs(), ILIAS\Repository\toolbar(), and ILIAS\Repository\user().

662  : void
663  {
664  if (!(bool) $this->settings->get('user_delete_own_account') ||
665  $this->user->getId() == SYSTEM_USER_ID) {
666  $this->ctrl->redirect($this, 'showGeneralSettings');
667  }
668 
669  // too make sure
670  $this->user->removeDeletionFlag();
671 
672  $this->setHeader();
673  $this->initSubTabs('deleteOwnAccount');
674  $this->tabs->activateTab('delacc');
675 
676  $modal = $this->ui_factory->modal()->interruptive(
677  $this->lng->txt('delete_account'),
678  $this->lng->txt('user_delete_own_account_logout_confirmation'),
679  $this->ctrl->getFormActionByClass(ilPersonalSettingsGUI::class, 'deleteOwnAccountLogout')
680  )->withActionButtonLabel($this->lng->txt('user_delete_own_account_logout_button'));
681 
682  $this->tpl->setOnScreenMessage('info', $this->lng->txt('user_delete_own_account_info'));
683  $this->toolbar->addComponent(
684  $this->ui_factory->button()->standard(
685  $this->lng->txt('btn_next'),
686  $modal->getShowSignal()
687  )
688  );
689 
690  $this->tpl->setContent($this->ui_renderer->render($modal));
691 
692  $this->tpl->printToStdout();
693  }
const SYSTEM_USER_ID
This file contains constants for PHPStan analyis, see: https://phpstan.org/config-reference#constants...
Definition: constants.php:26
+ Here is the call graph for this function:

◆ deleteOwnAccountStep2()

ilPersonalSettingsGUI::deleteOwnAccountStep2 ( )
protected

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

References ILIAS\Repository\ctrl(), initSubTabs(), ILIAS\Repository\lng(), setHeader(), ILIAS\Repository\settings(), SYSTEM_USER_ID, ILIAS\Repository\tabs(), ILIAS\Repository\toolbar(), and ILIAS\Repository\user().

713  : void
714  {
715  if (!(bool) $this->settings->get('user_delete_own_account') ||
716  $this->user->getId() == SYSTEM_USER_ID ||
717  !$this->user->hasDeletionFlag()) {
718  $this->ctrl->redirect($this, 'showGeneralSettings');
719  }
720 
721  $this->setHeader();
722  $this->initSubTabs('deleteOwnAccount');
723  $this->tabs->activateTab('delacc');
724 
725  $this->tpl->setOnScreenMessage(
726  'question',
727  $this->lng->txt('user_delete_own_account_final_confirmation')
728  );
729 
730  $this->toolbar->addComponent(
731  $this->ui_factory->button()->standard(
732  $this->lng->txt('confirm'),
733  $this->ctrl->getLinkTargetByClass(self::class, 'deleteOwnAccountStep3')
734  )
735  );
736 
737  $this->toolbar->addComponent(
738  $this->ui_factory->button()->standard(
739  $this->lng->txt('cancel'),
740  $this->ctrl->getLinkTargetByClass(self::class, 'abortDeleteOwnAccount')
741  )
742  );
743  $this->tpl->printToStdout();
744  }
const SYSTEM_USER_ID
This file contains constants for PHPStan analyis, see: https://phpstan.org/config-reference#constants...
Definition: constants.php:26
+ Here is the call graph for this function:

◆ deleteOwnAccountStep3()

ilPersonalSettingsGUI::deleteOwnAccountStep3 ( )
protected

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

References $message, ILIAS\Repository\ctrl(), ilDatePresentation\formatDate(), IL_CAL_UNIX, ILIAS\Repository\lng(), ILIAS\Repository\settings(), ilDatePresentation\setUseRelativeDates(), SYSTEM_USER_ID, and ILIAS\Repository\user().

746  : void
747  {
748  if (!(bool) $this->settings->get('user_delete_own_account') ||
749  $this->user->getId() == SYSTEM_USER_ID ||
750  !$this->user->hasDeletionFlag()) {
751  $this->ctrl->redirect($this, 'showGeneralSettings');
752  }
753 
754  // build notification
755 
756  $ntf = new ilSystemNotification();
757  $ntf->setLangModules(['user']);
758  $ntf->addAdditionalInfo('profile', $this->user->getProfileAsString($this->lng), true);
759 
760  // mail message
762  $ntf->setIntroductionDirect(
763  sprintf(
764  $this->lng->txt('user_delete_own_account_email_body'),
765  $this->user->getLogin(),
766  ILIAS_HTTP_PATH,
768  )
769  );
770 
771  $message = $ntf->composeAndGetMessage($this->user->getId(), null, 'read', true);
772  $subject = $this->lng->txt('user_delete_own_account_email_subject');
773 
774 
775  // send notification
776  $user_email = $this->user->getEmail();
777  $admin_mail = $this->settings->get('user_delete_own_account_email');
778 
779  $mmail = new ilMimeMail();
780  $mmail->From($this->mail_sender_factory->system());
781 
782  if ($user_email !== '') {
783  $mmail->To($user_email);
784  $mmail->Bcc($admin_mail);
785  $mmail->Subject($subject, true);
786  $mmail->Body($message);
787  $mmail->Send();
788  } elseif ($admin_mail !== null || $admin_mail !== '') {
789  $mmail->To($admin_mail);
790  $mmail->Subject($subject, true);
791  $mmail->Body($message);
792  $mmail->Send();
793  }
794 
795  $this->log->root()->log('Account deleted: ' . $this->user->getLogin() . ' (' . $this->user->getId() . ')');
796 
797  $this->user->delete();
798 
799  // terminate session
800  $this->auth_session->logout();
801  $this->ctrl->redirectToURL('login.php?accdel=1');
802  }
const SYSTEM_USER_ID
This file contains constants for PHPStan analyis, see: https://phpstan.org/config-reference#constants...
Definition: constants.php:26
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
const IL_CAL_UNIX
$message
Definition: xapiexit.php:32
static setUseRelativeDates(bool $a_status)
set use relative dates
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ executeCommand()

ilPersonalSettingsGUI::executeCommand ( )

execute command

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

References ILIAS\Repository\ctrl(), ilMailGlobalServices\getMailObjectRefId(), initSubTabs(), ILIAS\Repository\lng(), setHeader(), and ILIAS\Repository\tabs().

110  : void
111  {
112  $next_class = $this->ctrl->getNextClass();
113 
114  switch ($next_class) {
115  case 'ilmailoptionsgui':
116  if (!$this->rbac_system->checkAccess('internal_mail', ilMailGlobalServices::getMailObjectRefId())) {
117  throw new ilPermissionException($this->lng->txt('permission_denied'));
118  }
119 
120  $this->initSubTabs('showMailOptions');
121  $this->tabs->activateTab('mail_settings');
122  $this->setHeader();
123  $this->ctrl->forwardCommand(new ilMailOptionsGUI());
124  break;
125 
126  default:
127  $cmd = $this->ctrl->getCmd('showGeneralSettings');
128  $this->$cmd();
129  break;
130  }
131  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ initGeneralSettingsForm()

ilPersonalSettingsGUI::initGeneralSettingsForm ( )

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

References ILIAS\LTI\ToolProvider\$key, $lang, ilCalendarUserSettings\_getInstanceByUserId(), ilCalendarUtil\_getShortTimeZoneList(), ilSystemStyleSettings\_lookupActivatedStyle(), ilLanguage\_lookupEntry(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ILIAS\Repository\ctrl(), ilCalendarSettings\DATE_FORMAT_DMY, ilCalendarSettings\DATE_FORMAT_MDY, ilCalendarSettings\DATE_FORMAT_YMD, ILIAS\Repository\form(), ilSession\getSessionExpireValue(), ILIAS\Repository\help(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ilSessionReminder\MIN_LEAD_TIME, ilDatePresentation\secondsToString(), ilRadioOption\setInfo(), ilSelectInputGUI\setOptions(), ilFormPropertyGUI\setRequired(), ILIAS\Repository\settings(), ilUserStartingPointRepository\START_REPOSITORY_OBJ, ilSessionReminder\SUGGESTED_LEAD_TIME, ilCalendarSettings\TIME_FORMAT_12, ilCalendarSettings\TIME_FORMAT_24, ILIAS\Repository\user(), and userSettingVisible().

Referenced by saveGeneralSettings(), and showGeneralSettings().

379  : void
380  {
381  $this->form = new ilPropertyFormGUI();
382 
383  // language
384  if ($this->userSettingVisible('language')) {
385  $languages = $this->lng->getInstalledLanguages();
386  $options = [];
387  foreach ($languages as $lang_key) {
388  $options[$lang_key] = ilLanguage::_lookupEntry($lang_key, 'meta', 'meta_l_' . $lang_key);
389  }
390 
391  $lang = new ilSelectInputGUI($this->lng->txt('language'), 'language');
392  $lang->setOptionsLangAttribute(fn($options, $key) => $key);
393  $lang->setOptions($options);
394  $lang->setValue($this->user->getLanguage());
395  if (count($options) <= 1 || $this->settings->get('usr_settings_disable_language') === '1') {
396  $lang->setDisabled(true);
397  }
398  $this->form->addItem($lang);
399  }
400 
401  // skin/style
402  if ($this->userSettingVisible('skin_style')) {
403  $skins = $this->style_definition->getAllSkins();
404  if (is_array($skins)) {
405  $si = new ilSelectInputGUI($this->lng->txt('skin_style'), 'skin_style');
406 
407  $options = [];
408  foreach ($skins as $skin) {
409  foreach ($skin->getStyles() as $style) {
410  if (!ilSystemStyleSettings::_lookupActivatedStyle($skin->getId(), $style->getId()) || $style->isSubstyle()) {
411  continue;
412  }
413 
414  $options[$skin->getId() . ':' . $style->getId()] = $skin->getName() . ' / ' . $style->getName();
415  }
416  }
417  $si->setOptions($options);
418  $si->setValue($this->user->skin . ':' . $this->user->prefs['style']);
419  $si->setDisabled((bool) $this->settings->get('usr_settings_disable_skin_style'));
420  $this->form->addItem($si);
421  }
422  }
423 
424  // help tooltips
425  $this->help->addPersonalSettingToLegacyForm($this->form);
426 
427  // hits per page
428  if ($this->userSettingVisible('hits_per_page')) {
429  $si = new ilSelectInputGUI($this->lng->txt('hits_per_page'), 'hits_per_page');
430 
431  $hits_options = [10,15,20,30,40,50,100,9999];
432  $options = [];
433 
434  foreach ($hits_options as $hits_option) {
435  $hstr = ($hits_option == 9999)
436  ? $this->lng->txt('no_limit')
437  : $hits_option;
438  $options[$hits_option] = $hstr;
439  }
440  $si->setOptions($options);
441  $si->setValue($this->user->prefs['hits_per_page']);
442  $si->setDisabled((bool) $this->settings->get('usr_settings_disable_hits_per_page'));
443  $this->form->addItem($si);
444  }
445 
446  $lv = new ilSelectInputGUI($this->lng->txt('user_store_last_visited'), 'store_last_visited');
447  $options = [
448  0 => $this->lng->txt('user_lv_keep_entries'),
449  1 => $this->lng->txt('user_lv_keep_only_for_session'),
450  2 => $this->lng->txt('user_lv_do_not_store')
451  ];
452  $lv->setOptions($options);
453  $last_visited = (int) ($this->user->prefs['store_last_visited'] ?? 0);
454  $lv->setValue($last_visited);
455  $this->form->addItem($lv);
456 
457 
458  if (ilSessionReminder::isGloballyActivated()) {
459  $cb = new ilCheckboxInputGUI($this->lng->txt('session_reminder'), 'session_reminder_enabled');
460  $cb->setInfo($this->lng->txt('session_reminder_info'));
461  $cb->setValue('1');
462  $cb->setChecked((bool) $this->user->getPref('session_reminder_enabled'));
463 
465  $lead_time_gui = new ilNumberInputGUI($this->lng->txt('session_reminder_lead_time'), 'session_reminder_lead_time');
466  $lead_time_gui->setInfo(sprintf($this->lng->txt('session_reminder_lead_time_info'), ilDatePresentation::secondsToString($expires, true)));
467 
469  $max_value = max($min_value, ($expires / 60) - 1);
470 
471  $current_user_value = $this->user->getPref('session_reminder_lead_time');
472  if ($current_user_value < $min_value ||
473  $current_user_value > $max_value) {
474  $current_user_value = ilSessionReminder::SUGGESTED_LEAD_TIME;
475  }
476  $value = min(
477  max(
478  $min_value,
479  $current_user_value
480  ),
481  $max_value
482  );
483 
484  $lead_time_gui->setValue((string) $value);
485  $lead_time_gui->setSize(3);
486  $lead_time_gui->setMinValue($min_value);
487  $lead_time_gui->setMaxValue($max_value);
488  $cb->addSubItem($lead_time_gui);
489 
490  $this->form->addItem($cb);
491  }
492 
493  // calendar settings (copied here to be reachable when calendar is inactive)
494  // they cannot be hidden/deactivated
495 
496  $this->lng->loadLanguageModule('dateplaner');
497  $user_settings = ilCalendarUserSettings::_getInstanceByUserId($this->user->getId());
498 
499  $select = new ilSelectInputGUI($this->lng->txt('cal_user_timezone'), 'timezone');
501  $select->setInfo($this->lng->txt('cal_timezone_info'));
502  $select->setValue($user_settings->getTimeZone());
503  $this->form->addItem($select);
504 
505  $year = date('Y');
506  $select = new ilSelectInputGUI($this->lng->txt('cal_user_date_format'), 'date_format');
507  $select->setOptions([
508  ilCalendarSettings::DATE_FORMAT_DMY => '31.10.' . $year,
509  ilCalendarSettings::DATE_FORMAT_YMD => $year . '-10-31',
510  ilCalendarSettings::DATE_FORMAT_MDY => '10/31/' . $year
511  ]);
512  $select->setInfo($this->lng->txt('cal_date_format_info'));
513  $select->setValue($user_settings->getDateFormat());
514  $this->form->addItem($select);
515 
516  $select = new ilSelectInputGUI($this->lng->txt('cal_user_time_format'), 'time_format');
517  $select->setOptions([
520  ]);
521  $select->setInfo($this->lng->txt('cal_time_format_info'));
522  $select->setValue($user_settings->getTimeFormat());
523  $this->form->addItem($select);
524 
525  if ($this->starting_point_repository->isPersonalStartingPointEnabled()) {
526  $this->lng->loadLanguageModule('administration');
527  $si = new ilRadioGroupInputGUI($this->lng->txt('adm_user_starting_point'), 'usr_start');
528  $si->setRequired(true);
529  $si->setInfo($this->lng->txt('adm_user_starting_point_info'));
530  $def_opt = new ilRadioOption($this->lng->txt('adm_user_starting_point_inherit'), '0');
531  $def_opt->setInfo($this->lng->txt('adm_user_starting_point_inherit_info'));
532  $si->addOption($def_opt);
533  foreach ($this->starting_point_repository->getPossibleStartingPoints() as $value => $caption) {
535  continue;
536  }
537  $si->addOption(new ilRadioOption($this->lng->txt($caption), (string) $value));
538  }
539  $si->setValue((string) $this->starting_point_repository->getCurrentUserPersonalStartingPoint());
540  $this->form->addItem($si);
541 
542  // starting point: repository object
543  $repobj = new ilRadioOption(
544  $this->lng->txt('adm_user_starting_point_object'),
546  );
547  $repobj_id = new ilTextInputGUI($this->lng->txt('adm_user_starting_point_ref_id'), 'usr_start_ref_id');
548  $repobj_id->setInfo($this->lng->txt('adm_user_starting_point_ref_id_info'));
549  $repobj_id->setRequired(true);
550  $repobj_id->setSize(5);
552  $start_ref_id = $this->starting_point_repository->getCurrentUserPersonalStartingObject();
553  $repobj_id->setValue($start_ref_id);
554  if ($start_ref_id) {
555  $start_obj_id = ilObject::_lookupObjId($start_ref_id);
556  if ($start_obj_id) {
557  $repobj_id->setInfo($this->lng->txt('obj_' . ilObject::_lookupType($start_obj_id)) .
558  ': ' . ilObject::_lookupTitle($start_obj_id));
559  }
560  }
561  }
562  $repobj->addSubItem($repobj_id);
563  $si->addOption($repobj);
564  }
565 
566  $this->form->addCommandButton('saveGeneralSettings', $this->lng->txt('save'));
567  $this->form->setTitle($this->lng->txt('general_settings'));
568  $this->form->setFormAction($this->ctrl->getFormAction($this));
569  }
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 _lookupActivatedStyle(string $a_skin, string $a_style)
lookup if a style is activated
setInfo(string $a_info)
setOptions(array $a_options)
static _getShortTimeZoneList()
get short timezone list
static secondsToString(int $seconds, bool $force_with_seconds=false, ?ilLanguage $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
static _getInstanceByUserId(int $a_user_id)
static _lookupObjId(int $ref_id)
This class represents a property in a property form.
static _lookupTitle(int $obj_id)
string $key
Consumer key/client ID value.
Definition: System.php:193
setRequired(bool $a_required)
$lang
Definition: xapiexit.php:26
form( $class_path, string $cmd, string $submit_caption="")
static _lookupEntry(string $a_lang_key, string $a_mod, string $a_id)
static _lookupType(int $id, bool $reference=false)
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 ( )

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

References ilDAVActivationChecker\_isActive(), allowPasswordChange(), ilAuthUtils\AUTH_CAS, ilAuthUtils\AUTH_LOCAL, ilAuthUtils\AUTH_SHIBBOLETH, ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilSecuritySettingsChecker\getPasswordRequirementsInfo(), ILIAS\Repository\lng(), ilFormPropertyGUI\setInfo(), and ILIAS\Repository\user().

Referenced by savePassword(), and showPassword().

212  : void
213  {
214  $this->form = new ilPropertyFormGUI();
215 
216  if ($this->allowPasswordChange()) {
217  $pw_info_set = false;
218  if ($this->user->getAuthMode(true) == ilAuthUtils::AUTH_LOCAL) {
219  // current password
220  $cpass = new ilPasswordInputGUI($this->lng->txt('current_password'), 'current_password');
222  $cpass->setRetype(false);
223  $cpass->setSkipSyntaxCheck(true);
224  $pw_info_set = true;
225  // only if a password exists.
226  if ($this->user->getPasswd()) {
227  $cpass->setRequired(true);
228  }
229  $this->form->addItem($cpass);
230  }
231 
232  // new password
233  $ipass = new ilPasswordInputGUI($this->lng->txt('desired_password'), 'new_password');
234  if ($pw_info_set === false) {
236  }
237  $ipass->setRequired(true);
238  $ipass->setUseStripSlashes(false);
239 
240  $this->form->addItem($ipass);
241  $this->form->addCommandButton('savePassword', $this->lng->txt('save'));
242 
243  switch ($this->user->getAuthMode(true)) {
245  $this->form->setTitle($this->lng->txt('chg_password'));
246  break;
247 
251  $this->form->setTitle($this->lng->txt('chg_ilias_and_webfolder_password'));
252  } else {
253  $this->form->setTitle($this->lng->txt('chg_ilias_password'));
254  }
255  break;
256  default:
257  $this->form->setTitle($this->lng->txt('chg_ilias_password'));
258  break;
259  }
260  $this->form->setFormAction($this->ctrl->getFormAction($this));
261  }
262  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getPasswordRequirementsInfo()
infotext for ilPasswordInputGUI setInfo()
form( $class_path, string $cmd, string $submit_caption="")
allowPasswordChange()
Check, whether password change is allowed for user.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initSubTabs()

ilPersonalSettingsGUI::initSubTabs ( string  $a_cmd)
private

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

References allowPasswordChange(), ILIAS\Repository\ctrl(), ilMailGlobalServices\getMailObjectRefId(), ILIAS\Repository\help(), ILIAS\Repository\lng(), ILIAS\Repository\settings(), SYSTEM_USER_ID, ILIAS\Repository\tabs(), and ILIAS\Repository\user().

Referenced by deleteOwnAccountStep1(), deleteOwnAccountStep2(), executeCommand(), showGeneralSettings(), and showPassword().

133  : void
134  {
135  $this->help->setScreenIdComponent('user');
136 
137  $showPassword = $a_cmd == 'showPassword';
138  $showGeneralSettings = $a_cmd == 'showGeneralSettings';
139 
140  $this->tabs->addTarget(
141  'general_settings',
142  $this->ctrl->getLinkTarget($this, 'showGeneralSettings'),
143  '',
144  '',
145  '',
146  $showGeneralSettings
147  );
148 
149  if ($this->allowPasswordChange()) {
150  $this->tabs->addTarget(
151  'password',
152  $this->ctrl->getLinkTarget($this, 'showPassword'),
153  '',
154  '',
155  '',
156  $showPassword
157  );
158  }
159 
160  if ($this->rbac_system->checkAccess('internal_mail', ilMailGlobalServices::getMailObjectRefId())
161  && $this->settings->get('show_mail_settings')) {
162  $this->ctrl->setParameter($this, 'referrer', 'ilPersonalSettingsGUI');
163 
164  $this->tabs->addTarget(
165  'mail_settings',
166  $this->ctrl->getLinkTargetByClass('ilMailOptionsGUI'),
167  '',
168  ['ilMailOptionsGUI']
169  );
170  }
171 
172  if ($this->settings->get('user_delete_own_account') &&
173  $this->user->getId() != SYSTEM_USER_ID) {
174  $this->tabs->addTab(
175  'delacc',
176  $this->lng->txt('user_delete_own_account'),
177  $this->ctrl->getLinkTarget($this, 'deleteOwnAccountStep1')
178  );
179  }
180  }
const SYSTEM_USER_ID
This file contains constants for PHPStan analyis, see: https://phpstan.org/config-reference#constants...
Definition: constants.php:26
allowPasswordChange()
Check, whether password change is allowed for user.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveGeneralSettings()

ilPersonalSettingsGUI::saveGeneralSettings ( )

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

References ilCalendarUserSettings\_getInstanceByUserId(), checkPersonalStartingPoint(), ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ILIAS\Repository\help(), initGeneralSettingsForm(), ILIAS\Repository\lng(), showGeneralSettings(), ILIAS\Repository\user(), and workWithUserSetting().

571  : void
572  {
573  $this->initGeneralSettingsForm();
574  if ($this->form->checkInput()
575  && $this->checkPersonalStartingPoint()) {
576  if ($this->workWithUserSetting('skin_style')) {
577  //set user skin and style
578  if ($this->form->getInput('skin_style') != '') {
579  $sknst = explode(':', $this->form->getInput('skin_style'));
580 
581  if ($this->user->getPref('style') != $sknst[1] ||
582  $this->user->getPref('skin') != $sknst[0]) {
583  $this->user->setPref('skin', $sknst[0]);
584  $this->user->setPref('style', $sknst[1]);
585  }
586  }
587  }
588 
589  // language
590  if ($this->workWithUserSetting('language')) {
591  $this->user->setLanguage($this->form->getInput('language'));
592  }
593 
594  // hits per page
595  if ($this->workWithUserSetting('hits_per_page')) {
596  if ($this->form->getInput('hits_per_page') != '') {
597  $this->user->setPref('hits_per_page', $this->form->getInput('hits_per_page'));
598  }
599  }
600 
601  // help tooltips
602  $this->help->savePersonalSettingFromLegacyForm($this->form);
603 
604  $this->user->setPref('store_last_visited', $this->form->getInput('store_last_visited'));
605  if ((int) $this->form->getInput('store_last_visited') > 0) {
606  $this->navigation_history->deleteDBEntries();
607  if ((int) $this->form->getInput('store_last_visited') == 2) {
608  $this->navigation_history->deleteSessionEntries();
609  }
610  }
611 
612  if (ilSessionReminder::isGloballyActivated()) {
613  $this->user->setPref('session_reminder_enabled', $this->form->getInput('session_reminder_enabled'));
614  $this->user->setPref('session_reminder_lead_time', (string) $this->form->getInput('session_reminder_lead_time'));
615  }
616 
617  if ($this->starting_point_repository->isPersonalStartingPointEnabled()) {
618  $s_ref_id = $this->form->getInput('usr_start_ref_id');
619  $s_ref_id = ($s_ref_id === '')
620  ? null
621  : (int) $s_ref_id;
622  $this->starting_point_repository->setCurrentUserPersonalStartingPoint(
623  (int) $this->form->getInput('usr_start'),
624  $s_ref_id
625  );
626  }
627 
628  $this->user->update();
629 
630  // calendar settings
631  $user_settings = ilCalendarUserSettings::_getInstanceByUserId($this->user->getId());
632  $user_settings->setTimeZone($this->form->getInput('timezone'));
633  $user_settings->setDateFormat((int) $this->form->getInput('date_format'));
634  $user_settings->setTimeFormat((int) $this->form->getInput('time_format'));
635  $user_settings->save();
636 
637  $this->tpl->setOnScreenMessage('success', $this->lng->txtlng('common', 'msg_obj_modified', $this->user->getLanguage()), true);
638 
639  $this->ctrl->redirect($this, 'showGeneralSettings');
640  }
641 
642  $this->form->setValuesByPost();
643  $this->showGeneralSettings(true);
644  }
static _getInstanceByUserId(int $a_user_id)
form( $class_path, string $cmd, string $submit_caption="")
showGeneralSettings(bool $a_no_init=false)
+ Here is the call graph for this function:

◆ savePassword()

ilPersonalSettingsGUI::savePassword ( )

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

References allowPasswordChange(), ilAuthUtils\AUTH_LOCAL, ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilSession\get(), ilUserPasswordManager\getInstance(), initPasswordForm(), ilSecuritySettingsChecker\isPassword(), ilSecuritySettingsChecker\isPasswordValidForUserContext(), ILIAS\Repository\lng(), ilUtil\redirect(), ilSession\set(), showPassword(), and ILIAS\Repository\user().

282  : void
283  {
284  if (!$this->allowPasswordChange()) {
285  $this->ctrl->redirect($this, 'showPersonalData');
286  return;
287  }
288 
289  $this->initPasswordForm();
290  if ($this->form->checkInput()) {
291  $cp = $this->form->getItemByPostVar('current_password');
292  $np = $this->form->getItemByPostVar('new_password');
293  $error = false;
294 
295  if ($this->user->getAuthMode(true) == ilAuthUtils::AUTH_LOCAL) {
296  if (!ilUserPasswordManager::getInstance()->verifyPassword($this->user, $this->entered_current_password)) {
297  $error = true;
298  $cp->setAlert($this->lng->txt('passwd_wrong'));
299  }
300  }
301 
302  if (!ilSecuritySettingsChecker::isPassword($this->entered_new_password, $custom_error)) {
303  $error = true;
304  if ($custom_error != '') {
305  $np->setAlert($custom_error);
306  } else {
307  $np->setAlert($this->lng->txt('passwd_invalid'));
308  }
309  }
310  $error_lng_var = '';
312  $this->entered_new_password,
313  $this->user,
314  $error_lng_var
315  )) {
316  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('form_input_not_valid'));
317  $np->setAlert($this->lng->txt($error_lng_var));
318  $error = true;
319  }
320  if (($this->user->isPasswordExpired() || $this->user->isPasswordChangeDemanded())
321  && $this->entered_current_password == $this->entered_new_password) {
322  $error = true;
323  $np->setAlert($this->lng->txt('new_pass_equals_old_pass'));
324  }
325 
326  if (!$error) {
327  $this->user->resetPassword($this->entered_new_password, $this->entered_new_password);
328  if ($this->entered_current_password != $this->entered_new_password) {
329  $this->user->setLastPasswordChangeToNow();
330  $this->user->setPasswordPolicyResetStatus(false);
331  $this->user->update();
332  }
333 
334  if (ilSession::get('orig_request_target')) {
335  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'), true);
336  $target = ilSession::get('orig_request_target');
337  ilSession::set('orig_request_target', '');
338  ilUtil::redirect($target);
339  } else {
340  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
341  $this->showPassword(true, true);
342  return;
343  }
344  }
345  }
346  $this->form->setValuesByPost();
347  $this->showPassword(true);
348  }
static get(string $a_var)
static isPassword(string $a_passwd, ?string &$customError=null)
showPassword(bool $a_no_init=false, bool $hide_form=false)
static isPasswordValidForUserContext(string $clear_text_password, $user, ?string &$error_language_variable=null)
static redirect(string $a_script)
form( $class_path, string $cmd, string $submit_caption="")
allowPasswordChange()
Check, whether password change is allowed for user.
static getInstance()
Singleton method to reduce footprint (included files, created instances)
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:

◆ setHeader()

ilPersonalSettingsGUI::setHeader ( )

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

References ILIAS\Repository\lng().

Referenced by deleteOwnAccountStep1(), deleteOwnAccountStep2(), executeCommand(), showGeneralSettings(), and showPassword().

182  : void
183  {
184  $this->tpl->setTitle($this->lng->txt('personal_settings'));
185  }
+ 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 365 of file class.ilPersonalSettingsGUI.php.

References ILIAS\Repository\form(), initGeneralSettingsForm(), initSubTabs(), setHeader(), and ILIAS\Repository\tabs().

Referenced by saveGeneralSettings().

365  : void
366  {
367  $this->initSubTabs('showPersonalData');
368  $this->tabs->activateTab('general_settings');
369 
370  $this->setHeader();
371 
372  if (!$a_no_init) {
373  $this->initGeneralSettingsForm();
374  }
375  $this->tpl->setContent($this->form->getHTML());
376  $this->tpl->printToStdout();
377  }
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showPassword()

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

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

References ILIAS\Repository\form(), initPasswordForm(), initSubTabs(), ILIAS\Repository\lng(), setHeader(), ILIAS\Repository\tabs(), and ILIAS\Repository\user().

Referenced by savePassword().

190  : void {
191  $this->initSubTabs('showPersonalData');
192  $this->tabs->activateTab('password');
193 
194  $this->setHeader();
195  // check whether password of user have to be changed
196  // due to first login or password of user is expired
197  if ($this->user->isPasswordChangeDemanded()) {
198  $this->tpl->setOnScreenMessage('info', $this->lng->txt('password_change_on_first_login_demand'));
199  } elseif ($this->user->isPasswordExpired()) {
200  $msg = $this->lng->txt('password_expired');
201  $password_age = $this->user->getPasswordAge();
202  $this->tpl->setOnScreenMessage('info', sprintf($msg, $password_age));
203  }
204 
205  if (!$a_no_init && !$hide_form) {
206  $this->initPasswordForm();
207  }
208  $this->tpl->setContent(!$hide_form ? $this->form->getHTML() : '');
209  $this->tpl->printToStdout();
210  }
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ userSettingEnabled()

ilPersonalSettingsGUI::userSettingEnabled ( string  $setting)

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

360  : bool
361  {
362  return $this->user_settings_config->isChangeable($setting);
363  }

◆ userSettingVisible()

ilPersonalSettingsGUI::userSettingVisible ( string  $setting)

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

Referenced by initGeneralSettingsForm().

355  : bool
356  {
357  return $this->user_settings_config->isVisible($setting);
358  }
+ Here is the caller graph for this function:

◆ workWithUserSetting()

ilPersonalSettingsGUI::workWithUserSetting ( string  $setting)

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

Referenced by saveGeneralSettings().

350  : bool
351  {
352  return $this->user_settings_config->isVisibleAndChangeable($setting);
353  }
+ Here is the caller graph for this function:

Field Documentation

◆ $auth_session

ilAuthSession ilPersonalSettingsGUI::$auth_session
private

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

◆ $ctrl

ilCtrl ilPersonalSettingsGUI::$ctrl
private

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

◆ $entered_current_password

string ilPersonalSettingsGUI::$entered_current_password
private

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

◆ $entered_new_password

string ilPersonalSettingsGUI::$entered_new_password
private

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

◆ $form

ilPropertyFormGUI ilPersonalSettingsGUI::$form
private

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

◆ $help

ilHelpGUI ilPersonalSettingsGUI::$help
private

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

◆ $lng

ilLanguage ilPersonalSettingsGUI::$lng
private

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

◆ $log

LoggingServices ilPersonalSettingsGUI::$log
private

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

◆ $mail_sender_factory

ilMailMimeSenderFactory ilPersonalSettingsGUI::$mail_sender_factory
private

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

◆ $navigation_history

ilNavigationHistory ilPersonalSettingsGUI::$navigation_history
private

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

◆ $password_error

string ilPersonalSettingsGUI::$password_error
private

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

◆ $rbac_system

ilRbacSystem ilPersonalSettingsGUI::$rbac_system
private

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

◆ $request

UserGUIRequest ilPersonalSettingsGUI::$request
private

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

◆ $settings

ilSetting ilPersonalSettingsGUI::$settings
private

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

◆ $starting_point_repository

ilUserStartingPointRepository ilPersonalSettingsGUI::$starting_point_repository
private

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

◆ $style_definition

ilStyleDefinition ilPersonalSettingsGUI::$style_definition
private

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

◆ $tabs

ilTabsGUI ilPersonalSettingsGUI::$tabs
private

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

◆ $toolbar

ilToolbarGUI ilPersonalSettingsGUI::$toolbar
private

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

◆ $tpl

ilGlobalTemplateInterface ilPersonalSettingsGUI::$tpl
private

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

◆ $ui_factory

UIFactory ilPersonalSettingsGUI::$ui_factory
private

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

◆ $ui_renderer

Renderer ilPersonalSettingsGUI::$ui_renderer
private

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

◆ $upload_error

string ilPersonalSettingsGUI::$upload_error
private

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

◆ $user

ilObjUser ilPersonalSettingsGUI::$user
private

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

◆ $user_defined_fields

ilUserDefinedFields ilPersonalSettingsGUI::$user_defined_fields
private

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

◆ $user_settings_config

ilUserSettingsConfig ilPersonalSettingsGUI::$user_settings_config
private

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


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