19declare(strict_types=1);
31 private readonly \
ilCtrl $ctrl,
34 private readonly UIFactory $ui_factory,
35 private readonly UIRenderer $ui_renderer,
47 $this->tpl->setTitle($this->
lng->txt(
'user_delete_own_account'));
48 $cmd = $this->
ctrl->getCmd(
'showGeneralSettings');
49 $this->$cmd() .
'Cmd';
54 if (!(
bool) $this->
settings->get(
'user_delete_own_account') ||
56 $this->
ctrl->redirectByClass(
57 [\ilDashboardGUI::class, PersonalSettingsGUI::class],
63 $this->current_user->removeDeletionFlag();
65 $modal = $this->ui_factory->modal()->interruptive(
66 $this->
lng->txt(
'user_delete_own_account'),
67 $this->lng->txt(
'user_delete_own_account_logout_confirmation'),
68 $this->ctrl->getFormActionByClass(self::class,
'deleteOwnAccountLogout')
69 )->withActionButtonLabel($this->
lng->txt(
'user_delete_own_account_logout_button'));
71 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'user_delete_own_account_info'));
73 $this->ui_factory->button()->standard(
74 $this->lng->txt(
'btn_next'),
75 $modal->getShowSignal()
79 $this->tpl->setContent($this->ui_renderer->render($modal));
81 $this->tpl->printToStdout();
86 $this->current_user->removeDeletionFlag();
88 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'user_delete_own_account_aborted'),
true);
89 $this->
ctrl->redirect($this,
'showGeneralSettings');
94 $this->current_user->activateDeletionFlag();
97 $this->auth_session->logout();
99 $this->
ctrl->redirectToURL(
'login.php?cmd=force_login&target=usr_' . md5(
'usrdelown'));
105 !(
bool) $this->
settings->get(
'user_delete_own_account') ||
107 !$this->current_user->hasDeletionFlag()
109 $this->
ctrl->redirect($this,
'showGeneralSettings');
112 $this->tpl->setOnScreenMessage(
114 $this->
lng->txt(
'user_delete_own_account_final_confirmation')
118 $this->ui_factory->button()->standard(
119 $this->lng->txt(
'confirm'),
120 $this->ctrl->getLinkTargetByClass(self::class,
'deleteOwnAccountStep3')
125 $this->ui_factory->button()->standard(
126 $this->lng->txt(
'cancel'),
127 $this->ctrl->getLinkTargetByClass(self::class,
'abortDeleteOwnAccount')
130 $this->tpl->printToStdout();
136 !(
bool) $this->
settings->get(
'user_delete_own_account') ||
138 !$this->current_user->hasDeletionFlag()
140 $this->
ctrl->redirect($this,
'showGeneralSettings');
145 $ntf = new \ilSystemNotification();
146 $ntf->setLangModules([
'user']);
147 $ntf->addAdditionalInfo(
'profile', $this->current_user->getProfileAsString($this->lng),
true);
151 $ntf->setIntroductionDirect(
153 $this->
lng->txt(
'user_delete_own_account_email_body'),
154 $this->current_user->getLogin(),
160 $message = $ntf->composeAndGetMessage($this->current_user->getId(),
null,
'read',
true);
161 $subject = $this->
lng->txt(
'user_delete_own_account_email_subject');
164 $user_email = $this->current_user->getEmail();
165 $admin_mail = $this->
settings->get(
'user_delete_own_account_email');
167 $mmail = new \ilMimeMail();
168 $mmail->From($this->mail_sender_factory->system());
170 if ($user_email !==
'') {
171 $mmail->To($user_email);
172 $mmail->Bcc($admin_mail);
173 $mmail->Subject($subject,
true);
176 } elseif ($admin_mail !==
null || $admin_mail !==
'') {
177 $mmail->To($admin_mail);
178 $mmail->Subject($subject,
true);
183 $this->log->root()->log(
'Account deleted: ' . $this->current_user->getLogin() .
' (' . $this->current_user->getId() .
')');
185 $this->current_user->delete();
188 $this->auth_session->logout();
189 $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)
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.