19 declare(strict_types=1);
    34             '%s, progress-id (%s/%s)',
    35             $this->user_info->getFullname(),
    49         if (count($refs) < 1) {
    50             throw new ilException(
"Could not find ref_id for programme with obj_id $obj_id");
    52         return (
int) array_shift($refs);
    62         $node_settings = $settings_repo->
get($progress->
getNodeId());
    63         $completion_mode = $node_settings->getLPMode();
    65         switch ($completion_mode) {
    80         $successful = ($achieved_points >= $required_points);
    85                 ->withCompletion($completing_crs_id, $this->
getNow());
    99                 ->withCompletion(null, null)
   100                 ->withValidityOfQualification(null);
   113         while (!$zipper->
isTop()) {
   116                     function ($pgs) use ($settings_repo) {
   119                         $deadline = $pgs->getDeadline();
   120                         if (!is_null($deadline)
   121                             && $deadline->format($format) <= $today->format($format)
   146             $date = $cdate->add(
new DateInterval(
'P' . $period . 
'D'));
   152             ->withInvalidated(!$validity);
   164             $date = $date->add(
new DateInterval(
'P' . $period . 
'D'));
   174         $programme_status = $settings_repo->
get($pgs->
getNodeId())->getAssessmentSettings()->getStatus();
   190         int $acting_usr_id = null,
   191         bool $recalculate = 
true   197         if (is_null($acting_usr_id)) {
   199             $acting_usr_id = $this->getLoggedInUserId(); 
   204                 if (!is_null($deadline)
   205                     && $deadline->format($format) < $today->format($format)
   210                     $node_settings = $settings_repo->
get($progress->
getNodeId());
   211                     $completion_mode = $node_settings->getLPMode();
   219                 if (is_null($deadline)
   220                     || $deadline->format($format) >= $today->format($format)
   244                 ->withDeadline(null);
   250             ->withLastChange($acting_usr_id, $this->
getNow())
   251             ->withIndividualModifications(
false);
   267         $progress_path = $this->getProgressForNode($node_id)->getPath();
   268         $zipper = 
new Zipper($this->getProgressTree());
   269         return $zipper = $zipper->toPath($progress_path);
   274         $this->getEvents()->userSuccessful($this, $pgs->
getNodeId());
   278         $this->getEvents()->validityChange($this, $pgs->
getNodeId());
   282         $this->getEvents()->deadlineChange($this, $pgs->
getNodeId());
   286         $this->getEvents()->scoreChange($this, $pgs->
getNodeId());
   290         $this->getEvents()->userRevertSuccessful($this, $pgs->
getNodeId());
   295         $zipper = $this->
getZipper($this->getRootId());
   296         $zipper = $zipper->modifyAll(
   297             fn($pgs) => $pgs->withAssignmentDate($this->getNow())
   299         return $this->withProgressTree($zipper->getRoot());
   306         $zipper = $this->
getZipper($this->getRootId());
   307         $zipper = $zipper->modifyAll(
   308             function ($pgs) use ($acting_usr_id, $settings_repo): 
ilPRGProgress {
   314         return $this->withProgressTree($zipper->getRoot());
   323         $zipper = $this->
getZipper($node_id)->modifyFocus(
   324             function ($pgs) use ($err_collection, $acting_usr_id, $settings_repo): 
ilPRGProgress {
   325                 if ($pgs->isRelevant()) {
   326                     $err_collection->
add(
false, 
'will_not_modify_relevant_progress', $this->
getProgressIdString($pgs->getNodeId()));
   329                 $pgs = $pgs->markRelevant($this->
getNow(), $acting_usr_id);
   337         return $this->withProgressTree($zipper->getRoot());
   348         if ($zipper->isTop()) {
   349             $err_collection->
add(
false, 
'will_not_set_top_progress_to_irrelevant', $this->
getProgressIdString($node_id));
   353         $zipper = $zipper->modifyFocus(
   354             function ($pgs) use ($err_collection, $acting_usr_id): 
ilPRGProgress {
   355                 if (!$pgs->isRelevant()) {
   356                     $err_collection->
add(
false, 
'will_not_modify_irrelevant_progress', $this->
getProgressIdString($pgs->getNodeId()));
   360                     $err_collection->
add(
false, 
'will_not_modify_successful_progress', $this->
getProgressIdString($pgs->getNodeId()));
   364                 $pgs = $pgs->markNotRelevant($this->
getNow(), $acting_usr_id);
   371         return $this->withProgressTree($zipper->getRoot());
   383         $zipper = $zipper->modifyFocus(
   384             function ($pgs) use ($err_collection, $acting_usr_id, $settings_repo): 
ilPRGProgress {
   385                 if (!$pgs->isRelevant()) {
   386                     $err_collection->
add(
false, 
'will_not_modify_irrelevant_progress', $this->
getProgressIdString($pgs->getNodeId()));
   391                 if ($pgs->getStatus() === $new_status) {
   395                 if (!$pgs->isTransitionAllowedTo($new_status)) {
   396                     $err_collection->
add(
false, 
'status_transition_not_allowed', $this->
getProgressIdString($pgs->getNodeId()));
   401                     ->markAccredited($this->
getNow(), $acting_usr_id)
   402                     ->withCurrentAmountOfPoints($pgs->getAmountOfPoints());
   405                 if (!$pgs->getValidityOfQualification()) {
   406                     $settings = $settings_repo->
get($pgs->getNodeId())->getValidityOfQualificationSettings();
   417         return $this->withProgressTree($zipper->getRoot());
   429         $zipper = $zipper->modifyFocus(
   430             function ($pgs) use ($err_collection, $acting_usr_id, $settings_repo): 
ilPRGProgress {
   431                 if (!$pgs->isRelevant()) {
   432                     $err_collection->
add(
false, 
'will_not_modify_irrelevant_progress', $this->
getProgressIdString($pgs->getNodeId()));
   437                 if ($pgs->getStatus() === $new_status) {
   441                 if (!$pgs->isTransitionAllowedTo($new_status)
   445                     $err_collection->
add(
false, 
'status_transition_not_allowed', $this->
getProgressIdString($pgs->getNodeId()));
   450                     ->unmarkAccredited($this->
getNow(), $acting_usr_id)
   451                     ->withCurrentAmountOfPoints($pgs->getAchievedPointsOfChildren());
   454                 $old_status = $pgs->getStatus();
   456                 if ($pgs->getStatus() !== $old_status) {
   457                     $err_collection->
add(
false, 
'status_changed_due_to_deadline', $this->
getProgressIdString($pgs->getNodeId()));
   467         return $this->withProgressTree($zipper->getRoot());
   475         $zipper = $this->
getZipper($this->getRootId());
   477         $zipper = $zipper->modifyAll(
   478             function ($pgs) use ($err_collection, $acting_usr_id, $settings_repo, &$leafs): 
ilPRGProgress {
   482                 if (!$pgs->getSubnodes()) {
   483                     $leafs[] = $pgs->getPath();
   489         foreach ($leafs as 
$path) {
   492         return $this->withProgressTree($zipper->getRoot());
   498         int $triggering_obj_id
   500         $zipper = $this->
getZipper($node_id)->modifyFocus(
   501             function ($pgs) use ($settings_repo, $triggering_obj_id): 
ilPRGProgress {
   505                 if ($pgs->isInProgress() &&
   506                     (is_null($deadline) || $deadline->format($format) >= $now->format($format))
   508                     $pgs = $pgs->succeed($now, $triggering_obj_id)
   509                         ->withCurrentAmountOfPoints($pgs->getAmountOfPoints());
   511                     $settings = $settings_repo->
get($pgs->getNodeId())->getValidityOfQualificationSettings();
   521         return $this->withProgressTree($zipper->getRoot());
   529         $zipper = $this->
getZipper($this->getRootId());
   532         $deadline = $this->
getNow();
   533         $zipper = $zipper->modifyAll(
   534             function ($pgs) use ($acting_usr_id, $deadline, &$touched): 
ilPRGProgress {
   535                 if (is_null($pgs->getDeadline())
   536                     || !$pgs->isInProgress()
   544                 return $pgs->markFailed($this->
getNow(), $acting_usr_id);
   548         foreach ($touched as 
$path) {
   552         return $this->withProgressTree($zipper->getRoot());
   562         $zipper = $this->
getZipper($node_id)->modifyFocus(
   563             function ($pgs) use ($err_collection, $acting_usr_id, $settings_repo, $deadline): 
ilPRGProgress {
   564                 if (!$pgs->isRelevant()) {
   565                     $err_collection->
add(
false, 
'will_not_modify_irrelevant_progress', $this->
getProgressIdString($pgs->getNodeId()));
   568                 if ($pgs->isSuccessful()) {
   569                     $err_collection->
add(
false, 
'will_not_modify_deadline_on_successful_progress', $this->
getProgressIdString($pgs->getNodeId()));
   573                 $pgs = $pgs->withDeadline($deadline)
   574                     ->withLastChange($acting_usr_id, $this->
getNow())
   575                     ->withIndividualModifications(
true);
   577                 if ($pgs->isInProgress()) {
   586         return $this->withProgressTree($zipper->getRoot());
   596         $zipper = $this->
getZipper($node_id)->modifyFocus(
   597             function ($pgs) use ($err_collection, $acting_usr_id, $settings_repo, $validity_date): 
ilPRGProgress {
   598                 if (!$pgs->isRelevant()) {
   599                     $err_collection->
add(
false, 
'will_not_modify_irrelevant_progress', $this->
getProgressIdString($pgs->getNodeId()));
   602                 if (!$pgs->isSuccessful()) {
   603                     $err_collection->
add(
false, 
'will_not_modify_validity_on_non_successful_progress', $this->
getProgressIdString($pgs->getNodeId()));
   608                 $pgs = $pgs->withValidityOfQualification($validity_date)
   609                     ->withLastChange($acting_usr_id, $this->
getNow())
   610                     ->withIndividualModifications(
true)
   611                     ->withInvalidated(!$validity);
   620         return $this->withProgressTree($zipper->getRoot());
   630         $zipper = $this->
getZipper($node_id)->modifyFocus(
   631             function ($pgs) use ($err_collection, $acting_usr_id, $settings_repo, $points): 
ilPRGProgress {
   632                 if (!$pgs->isRelevant()) {
   633                     $err_collection->
add(
false, 
'will_not_modify_irrelevant_progress', $this->
getProgressIdString($pgs->getNodeId()));
   636                 if ($pgs->isSuccessful()) {
   637                     $err_collection->
add(
false, 
'will_not_modify_successful_progress', $this->
getProgressIdString($pgs->getNodeId()));
   641                 $pgs = $pgs->withAmountOfPoints($points)
   642                     ->withLastChange($acting_usr_id, $this->
getNow())
   643                     ->withIndividualModifications(
true);
   652         return $this->withProgressTree($zipper->getRoot());
   658         $zipper = $this->
getZipper($this->getRootId());
   662         $zipper = $zipper->modifyAll(
   664                 if (!$pgs->isSuccessful() || $pgs->hasValidQualification($now)) {
   668                 return $pgs->invalidate();
   672         foreach ($touched as 
$path) {
   676         return $this->withProgressTree($zipper->getRoot());
 unmarkAccredited(ilStudyProgrammeSettingsRepository $settings_repo, int $node_id, int $acting_usr_id, ilPRGMessageCollection $err_collection)
 
notifyProgressRevertSuccess(ilPRGProgress $pgs)
 
notifyScoreChange(ilPRGProgress $pgs)
 
markNotRelevant(ilStudyProgrammeSettingsRepository $settings_repo, int $node_id, int $acting_usr_id, ilPRGMessageCollection $err_collection)
 
resetProgressToSettings(ilStudyProgrammeSettingsRepository $settings_repo, ilPRGProgress $pgs, int $acting_usr_id)
 
markAccredited(ilStudyProgrammeSettingsRepository $settings_repo, ilStudyProgrammeEvents $events, int $node_id, int $acting_usr_id, ilPRGMessageCollection $err_collection)
 
changeProgressDeadline(ilStudyProgrammeSettingsRepository $settings_repo, int $node_id, int $acting_usr_id, ilPRGMessageCollection $err_collection, ?DateTimeImmutable $deadline)
 
succeed(ilStudyProgrammeSettingsRepository $settings_repo, int $node_id, int $triggering_obj_id)
 
withDeadline(?\DateTimeImmutable $deadline=null)
 
recalculateProgressStatus(ilStudyProgrammeSettingsRepository $settings_repo, ilPRGProgress $progress)
 
notifyProgressSuccess(ilPRGProgress $pgs)
 
static _getAllReferences(int $id)
get all reference ids for object ID 
 
withCurrentAmountOfPoints(int $points_cur)
 
get(int $obj_id)
Load settings belonging to a SP-Object. 
 
updateProgressDeadlineFromSettings(ilStudyProgrammeDeadlineSettings $settings, ilPRGProgress $progress)
 
applyProgressDeadline(ilStudyProgrammeSettingsRepository $settings_repo, ilPRGProgress $progress, int $acting_usr_id=null, bool $recalculate=true)
 
invalidate(ilStudyProgrammeSettingsRepository $settings_repo)
 
getValidityOfQualification()
 
getAchievedPointsOfChildren()
 
add(bool $success, string $message, string $record_identitifer)
 
markNotFailed(\DateTimeImmutable $date, int $acting_usr_id)
 
updateParentProgresses(ilStudyProgrammeSettingsRepository $settings_repo, Zipper $zipper)
 
changeProgressValidityDate(ilStudyProgrammeSettingsRepository $settings_repo, int $node_id, int $acting_usr_id, ilPRGMessageCollection $err_collection, ?DateTimeImmutable $validity_date)
 
getProgressIdString(int $node_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...
 
updateProgressRelevanceFromSettings(ilStudyProgrammeSettingsRepository $settings_repo, ilPRGProgress $pgs)
 
updatePlanFromRepository(ilStudyProgrammeSettingsRepository $settings_repo, int $acting_usr_id, ilPRGMessageCollection $err_collection)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
markFailed(\DateTimeImmutable $date, int $acting_usr_id)
 
resetProgresses(ilStudyProgrammeSettingsRepository $settings_repo, int $acting_usr_id)
 
changeAmountOfPoints(ilStudyProgrammeSettingsRepository $settings_repo, int $node_id, int $acting_usr_id, ilPRGMessageCollection $err_collection, int $points)
 
const STATUS_NOT_RELEVANT
 
markProgressesFailedForExpiredDeadline(ilStudyProgrammeSettingsRepository $settings_repo, int $acting_usr_id)
 
notifyValidityChange(ilPRGProgress $pgs)
 
notifyDeadlineChange(ilPRGProgress $pgs)
 
const COMPLETED_BY_SUBNODES
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
withValidityOfQualification(\DateTimeImmutable $date=null)
 
updateProgressValidityFromSettings(ilStudyProgrammeValidityOfAchievedQualificationSettings $settings, ilPRGProgress $progress)
 
Holds information about multi-actions, mainly in context of member-assignemnts and status changes...
 
markRelevant(ilStudyProgrammeSettingsRepository $settings_repo, int $node_id, int $acting_usr_id, ilPRGMessageCollection $err_collection)