19 declare(strict_types=1);
30 private const ID =
'prg_restart_assignments_temporal_progress';
43 $this->
log = $DIC[
'ilLog'];
44 $this->
lng = $DIC[
'lng'];
45 $this->
lng->loadLanguageModule(
'prg');
48 $this->assignment_repo =
$dic[
'repo.assignment'];
49 $this->adapter =
$dic[
'cron.restart'];
54 return $this->
lng->txt(
'prg_restart_assignments_temporal_progress_title');
59 return $this->
lng->txt(
'prg_restart_assignments_temporal_progress_desc');
79 return CronJobScheduleType::SCHEDULE_TYPE_IN_DAYS;
92 $programmes_to_reassign = $this->adapter->getRelevantProgrammeIds();
93 if (count($programmes_to_reassign) === 0) {
98 $programmes_and_due = [];
100 foreach ($programmes_to_reassign as $programme_obj_id => $days_offset) {
102 $due = $today->add($interval);
103 $programmes_and_due[$programme_obj_id] = $due;
106 $assignments = $this->assignment_repo->getAboutToExpire($programmes_and_due,
false);
108 if (count($assignments) === 0) {
112 foreach ($assignments as $ass) {
113 if ($ass->getRestartedAssignmentId() < 0) {
116 $restart_settings = $prg->getSettings()->getValidityOfQualificationSettings();
117 if ($restart_settings->getRestartRecheck()
118 && !$ass->isManuallyAssigned()
119 && !$prg->getApplicableMembershipSourceForUser($ass->getUserId(), null)
126 'PRG, RestartAssignments: user %s\'s assignment %s is being restarted (Programme %s)',
133 $restarted = $prg->assignUser($ass->getUserId(), self::ACTING_USR_ID,
false);
134 $ass = $ass->withRestarted($restarted->getId(), $today);
135 $this->assignment_repo->store($ass);
137 $this->adapter->actOnSingleAssignment($restarted);
148 if (!array_key_exists($prg_obj_id, $this->prgs)) {
151 return $this->prgs[$prg_obj_id];
159 protected function log(
string $msg): void
161 $this->
log->write($msg);
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilPRGAssignmentDBRepository $assignment_repo
ilPrgCronJobAdapter $adapter
Component logger with individual log levels by component id.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getStudyProgramme(int $prg_obj_id)
getDefaultScheduleValue()
const AUTO_ASSIGNED_BY_RESTART
final const STATUS_NO_ACTION
Re-assign users (according to restart-date).
static getInstanceByObjId(int $obj_id)
Assignments are relations of users to a PRG; They hold progress-information for (sub-)nodes of the PR...