ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTermsOfServiceWithdrawalGUIHelper Class Reference

Class ilTermsOfServiceWithdrawalGUIHelper. More...

+ Collaboration diagram for ilTermsOfServiceWithdrawalGUIHelper:

Public Member Functions

 __construct (ilObjUser $subjectUser)
 ilTermsOfServiceWithdrawalGUIHelper constructor. More...
 
 modifyFooter (Footer $footer)
 
 handleWithdrawalLogoutRequest (RequestInterface $httpRequest, object $guiClass)
 
 getWithdrawalTextForLogoutScreen (RequestInterface $httpRequest)
 
 getConsentWithdrawalConfirmation (object $parentObject)
 
 setWithdrawalInfoForLoginScreen (RequestInterface $httpRequest)
 

Protected Attributes

 $lng
 
 $ctrl
 
 $setting
 
 $tpl
 
 $user
 
 $uiFactory
 
 $uiRenderer
 
 $tosHelper
 

Private Member Functions

 getWithdrawalSectionForModal ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTermsOfServiceWithdrawalGUIHelper::__construct ( ilObjUser  $subjectUser)

ilTermsOfServiceWithdrawalGUIHelper constructor.

Parameters
ilObjUser$subjectUser

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

References $DIC, and user().

36  {
37  global $DIC;
38 
39  $this->user = $subjectUser;
40 
41  $this->lng = $DIC->language();
42  $this->ctrl = $DIC->ctrl();
43  $this->setting = $DIC->settings();
44  $this->tpl = $DIC->ui()->mainTemplate();
45  $this->uiFactory = $DIC->ui()->factory();
46  $this->uiRenderer = $DIC->ui()->renderer();
47  $this->tosHelper = new ilTermsOfServiceHelper();
48  }
user()
Definition: user.php:4
global $DIC
Definition: goto.php:24
Class ilTermsOfServiceHelper.
+ Here is the call graph for this function:

Member Function Documentation

◆ getConsentWithdrawalConfirmation()

ilTermsOfServiceWithdrawalGUIHelper::getConsentWithdrawalConfirmation ( object  $parentObject)
Parameters
object$parentObject
Returns
string

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

References $message, AUTH_LDAP, AUTH_LOCAL, and user().

170  : string
171  {
172  $defaultAuth = AUTH_LOCAL;
173  if ($this->setting->get('auth_mode')) {
174  $defaultAuth = $this->setting->get('auth_mode');
175  }
176 
177  $isLdapUser = (
178  $this->user->getAuthMode() == AUTH_LDAP ||
179  ($this->user->getAuthMode() === 'default' && $defaultAuth == AUTH_LDAP)
180  );
181 
182  $lng_suffix = '';
183  if (!$this->user->getAgreeDate()) {
184  $lng_suffix = '_no_consent_yet';
185  }
186  $question = $this->lng->txt('withdrawal_sure_account' . $lng_suffix);
187  if (!$isLdapUser && (bool) $this->setting->get('tos_withdrawal_usr_deletion', false)) {
188  $question = $this->lng->txt('withdrawal_sure_account_deletion' . $lng_suffix);
189  }
190 
191  $confirmation = $this->uiFactory->messageBox()->confirmation($question)->withButtons([
192  $this->uiFactory->button()->standard(
193  $this->lng->txt('confirm'),
194  $this->ctrl->getFormAction($parentObject, 'withdrawAcceptance')
195  ),
196  $this->uiFactory->button()->standard(
197  $this->lng->txt('cancel'),
198  $this->ctrl->getFormAction($parentObject, 'cancelWithdrawal')
199  ),
200  ]);
201 
202  if ($isLdapUser) {
203  $message = nl2br(str_ireplace("[BR]", "\n", sprintf(
204  $this->lng->txt('withdrawal_mail_info') . $this->lng->txt('withdrawal_mail_text'),
205  $this->user->getFullname(),
206  $this->user->getLogin(),
207  $this->user->getExternalAccount()
208  )));
209 
210  $panelContent = $this->uiFactory->legacy(
211  $this->uiRenderer->render([
212  $confirmation,
213  $this->uiFactory->divider()->horizontal(),
214  $this->uiFactory->legacy($message)
215  ])
216  );
217 
218  $content = $this->uiRenderer->render(
219  $this->uiFactory->panel()->standard($this->lng->txt('withdraw_usr_agreement'), $panelContent)
220  );
221  } else {
222  $content = $this->uiRenderer->render($confirmation);
223  }
224 
225  return $content;
226  }
const AUTH_LDAP
user()
Definition: user.php:4
const AUTH_LOCAL
$message
Definition: xapiexit.php:14
+ Here is the call graph for this function:

