19 declare(strict_types=1);
44 $this->main_tpl = $DIC->ui()->mainTemplate();
46 $this->
user = $subjectUser;
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();
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(
63 $this->uiRenderer->render(
79 $this->tosHelper->isGloballyEnabled() &&
80 $this->tosHelper->isIncludedUser($this->
user) &&
81 $this->
user->getAgreeDate()
83 $entity = $this->tosHelper->getCurrentAcceptanceForUser($this->
user);
84 if ($entity->getId()) {
86 $this->uiFactory->modal()->roundtrip(
89 $this->uiFactory->legacy($this->
lng->txt(
'usr_agreement_footer_intro')),
90 $this->uiFactory->divider()->horizontal(),
91 $this->uiFactory->legacy(
99 $this->uiFactory->button()->shy($this->
lng->txt(
'usr_agreement'),
'#')
108 ServerRequestInterface $httpRequest,
111 if (!isset($httpRequest->getQueryParams()[
'withdraw_consent'])) {
115 if (!$this->tosHelper->isGloballyEnabled() || !$this->tosHelper->isIncludedUser($this->
user)) {
120 if ($this->setting->get(
'auth_mode')) {
121 $defaultAuth = $this->setting->get(
'auth_mode');
134 $this->
user->writePref(
'consent_withdrawal_requested',
'1');
137 $this->
ctrl->setParameter($guiClass,
'withdrawal_relogin_content',
'external');
139 $this->
ctrl->setParameter($guiClass,
'withdrawal_relogin_content',
'internal');
145 $withdrawalStatus = ($httpRequest->getQueryParams()[
'withdrawal_relogin_content'] ?? 0);
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');
153 $text .= $this->
lng->txt(
'withdraw_consent_description_external');
163 if ($this->setting->get(
'auth_mode')) {
164 $defaultAuth = $this->setting->get(
'auth_mode');
173 if (!$this->
user->getAgreeDate()) {
174 $lng_suffix =
'_no_consent_yet';
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);
181 $confirmation = $this->uiFactory->messageBox()->confirmation($question)->withButtons([
182 $this->uiFactory->button()->standard(
183 $this->
lng->txt(
'confirm'),
184 $this->
ctrl->getFormAction($parentObject,
'withdrawAcceptance')
186 $this->uiFactory->button()->standard(
187 $this->
lng->txt(
'cancel'),
188 $this->
ctrl->getFormAction($parentObject,
'cancelWithdrawal')
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()
200 $panelContent = $this->uiFactory->legacy(
201 $this->uiRenderer->render([
203 $this->uiFactory->divider()->horizontal(),
208 $content = $this->uiRenderer->render(
209 $this->uiFactory->panel()->standard($this->
lng->txt(
'withdraw_usr_agreement'), $panelContent)
212 $content = $this->uiRenderer->render($confirmation);
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'));
227 $this->main_tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'withdrawal_complete'));
getWithdrawalSectionForModal()
Class ilTermsOfServiceWithdrawalGUIHelper.
An entity that renders components to a string output.
ilGlobalTemplateInterface $main_tpl
__construct(ilObjUser $subjectUser)
withAdditionalModalAndTrigger(Modal\RoundTrip $roundTripModal, Button\Shy $shyButton)
getWithdrawalTextForLogoutScreen(ServerRequestInterface $httpRequest)
handleWithdrawalLogoutRequest(ServerRequestInterface $httpRequest, object $guiClass)
static logoutUrl(array $parameters=[])
Return the logout URL with a valid CSRF token.
ilTermsOfServiceHelper $tosHelper
modifyFooter(Footer $footer)
Class ilTermsOfServiceHelper.
setWithdrawalInfoForLoginScreen(ServerRequestInterface $httpRequest)
getConsentWithdrawalConfirmation(object $parentObject)
This describes the Footer.