ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilPRGAssignmentActions.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
28 {
29  abstract public function getEvents(): StudyProgrammeEvents;
30 
31  protected function getProgressIdString(int $node_id): string
32  {
33  return sprintf(
34  '%s, progress-id (%s/%s)',
35  $this->user_info->getFullname(),
36  $this->getId(),
37  (string) $node_id
38  );
39  }
40 
41  protected function getNow(): DateTimeImmutable
42  {
43  return new DateTimeImmutable();
44  }
45 
46  protected function getRefIdFor(int $obj_id): int
47  {
48  $refs = ilObject::_getAllReferences($obj_id);
49  if (count($refs) < 1) {
50  throw new ilException("Could not find ref_id for programme with obj_id $obj_id");
51  }
52  return (int) array_shift($refs);
53  }
54 
55  protected function recalculateProgressStatus(
57  ilPRGProgress $progress
58  ): ilPRGProgress {
59  if (!$progress->isRelevant()) {
60  return $progress;
61  }
62  $node_settings = $settings_repo->get($progress->getNodeId());
63  $completion_mode = $node_settings->getLPMode();
64 
65  switch ($completion_mode) {
68  return $progress;
69  break;
71  $completing_crs_id = ilPRGProgress::COMPLETED_BY_SUBNODES;
72  $achieved_points = $progress->getAchievedPointsOfChildren();
73  break;
74  }
75 
76  $progress = $progress->withCurrentAmountOfPoints($achieved_points);
77  $this->notifyScoreChange($progress);
78 
79  $required_points = $progress->getAmountOfPoints();
80  $successful = ($achieved_points >= $required_points);
81 
82  if ($successful && !$progress->isSuccessful()) {
83  $progress = $progress
85  ->withCompletion($completing_crs_id, $this->getNow());
86 
87  if (!$progress->getValidityOfQualification()) {
88  $settings = $settings_repo->get($progress->getNodeId())->getValidityOfQualificationSettings();
89  $progress = $this->updateProgressValidityFromSettings($settings, $progress);
90  }
91  $this->notifyProgressSuccess($progress);
92  }
93 
94  if (!$successful && $progress->isSuccessful()
96  ) {
97  $progress = $progress
99  ->withCompletion(null, null)
100  ->withValidityOfQualification(null);
101 
102  $this->notifyValidityChange($progress);
103  $this->notifyProgressRevertSuccess($progress);
104  }
105 
106  return $progress;
107  }
108 
109  protected function updateParentProgresses(
110  ilStudyProgrammeSettingsRepository $settings_repo,
111  Zipper $zipper
112  ): Zipper {
113  while (!$zipper->isTop()) {
114  $zipper = $zipper->toParent()
115  ->modifyFocus(
116  function ($pgs) use ($settings_repo) {
117  $today = $this->getNow();
118  $format = ilPRGProgress::DATE_FORMAT;
119  $deadline = $pgs->getDeadline();
120  if (!is_null($deadline)
121  && $deadline->format($format) <= $today->format($format)
122  ) {
123  return $pgs;
124  }
125  return $this->recalculateProgressStatus($settings_repo, $pgs);
126  }
127  );
128  }
129  return $zipper;
130  }
131 
134  ilPRGProgress $progress
135  ): ilPRGProgress {
136  $cdate = $progress->getCompletionDate();
137  if (!$cdate
138  || $progress->isSuccessful() === false
139  ) {
140  return $progress;
141  }
142  $period = $settings->getQualificationPeriod();
143  $date = $settings->getQualificationDate();
144 
145  if ($period) {
146  $date = $cdate->add(new DateInterval('P' . $period . 'D'));
147  }
148 
149  $validity = is_null($date) || $date->format(ilPRGProgress::DATE_FORMAT) >= $this->getNow()->format(ilPRGProgress::DATE_FORMAT);
150  $this->notifyValidityChange($progress);
151  return $progress->withValidityOfQualification($date)
152  ->withInvalidated(!$validity);
153  }
154 
157  ilPRGProgress $progress
158  ): ilPRGProgress {
159  $period = $settings->getDeadlinePeriod();
160  $date = $settings->getDeadlineDate();
161 
162  if ($period) {
163  $date = $progress->getAssignmentDate();
164  $date = $date->add(new DateInterval('P' . $period . 'D'));
165  }
166  $this->notifyDeadlineChange($progress);
167  return $progress->withDeadline($date);
168  }
169 
171  ilStudyProgrammeSettingsRepository $settings_repo,
172  ilPRGProgress $pgs
173  ): ilPRGProgress {
174  $programme_status = $settings_repo->get($pgs->getNodeId())->getAssessmentSettings()->getStatus();
175  $active = $programme_status === ilStudyProgrammeSettings::STATUS_ACTIVE;
176 
177  if ($active && !$pgs->isRelevant()) {
179  }
180  if (!$active && $pgs->isInProgress()) {
182  }
183  return $pgs;
184  }
185 
186 
187  protected function applyProgressDeadline(
188  ilStudyProgrammeSettingsRepository $settings_repo,
189  ilPRGProgress $progress,
190  ?int $acting_usr_id = null,
191  bool $recalculate = true
192  ): ilPRGProgress {
193  $today = $this->getNow();
194  $format = ilPRGProgress::DATE_FORMAT;
195  $deadline = $progress->getDeadline();
196 
197  if (is_null($acting_usr_id)) {
198  throw new Exception('no acting user.');
199  $acting_usr_id = $this->getLoggedInUserId(); //TODO !
200  }
201 
202  switch ($progress->getStatus()) {
204  if (!is_null($deadline)
205  && $deadline->format($format) < $today->format($format)
206  ) {
207  $progress = $progress->markFailed($this->getNow(), $acting_usr_id);
208  $this->notifyProgressRevertSuccess($progress);
209  } else {
210  $node_settings = $settings_repo->get($progress->getNodeId());
211  $completion_mode = $node_settings->getLPMode();
212  if ($recalculate || $completion_mode !== ilStudyProgrammeSettings::MODE_LP_COMPLETED) {
213  $progress = $this->recalculateProgressStatus($settings_repo, $progress);
214  }
215  }
216  break;
217 
219  if (is_null($deadline)
220  || $deadline->format($format) >= $today->format($format)
221  ) {
222  $progress = $progress->markNotFailed($this->getNow(), $acting_usr_id);
223  $this->notifyProgressRevertSuccess($progress);
224  }
225  break;
226  }
227 
228  return $progress;
229  }
230 
231 
232  protected function resetProgressToSettings(
233  ilStudyProgrammeSettingsRepository $settings_repo,
234  ilPRGProgress $pgs,
235  int $acting_usr_id
236  ): ilPRGProgress {
237  $settings = $settings_repo->get($pgs->getNodeId());
238  if ($pgs->isRelevant()) {
239  $pgs = $this->updateProgressValidityFromSettings($settings->getValidityOfQualificationSettings(), $pgs);
240  $pgs = $this->updateProgressDeadlineFromSettings($settings->getDeadlineSettings(), $pgs);
241  } else {
242  $pgs = $pgs
244  ->withDeadline(null);
245  $this->notifyValidityChange($pgs);
246  }
247 
248  $pgs = $pgs
249  ->withAmountOfPoints($settings->getAssessmentSettings()->getPoints())
250  ->withLastChange($acting_usr_id, $this->getNow())
251  ->withIndividualModifications(false);
252 
253  if ($pgs->isSuccessful()) {
254  $pgs = $pgs->withCurrentAmountOfPoints($pgs->getAmountOfPoints());
255  $this->notifyScoreChange($pgs);
256  }
257 
258  return $pgs;
259  }
260 
261 
262 
263  // ------------------------- tree-manipulation -----------------------------
264 
265  protected function getZipper($node_id)
266  {
267  $progress_path = $this->getProgressForNode($node_id)->getPath();
268  $zipper = new Zipper($this->getProgressTree());
269  return $zipper = $zipper->toPath($progress_path);
270  }
271 
272  protected function notifyProgressSuccess(ilPRGProgress $pgs): void
273  {
274  $this->getEvents()->userSuccessful($this, $pgs->getNodeId());
275  }
276  protected function notifyValidityChange(ilPRGProgress $pgs): void
277  {
278  $this->getEvents()->validityChange($this, $pgs->getNodeId());
279  }
280  protected function notifyDeadlineChange(ilPRGProgress $pgs): void
281  {
282  $this->getEvents()->deadlineChange($this, $pgs->getNodeId());
283  }
284  protected function notifyScoreChange(ilPRGProgress $pgs): void
285  {
286  $this->getEvents()->scoreChange($this, $pgs->getNodeId());
287  }
288  protected function notifyProgressRevertSuccess(ilPRGProgress $pgs): void
289  {
290  $this->getEvents()->userRevertSuccessful($this, $pgs->getNodeId());
291  }
292 
293  public function initAssignmentDates(): self
294  {
295  $zipper = $this->getZipper($this->getRootId());
296  $zipper = $zipper->modifyAll(
297  fn($pgs) => $pgs->withAssignmentDate($this->getNow())
298  );
299  return $this->withProgressTree($zipper->getRoot());
300  }
301 
302  public function resetProgresses(
303  ilStudyProgrammeSettingsRepository $settings_repo,
304  int $acting_usr_id
305  ): self {
306  $zipper = $this->getZipper($this->getRootId());
307  $zipper = $zipper->modifyAll(
308  function ($pgs) use ($acting_usr_id, $settings_repo): ilPRGProgress {
309  $pgs = $this->updateProgressRelevanceFromSettings($settings_repo, $pgs);
310  $pgs = $this->resetProgressToSettings($settings_repo, $pgs, $acting_usr_id);
311  return $pgs;
312  }
313  );
314  return $this->withProgressTree($zipper->getRoot());
315  }
316 
317  public function markRelevant(
318  ilStudyProgrammeSettingsRepository $settings_repo,
319  int $node_id,
320  int $acting_usr_id,
321  ilPRGMessageCollection $err_collection
322  ): self {
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()));
327  return $pgs;
328  }
329  $pgs = $pgs->markRelevant($this->getNow(), $acting_usr_id);
330  $err_collection->add(true, 'set_to_relevant', $this->getProgressIdString($pgs->getNodeId()));
331  $pgs = $this->recalculateProgressStatus($settings_repo, $pgs);
332  return $pgs;
333  }
334  );
335 
336  $zipper = $this->updateParentProgresses($settings_repo, $zipper);
337  return $this->withProgressTree($zipper->getRoot());
338  }
339 
340  public function markNotRelevant(
341  ilStudyProgrammeSettingsRepository $settings_repo,
342  int $node_id,
343  int $acting_usr_id,
344  ilPRGMessageCollection $err_collection
345  ): self {
346  $zipper = $this->getZipper($node_id);
347 
348  if ($zipper->isTop()) {
349  $err_collection->add(false, 'will_not_set_top_progress_to_irrelevant', $this->getProgressIdString($node_id));
350  return $this;
351  }
352 
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()));
357  return $pgs;
358  }
359  if ($pgs->getStatus() === ilPRGProgress::STATUS_COMPLETED) {
360  $err_collection->add(false, 'will_not_modify_successful_progress', $this->getProgressIdString($pgs->getNodeId()));
361  return $pgs;
362  }
363 
364  $pgs = $pgs->markNotRelevant($this->getNow(), $acting_usr_id);
365  $err_collection->add(true, 'set_to_irrelevant', $this->getProgressIdString($pgs->getNodeId()));
366  return $pgs;
367  }
368  );
369 
370  $zipper = $this->updateParentProgresses($settings_repo, $zipper);
371  return $this->withProgressTree($zipper->getRoot());
372  }
373 
374  public function markAccredited(
375  ilStudyProgrammeSettingsRepository $settings_repo,
376  ilStudyProgrammeEvents $events, //TODO: remove.
377  int $node_id,
378  int $acting_usr_id,
379  ilPRGMessageCollection $err_collection
380  ): self {
381  $zipper = $this->getZipper($node_id);
382 
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()));
387  return $pgs;
388  }
389 
390  $new_status = ilPRGProgress::STATUS_ACCREDITED;
391  if ($pgs->getStatus() === $new_status) {
392  $err_collection->add(false, 'status_unchanged', $this->getProgressIdString($pgs->getNodeId()));
393  return $pgs;
394  }
395  if (!$pgs->isTransitionAllowedTo($new_status)) {
396  $err_collection->add(false, 'status_transition_not_allowed', $this->getProgressIdString($pgs->getNodeId()));
397  return $pgs;
398  }
399 
400  $pgs = $pgs
401  ->markAccredited($this->getNow(), $acting_usr_id)
402  ->withCurrentAmountOfPoints($pgs->getAmountOfPoints());
403  $this->notifyScoreChange($pgs);
404 
405  if (!$pgs->getValidityOfQualification()) {
406  $settings = $settings_repo->get($pgs->getNodeId())->getValidityOfQualificationSettings();
407  $pgs = $this->updateProgressValidityFromSettings($settings, $pgs);
408  }
409 
410  $this->notifyProgressSuccess($pgs);
411  $err_collection->add(true, 'status_changed', $this->getProgressIdString($pgs->getNodeId()));
412  return $pgs;
413  }
414  );
415 
416  $zipper = $this->updateParentProgresses($settings_repo, $zipper);
417  return $this->withProgressTree($zipper->getRoot());
418  }
419 
420 
421  public function unmarkAccredited(
422  ilStudyProgrammeSettingsRepository $settings_repo,
423  int $node_id,
424  int $acting_usr_id,
425  ilPRGMessageCollection $err_collection
426  ): self {
427  $zipper = $this->getZipper($node_id);
428 
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()));
433  return $pgs;
434  }
435 
436  $new_status = ilPRGProgress::STATUS_IN_PROGRESS;
437  if ($pgs->getStatus() === $new_status) {
438  $err_collection->add(false, 'status_unchanged', $this->getProgressIdString($pgs->getNodeId()));
439  return $pgs;
440  }
441  if (!$pgs->isTransitionAllowedTo($new_status)
442  //special case: completion may not be revoked manually (but might be as a calculation-result of underlying progresses)
443  || $pgs->getStatus() === ilPRGProgress::STATUS_COMPLETED
444  ) {
445  $err_collection->add(false, 'status_transition_not_allowed', $this->getProgressIdString($pgs->getNodeId()));
446  return $pgs;
447  }
448 
449  $pgs = $pgs
450  ->unmarkAccredited($this->getNow(), $acting_usr_id)
451  ->withCurrentAmountOfPoints($pgs->getAchievedPointsOfChildren());
452  $this->notifyScoreChange($pgs);
453 
454  $old_status = $pgs->getStatus();
455  $pgs = $this->applyProgressDeadline($settings_repo, $pgs, $acting_usr_id);
456  if ($pgs->getStatus() !== $old_status) {
457  $err_collection->add(false, 'status_changed_due_to_deadline', $this->getProgressIdString($pgs->getNodeId()));
458  } else {
459  $err_collection->add(true, 'status_changed', $this->getProgressIdString($pgs->getNodeId()));
460  }
461  $this->notifyProgressRevertSuccess($pgs);
462  return $pgs;
463  }
464  );
465 
466  $zipper = $this->updateParentProgresses($settings_repo, $zipper);
467  return $this->withProgressTree($zipper->getRoot());
468  }
469 
470  public function updatePlanFromRepository(
471  ilStudyProgrammeSettingsRepository $settings_repo,
472  int $acting_usr_id,
473  ilPRGMessageCollection $err_collection
474  ): self {
475  $zipper = $this->getZipper($this->getRootId());
476  $leafs = [];
477  $zipper = $zipper->modifyAll(
478  function ($pgs) use ($err_collection, $acting_usr_id, $settings_repo, &$leafs): ilPRGProgress {
479  $pgs = $this->updateProgressRelevanceFromSettings($settings_repo, $pgs);
480  $pgs = $this->resetProgressToSettings($settings_repo, $pgs, $acting_usr_id);
481  $pgs = $this->applyProgressDeadline($settings_repo, $pgs, $acting_usr_id, false);
482  if (!$pgs->getSubnodes()) {
483  $leafs[] = $pgs->getPath();
484  }
485  return $pgs;
486  }
487  );
488 
489  foreach ($leafs as $path) {
490  $zipper = $this->updateParentProgresses($settings_repo, $zipper->toPath($path));
491  }
492  return $this->withProgressTree($zipper->getRoot());
493  }
494 
495  public function succeed(
496  ilStudyProgrammeSettingsRepository $settings_repo,
497  int $node_id,
498  int $triggering_obj_id
499  ): self {
500  $zipper = $this->getZipper($node_id)->modifyFocus(
501  function ($pgs) use ($settings_repo, $triggering_obj_id): ilPRGProgress {
502  $deadline = $pgs->getDeadline();
503  $format = ilPRGProgress::DATE_FORMAT;
504  $now = $this->getNow();
505  if ($pgs->isInProgress() &&
506  (is_null($deadline) || $deadline->format($format) >= $now->format($format))
507  ) {
508  $pgs = $pgs->succeed($now, $triggering_obj_id)
509  ->withCurrentAmountOfPoints($pgs->getAmountOfPoints());
510  $this->notifyScoreChange($pgs);
511  $settings = $settings_repo->get($pgs->getNodeId())->getValidityOfQualificationSettings();
512  $pgs = $this->updateProgressValidityFromSettings($settings, $pgs);
513  }
514 
515  $this->notifyProgressSuccess($pgs);
516  return $pgs;
517  }
518  );
519 
520  $zipper = $this->updateParentProgresses($settings_repo, $zipper);
521  return $this->withProgressTree($zipper->getRoot());
522  }
523 
524 
526  ilStudyProgrammeSettingsRepository $settings_repo,
527  int $acting_usr_id
528  ): self {
529  $zipper = $this->getZipper($this->getRootId());
530  $touched = [];
531 
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()
537  || $pgs->getDeadline()->format(ilPRGProgress::DATE_FORMAT) >= $deadline->format(ilPRGProgress::DATE_FORMAT)
538  ) {
539  return $pgs;
540  }
541 
542  $touched[] = $pgs->getPath();
543  $this->notifyProgressRevertSuccess($pgs);
544  return $pgs->markFailed($this->getNow(), $acting_usr_id);
545  }
546  );
547 
548  foreach ($touched as $path) {
549  $zipper = $this->updateParentProgresses($settings_repo, $zipper->toPath($path));
550  }
551 
552  return $this->withProgressTree($zipper->getRoot());
553  }
554 
555  public function changeProgressDeadline(
556  ilStudyProgrammeSettingsRepository $settings_repo,
557  int $node_id,
558  int $acting_usr_id,
559  ilPRGMessageCollection $err_collection,
560  ?DateTimeImmutable $deadline
561  ): self {
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()));
566  return $pgs;
567  }
568  if ($pgs->isSuccessful()) {
569  $err_collection->add(false, 'will_not_modify_deadline_on_successful_progress', $this->getProgressIdString($pgs->getNodeId()));
570  return $pgs;
571  }
572 
573  $pgs = $pgs->withDeadline($deadline)
574  ->withLastChange($acting_usr_id, $this->getNow())
575  ->withIndividualModifications(true);
576  $pgs = $this->applyProgressDeadline($settings_repo, $pgs, $acting_usr_id);
577  if ($pgs->isInProgress()) {
578  $this->notifyDeadlineChange($pgs);
579  }
580  $err_collection->add(true, 'deadline_updated', $this->getProgressIdString($pgs->getNodeId()));
581  return $pgs;
582  }
583  );
584 
585  $zipper = $this->updateParentProgresses($settings_repo, $zipper);
586  return $this->withProgressTree($zipper->getRoot());
587  }
588 
589  public function changeProgressValidityDate(
590  ilStudyProgrammeSettingsRepository $settings_repo,
591  int $node_id,
592  int $acting_usr_id,
593  ilPRGMessageCollection $err_collection,
594  ?DateTimeImmutable $validity_date
595  ): self {
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()));
600  return $pgs;
601  }
602  if (!$pgs->isSuccessful()) {
603  $err_collection->add(false, 'will_not_modify_validity_on_non_successful_progress', $this->getProgressIdString($pgs->getNodeId()));
604  return $pgs;
605  }
606 
607  $validity = is_null($validity_date) || $validity_date->format(ilPRGProgress::DATE_FORMAT) >= $this->getNow()->format(ilPRGProgress::DATE_FORMAT);
608  $pgs = $pgs->withValidityOfQualification($validity_date)
609  ->withLastChange($acting_usr_id, $this->getNow())
610  ->withIndividualModifications(true)
611  ->withInvalidated(!$validity);
612 
613  $this->notifyValidityChange($pgs);
614  $err_collection->add(true, 'validity_updated', $this->getProgressIdString($pgs->getNodeId()));
615  return $pgs;
616  }
617  );
618 
619  //$zipper = $this->updateParentProgresses($settings_repo, $zipper);
620  return $this->withProgressTree($zipper->getRoot());
621  }
622 
623  public function changeAmountOfPoints(
624  ilStudyProgrammeSettingsRepository $settings_repo,
625  int $node_id,
626  int $acting_usr_id,
627  ilPRGMessageCollection $err_collection,
628  int $points
629  ): self {
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()));
634  return $pgs;
635  }
636  if ($pgs->isSuccessful()) {
637  $err_collection->add(false, 'will_not_modify_successful_progress', $this->getProgressIdString($pgs->getNodeId()));
638  return $pgs;
639  }
640 
641  $pgs = $pgs->withAmountOfPoints($points)
642  ->withLastChange($acting_usr_id, $this->getNow())
643  ->withIndividualModifications(true);
644 
645  $err_collection->add(true, 'required_points_updated', $this->getProgressIdString($pgs->getNodeId()));
646  $pgs = $this->recalculateProgressStatus($settings_repo, $pgs);
647  return $pgs;
648  }
649  );
650 
651  $zipper = $this->updateParentProgresses($settings_repo, $zipper);
652  return $this->withProgressTree($zipper->getRoot());
653  }
654 
655  public function invalidate(
657  ): self {
658  $zipper = $this->getZipper($this->getRootId());
659  $touched = [];
660  $now = $this->getNow();
661 
662  $zipper = $zipper->modifyAll(
663  function ($pgs) use ($now, &$touched): ilPRGProgress {
664  if (!$pgs->isSuccessful() || $pgs->hasValidQualification($now)) {
665  return $pgs;
666  }
667  $touched[] = $pgs->getPath();
668  return $pgs->invalidate();
669  }
670  );
671 
672  foreach ($touched as $path) {
673  $zipper = $this->updateParentProgresses($settings_repo, $zipper->toPath($path));
674  }
675 
676  return $this->withProgressTree($zipper->getRoot());
677  }
678 }
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)
withValidityOfQualification(?\DateTimeImmutable $date=null)
changeProgressDeadline(ilStudyProgrammeSettingsRepository $settings_repo, int $node_id, int $acting_usr_id, ilPRGMessageCollection $err_collection, ?DateTimeImmutable $deadline)
withStatus(int $status)
succeed(ilStudyProgrammeSettingsRepository $settings_repo, int $node_id, int $triggering_obj_id)
getRefIdFor(int $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)
invalidate(ilStudyProgrammeSettingsRepository $settings_repo)
add(bool $success, string $message, string $record_identitifer)
markNotFailed(\DateTimeImmutable $date, int $acting_usr_id)
$path
Definition: ltiservices.php:29
updateParentProgresses(ilStudyProgrammeSettingsRepository $settings_repo, Zipper $zipper)
changeProgressValidityDate(ilStudyProgrammeSettingsRepository $settings_repo, int $node_id, int $acting_usr_id, ilPRGMessageCollection $err_collection, ?DateTimeImmutable $validity_date)
applyProgressDeadline(ilStudyProgrammeSettingsRepository $settings_repo, ilPRGProgress $progress, ?int $acting_usr_id=null, bool $recalculate=true)
getProgressIdString(int $node_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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)
Covers the persistence of settings belonging to a study programme (SP).
getZipper($node_id)
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)
markProgressesFailedForExpiredDeadline(ilStudyProgrammeSettingsRepository $settings_repo, int $acting_usr_id)
notifyValidityChange(ilPRGProgress $pgs)
initAssignmentDates()
notifyDeadlineChange(ilPRGProgress $pgs)
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)