◆ getWithdrawalSectionForModal()

ilTermsOfServiceWithdrawalGUIHelper::getWithdrawalSectionForModal ( )
private
Returns
ilTemplate

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

Referenced by modifyFooter().

53  : ilTemplate
54  {
55  $template = new ilTemplate('tpl.tos_withdrawal_section.html', true, true, 'Services/TermsOfService');
56  $template->setVariable('TXT_TOS_WITHDRAWAL_HEADLINE', $this->lng->txt('withdraw_consent_header'));
57  $template->setVariable('TXT_TOS_WITHDRAWAL', $this->lng->txt('withdraw_consent_description'));
58  $template->setVariable(
59  'BTN_TOS_WITHDRAWAL',
60  $this->uiRenderer->render(
61  $this->uiFactory->button()->standard($this->lng->txt('withdraw_consent'), 'logout.php?withdraw_consent')
62  )
63  );
64 
65  return $template;
66  }
+ Here is the caller graph for this function:

◆ getWithdrawalTextForLogoutScreen()

ilTermsOfServiceWithdrawalGUIHelper::getWithdrawalTextForLogoutScreen ( RequestInterface  $httpRequest)
Parameters
RequestInterface$httpRequest
Returns
string

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

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

◆ handleWithdrawalLogoutRequest()

ilTermsOfServiceWithdrawalGUIHelper::handleWithdrawalLogoutRequest ( RequestInterface  $httpRequest,
object  $guiClass 
)
Parameters
RequestInterface$httpRequest
object$guiClass

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

References AUTH_ECS, AUTH_LOCAL, AUTH_PROVIDER_LTI, and user().

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

◆ modifyFooter()

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

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

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

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

◆ setWithdrawalInfoForLoginScreen()

ilTermsOfServiceWithdrawalGUIHelper::setWithdrawalInfoForLoginScreen ( RequestInterface  $httpRequest)
Parameters
RequestInterface$httpRequest

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

References ilUtil\sendInfo().

231  : void
232  {
233  if (isset($httpRequest->getQueryParams()['tos_withdrawal_type'])) {
234  $withdrawalType = (int) $httpRequest->getQueryParams()['tos_withdrawal_type'];
235  if (1 === $withdrawalType) {
236  ilUtil::sendInfo($this->lng->txt('withdrawal_complete_deleted'));
237  } elseif (2 === $withdrawalType) {
238  ilUtil::sendInfo($this->lng->txt('withdrawal_complete_redirect'));
239  } else {
240  ilUtil::sendInfo($this->lng->txt('withdrawal_complete'));
241  }
242  }
243  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilTermsOfServiceWithdrawalGUIHelper::$ctrl
protected

◆ $lng

ilTermsOfServiceWithdrawalGUIHelper::$lng
protected

◆ $setting

ilTermsOfServiceWithdrawalGUIHelper::$setting
protected

◆ $tosHelper

ilTermsOfServiceWithdrawalGUIHelper::$tosHelper
protected

◆ $tpl

ilTermsOfServiceWithdrawalGUIHelper::$tpl
protected

◆ $uiFactory

ilTermsOfServiceWithdrawalGUIHelper::$uiFactory
protected

◆ $uiRenderer

ilTermsOfServiceWithdrawalGUIHelper::$uiRenderer
protected

◆ $user

ilTermsOfServiceWithdrawalGUIHelper::$user
protected

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