ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilIndividualAssessmentMember.php
Go to the documentation of this file.
1 <?php
2 require_once 'Modules/IndividualAssessment/classes/class.ilObjIndividualAssessment.php';
3 require_once 'Services/User/classes/class.ilObjUser.php';
4 require_once 'Modules/IndividualAssessment/exceptions/class.ilIndividualAssessmentException.php';
5 require_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;
21  protected $notification_ts;
22  protected $lp_status;
23  protected $place;
24  protected $event_time;
25  protected $changer_id;
26  protected $change_time;
27 
29  {
31  $this->internal_note = $data[ilIndividualAssessmentMembers::FIELD_INTERNAL_NOTE];
32  $this->examiner_id = $data[ilIndividualAssessmentMembers::FIELD_EXAMINER_ID];
33  $this->notify = $data[ilIndividualAssessmentMembers::FIELD_NOTIFY] ? true : false;
34  $this->finalized = $data[ilIndividualAssessmentMembers::FIELD_FINALIZED] ? true : false;
36  $this->notification_ts = $data[ilIndividualAssessmentMembers::FIELD_NOTIFICATION_TS];
38  $this->event_time = new ilDate($data[ilIndividualAssessmentMembers::FIELD_EVENTTIME], IL_CAL_UNIX);
39  $this->changer_id = $data[ilIndividualAssessmentMembers::FIELD_CHANGER_ID];
40  $this->file_name = $data[ilIndividualAssessmentMembers::FIELD_FILE_NAME];
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  {
60  return $this->internal_note;
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 ilDate || is_null($event_time));
231  $clone = clone $this;
232  $clone->event_time = $event_time;
233  return $clone;
234  }
235 
242  public function withExaminerId($examiner_id)
243  {
244  assert(is_numeric($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 
272  public function withChangeTime($change_time)
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  {
299  || (string) $lp_status === (string) ilIndividualAssessmentMembers::LP_FAILED;
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  {
390  return $this->notification_ts;
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 }
assessment()
Get the ilObjIndividualAssessment corresponding to this membership.
withChangeTime($change_time)
Clone this object and set an change time.
For the purpose of streamlining the grading and learning-process status definition outside of tests...
const IL_CAL_DATETIME
withReciever(ilIndividualAssessmentMember $member)
Define the member, that should recieve the message.
withPlace($place)
Clone this object and set an internal note.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
examinerId()
Get the user id of the examiner.
withFinalized()
Clone this object and finalize.
withFileName($file_name)
Set the name of the file.
mayBeFinalized()
Can this membership be finalized?
withChangerId($changer_id)
Clone this object and set an changer_id.
const IL_CAL_UNIX
notificationTS()
Get the timestamp, at which the notification was sent.
finalized()
Is this membership allready finalized?
changerId()
Get the user id of the changer.
withLPStatus($lp_status)
Clone this object and set LP-status.
withRecord($record)
Clone this object and set a record.
withOccasionFailed()
Set message mode to failed.
firstname()
Get the examinee firstname corresponding to this membership.
Class for single dates.
maybeSendNotification(ilIndividualAssessmentNotificator $notificator)
Notify a user, if he is supposed to be notified, using some notificator object.
lastname()
Get the examinee lastname corresponding to this membership.
Basic method collection should be implemented by a notificator used by Individual assessment...
withNotify($notify)
Clone this object and set wether the examinee should be notified.
withInternalNote($internal_note)
Clone this object and set an internal note.
withEventTime($event_time)
Clone this object and set an internal note.
Date and time handling
withViewFile($view_file)
Set user can view uploaded file.
login()
Get the examinee login corresponding to this membership.
withOccasionCompleted()
Set message mode to completed.
viewFile()
Can user see the uploaded file.
withExaminerId($examiner_id)
Clone this object and set an examiner_id.
Edit the record of a user, set LP.
name()
Get the examinee name corresponding to this membership.
notify()
Will the user be notified after finalization?
fileName()
Get the name of the uploaded file.
__construct(ilObjIndividualAssessment $iass, ilObjUser $usr, array $data)
assessmentId()
Get the ilObjIndividualAssessment id corresponding to this membership.
id()
Get the user id corresponding to this membership.
LPStatus()
Get the LP-status corresponding to this membership.
$data
Definition: bench.php:6