ILIAS  release_8 Revision v8.24
class.ilObjTermsOfService.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26{
28
33 public function __construct($a_id = 0, $a_reference = true)
34 {
35 global $DIC;
36
37 parent::__construct($a_id, $a_reference);
38
39 $this->settings = $DIC['ilSetting'];
40 }
41
42 protected function initType(): void
43 {
44 $this->type = 'tos';
45 }
46
47 public function resetAll(): void
48 {
49 $in = $this->db->in('usr_id', [ANONYMOUS_USER_ID, SYSTEM_USER_ID], true, 'integer');
50 $this->db->manipulate("UPDATE usr_data SET agree_date = NULL WHERE $in");
51
52 $this->settings->set('tos_last_reset', (string) time());
53 }
54
55 public function getLastResetDate(): ilDateTime
56 {
57 return new ilDateTime((int) $this->settings->get('tos_last_reset', '0'), IL_CAL_UNIX);
58 }
59
60 public function saveStatus(bool $status): void
61 {
62 $this->settings->set('tos_status', (string) ((int) $status));
63 }
64
65 public function getStatus(): bool
66 {
67 return (bool) $this->settings->get('tos_status', '0');
68 }
69
70 public function setReevaluateOnLogin(bool $status): void
71 {
72 $this->settings->set('tos_reevaluate_on_login', (string) ((int) $status));
73 }
74
75 public function shouldReevaluateOnLogin(): bool
76 {
77 return (bool) $this->settings->get('tos_reevaluate_on_login', '0');
78 }
79}
const IL_CAL_UNIX
@classDescription Date and time handling
Class ilObjTermsOfService.
__construct($a_id=0, $a_reference=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const SYSTEM_USER_ID
This file contains constants for PHPStan analyis, see: https://phpstan.org/config-reference#constants...
Definition: constants.php:26
const ANONYMOUS_USER_ID
Definition: constants.php:27
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc