19 declare(strict_types=1);
46 private readonly
User $user,
47 private readonly
UI $ui,
48 private readonly
Routing $routing,
50 private readonly
Closure $query_parameter,
51 private readonly
Provide $legal_documents,
52 private readonly
Closure $after_user_withdrawal
58 $status = $this->
query(
'withdrawal_relogin_content');
59 $lng =
'withdraw_consent_description_' . ($status ===
'external' ?
'external' :
'internal');
62 $this->
ui->create()->divider()->horizontal(),
63 $this->
ui->create()->legacy($this->
ui->txt(
$lng))
69 return $this->
user->withdrawalRequested()->value();
74 if ($this->
user->cannotAgree() || $this->
user->neverAgreed()) {
78 $this->
user->withdrawalRequested()->update(
true);
80 $external = $this->
user->isExternalAccount();
82 $this->routing->ctrl()->setParameterByClass(ilStartUpGUI::class,
'withdrawal_relogin_content', $external ?
'external' :
'internal');
87 $type = $this->
query(
'tos_withdrawal_type');
89 $this->
ui->mainTemplate()->setOnScreenMessage(
'info', match ($type) {
90 'delete_user' => $this->
ui->txt(
'withdrawal_complete_deleted'),
91 'external' => $this->
ui->txt(
'withdrawal_complete_redirect'),
92 null,
'default' => $this->
ui->txt(
'withdrawal_complete'),
107 $this->
user->agreeDate()->update(null);
108 $this->
user->withdrawalRequested()->update(
false);
110 $withdrawal_type =
'default';
111 if ($this->
user->isLDAPUser()) {
113 $withdrawal_type =
'external';
114 } elseif ($this->
settings->deleteUserOnWithdrawal()->value()) {
115 $this->
user->raw()->delete();
116 $withdrawal_type =
'delete_user';
119 ($this->after_user_withdrawal)();
121 $this->legal_documents->withdrawal()->finishAndLogout([
'tos_withdrawal_type' => $withdrawal_type]);
126 $this->
user->withdrawalRequested()->update(
false);
127 $this->routing->redirectToOriginalTarget();
132 $title = $this->
ui->txt(
'refuse_acceptance');
134 if ($this->
user->isLDAPUser()) {
136 $this->
ui->create()->panel()->standard($this->
ui->txt(
'withdraw_usr_agreement'), [
138 $this->
ui->create()->divider()->horizontal(),
139 $this->
ui->create()->legacy(nl2br($this->
user->format($this->ui->txt(
'withdrawal_mail_info') . $this->
ui->txt(
'withdrawal_mail_text'))))
144 $deletion = $this->
settings->deleteUserOnWithdrawal()->value() ?
'_deletion' :
'';
150 $lng_suffix = $this->
user->neverAgreed() ?
'_no_consent_yet' :
'';
151 $question =
'withdrawal_sure_account' . $add_to_question . $lng_suffix;
153 return $this->
ui->create()->messageBox()->confirmation($this->
ui->txt($question))->withButtons([
154 $this->
ui->create()->button()->standard(
155 $this->
ui->txt(
'confirm'),
156 $this->routing->ctrl()->getLinkTargetByClass($gui,
'indeed')
158 $this->
ui->create()->button()->standard(
159 $this->
ui->txt(
'cancel'),
160 $this->routing->ctrl()->getLinkTargetByClass($gui,
'cancel')
168 $mail->setRecipients([$this->
settings->adminEmail()->value()]);
169 $mail->sendGeneric($this->
ui->txt(
'withdrawal_mail_subject'), $this->
user->format($this->
ui->txt(
'withdrawal_mail_text')));
174 return new PageContent($this->
ui->txt(
'refuse_tos_acceptance'), $components);
177 private function query(
string $query_parameter): ?string
179 return ($this->query_parameter)($query_parameter, fn(
Refinery $r) => $r->byTrying([
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
RFC 822 Email address list validation Utility.