ILIAS  release_8 Revision v8.24
ilTermsOfServiceWithdrawalGUIHelper Class Reference

Class ilTermsOfServiceWithdrawalGUIHelper. More...

+ Collaboration diagram for ilTermsOfServiceWithdrawalGUIHelper:

Public Member Functions

 __construct (ilObjUser $subjectUser)
 
 modifyFooter (Footer $footer)
 
 handleWithdrawalLogoutRequest (ServerRequestInterface $httpRequest, object $guiClass)
 
 getWithdrawalTextForLogoutScreen (ServerRequestInterface $httpRequest)
 
 getConsentWithdrawalConfirmation (object $parentObject)
 
 setWithdrawalInfoForLoginScreen (ServerRequestInterface $httpRequest)
 

Protected Attributes

ilLanguage $lng
 
ilCtrlInterface $ctrl
 
ilSetting $setting
 
ilObjUser $user
 
Factory $uiFactory
 
Renderer $uiRenderer
 
ilTermsOfServiceHelper $tosHelper
 

Private Member Functions

 getWithdrawalSectionForModal ()
 

Private Attributes

ilGlobalTemplateInterface $main_tpl
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTermsOfServiceWithdrawalGUIHelper::__construct ( ilObjUser  $subjectUser)

Definition at line 41 of file class.ilTermsOfServiceWithdrawalGUIHelper.php.

42 {
43 global $DIC;
44 $this->main_tpl = $DIC->ui()->mainTemplate();
45
46 $this->user = $subjectUser;
47
48 $this->lng = $DIC->language();
49 $this->ctrl = $DIC->ctrl();
50 $this->setting = $DIC->settings();
51 $this->uiFactory = $DIC->ui()->factory();
52 $this->uiRenderer = $DIC->ui()->renderer();
53 $this->tosHelper = new ilTermsOfServiceHelper();
54 }
Class ilTermsOfServiceHelper.
global $DIC
Definition: feed.php:28

References $DIC, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ getConsentWithdrawalConfirmation()

ilTermsOfServiceWithdrawalGUIHelper::getConsentWithdrawalConfirmation ( object  $parentObject)

Definition at line 160 of file class.ilTermsOfServiceWithdrawalGUIHelper.php.

160 : string
161 {
162 $defaultAuth = ilAuthUtils::AUTH_LOCAL;
163 if ($this->setting->get('auth_mode')) {
164 $defaultAuth = $this->setting->get('auth_mode');
165 }
166
167 $isLdapUser = (
168 $this->user->getAuthMode() == ilAuthUtils::AUTH_LDAP ||
169 ($this->user->getAuthMode() === 'default' && $defaultAuth == ilAuthUtils::AUTH_LDAP)
170 );
171
172 $lng_suffix = '';
173 if (!$this->user->getAgreeDate()) {
174 $lng_suffix = '_no_consent_yet';
175 }
176 $question = $this->lng->txt('withdrawal_sure_account' . $lng_suffix);
177 if (!$isLdapUser && $this->setting->get('tos_withdrawal_usr_deletion', '0')) {
178 $question = $this->lng->txt('withdrawal_sure_account_deletion' . $lng_suffix);
179 }
180
181 $confirmation = $this->uiFactory->messageBox()->confirmation($question)->withButtons([
182 $this->uiFactory->button()->standard(
183 $this->lng->txt('confirm'),
184 $this->ctrl->getFormAction($parentObject, 'withdrawAcceptance')
185 ),
186 $this->uiFactory->button()->standard(
187 $this->lng->txt('cancel'),
188 $this->ctrl->getFormAction($parentObject, 'cancelWithdrawal')
189 ),
190 ]);
191
192 if ($isLdapUser) {
193 $message = nl2br(str_ireplace('[BR]', "\n", sprintf(
194 $this->lng->txt('withdrawal_mail_info') . $this->lng->txt('withdrawal_mail_text'),
195 $this->user->getFullname(),
196 $this->user->getLogin(),
197 $this->user->getExternalAccount()
198 )));
199
200 $panelContent = $this->uiFactory->legacy(
201 $this->uiRenderer->render([
202 $confirmation,
203 $this->uiFactory->divider()->horizontal(),
204 $this->uiFactory->legacy($message)
205 ])
206 );
207
208 $content = $this->uiRenderer->render(
209 $this->uiFactory->panel()->standard($this->lng->txt('withdraw_usr_agreement'), $panelContent)
210 );
211 } else {
212 $content = $this->uiRenderer->render($confirmation);
213 }
214
215 return $content;
216 }
$message
Definition: xapiexit.php:32

