ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\WithdrawProcess Class Reference
+ Inheritance diagram for ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\WithdrawProcess:
+ Collaboration diagram for ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\WithdrawProcess:

Public Member Functions

 __construct (private readonly User $user, private readonly UI $ui, private readonly Routing $routing, private readonly Settings $settings, private readonly Closure $query_parameter, private readonly Provide $legal_documents, private readonly Closure $after_user_withdrawal)
 
 showValidatePasswordMessage ()
 
 isOnGoing ()
 
 withdrawalFinished ()
 
 showWithdraw (string $gui, string $cmd)
 
 showWithdraw (string $gui, string $cmd)
 
 showValidatePasswordMessage ()
 
 isOnGoing ()
 
 withdrawalFinished ()
 

Private Member Functions

 withdrawalRequested ()
 
 withdraw ()
 
 cancelWithdrawal ()
 
 showWithdrawConfirmation (string $gui, string $cmd)
 
 confirmation (string $gui, string $add_to_question='')
 
 sendMail ()
 
 query (string $query_parameter)
 

Detailed Description

Definition at line 37 of file WithdrawProcess.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\WithdrawProcess::__construct ( private readonly User  $user,
private readonly UI  $ui,
private readonly Routing  $routing,
private readonly Settings  $settings,
private readonly Closure  $query_parameter,
private readonly Provide  $legal_documents,
private readonly Closure  $after_user_withdrawal 
)
Parameters
Closure(string,Closure(Refinery)Transformation): mixed $query_parameter
Closure()void $after_user_withdrawal

Definition at line 43 of file WithdrawProcess.php.

51 {
52 }

Member Function Documentation

◆ cancelWithdrawal()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\WithdrawProcess::cancelWithdrawal ( )
private

Definition at line 125 of file WithdrawProcess.php.

125 : void
126 {
127 $this->user->withdrawalRequested()->update(false);
128 $this->routing->redirectToOriginalTarget();
129 }

References ILIAS\Repository\user().

Referenced by ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\WithdrawProcess\showWithdraw().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmation()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\WithdrawProcess::confirmation ( string  $gui,
string  $add_to_question = '' 
)
private

Definition at line 149 of file WithdrawProcess.php.

149 : Component
150 {
151 $lng_suffix = $this->user->neverAgreed() ? '_no_consent_yet' : '';
152 $question = 'withdrawal_sure_account' . $add_to_question . $lng_suffix;
153
154 return $this->ui->create()->messageBox()->confirmation($this->ui->txt($question))->withButtons([
155 $this->ui->create()->button()->standard(
156 $this->ui->txt('confirm'),
157 $this->routing->ctrl()->getLinkTargetByClass($gui, 'indeed')
158 ),
159 $this->ui->create()->button()->standard(
160 $this->ui->txt('cancel'),
161 $this->routing->ctrl()->getLinkTargetByClass($gui, 'cancel')
162 ),
163 ]);
164 }

References ILIAS\Repository\ui(), and ILIAS\Repository\user().

Referenced by ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\WithdrawProcess\showWithdrawConfirmation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isOnGoing()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\WithdrawProcess::isOnGoing ( )

Implements ILIAS\LegalDocuments\ConsumerSlots\WithdrawProcess.

Definition at line 68 of file WithdrawProcess.php.

68 : bool
69 {
70 return $this->user->withdrawalRequested()->value();
71 }

References ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ query()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\WithdrawProcess::query ( string  $query_parameter)
private

Definition at line 173 of file WithdrawProcess.php.

173 : ?string
174 {
175 return ($this->query_parameter)($query_parameter, fn(Refinery $r) => $r->byTrying([
176 $r->null(),
177 $r->to()->string(),
178 ]));
179 }

Referenced by ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\WithdrawProcess\withdrawalFinished().

+ Here is the caller graph for this function:

◆ sendMail()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\WithdrawProcess::sendMail ( )
private

Definition at line 166 of file WithdrawProcess.php.

166 : void
167 {
168 $mail = new Mail();
169 $mail->setRecipients([$this->settings->adminEmail()->value()]);
170 $mail->sendGeneric($this->ui->txt('withdrawal_mail_subject'), $this->user->format($this->ui->txt('withdrawal_mail_text')));
171 }
RFC 822 Email address list validation Utility.

References ILIAS\Repository\settings(), and ILIAS\Repository\ui().

