ILIAS  release_8 Revision v8.24
class.ilTermsOfServiceDocumentCriterionAssignment.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26{
27 private const TABLE_NAME = 'tos_criterion_to_doc';
28
37 protected ?int $id = null;
38
45 protected int $assigned_ts = 0;
46
53 protected int $modification_ts = 0;
54
61 protected int $doc_id = 0;
62
70 protected string $criterion_id = '';
71
78 protected string $criterion_value;
79
86 protected int $owner_usr_id = 0;
87
94 protected int $last_modified_usr_id = 0;
95
96 public static function returnDbTableName(): string
97 {
98 return self::TABLE_NAME;
99 }
100
101 public function create(): void
102 {
103 $this->setAssignedTs(time());
104
105 parent::create();
106 }
107
108 public function update(): void
109 {
110 $this->setModificationTs(time());
111
112 parent::update();
113 }
114
116 {
117 $this->criterion_value = $config->toJson();
118 }
119
121 {
122 return new ilTermsOfServiceCriterionConfig($this->criterion_value);
123 }
124
125 public function getCriterionId(): string
126 {
127 return $this->criterion_id;
128 }
129
133 public function equals($other): bool
134 {
135 if (!($other instanceof static)) {
136 return false;
137 }
138
139 $criterionIdCurrent = $this->getCriterionId();
140 $criterionIdNew = $other->getCriterionId();
141
142 $valueCurrent = $this->getCriterionValue();
143 $valueNew = $other->getCriterionValue();
144
145 $equals = (
146 $criterionIdCurrent === $criterionIdNew &&
147 $valueCurrent == $valueNew
148 );
149
150 return $equals;
151 }
152}
Class ActiveRecord.
Class ilTermsOfServiceCriterionConfig.
Interface ilTermsOfServiceEquatable.
Interface ilTermsOfServiceEvaluableCriterion.
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:85