References $message, ilAuthUtils\AUTH_LDAP, ilAuthUtils\AUTH_LOCAL, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ getWithdrawalSectionForModal()

ilTermsOfServiceWithdrawalGUIHelper::getWithdrawalSectionForModal ( )
private

Definition at line 56 of file class.ilTermsOfServiceWithdrawalGUIHelper.php.

57 {
58 $template = new ilTemplate('tpl.tos_withdrawal_section.html', true, true, 'Services/TermsOfService');
59 $template->setVariable('TXT_TOS_WITHDRAWAL_HEADLINE', $this->lng->txt('withdraw_consent_header'));
60 $template->setVariable('TXT_TOS_WITHDRAWAL', $this->lng->txt('withdraw_consent_description'));
61 $template->setVariable(
62 'BTN_TOS_WITHDRAWAL',
63 $this->uiRenderer->render(
64 $this->uiFactory->button()->standard($this->lng->txt('withdraw_consent'), ilStartUpGUI::logoutUrl(['withdraw_consent' => '']))
65 )
66 );
67
68 return $template;
69 }
static logoutUrl(array $parameters=[])
Return the logout URL with a valid CSRF token.
special template class to simplify handling of ITX/PEAR

References ILIAS\Repository\lng(), and ilStartUpGUI\logoutUrl().

+ Here is the call graph for this function:

◆ getWithdrawalTextForLogoutScreen()

ilTermsOfServiceWithdrawalGUIHelper::getWithdrawalTextForLogoutScreen ( ServerRequestInterface  $httpRequest)

Definition at line 143 of file class.ilTermsOfServiceWithdrawalGUIHelper.php.

