ILIAS  release_8 Revision v8.23
class.ilTermsOfServiceAcceptanceStartUpStep.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
23 
29 {
30  private Container $dic;
31 
32  public function __construct(Container $dic)
33  {
34  $this->dic = $dic;
35  }
36 
37  public function shouldStoreRequestTarget(): bool
38  {
39  return true;
40  }
41 
42  public function isInFulfillment(): bool
43  {
44  return (
45  strtolower($this->dic->ctrl()->getCmdClass()) === strtolower(ilStartUpGUI::class) &&
46  (
47  strtolower($this->dic->ctrl()->getCmd()) === 'getacceptance' ||
48  strtolower($this->dic->ctrl()->getCmd()) === 'confirmacceptance' ||
49  strtolower($this->dic->ctrl()->getCmd()) === 'confirmwithdrawal'
50  )
51  );
52  }
53 
54  public function shouldInterceptRequest(): bool
55  {
56  if ($this->isInFulfillment()) {
57  return false;
58  }
59 
60  if (!$this->dic->user()->hasToAcceptTermsOfServiceInSession()) {
61  return false;
62  }
63 
64  if ($this->dic->user()->checkTimeLimit()) {
65  if ($this->dic->user()->hasToAcceptTermsOfService()) {
66  return true;
67  }
68 
70  $tosService = $this->dic['tos.service'];
71  if ($tosService->hasToResignAcceptance($this->dic->user(), $this->dic->logger()->tos())) {
72  $tosService->resetAcceptance($this->dic->user());
73  return true;
74  }
75  }
76 
77  return false;
78  }
79 
80  public function execute(): void
81  {
82  $this->dic->ctrl()->redirectToURL('ilias.php?baseClass=ilStartUpGUI&cmdClass=ilStartupGUI&cmd=getAcceptance');
83  }
84 }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:31