Referenced by ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\WithdrawProcess\withdraw().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showValidatePasswordMessage()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\WithdrawProcess::showValidatePasswordMessage ( )
Returns
list<Component>

Implements ILIAS\LegalDocuments\ConsumerSlots\WithdrawProcess.

Definition at line 54 of file WithdrawProcess.php.

54 : array
55 {
56 $status = $this->withdrawalRequested();
57 if ($status === null) {
58 return [];
59 }
60 $lng = 'withdraw_consent_description_' . ($status === 'external' ? 'external' : 'internal');
61
62 return [
63 $this->ui->create()->divider()->horizontal(),
64 $this->ui->create()->legacy()->content($this->ui->txt($lng))
65 ];
66 }
global $lng
Definition: privfeed.php:31

References $lng, ILIAS\Repository\ui(), and ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\WithdrawProcess\withdrawalRequested().

+ Here is the call graph for this function:

◆ showWithdraw()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\WithdrawProcess::showWithdraw ( string  $gui,
string  $cmd 
)

◆ showWithdrawConfirmation()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\WithdrawProcess::showWithdrawConfirmation ( string  $gui,
string  $cmd 
)
private

Definition at line 131 of file WithdrawProcess.php.

131 : PageFragment
132 {
133 $title = $this->ui->txt('refuse_acceptance');
134
135 if ($this->user->isLDAPUser()) {
136 return new PageContent($title, [
137 $this->ui->create()->panel()->standard($this->ui->txt('withdraw_usr_agreement'), [
138 $this->confirmation($gui),
139 $this->ui->create()->divider()->horizontal(),
140 $this->ui->create()->legacy()->content(nl2br($this->user->format($this->ui->txt('withdrawal_mail_info') . $this->ui->txt('withdrawal_mail_text'))))
141 ])
142 ]);
143 }
144
145 $deletion = $this->settings->deleteUserOnWithdrawal()->value() ? '_deletion' : '';
146 return new PageContent($title, [$this->confirmation($gui, $deletion)]);
147 }

References ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\WithdrawProcess\confirmation(), ILIAS\Repository\settings(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

Referenced by ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\WithdrawProcess\showWithdraw().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ withdraw()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\WithdrawProcess::withdraw ( )
private

Definition at line 106 of file WithdrawProcess.php.

106 : void
107 {
108 $this->user->agreeDate()->update(null);
109 $this->user->withdrawalRequested()->update(false);
110
111 $withdrawal_type = 'default';
112 if ($this->user->isLDAPUser()) {
113 $this->sendMail();
114 $withdrawal_type = 'external';
115 } elseif ($this->settings->deleteUserOnWithdrawal()->value()) {
116 $this->user->raw()->delete();
117 $withdrawal_type = 'delete_user';
118 }
119
120 ($this->after_user_withdrawal)();
121
122 $this->legal_documents->withdrawal()->finishAndLogout(['tos_withdrawal_type' => $withdrawal_type]);
123 }

References ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\WithdrawProcess\sendMail(), ILIAS\Repository\settings(), and ILIAS\Repository\user().

Referenced by ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\WithdrawProcess\showWithdraw().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ withdrawalFinished()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\WithdrawProcess::withdrawalFinished ( )

Implements ILIAS\LegalDocuments\ConsumerSlots\WithdrawProcess.

Definition at line 86 of file WithdrawProcess.php.

86 : void
87 {
88 $type = $this->query('tos_withdrawal_type');
89
90 $this->ui->mainTemplate()->setOnScreenMessage('info', match ($type) {
91 'delete_user' => $this->ui->txt('withdrawal_complete_deleted'),
92 'external' => $this->ui->txt('withdrawal_complete_redirect'),
93 null, 'default' => $this->ui->txt('withdrawal_complete'),
94 });
95 }

References ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\WithdrawProcess\query(), and ILIAS\Repository\ui().

+ Here is the call graph for this function:

◆ withdrawalRequested()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\WithdrawProcess::withdrawalRequested ( )
private

Definition at line 73 of file WithdrawProcess.php.

73 : ?string
74 {
75 if ($this->user->cannotAgree() || $this->user->neverAgreed()) {
76 return null;
77 }
78
79 $this->user->withdrawalRequested()->update(true);
80
81 $external = $this->user->isExternalAccount();
82
83 return $external ? 'external' : 'internal';
84 }

References ILIAS\Repository\user().

Referenced by ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\WithdrawProcess\showValidatePasswordMessage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: