ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
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 30 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 32 of file class.DeleteAccountGUI.php.

44 {
45 }

Member Function Documentation

◆ abortDeleteOwnAccount()

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

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

94 : void
95 {
96 $this->current_user->removeDeletionFlag();
97
98 $this->tpl->setOnScreenMessage(
99 'info',
100 $this->lng->txt('user_delete_own_account_aborted'),
101 true
102 );
103 $this->ctrl->redirectByClass(
104 [\ilDashboardGUI::class, PersonalSettingsGUI::class],
105 'show'
106 );
107 }

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 109 of file class.DeleteAccountGUI.php.

109 : void
110 {
111 $this->current_user->activateDeletionFlag();
112
114 $this->auth_session->logout();
115
116 $this->ctrl->redirectToURL(
117 'login.php?cmd=force_login&target=usr_'
119 );
120 }
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 54 of file class.DeleteAccountGUI.php.

54 : void
55 {
56 if (!(bool) $this->settings->get('user_delete_own_account') ||
57 $this->current_user->getId() === SYSTEM_USER_ID) {
58 $this->ctrl->redirectByClass(
59 [\ilDashboardGUI::class, PersonalSettingsGUI::class],
60 'show'
61 );
62 }
63
64 // to make sure
65 $this->current_user->removeDeletionFlag();
66
67 $modal = $this->ui_factory->modal()->interruptive(
68 $this->lng->txt('user_delete_own_account'),
69 $this->lng->txt('user_delete_own_account_logout_confirmation'),
70 $this->ctrl->getFormActionByClass(
71 self::class,
72 'deleteOwnAccountLogout'
73 )
74 )->withActionButtonLabel(
75 $this->lng->txt('user_delete_own_account_logout_button')
76 );
77
78 $this->tpl->setOnScreenMessage(
79 'info',
80 $this->lng->txt('user_delete_own_account_info')
81 );
82 $this->toolbar->addComponent(
83 $this->ui_factory->button()->standard(
84 $this->lng->txt('btn_next'),
85 $modal->getShowSignal()
86 )
87 );
88
89 $this->tpl->setContent($this->ui_renderer->render($modal));
90
91 $this->tpl->printToStdout();
92 }
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 122 of file class.DeleteAccountGUI.php.

122 : void
123 {
124 if (
125 !(bool) $this->settings->get('user_delete_own_account') ||
126 $this->current_user->getId() === SYSTEM_USER_ID ||
127 !$this->current_user->hasDeletionFlag()
128 ) {
129 $this->ctrl->redirect($this, 'showGeneralSettings');
130 }
131
132 $this->tpl->setOnScreenMessage(
133 'question',
134 $this->lng->txt('user_delete_own_account_final_confirmation')
135 );
136
137 $this->toolbar->addComponent(
138 $this->ui_factory->button()->standard(
139 $this->lng->txt('confirm'),
140 $this->ctrl->getLinkTargetByClass(
141 self::class,
142 'deleteOwnAccountStep3'
143 )
144 )
145 );
146
147 $this->toolbar->addComponent(
148 $this->ui_factory->button()->standard(
149 $this->lng->txt('cancel'),
150 $this->ctrl->getLinkTargetByClass(
151 self::class,
152 'abortDeleteOwnAccount'
153 )
154 )
155 );
156 $this->tpl->printToStdout();
157 }

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 159 of file class.DeleteAccountGUI.php.

159 : void
160 {
161 if (
162 !(bool) $this->settings->get('user_delete_own_account') ||
163 $this->current_user->getId() === SYSTEM_USER_ID ||
164 !$this->current_user->hasDeletionFlag()
165 ) {
166 $this->ctrl->redirect($this, 'showGeneralSettings');
167 }
168
169 // build notification
170
171 $ntf = new \ilSystemNotification();
172 $ntf->setLangModules(['user']);
173 $ntf->addAdditionalInfo(
174 'profile',
175 $this->current_user->getProfileAsString($this->lng),
176 true
177 );
178
179 // mail message
181 $ntf->setIntroductionDirect(
182 sprintf(
183 $this->lng->txt('user_delete_own_account_email_body'),
184 $this->current_user->getLogin(),
185 ILIAS_HTTP_PATH,
187 new \ilDateTime(
188 time(),
190 )
191 )
192 )
193 );
194
195 $message = $ntf->composeAndGetMessage(
196 $this->current_user->getId(),
197 null,
198 'read',
199 true
200 );
201 $subject = $this->lng->txt('user_delete_own_account_email_subject');
202
203 // send notification
204 $user_email = $this->current_user->getEmail();
205 $admin_mail = $this->settings->get('user_delete_own_account_email');
206
207 $mmail = new \ilMimeMail();
208 $mmail->From($this->mail_sender_factory->system());
209
210 if ($user_email !== '') {
211 $mmail->To($user_email);
212 $mmail->Bcc($admin_mail);
213 $mmail->Subject($subject, true);
214 $mmail->Body($message);
215 $mmail->Send();
216 } elseif ($admin_mail !== null || $admin_mail !== '') {
217 $mmail->To($admin_mail);
218 $mmail->Subject($subject, true);
219 $mmail->Body($message);
220 $mmail->Send();
221 }
222
223 $this->log->root()->log(
224 'Account deleted: ' . $this->current_user->getLogin()
225 . ' (' . $this->current_user->getId() . ')'
226 );
227
228 $this->current_user->delete();
229
230 // terminate session
231 $this->auth_session->logout();
232 $this->ctrl->redirectToURL('login.php?accdel=1');
233 }
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 47 of file class.DeleteAccountGUI.php.

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

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: