ILIAS  release_8 Revision v8.23
class.ilTermsOfServiceWithdrawalStartUpStep.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
23 
30 {
31  private Container $dic;
32 
33  public function __construct(Container $dic)
34  {
35  $this->dic = $dic;
36  }
37 
38  public function shouldStoreRequestTarget(): bool
39  {
40  return true;
41  }
42 
43  public function isInFulfillment(): bool
44  {
45  return (
46  strtolower($this->dic->ctrl()->getCmdClass()) === strtolower(ilPersonalProfileGUI::class) && (
47  strtolower($this->dic->ctrl()->getCmd()) === 'showuseragreement' ||
48  strtolower($this->dic->ctrl()->getCmd()) === 'confirmwithdrawal' ||
49  strtolower($this->dic->ctrl()->getCmd()) === 'showconsentwithdrawalconfirmation' ||
50  strtolower($this->dic->ctrl()->getCmd()) === 'cancelwithdrawal' ||
51  strtolower($this->dic->ctrl()->getCmd()) === 'withdrawacceptance' ||
52  strtolower($this->dic->ctrl()->getCmd()) === 'rejectwithdrawal'
53  )
54  );
55  }
56 
57  public function shouldInterceptRequest(): bool
58  {
59  if ($this->isInFulfillment()) {
60  return false;
61  }
62 
63  if ($this->dic->user()->getPref('consent_withdrawal_requested')) {
64  return true;
65  }
66 
67  return false;
68  }
69 
70  public function execute(): void
71  {
72  $this->dic->ctrl()->redirectByClass(
73  [ilDashboardGUI::class, ilPersonalProfileGUI::class],
74  'showConsentWithdrawalConfirmation'
75  );
76  }
77 }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:31