ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilTermsOfServiceDocumentCriterionAssignment.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 {
10  const TABLE_NAME = 'tos_criterion_to_doc';
11 
20  protected $id;
21 
28  protected $assigned_ts = 0;
29 
36  protected $modification_ts = 0;
37 
44  protected $doc_id = 0;
45 
53  protected $criterion_id = '';
54 
61  protected $criterion_value = '';
62 
69  protected $owner_usr_id = 0;
70 
77  protected $last_modified_usr_id = '';
78 
82  public static function returnDbTableName()
83  {
84  return self::TABLE_NAME;
85  }
86 
90  public function create()
91  {
92  $this->setAssignedTs(time());
93 
94  parent::create();
95  }
96 
100  public function update()
101  {
102  $this->setModificationTs(time());
103 
104  parent::update();
105  }
106 
111  {
112  $this->criterion_value = $config->toJson();
113  }
114 
119  {
120  return new \ilTermsOfServiceCriterionConfig($this->criterion_value);
121  }
122 
126  public function getCriterionId() : string
127  {
128  return $this->criterion_id;
129  }
130 
134  public function equals($other) : bool
135  {
136  if (!($other instanceof static)) {
137  return false;
138  }
139 
140  $criterionIdCurrent = $this->getCriterionId();
141  $criterionIdNew = $other->getCriterionId();
142 
143  $valueCurrent = $this->getCriterionValue();
144  $valueNew = $other->getCriterionValue();
145 
146  $equals = (
147  $criterionIdCurrent == $criterionIdNew &&
148  $valueCurrent == $valueNew
149  );
150 
151  return $equals;
152  }
153 }
$config
Definition: bootstrap.php:15
Class ActiveRecord.
Interface ilTermsOfServiceEvaluableCriterion.
Class ilTermsOfServiceCriterionConfig.
Interface ilTermsOfServiceEquatable.
update($pash, $contents, Config $config)