ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilIndividualAssessmentMember.php
Go to the documentation of this file.
1<?php
2require_once 'Modules/IndividualAssessment/classes/class.ilObjIndividualAssessment.php';
3require_once 'Services/User/classes/class.ilObjUser.php';
4require_once 'Modules/IndividualAssessment/exceptions/class.ilIndividualAssessmentException.php';
5require_once 'Modules/IndividualAssessment/classes/Members/class.ilIndividualAssessmentMembers.php';
12{
13 protected $iass;
14 protected $usr;
15
16 protected $record;
17 protected $internal_note;
18 protected $examiner_id;
19 protected $notify;
20 protected $finalized;
22 protected $lp_status;
23 protected $place;
24 protected $event_time;
25 protected $changer_id;
26 protected $change_time;
27
29 {
33 $this->notify = $data[ilIndividualAssessmentMembers::FIELD_NOTIFY] ? true : false;
34 $this->finalized = $data[ilIndividualAssessmentMembers::FIELD_FINALIZED] ? true : false;
43 $this->iass = $iass;
44 $this->usr = $usr;
45 }
46
50 public function record()
51 {
52 return $this->record;
53 }
54
58 public function internalNote()
59 {
61 }
62
68 public function examinerId()
69 {
70 return $this->examiner_id;
71 }
72
78 public function changerId()
79 {
80 return $this->changer_id;
81 }
82
88 public function changeTime()
89 {
90 return $this->change_time;
91 }
92
98 public function notify()
99 {
100 return $this->notify;
101 }
102
111 {
112 if (!$this->finalized()) {
113 throw new ilIndividualAssessmentException('must finalize before notification');
114 }
115 if ($this->notify) {
116 $notificator = (string) $this->lp_status === (string) ilIndividualAssessmentMembers::LP_COMPLETED ?
117 $notificator->withOccasionCompleted() :
118 $notificator->withOccasionFailed();
119 $notificator->withReciever($this)->send();
120 $this->notification_ts = time();
121 }
122 return $this;
123 }
124
130 public function id()
131 {
132 return $this->usr->getId();
133 }
134
140 public function assessmentId()
141 {
142 return $this->iass->getId();
143 }
144
150 public function assessment()
151 {
152 return $this->iass;
153 }
154
160 public function finalized()
161 {
162 return (string) $this->finalized === "1" ? true : false;
163 }
164
170 public function mayBeFinalized()
171 {
172 if ($this->iass->getSettings()->fileRequired() && (string) $this->file_name === '') {
173 return false;
174 }
175 return ((string) $this->lp_status === (string) ilIndividualAssessmentMembers::LP_COMPLETED
176 ||(string) $this->lp_status === (string) ilIndividualAssessmentMembers::LP_FAILED)
177 && !$this->finalized();
178 }
179
186 public function withRecord($record)
187 {
188 assert('is_string($record) || $record === null');
189 $clone = clone $this;
190 $clone->record = $record;
191 return $clone;
192 }
193
201 {
202 assert('is_string($internal_note) || $internal_note === null');
203 $clone = clone $this;
204 $clone->internal_note = $internal_note;
205 return $clone;
206 }
207
214 public function withPlace($place)
215 {
216 assert('is_string($place) || is_null($place)');
217 $clone = clone $this;
218 $clone->place = $place;
219 return $clone;
220 }
221
228 public function withEventTime($event_time)
229 {
230 assert('$event_time instanceof ilDateTime || is_null($event_time)');
231 $clone = clone $this;
232 $clone->event_time = $event_time;
233 return $clone;
234 }
235
243 {
244 assert('is_numeric($examiner_id)');
245 assert('ilObjUser::_exists($examiner_id)');
246 $clone = clone $this;
247 $clone->examiner_id = $examiner_id;
248 return $clone;
249 }
250
257 public function withChangerId($changer_id)
258 {
259 assert('is_numeric($changer_id)');
260 assert('ilObjUser::_exists($changer_id)');
261 $clone = clone $this;
262 $clone->changer_id = $changer_id;
263 return $clone;
264 }
265
273 {
274 assert('$change_time instanceof ilDateTime || is_null($change_time)');
275 $clone = clone $this;
276 $clone->change_time = $change_time;
277 return $clone;
278 }
279
286 public function withNotify($notify)
287 {
288 assert('is_bool($notify)');
289 $clone = clone $this;
290 $clone->notify = (bool) $notify;
291 return $clone;
292 }
293
294 protected function LPStatusValid($lp_status)
295 {
300 }
301
308 public function withLPStatus($lp_status)
309 {
310 if ($this->LPStatusValid($lp_status)) {
311 $clone = clone $this;
312 $clone->lp_status = $lp_status;
313 return $clone;
314 }
315 throw new ilIndividualAssessmentException('user allready finalized or invalid learning progress status');
316 }
317
323 public function lastname()
324 {
325 return $this->usr->getLastname();
326 }
327
333 public function firstname()
334 {
335 return $this->usr->getFirstname();
336 }
337
343 public function login()
344 {
345 return $this->usr->getLogin();
346 }
347
353 public function name()
354 {
355 return $this->usr->getFullname();
356 }
357
363 public function LPStatus()
364 {
365 return $this->lp_status;
366 }
367
373 public function withFinalized()
374 {
375 if ($this->mayBeFinalized()) {
376 $clone = clone $this;
377 $clone->finalized = 1;
378 return $clone;
379 }
380 throw new ilIndividualAssessmentException('user cant be finalized');
381 }
382
388 public function notificationTS()
389 {
391 }
392
398 public function place()
399 {
400 return $this->place;
401 }
402
408 public function eventTime()
409 {
410 return $this->event_time;
411 }
417 public function fileName()
418 {
419 return $this->file_name;
420 }
421
429 public function withFileName($file_name)
430 {
431 assert('is_string($file_name)');
432 $clone = clone $this;
433 $clone->file_name = $file_name;
434 return $clone;
435 }
436
442 public function viewFile()
443 {
444 return $this->view_file;
445 }
446
454 public function withViewFile($view_file)
455 {
456 assert('is_bool($view_file)');
457 $clone = clone $this;
458 $clone->view_file = $view_file;
459 return $clone;
460 }
461}
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_UNIX
const IL_CAL_DATETIME
@classDescription Date and time handling
Edit the record of a user, set LP.
examinerId()
Get the user id of the examiner.
maybeSendNotification(ilIndividualAssessmentNotificator $notificator)
Notify a user, if he is supposed to be notified, using some notificator object.
viewFile()
Can user see the uploaded file.
lastname()
Get the examinee lastname corresponding to this membership.
withInternalNote($internal_note)
Clone this object and set an internal note.
assessmentId()
Get the ilObjIndividualAssessment id corresponding to this membership.
finalized()
Is this membership allready finalized?
__construct(ilObjIndividualAssessment $iass, ilObjUser $usr, array $data)
withExaminerId($examiner_id)
Clone this object and set an examiner_id.
withViewFile($view_file)
Set user can view uploaded file.
LPStatus()
Get the LP-status corresponding to this membership.
id()
Get the user id corresponding to this membership.
fileName()
Get the name of the uploaded file.
changerId()
Get the user id of the changer.
withLPStatus($lp_status)
Clone this object and set LP-status.
withEventTime($event_time)
Clone this object and set an internal note.
notify()
Will the user be notified after finalization?
withRecord($record)
Clone this object and set a record.
withNotify($notify)
Clone this object and set wether the examinee should be notified.
login()
Get the examinee login corresponding to this membership.
withChangeTime($change_time)
Clone this object and set an change time.
assessment()
Get the ilObjIndividualAssessment corresponding to this membership.
withFinalized()
Clone this object and finalize.
withChangerId($changer_id)
Clone this object and set an changer_id.
withFileName($file_name)
Set the name of the file.
notificationTS()
Get the timestamp, at which the notification was sent.
name()
Get the examinee name corresponding to this membership.
mayBeFinalized()
Can this membership be finalized?
withPlace($place)
Clone this object and set an internal note.
firstname()
Get the examinee firstname corresponding to this membership.
For the purpose of streamlining the grading and learning-process status definition outside of tests,...
Basic method collection should be implemented by a notificator used by Individual assessment.
withOccasionFailed()
Set message mode to failed.
withOccasionCompleted()
Set message mode to completed.
withReciever(ilIndividualAssessmentMember $member)
Define the member, that should recieve the message.