1<?
php declare(strict_types = 1);
200 $clone = clone $this;
215 $clone = clone $this;
230 $clone = clone $this;
251 throw new ilException(
"ilStudyProgrammeProgress::setAmountOfPoints: "
252 .
"Expected a number >= 0 as argument, got '$points'");
255 $clone = clone $this;
272 throw new ilException(
"ilStudyProgrammeProgress::setAmountOfPoints: "
273 .
"Expected a number >= 0 as argument, got '$points'");
275 $clone = clone $this;
296 if (!in_array(
$status, self::$STATUS)) {
297 throw new ilException(
"No such status: " .
"'$status'");
302 "Changing progress with status " . $this->
getStatus()
303 .
" cannot change to status " .
"'$status'"
304 .
' (progress_id: ' . $this->
getId() .
')'
308 $clone = clone $this;
315 return is_null($this->status) ||
316 $this->status == $new_status ||
317 in_array($new_status, self::getAllowedTargetStatusFor($this->status));
322 switch ($status_from) {
339 self::STATUS_IN_PROGRESS
368 if ($this->last_change) {
369 return DateTimeImmutable::createFromFormat(self::DATE_TIME_FORMAT, $this->last_change);
384 "Cannot set last change to an earlier date:"
385 .
"\ncurrent: " . $this->
getLastChange()->format(self::DATE_TIME_FORMAT)
386 .
"\nnew: " . $new_date,
390 $clone = clone $this;
391 $clone->last_change = $new_date;
398 return $this->assignment_date;
403 $clone = clone $this;
404 $clone->assignment_date = $assignment_date;
410 return $this->completion_date;
419 return $this->completion_by;
423 int $usr_or_obj_id =
null,
424 DateTimeImmutable $completion_date =
null
426 $clone = clone $this;
427 $clone->completion_by = $usr_or_obj_id;
428 $clone->completion_date = $completion_date;
434 return $this->deadline;
439 $clone = clone $this;
440 $clone->deadline = $deadline;
446 return $this->vq_date;
451 $clone = clone $this;
452 $clone->vq_date = $date;
458 return $this->is_individual;
463 $clone = clone $this;
464 $clone->is_individual = $individual;
473 self::STATUS_COMPLETED,
474 self::STATUS_ACCREDITED
485 if (!$this->isSuccessful()) {
489 is_null($this->getValidityOfQualification()) ||
490 $this->getValidityOfQualification()->format(
'Y-m-d') >= $now->format(
'Y-m-d')
496 return $this->getStatus() != self::STATUS_NOT_RELEVANT;
501 return $this->getStatus() == self::STATUS_FAILED;
506 return $this->getStatus() == self::STATUS_ACCREDITED;
511 return $this->getStatus() == self::STATUS_IN_PROGRESS;
516 if (!$this->vq_date || $this->vq_date->format(
'Y-m-d') > date(
'Y-m-d')) {
517 throw new ilException(
"may not invalidate non-expired progress");
519 $clone = clone $this;
520 $clone->invalidated =
true;
526 return $this->invalidated;
535 !is_null($this->getValidityOfQualification()) &&
536 $this->getValidityOfQualification()->format(
'Y-m-d') < (
new DateTimeImmutable())->format(
'Y-m-d')
547 ->withCompletion($acting_usr_id, $date)
548 ->withLastChange($acting_usr_id, $date);
555 ->withCompletion(
null,
null)
556 ->withValidityOfQualification(
null)
557 ->withLastChange($acting_usr_id, $date);
564 ->withCompletion(
null,
null)
565 ->withLastChange($acting_usr_id, $date);
572 ->withCompletion(
null,
null)
573 ->withLastChange($acting_usr_id, $date);
580 ->withCompletion($triggering_obj_id, $date)
581 ->withLastChange($triggering_obj_id, $date);
588 ->withLastChange($acting_usr_id, $date)
589 ->withValidityOfQualification(
null)
591 ->withIndividualModifications(
true);
598 ->withCompletion(
null,
null)
599 ->withLastChange($acting_usr_id, $date)
600 ->withIndividualModifications(
true);
foreach($mandatory_scripts as $file) $timestamp
An exception for terminatinating execution or to throw for unit testing.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilStudyProgrammeProgress.
withAssignmentDate(DateTimeImmutable $assignment_date)
withAmountOfPoints(int $points)
Throws when amount of points is smaller then zero.
markNotRelevant(DateTimeImmutable $date, int $acting_usr_id)
getId()
Get the id of the progress.
markRelevant(DateTimeImmutable $date, int $acting_usr_id)
withLastChange(int $last_change_by, DateTimeImmutable $timestamp)
markAccredited(DateTimeImmutable $date, int $acting_usr_id)
withIndividualModifications(bool $individual)
getAssignmentId()
Get the assignment this progress belongs to.
withCurrentAmountOfPoints(int $points_cur)
Set the amount of points the user currently has achieved on this node.
markNotFailed(DateTimeImmutable $date, int $acting_usr_id)
withCompletion(int $usr_or_obj_id=null, DateTimeImmutable $completion_date=null)
unmarkAccredited(DateTimeImmutable $date, int $acting_usr_id)
const STATUS_NOT_RELEVANT
getAmountOfPoints()
Get the amount of points the user needs to achieve on the subnodes of this node.
getStatus()
Get the status the user has on this node.
const DATE_FORMAT_ENDOFDAY
getUserId()
Get the id of the user this progress is for.
getValidityOfQualification()
withValidityOfQualification(DateTimeImmutable $date=null)
getCompletionBy()
Get the id of object or user that lead to the successful completion of this node.
static getAllowedTargetStatusFor(int $status_from)
hasValidQualification(DateTimeImmutable $now)
There may be no qualification at all (since the PRG is not passed), or the qualification is valid or ...
withAssignmentId(int $assignment_id)
isTransitionAllowedTo(int $new_status)
getLastChangeBy()
Get the id of the user/object who/which invoked the last change on this assignment.
succeed(DateTimeImmutable $date, int $triggering_obj_id)
hasIndividualModifications()
withStatus(int $status)
Set the status of this node.
getCurrentAmountOfPoints()
withDeadline(DateTimeImmutable $deadline=null)
markFailed(DateTimeImmutable $date, int $acting_usr_id)
getNodeId()
Get the obj_id of the program node this progress belongs to.