ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilIndividualAssessmentMember.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25{
27 protected ilObjUser $usr;
29 protected int $notification_ts;
30 protected ?int $examiner_id;
31 protected ?int $changer_id;
32 protected ?DateTimeImmutable $change_time;
33
34 public function __construct(
39 ?int $examiner_id = null,
40 ?int $changer_id = null,
41 ?DateTimeImmutable $change_time = null
42 ) {
43 $this->iass = $iass;
44 $this->usr = $usr;
45 $this->grading = $grading;
46 $this->notification_ts = $notification_ts;
47 $this->examiner_id = $examiner_id;
48 $this->changer_id = $changer_id;
49 $this->change_time = $change_time;
50 }
51
52 public function maybeSendNotification(
55 if (!$this->finalized()) {
56 throw new ilIndividualAssessmentException('must finalize before notification');
57 }
58 if ($this->notify()) {
59 $notificator = (string) $this->LPStatus() === (string) ilIndividualAssessmentMembers::LP_COMPLETED ?
60 $notificator->withOccasionCompleted() :
61 $notificator->withOccasionFailed();
62 $notificator->withReceiver($this)->send();
63 $this->notification_ts = time();
64 }
65 return $this;
66 }
67
68 public function mayBeFinalized(): bool
69 {
70 if ($this->iass->getSettings()->isFileRequired() && (string) $this->fileName() === '') {
71 return false;
72 }
73 return in_array(
74 $this->LPStatus(),
75 [
78 ]
79 ) &&
80 !$this->finalized();
81 }
82
83 public function notificationTS(): int
84 {
85 return $this->notification_ts;
86 }
87
88 public function examinerId(): ?int
89 {
90 return $this->examiner_id;
91 }
92
93 public function withExaminerId(int $examiner_id): ilIndividualAssessmentMember
94 {
95 $clone = clone $this;
96 $clone->examiner_id = $examiner_id;
97 return $clone;
98 }
99
100 public function changerId(): ?int
101 {
102 return $this->changer_id;
103 }
104
105 public function withChangerId(int $changer_id): ilIndividualAssessmentMember
106 {
107 $clone = clone $this;
108 $clone->changer_id = $changer_id;
109 return $clone;
110 }
111
112 public function changeTime(): ?DateTimeImmutable
113 {
114 return $this->change_time;
115 }
116
117 public function withChangeTime(?DateTimeImmutable $change_time = null): ilIndividualAssessmentMember
118 {
119 $clone = clone $this;
120 $clone->change_time = $change_time;
121 return $clone;
122 }
123
125 {
126 return $this->grading;
127 }
128
129 public function withGrading($grading): ilIndividualAssessmentMember
130 {
131 $clone = clone $this;
132 $clone->grading = $grading;
133 return $clone;
134 }
135
136 public function record(): string
137 {
138 return $this->grading->getRecord();
139 }
140
141 public function internalNote(): string
142 {
143 return $this->grading->getInternalNote();
144 }
145
146 public function fileName(): ?string
147 {
148 return $this->grading->getFile();
149 }
150
151 public function viewFile(): bool
152 {
153 return $this->grading->isFileVisible();
154 }
155
156 public function LPStatus(): int
157 {
158 return $this->grading->getLearningProgress();
159 }
160
161 public function place(): string
162 {
163 return $this->grading->getPlace();
164 }
165
166 public function eventTime(): ?DateTimeImmutable
167 {
168 return $this->grading->getEventTime();
169 }
170
171 public function notify(): bool
172 {
173 return $this->grading->isNotify();
174 }
175
176 public function finalized(): bool
177 {
178 return $this->grading->isFinalized();
179 }
180
182 {
183 return $this->iass;
184 }
185
186 public function assessmentId(): int
187 {
188 return $this->iass->getId();
189 }
190
191 public function id(): int
192 {
193 return $this->usr->getId();
194 }
195
196 public function lastname(): string
197 {
198 return $this->usr->getLastname();
199 }
200
201 public function firstname(): string
202 {
203 return $this->usr->getFirstname();
204 }
205
206 public function login(): string
207 {
208 return $this->usr->getLogin();
209 }
210
211 public function name(): string
212 {
213 return $this->usr->getFullname();
214 }
215}
Edit the record of a user, set LP.
maybeSendNotification(ilIndividualAssessmentNotificator $notificator)
ilIndividualAssessmentUserGrading $grading
__construct(ilObjIndividualAssessment $iass, ilObjUser $usr, ilIndividualAssessmentUserGrading $grading, int $notification_ts, ?int $examiner_id=null, ?int $changer_id=null, ?DateTimeImmutable $change_time=null)
withChangeTime(?DateTimeImmutable $change_time=null)
For the purpose of streamlining the grading and learning-process status definition outside of tests,...
User class.
Basic method collection should be implemented by a notificator used by Individual assessment.
if(!file_exists('../ilias.ini.php'))