19declare(strict_types=1);
33 private readonly \
ilCtrl $ctrl,
36 private readonly UIFactory $ui_factory,
37 private readonly UIRenderer $ui_renderer,
49 $this->tpl->setTitle($this->
lng->txt(
'user_delete_own_account'));
50 $cmd = $this->
ctrl->getCmd(
'deleteOwnAccountStep1');
56 if (!(
bool) $this->
settings->get(
'user_delete_own_account') ||
58 $this->
ctrl->redirectByClass(
59 [\ilDashboardGUI::class, PersonalSettingsGUI::class],
65 $this->current_user->removeDeletionFlag();
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(
72 'deleteOwnAccountLogout'
74 )->withActionButtonLabel(
75 $this->
lng->txt(
'user_delete_own_account_logout_button')
78 $this->tpl->setOnScreenMessage(
80 $this->
lng->txt(
'user_delete_own_account_info')
83 $this->ui_factory->button()->standard(
84 $this->lng->txt(
'btn_next'),
85 $modal->getShowSignal()
89 $this->tpl->setContent($this->ui_renderer->render($modal));
91 $this->tpl->printToStdout();
96 $this->current_user->removeDeletionFlag();
98 $this->tpl->setOnScreenMessage(
100 $this->
lng->txt(
'user_delete_own_account_aborted'),
103 $this->
ctrl->redirectByClass(
104 [\ilDashboardGUI::class, PersonalSettingsGUI::class],
111 $this->current_user->activateDeletionFlag();
114 $this->auth_session->logout();
116 $this->
ctrl->redirectToURL(
117 'login.php?cmd=force_login&target=usr_'
125 !(
bool) $this->
settings->get(
'user_delete_own_account') ||
127 !$this->current_user->hasDeletionFlag()
129 $this->
ctrl->redirect($this,
'showGeneralSettings');
132 $this->tpl->setOnScreenMessage(
134 $this->
lng->txt(
'user_delete_own_account_final_confirmation')
138 $this->ui_factory->button()->standard(
139 $this->lng->txt(
'confirm'),
140 $this->ctrl->getLinkTargetByClass(
142 'deleteOwnAccountStep3'
148 $this->ui_factory->button()->standard(
149 $this->lng->txt(
'cancel'),
150 $this->ctrl->getLinkTargetByClass(
152 'abortDeleteOwnAccount'
156 $this->tpl->printToStdout();
162 !(
bool) $this->
settings->get(
'user_delete_own_account') ||
164 !$this->current_user->hasDeletionFlag()
166 $this->
ctrl->redirect($this,
'showGeneralSettings');
171 $ntf = new \ilSystemNotification();
172 $ntf->setLangModules([
'user']);
173 $ntf->addAdditionalInfo(
175 $this->current_user->getProfileAsString($this->lng),
181 $ntf->setIntroductionDirect(
183 $this->
lng->txt(
'user_delete_own_account_email_body'),
184 $this->current_user->getLogin(),
195 $message = $ntf->composeAndGetMessage(
196 $this->current_user->getId(),
201 $subject = $this->
lng->txt(
'user_delete_own_account_email_subject');
204 $user_email = $this->current_user->getEmail();
205 $admin_mail = $this->
settings->get(
'user_delete_own_account_email');
207 $mmail = new \ilMimeMail();
208 $mmail->From($this->mail_sender_factory->system());
210 if ($user_email !==
'') {
211 $mmail->To($user_email);
212 $mmail->Bcc($admin_mail);
213 $mmail->Subject($subject,
true);
214 $mmail->Body($message);
216 } elseif ($admin_mail !==
null || $admin_mail !==
'') {
217 $mmail->To($admin_mail);
218 $mmail->Subject($subject,
true);
219 $mmail->Body($message);
223 $this->log->root()->log(
224 'Account deleted: ' . $this->current_user->getLogin()
225 .
' (' . $this->current_user->getId() .
')'
228 $this->current_user->delete();
231 $this->auth_session->logout();
232 $this->
ctrl->redirectToURL(
'login.php?accdel=1');
Provides fluid interface to LoggingServices.
Builds a Color from either hex- or rgb values.
__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)
@ilCtrl_Calls ILIAS\User\Settings\PersonalSettingsGUI: ILIAS\User\Account\DeleteAccountGUI @ilCtrl_Ca...
const DEL_OWN_ACCOUNT_OPERATION
Class ilCtrl provides processing control methods.
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
static setClosingContext(int $a_context)
set closing context (for statistics)
const int SESSION_CLOSE_USER
const SYSTEM_USER_ID
This file contains constants for PHPStan analyis, see: https://phpstan.org/config-reference#constants...
An entity that renders components to a string output.