2020
2121namespace ILIAS \User \Account ;
2222
23+ use ILIAS \User \Settings \PersonalSettingsGUI ;
2324use ILIAS \DI \LoggingServices ;
2425use ILIAS \Language \Language ;
2526use ILIAS \UI \Factory as UIFactory ;
@@ -46,8 +47,8 @@ public function __construct(
4647 public function executeCommand (): void
4748 {
4849 $ this ->tpl ->setTitle ($ this ->lng ->txt ('user_delete_own_account ' ));
49- $ cmd = $ this ->ctrl ->getCmd ('showGeneralSettings ' );
50- $ this ->$ cmd () . ' Cmd ' ;
50+ $ cmd = $ this ->ctrl ->getCmd ('deleteOwnAccountStep1 ' );
51+ $ this ->$ cmd ();
5152 }
5253
5354 protected function deleteOwnAccountStep1 (): void
@@ -66,10 +67,18 @@ protected function deleteOwnAccountStep1(): void
6667 $ modal = $ this ->ui_factory ->modal ()->interruptive (
6768 $ this ->lng ->txt ('user_delete_own_account ' ),
6869 $ 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 ' ));
70+ $ this ->ctrl ->getFormActionByClass (
71+ self ::class,
72+ 'deleteOwnAccountLogout '
73+ )
74+ )->withActionButtonLabel (
75+ $ this ->lng ->txt ('user_delete_own_account_logout_button ' )
76+ );
7177
72- $ this ->tpl ->setOnScreenMessage ('info ' , $ this ->lng ->txt ('user_delete_own_account_info ' ));
78+ $ this ->tpl ->setOnScreenMessage (
79+ 'info ' ,
80+ $ this ->lng ->txt ('user_delete_own_account_info ' )
81+ );
7382 $ this ->toolbar ->addComponent (
7483 $ this ->ui_factory ->button ()->standard (
7584 $ this ->lng ->txt ('btn_next ' ),
@@ -86,8 +95,15 @@ protected function abortDeleteOwnAccount(): void
8695 {
8796 $ this ->current_user ->removeDeletionFlag ();
8897
89- $ this ->tpl ->setOnScreenMessage ('info ' , $ this ->lng ->txt ('user_delete_own_account_aborted ' ), true );
90- $ this ->ctrl ->redirect ($ this , 'showGeneralSettings ' );
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+ );
91107 }
92108
93109 protected function deleteOwnAccountLogout (): void
@@ -121,14 +137,20 @@ protected function deleteOwnAccountStep2(): void
121137 $ this ->toolbar ->addComponent (
122138 $ this ->ui_factory ->button ()->standard (
123139 $ this ->lng ->txt ('confirm ' ),
124- $ this ->ctrl ->getLinkTargetByClass (self ::class, 'deleteOwnAccountStep3 ' )
140+ $ this ->ctrl ->getLinkTargetByClass (
141+ self ::class,
142+ 'deleteOwnAccountStep3 '
143+ )
125144 )
126145 );
127146
128147 $ this ->toolbar ->addComponent (
129148 $ this ->ui_factory ->button ()->standard (
130149 $ this ->lng ->txt ('cancel ' ),
131- $ this ->ctrl ->getLinkTargetByClass (self ::class, 'abortDeleteOwnAccount ' )
150+ $ this ->ctrl ->getLinkTargetByClass (
151+ self ::class,
152+ 'abortDeleteOwnAccount '
153+ )
132154 )
133155 );
134156 $ this ->tpl ->printToStdout ();
@@ -148,7 +170,11 @@ protected function deleteOwnAccountStep3(): void
148170
149171 $ ntf = new \ilSystemNotification ();
150172 $ ntf ->setLangModules (['user ' ]);
151- $ ntf ->addAdditionalInfo ('profile ' , $ this ->current_user ->getProfileAsString ($ this ->lng ), true );
173+ $ ntf ->addAdditionalInfo (
174+ 'profile ' ,
175+ $ this ->current_user ->getProfileAsString ($ this ->lng ),
176+ true
177+ );
152178
153179 // mail message
154180 \ilDatePresentation::setUseRelativeDates (false );
@@ -157,11 +183,21 @@ protected function deleteOwnAccountStep3(): void
157183 $ this ->lng ->txt ('user_delete_own_account_email_body ' ),
158184 $ this ->current_user ->getLogin (),
159185 ILIAS_HTTP_PATH ,
160- \ilDatePresentation::formatDate (new \ilDateTime (time (), IL_CAL_UNIX ))
186+ \ilDatePresentation::formatDate (
187+ new \ilDateTime (
188+ time (),
189+ IL_CAL_UNIX
190+ )
191+ )
161192 )
162193 );
163194
164- $ message = $ ntf ->composeAndGetMessage ($ this ->current_user ->getId (), null , 'read ' , true );
195+ $ message = $ ntf ->composeAndGetMessage (
196+ $ this ->current_user ->getId (),
197+ null ,
198+ 'read ' ,
199+ true
200+ );
165201 $ subject = $ this ->lng ->txt ('user_delete_own_account_email_subject ' );
166202
167203 // send notification
@@ -184,7 +220,10 @@ protected function deleteOwnAccountStep3(): void
184220 $ mmail ->Send ();
185221 }
186222
187- $ this ->log ->root ()->log ('Account deleted: ' . $ this ->current_user ->getLogin () . ' ( ' . $ this ->current_user ->getId () . ') ' );
223+ $ this ->log ->root ()->log (
224+ 'Account deleted: ' . $ this ->current_user ->getLogin ()
225+ . ' ( ' . $ this ->current_user ->getId () . ') '
226+ );
188227
189228 $ this ->current_user ->delete ();
190229
0 commit comments