ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ILIAS\User\Account\DeleteAccountGUI Class Reference
+ Collaboration diagram for ILIAS\User\Account\DeleteAccountGUI:

Public Member Functions

 __construct (private readonly \ilCtrl $ctrl, private readonly Language $lng, private readonly \ilGlobalTemplateInterface $tpl, private readonly UIFactory $ui_factory, private readonly UIRenderer $ui_renderer, private readonly \ilToolbarGUI $toolbar, private readonly LoggingServices $log, private readonly \ilMailMimeSenderFactory $mail_sender_factory, private readonly \ilSetting $settings, private readonly \ilAuthSession $auth_session, private readonly \ilObjUser $current_user)
 
 executeCommand ()
 

Protected Member Functions

 deleteOwnAccountStep1 ()
 
 abortDeleteOwnAccount ()
 
 deleteOwnAccountLogout ()
 
 deleteOwnAccountStep2 ()
 
 deleteOwnAccountStep3 ()
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ILIAS\User\Account\DeleteAccountGUI::__construct ( private readonly \ilCtrl  $ctrl,
private readonly Language  $lng,
private readonly \ilGlobalTemplateInterface  $tpl,
private readonly UIFactory  $ui_factory,
private readonly UIRenderer  $ui_renderer,
private readonly \ilToolbarGUI  $toolbar,
private readonly LoggingServices  $log,
private readonly \ilMailMimeSenderFactory  $mail_sender_factory,
private readonly \ilSetting  $settings,
private readonly \ilAuthSession  $auth_session,
private readonly \ilObjUser  $current_user 
)

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

43 {
44 }

Member Function Documentation

◆ abortDeleteOwnAccount()

ILIAS\User\Account\DeleteAccountGUI::abortDeleteOwnAccount ( )
protected

Definition at line 85 of file class.DeleteAccountGUI.php.

85 : void
86 {
87 $this->current_user->removeDeletionFlag();
88
89 $this->tpl->setOnScreenMessage('info', $this->lng->txt('user_delete_own_account_aborted'), true);
90 $this->ctrl->redirect($this, 'showGeneralSettings');
91 }

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

+ Here is the call graph for this function:

◆ deleteOwnAccountLogout()

ILIAS\User\Account\DeleteAccountGUI::deleteOwnAccountLogout ( )
protected

Definition at line 93 of file class.DeleteAccountGUI.php.

93 : void
94 {
95 $this->current_user->activateDeletionFlag();
96
98 $this->auth_session->logout();
99
100 $this->ctrl->redirectToURL(
101 'login.php?cmd=force_login&target=usr_'
103 );
104 }
static setClosingContext(int $a_context)
set closing context (for statistics)
const int SESSION_CLOSE_USER

References ILIAS\Repository\ctrl(), ILIAS\User\StaticURLHandler\DEL_OWN_ACCOUNT_OPERATION, ilSession\SESSION_CLOSE_USER, and ilSession\setClosingContext().

+ Here is the call graph for this function:

◆ deleteOwnAccountStep1()

ILIAS\User\Account\DeleteAccountGUI::deleteOwnAccountStep1 ( )
protected

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

53 : void
54 {
55 if (!(bool) $this->settings->get('user_delete_own_account') ||
56 $this->current_user->getId() === SYSTEM_USER_ID) {
57 $this->ctrl->redirectByClass(
58 [\ilDashboardGUI::class, PersonalSettingsGUI::class],
59 'show'
60 );
61 }
62
63 // to make sure
64 $this->current_user->removeDeletionFlag();
65
66 $modal = $this->ui_factory->modal()->interruptive(
67 $this->lng->txt('user_delete_own_account'),
68 $this->lng->txt('user_delete_own_account_logout_confirmation'),
69 $this->ctrl->getFormActionByClass(self::class, 'deleteOwnAccountLogout')
70 )->withActionButtonLabel($this->lng->txt('user_delete_own_account_logout_button'));
71
72 $this->tpl->setOnScreenMessage('info', $this->lng->txt('user_delete_own_account_info'));
73 $this->toolbar->addComponent(
74 $this->ui_factory->button()->standard(
75 $this->lng->txt('btn_next'),
76 $modal->getShowSignal()
77 )
78 );
79
80 $this->tpl->setContent($this->ui_renderer->render($modal));
81
82 $this->tpl->printToStdout();
83 }
const SYSTEM_USER_ID
This file contains constants for PHPStan analyis, see: https://phpstan.org/config-reference#constants...
Definition: constants.php:26

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\settings(), SYSTEM_USER_ID, and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

