ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilObjTermsOfService.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
9{
11 protected $db;
12
14 protected $settings;
15
20 public function __construct($a_id = 0, $a_reference = true)
21 {
22 global $DIC;
23
24 parent::__construct($a_id, $a_reference);
25
26 $this->db = $DIC['ilDB'];
27 $this->settings = $DIC['ilSetting'];
28 }
29
33 protected function initType()
34 {
35 $this->type = 'tos';
36 }
37
41 public function resetAll() : void
42 {
43 $in = $this->db->in('usr_id', [ANONYMOUS_USER_ID, SYSTEM_USER_ID], true, 'integer');
44 $this->db->manipulate("UPDATE usr_data SET agree_date = NULL WHERE $in");
45
46 $this->settings->set('tos_last_reset', time());
47 }
48
53 public function getLastResetDate() : ilDateTime
54 {
55 return new ilDateTime($this->settings->get('tos_last_reset'), IL_CAL_UNIX);
56 }
57
61 public function saveStatus(bool $status) : void
62 {
63 $this->settings->set('tos_status', (int) $status);
64 }
65
69 public function getStatus() : bool
70 {
71 return (bool) $this->settings->get('tos_status', false);
72 }
73
77 public function setReevaluateOnLogin(bool $status) : void
78 {
79 $this->settings->set('tos_reevaluate_on_login', (int) $status);
80 }
81
85 public function shouldReevaluateOnLogin() : bool
86 {
87 return (bool) $this->settings->get('tos_reevaluate_on_login', false);
88 }
89}
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_UNIX
@classDescription Date and time handling
Class ilObjTermsOfService.
__construct($a_id=0, $a_reference=true)
Class ilObject2 This is an intermediate progress of ilObject class.
const SYSTEM_USER_ID
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: constants.php:24
const ANONYMOUS_USER_ID
Definition: constants.php:25
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
settings()
Definition: settings.php:2