ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 28 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 30 of file class.DeleteAccountGUI.php.

42 {
43 }

Member Function Documentation

◆ abortDeleteOwnAccount()

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

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

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

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

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

References ILIAS\Repository\ctrl(), 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 52 of file class.DeleteAccountGUI.php.

52 : void
53 {
54 if (!(bool) $this->settings->get('user_delete_own_account') ||
55 $this->current_user->getId() === SYSTEM_USER_ID) {
56 $this->ctrl->redirectByClass(
57 [\ilDashboardGUI::class, PersonalSettingsGUI::class],
58 'show'
59 );
60 }
61
62 // to make sure
63 $this->current_user->removeDeletionFlag();
64
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'));
70
71 $this->tpl->setOnScreenMessage('info', $this->lng->txt('user_delete_own_account_info'));
72 $this->toolbar->addComponent(
73 $this->ui_factory->button()->standard(
74 $this->lng->txt('btn_next'),
75 $modal->getShowSignal()
76 )
77 );
78
79 $this->tpl->setContent($this->ui_renderer->render($modal));
80
81 $this->tpl->printToStdout();
82 }
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 102 of file class.DeleteAccountGUI.php.

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

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

133 : void
134 {
135 if (
136 !(bool) $this->settings->get('user_delete_own_account') ||
137 $this->current_user->getId() === SYSTEM_USER_ID ||
138 !$this->current_user->hasDeletionFlag()
139 ) {
140 $this->ctrl->redirect($this, 'showGeneralSettings');
141 }
142
143 // build notification
144
145 $ntf = new \ilSystemNotification();
146 $ntf->setLangModules(['user']);
147 $ntf->addAdditionalInfo('profile', $this->current_user->getProfileAsString($this->lng), true);
148
149 // mail message
151 $ntf->setIntroductionDirect(
152 sprintf(
153 $this->lng->txt('user_delete_own_account_email_body'),
154 $this->current_user->getLogin(),
155 ILIAS_HTTP_PATH,
157 )
158 );
159
160 $message = $ntf->composeAndGetMessage($this->current_user->getId(), null, 'read', true);
161 $subject = $this->lng->txt('user_delete_own_account_email_subject');
162
163 // send notification
164 $user_email = $this->current_user->getEmail();
165 $admin_mail = $this->settings->get('user_delete_own_account_email');
166
167 $mmail = new \ilMimeMail();
168 $mmail->From($this->mail_sender_factory->system());
169
170 if ($user_email !== '') {
171 $mmail->To($user_email);
172 $mmail->Bcc($admin_mail);
173 $mmail->Subject($subject, true);
174 $mmail->Body($message);
175 $mmail->Send();
176 } elseif ($admin_mail !== null || $admin_mail !== '') {
177 $mmail->To($admin_mail);
178 $mmail->Subject($subject, true);
179 $mmail->Body($message);
180 $mmail->Send();
181 }
182
183 $this->log->root()->log('Account deleted: ' . $this->current_user->getLogin() . ' (' . $this->current_user->getId() . ')');
184
185 $this->current_user->delete();
186
187 // terminate session
188 $this->auth_session->logout();
189 $this->ctrl->redirectToURL('login.php?accdel=1');
190 }
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
$message
Definition: xapiexit.php:31

References $message, 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 45 of file class.DeleteAccountGUI.php.

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

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: