19 declare(strict_types=1);
    36         self::STATUS_IN_PROGRESS,
    37         self::STATUS_COMPLETED,
    38         self::STATUS_ACCREDITED,
    39         self::STATUS_NOT_RELEVANT,
    65         int $status = self::STATUS_NOT_RELEVANT
    69         $this->last_change = new \DateTimeImmutable();
    70         $this->assignment_date = new \DateTimeImmutable();
    88             throw new ilException(
"ilPRGProgress::setAmountOfPoints: "    89                                  . 
"Expected a number >= 0 as argument, got '$points'");
   104         if ($points_cur < 0) {
   105             throw new ilException(
"ilPRGProgress::setAmountOfPoints: "   106                                  . 
"Expected a number >= 0 as argument, got '$points'");
   109         $clone = clone $this;
   121         if (!in_array($status, self::$STATUS)) {
   122             throw new ilException(
"No such status: " . 
"'$status'");
   127                 "Changing progress with status " . $this->
getStatus()
   128                 . 
" cannot change to status " . 
"'$status'"   129                 . 
' (progress_id: ' . $this->
getId() . 
')'   133         $clone = clone $this;
   140         return is_null($this->status) ||
   141             $this->status === $new_status ||
   142             in_array($new_status, self::getAllowedTargetStatusFor($this->status));
   147         switch ($status_from) {
   148             case self::STATUS_IN_PROGRESS:
   150                     self::STATUS_ACCREDITED,
   151                     self::STATUS_COMPLETED,
   153                     self::STATUS_NOT_RELEVANT
   155             case self::STATUS_ACCREDITED:
   157                     self::STATUS_IN_PROGRESS,
   158                     self::STATUS_COMPLETED,
   160                     self::STATUS_NOT_RELEVANT
   162             case self::STATUS_COMPLETED:
   164                     self::STATUS_IN_PROGRESS, 
   165                     self::STATUS_NOT_RELEVANT
   167             case self::STATUS_FAILED:
   169                     self::STATUS_IN_PROGRESS,
   170                     self::STATUS_COMPLETED, 
   171                     self::STATUS_NOT_RELEVANT
   173             case self::STATUS_NOT_RELEVANT:
   175                     self::STATUS_IN_PROGRESS
   196         $clone = clone $this;
   209         $clone = clone $this;
   225         int $usr_or_obj_id = null,
   228         $clone = clone $this;
   229         $clone->completion_by = $usr_or_obj_id;
   241         $clone = clone $this;
   253         $clone = clone $this;
   254         $clone->vq_date = $date;
   265         $clone = clone $this;
   266         $clone->is_individual = $individual;
   275                 self::STATUS_COMPLETED,
   276                 self::STATUS_ACCREDITED
   298         return $this->
getStatus() != self::STATUS_NOT_RELEVANT;
   303         return $this->
getStatus() == self::STATUS_FAILED;
   308         return $this->
getStatus() == self::STATUS_ACCREDITED;
   313         return $this->
getStatus() == self::STATUS_IN_PROGRESS;
   320         foreach ($children as $child_progress) {
   321             if ($child_progress->isSuccessful()) {
   322                 $sum += $child_progress->getAmountOfPoints();
   332         foreach ($children as $child_progress) {
   333             if ($child_progress->isRelevant()) {
   334                 $sum += $child_progress->getAmountOfPoints();
   342         if (!$this->vq_date) {
   343             throw new ilException(
"may not invalidate non-expired progress (no invalidation date)");
   345         if ($this->vq_date->format(self::DATE_FORMAT) > date(self::DATE_FORMAT)) {
   346             $msg = $this->vq_date->format(self::DATE_FORMAT) . 
' > ' . date(self::DATE_FORMAT);
   347             throw new ilException(
"may not invalidate non-expired progress ($msg)");
   359         $clone = clone $this;
   367             ->withStatus(self::STATUS_ACCREDITED)
   368             ->withCompletion($acting_usr_id, $date)
   369             ->withLastChange($acting_usr_id, $date);
   375             ->withStatus(self::STATUS_IN_PROGRESS)
   376             ->withCompletion(null, null)
   377             ->withValidityOfQualification(null)
   378             ->withLastChange($acting_usr_id, $date);
   384             ->withStatus(self::STATUS_FAILED)
   385             ->withCompletion(null, null)
   386             ->withLastChange($acting_usr_id, $date);
   392             ->withStatus(self::STATUS_IN_PROGRESS)
   393             ->withCompletion(null, null)
   394             ->withLastChange($acting_usr_id, $date);
   400             ->withStatus(self::STATUS_COMPLETED)
   401             ->withCompletion($triggering_obj_id, $date)
   402             ->withLastChange($triggering_obj_id, $date);
   408             ->withStatus(self::STATUS_NOT_RELEVANT)
   409             ->withLastChange($acting_usr_id, $date)
   410             ->withValidityOfQualification(null)
   412             ->withCompletion(null, null)
   413             ->withCurrentAmountOfPoints(0)
   414             ->withIndividualModifications(
true);
   420             ->withStatus(self::STATUS_IN_PROGRESS)
   421             ->withCompletion(null, null)
   422             ->withLastChange($acting_usr_id, $date)
   423             ->withIndividualModifications(
true);
 
markAccredited(\DateTimeImmutable $date, int $acting_usr_id)
 
isTransitionAllowedTo(int $new_status)
 
DateTimeImmutable $deadline
 
markNotRelevant(\DateTimeImmutable $date, int $acting_usr_id)
 
withCompletion(int $usr_or_obj_id=null, \DateTimeImmutable $completion_date=null)
 
succeed(\DateTimeImmutable $date, int $triggering_obj_id)
 
hasValidQualification(\DateTimeImmutable $now)
There may be no qualification at all (since the PRG is not passed), or the qualification is valid or ...
 
__construct(int $prg_obj_id, int $status=self::STATUS_NOT_RELEVANT)
 
withDeadline(?\DateTimeImmutable $deadline=null)
 
DateTimeImmutable $assignment_date
 
withIndividualModifications(bool $individual)
 
withCurrentAmountOfPoints(int $points_cur)
 
getValidityOfQualification()
 
getAchievedPointsOfChildren()
 
markNotFailed(\DateTimeImmutable $date, int $acting_usr_id)
 
withAmountOfPoints(int $points)
 
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...
 
static getAllowedTargetStatusFor(int $status_from)
 
hasIndividualModifications()
 
markFailed(\DateTimeImmutable $date, int $acting_usr_id)
 
unmarkAccredited(\DateTimeImmutable $date, int $acting_usr_id)
 
const STATUS_NOT_RELEVANT
 
getCurrentAmountOfPoints()
 
DateTimeImmutable $last_change
 
getPossiblePointsOfRelevantChildren()
 
withLastChange(int $last_change_by, \DateTimeImmutable $last_change)
 
markRelevant(\DateTimeImmutable $date, int $acting_usr_id)
 
const COMPLETED_BY_SUBNODES
 
DateTimeImmutable $completion_date
 
withValidityOfQualification(\DateTimeImmutable $date=null)
 
withInvalidated(bool $invalidated)
 
DateTimeImmutable $vq_date
 
withAssignmentDate(?\DateTimeImmutable $assignment_date)