ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilObjTermsOfService.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
9 {
13  protected $db;
14 
18  protected $settings;
19 
24  public function __construct($a_id = 0, $a_reference = true)
25  {
26  global $DIC;
27 
28  parent::__construct($a_id, $a_reference);
29 
30  $this->db = $DIC['ilDB'];
31  $this->settings = $DIC['ilSetting'];
32  }
33 
37  protected function initType()
38  {
39  $this->type = 'tos';
40  }
41 
45  public function resetAll()
46  {
47  $in = $this->db->in('usr_id', array(ANONYMOUS_USER_ID, SYSTEM_USER_ID), true, 'integer');
48  $this->db->manipulate("UPDATE usr_data SET agree_date = NULL WHERE $in");
49 
50  $this->settings->set('tos_last_reset', time());
51  }
52 
57  public function getLastResetDate() : \ilDateTime
58  {
59  return new \ilDateTime($this->settings->get('tos_last_reset'), IL_CAL_UNIX);
60  }
61 
65  public function saveStatus(bool $status)
66  {
67  \ilTermsOfServiceHelper::setStatus((bool) $status);
68  }
69 
73  public function getStatus() : bool
74  {
75  return \ilTermsOfServiceHelper::isEnabled();
76  }
77 }
settings()
Definition: settings.php:2
__construct($a_id=0, $a_reference=true)
global $DIC
Definition: saml.php:7
const IL_CAL_UNIX
Date and time handling
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
Class ilObject2 This is an intermediate progress of ilObject class.
Class ilObjTermsOfService.