143 : string
144 {
145 $withdrawalStatus = ($httpRequest->getQueryParams()['withdrawal_relogin_content'] ?? 0);
146
147 $text = '';
148 if ($withdrawalStatus !== 0) {
149 $text = $this->uiRenderer->render($this->uiFactory->divider()->horizontal());
150 if ($withdrawalStatus === 'internal') {
151 $text .= $this->lng->txt('withdraw_consent_description_internal');
152 } else {
153 $text .= $this->lng->txt('withdraw_consent_description_external');
154 }
155 }
156
157 return $text;
158 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ handleWithdrawalLogoutRequest()

ilTermsOfServiceWithdrawalGUIHelper::handleWithdrawalLogoutRequest ( ServerRequestInterface  $httpRequest,
object  $guiClass 
)

Definition at line 107 of file class.ilTermsOfServiceWithdrawalGUIHelper.php.

110 : void {
111 if (!isset($httpRequest->getQueryParams()['withdraw_consent'])) {
112 return;
113 }
114
115 if (!$this->tosHelper->isGloballyEnabled() || !$this->tosHelper->isIncludedUser($this->user)) {
116 return;
117 }
118
119 $defaultAuth = ilAuthUtils::AUTH_LOCAL;
120 if ($this->setting->get('auth_mode')) {
121 $defaultAuth = $this->setting->get('auth_mode');
122 }
123
124 $external = false;
125 if (
126 $this->user->getAuthMode() == ilAuthUtils::AUTH_PROVIDER_LTI ||
127 $this->user->getAuthMode() == ilAuthUtils::AUTH_ECS ||
128 ($this->user->getAuthMode() === 'default' && $defaultAuth == ilAuthUtils::AUTH_PROVIDER_LTI) ||
129 ($this->user->getAuthMode() === 'default' && $defaultAuth == ilAuthUtils::AUTH_ECS)
130 ) {
131 $external = true;
132 }
133
134 $this->user->writePref('consent_withdrawal_requested', '1');
135
136 if ($external) {
137 $this->ctrl->setParameter($guiClass, 'withdrawal_relogin_content', 'external');
138 } else {
139 $this->ctrl->setParameter($guiClass, 'withdrawal_relogin_content', 'internal');
140 }
141 }

◆ modifyFooter()

ilTermsOfServiceWithdrawalGUIHelper::modifyFooter ( Footer  $footer)
Parameters
Footer$footer
Returns
Footer
Exceptions
ilTermsOfServiceMissingDatabaseAdapterException

Definition at line 76 of file class.ilTermsOfServiceWithdrawalGUIHelper.php.

76 : Footer
77 {
78 if (
79 $this->tosHelper->isGloballyEnabled() &&
80 $this->tosHelper->isIncludedUser($this->user) &&
81 $this->user->getAgreeDate()
82 ) {
83 $entity = $this->tosHelper->getCurrentAcceptanceForUser($this->user);
84 if ($entity->getId()) {
85 $footer = $footer->withAdditionalModalAndTrigger(
86 $this->uiFactory->modal()->roundtrip(
87 $entity->getTitle(),
88 [
89 $this->uiFactory->legacy($this->lng->txt('usr_agreement_footer_intro')),
90 $this->uiFactory->divider()->horizontal(),
91 $this->uiFactory->legacy(
92 implode('', [
93 $entity->getText(),
94 $this->getWithdrawalSectionForModal()->get()
95 ])
96 )
97 ]
98 ),
99 $this->uiFactory->button()->shy($this->lng->txt('usr_agreement'), '#')
100 );
101 }
102 }
103
104 return $footer;
105 }
This describes the Footer.
Definition: Footer.php:33
withAdditionalModalAndTrigger(Modal\RoundTrip $roundTripModal, Button\Shy $shyButton)

References ILIAS\Repository\user(), and ILIAS\UI\Component\MainControls\Footer\withAdditionalModalAndTrigger().

+ Here is the call graph for this function:

◆ setWithdrawalInfoForLoginScreen()

ilTermsOfServiceWithdrawalGUIHelper::setWithdrawalInfoForLoginScreen ( ServerRequestInterface  $httpRequest)

Definition at line 218 of file class.ilTermsOfServiceWithdrawalGUIHelper.php.

218 : void
219 {
220 if (isset($httpRequest->getQueryParams()['tos_withdrawal_type'])) {
221 $withdrawalType = (int) $httpRequest->getQueryParams()['tos_withdrawal_type'];
222 if (1 === $withdrawalType) {
223 $this->main_tpl->setOnScreenMessage('info', $this->lng->txt('withdrawal_complete_deleted'));
224 } elseif (2 === $withdrawalType) {
225 $this->main_tpl->setOnScreenMessage('info', $this->lng->txt('withdrawal_complete_redirect'));
226 } else {
227 $this->main_tpl->setOnScreenMessage('info', $this->lng->txt('withdrawal_complete'));
228 }
229 }
230 }

References ILIAS\Repository\int(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrlInterface ilTermsOfServiceWithdrawalGUIHelper::$ctrl
protected

◆ $lng

ilLanguage ilTermsOfServiceWithdrawalGUIHelper::$lng
protected

◆ $main_tpl

ilGlobalTemplateInterface ilTermsOfServiceWithdrawalGUIHelper::$main_tpl
private

◆ $setting

ilSetting ilTermsOfServiceWithdrawalGUIHelper::$setting
protected

◆ $tosHelper

ilTermsOfServiceHelper ilTermsOfServiceWithdrawalGUIHelper::$tosHelper
protected

◆ $uiFactory

Factory ilTermsOfServiceWithdrawalGUIHelper::$uiFactory
protected

◆ $uiRenderer

Renderer ilTermsOfServiceWithdrawalGUIHelper::$uiRenderer
protected

◆ $user

ilObjUser ilTermsOfServiceWithdrawalGUIHelper::$user
protected

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