◆ deleteOwnAccountStep2()

ILIAS\User\Account\DeleteAccountGUI::deleteOwnAccountStep2 ( )
protected

Definition at line 106 of file class.DeleteAccountGUI.php.

106 : void
107 {
108 if (
109 !(bool) $this->settings->get('user_delete_own_account') ||
110 $this->current_user->getId() === SYSTEM_USER_ID ||
111 !$this->current_user->hasDeletionFlag()
112 ) {
113 $this->ctrl->redirect($this, 'showGeneralSettings');
114 }
115
116 $this->tpl->setOnScreenMessage(
117 'question',
118 $this->lng->txt('user_delete_own_account_final_confirmation')
119 );
120
121 $this->toolbar->addComponent(
122 $this->ui_factory->button()->standard(
123 $this->lng->txt('confirm'),
124 $this->ctrl->getLinkTargetByClass(self::class, 'deleteOwnAccountStep3')
125 )
126 );
127
128 $this->toolbar->addComponent(
129 $this->ui_factory->button()->standard(
130 $this->lng->txt('cancel'),
131 $this->ctrl->getLinkTargetByClass(self::class, 'abortDeleteOwnAccount')
132 )
133 );
134 $this->tpl->printToStdout();
135 }

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\settings(), SYSTEM_USER_ID, and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

◆ deleteOwnAccountStep3()

ILIAS\User\Account\DeleteAccountGUI::deleteOwnAccountStep3 ( )
protected

Definition at line 137 of file class.DeleteAccountGUI.php.

137 : void
138 {
139 if (
140 !(bool) $this->settings->get('user_delete_own_account') ||
141 $this->current_user->getId() === SYSTEM_USER_ID ||
142 !$this->current_user->hasDeletionFlag()
143 ) {
144 $this->ctrl->redirect($this, 'showGeneralSettings');
145 }
146
147 // build notification
148
149 $ntf = new \ilSystemNotification();
150 $ntf->setLangModules(['user']);
151 $ntf->addAdditionalInfo('profile', $this->current_user->getProfileAsString($this->lng), true);
152
153 // mail message
155 $ntf->setIntroductionDirect(
156 sprintf(
157 $this->lng->txt('user_delete_own_account_email_body'),
158 $this->current_user->getLogin(),
159 ILIAS_HTTP_PATH,
161 )
162 );
163
164 $message = $ntf->composeAndGetMessage($this->current_user->getId(), null, 'read', true);
165 $subject = $this->lng->txt('user_delete_own_account_email_subject');
166
167 // send notification
168 $user_email = $this->current_user->getEmail();
169 $admin_mail = $this->settings->get('user_delete_own_account_email');
170
171 $mmail = new \ilMimeMail();
172 $mmail->From($this->mail_sender_factory->system());
173
174 if ($user_email !== '') {
175 $mmail->To($user_email);
176 $mmail->Bcc($admin_mail);
177 $mmail->Subject($subject, true);
178 $mmail->Body($message);
179 $mmail->Send();
180 } elseif ($admin_mail !== null || $admin_mail !== '') {
181 $mmail->To($admin_mail);
182 $mmail->Subject($subject, true);
183 $mmail->Body($message);
184 $mmail->Send();
185 }
186
187 $this->log->root()->log('Account deleted: ' . $this->current_user->getLogin() . ' (' . $this->current_user->getId() . ')');
188
189 $this->current_user->delete();
190
191 // terminate session
192 $this->auth_session->logout();
193 $this->ctrl->redirectToURL('login.php?accdel=1');
194 }
const IL_CAL_UNIX
static setUseRelativeDates(bool $a_status)
set use relative dates
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling

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

+ Here is the call graph for this function:

◆ executeCommand()

ILIAS\User\Account\DeleteAccountGUI::executeCommand ( )

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

46 : void
47 {
48 $this->tpl->setTitle($this->lng->txt('user_delete_own_account'));
49 $cmd = $this->ctrl->getCmd('showGeneralSettings');
50 $this->$cmd() . 'Cmd';
51 }

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

+ Here is the call graph for this function:

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