ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilIndividualAssessmentMember.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
11{
15 protected $iass;
16
20 protected $usr;
21
25 protected $grading;
26
30 protected $examiner_id;
31
36
40 protected $changer_id;
41
45 protected $change_time;
46
47 public function __construct(
51 ?int $examiner_id,
53 ?int $changer_id,
54 ?DateTime $change_time
55 ) {
56 $this->iass = $iass;
57 $this->usr = $usr;
58 $this->grading = $grading;
59 $this->examiner_id = $examiner_id;
60 $this->notification_ts = $notification_ts;
61 $this->changer_id = $changer_id;
62 $this->change_time = $change_time;
63 }
64
65 public function record() : string
66 {
67 return $this->grading->getRecord();
68 }
69
70 public function internalNote() : string
71 {
72 return $this->grading->getInternalNote();
73 }
74
75 public function examinerId() : ?int
76 {
77 return $this->examiner_id;
78 }
79
80 public function changerId() : ?int
81 {
82 return $this->changer_id;
83 }
84
85 public function changeTime() : ?DateTime
86 {
87 return $this->change_time;
88 }
89
90 public function notify() : bool
91 {
92 return $this->grading->isNotify();
93 }
94
95 public function maybeSendNotification(
98 if (!$this->finalized()) {
99 throw new ilIndividualAssessmentException('must finalize before notification');
100 }
101 if ($this->notify()) {
102 $notificator = (string) $this->LPStatus() === (string) ilIndividualAssessmentMembers::LP_COMPLETED ?
103 $notificator->withOccasionCompleted() :
104 $notificator->withOccasionFailed();
105 $notificator->withReciever($this)->send();
106 $this->notification_ts = time();
107 }
108 return $this;
109 }
110
111 public function id() : int
112 {
113 return (int) $this->usr->getId();
114 }
115
116 public function assessmentId() : int
117 {
118 return (int) $this->iass->getId();
119 }
120
122 {
123 return $this->iass;
124 }
125
126 public function finalized() : bool
127 {
128 return $this->grading->isFinalized();
129 }
130
131 public function mayBeFinalized() : bool
132 {
133 if ($this->iass->getSettings()->isFileRequired() && (string) $this->fileName() === '') {
134 return false;
135 }
136 return in_array(
137 $this->LPStatus(),
138 [
141 ]
142 ) &&
143 !$this->finalized();
144 }
145
146 public function withExaminerId(int $examiner_id) : ilIndividualAssessmentMember
147 {
148 $clone = clone $this;
149 $clone->examiner_id = $examiner_id;
150 return $clone;
151 }
152
153 public function withChangerId(int $changer_id) : ilIndividualAssessmentMember
154 {
155 $clone = clone $this;
156 $clone->changer_id = $changer_id;
157 return $clone;
158 }
159
160 public function withChangeTime(DateTime $change_time = null) : ilIndividualAssessmentMember
161 {
162 $clone = clone $this;
163 $clone->change_time = $change_time;
164 return $clone;
165 }
166
167 protected function LPStatusValid($lp_status)
168 {
169 return (string) $lp_status === (string) ilIndividualAssessmentMembers::LP_NOT_ATTEMPTED
170 || (string) $lp_status === (string) ilIndividualAssessmentMembers::LP_IN_PROGRESS
171 || (string) $lp_status === (string) ilIndividualAssessmentMembers::LP_COMPLETED
172 || (string) $lp_status === (string) ilIndividualAssessmentMembers::LP_FAILED;
173 }
174
175 public function lastname() : string
176 {
177 return $this->usr->getLastname();
178 }
179
180 public function firstname() : string
181 {
182 return $this->usr->getFirstname();
183 }
184
185 public function login() : string
186 {
187 return $this->usr->getLogin();
188 }
189
190 public function name() : string
191 {
192 return $this->usr->getFullname();
193 }
194
195 public function LPStatus() : int
196 {
197 return $this->grading->getLearningProgress();
198 }
199
200 public function notificationTS() : int
201 {
202 return $this->notification_ts;
203 }
204
205 public function place() : string
206 {
207 return $this->grading->getPlace();
208 }
209
210 public function eventTime() : ?DateTimeImmutable
211 {
212 return $this->grading->getEventTime();
213 }
214
215 public function fileName() : ?string
216 {
217 return $this->grading->getFile();
218 }
219
220 public function viewFile() : bool
221 {
222 return $this->grading->isFileVisible();
223 }
224
226 {
227 return $this->grading;
228 }
229
230 public function withGrading($grading) : ilIndividualAssessmentMember
231 {
232 $clone = clone $this;
233 $clone->grading = $grading;
234 return $clone;
235 }
236}
An exception for terminatinating execution or to throw for unit testing.
Edit the record of a user, set LP.
maybeSendNotification(ilIndividualAssessmentNotificator $notificator)
__construct(ilObjIndividualAssessment $iass, ilObjUser $usr, ?ilIndividualAssessmentUserGrading $grading, ?int $examiner_id, int $notification_ts, ?int $changer_id, ?DateTime $change_time)
For the purpose of streamlining the grading and learning-process status definition outside of tests,...
if(!file_exists(getcwd() . '/ilias.ini.php'))
registration confirmation script for ilias
Definition: confirmReg.php:12
Basic method collection should be implemented by a notificator used by Individual assessment.