ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilTermsOfServiceAcceptanceStartUpStep.php
Go to the documentation of this file.
1 <?php declare(strict_types=1);
2 /* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
6 
12 {
14  private $dic;
15 
20  public function __construct(Container $dic)
21  {
22  $this->dic = $dic;
23  }
24 
28  public function shouldStoreRequestTarget() : bool
29  {
30  return true;
31  }
32 
36  public function isInFulfillment() : bool
37  {
38  return (
39  strtolower($this->dic->ctrl()->getCmdClass()) === 'ilstartupgui' &&
40  (
41  strtolower($this->dic->ctrl()->getCmd()) === 'getacceptance' ||
42  strtolower($this->dic->ctrl()->getCmd()) === 'confirmacceptance' ||
43  strtolower($this->dic->ctrl()->getCmd()) === 'confirmwithdrawal'
44  )
45  );
46  }
47 
51  public function shouldInterceptRequest() : bool
52  {
53  if ($this->isInFulfillment()) {
54  return false;
55  }
56 
57  if (!$this->dic->user()->hasToAcceptTermsOfServiceInSession()) {
58  return false;
59  }
60 
61  if ($this->dic->user()->checkTimeLimit()) {
62  if ($this->dic->user()->hasToAcceptTermsOfService()) {
63  return true;
64  }
65 
67  $tosService = $this->dic['tos.service'];
68  if ($tosService->hasToResignAcceptance($this->dic->user(), $this->dic->logger()->tos())) {
69  $tosService->resetAcceptance($this->dic->user());
70  return true;
71  }
72  }
73 
74  return false;
75  }
76 
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:18
__construct(Container $dic)
ilTermsOfServiceAcceptanceStartUpStep constructor.