3 declare(strict_types=1);
27 private const ID =
'prg_user_risky_to_fail';
37 $this->
log = $DIC[
'ilLog'];
38 $this->
lng = $DIC[
'lng'];
39 $this->
lng->loadLanguageModule(
'prg');
42 $this->assignment_repo =
$dic[
'repo.assignment'];
43 $this->adapter =
$dic[
'cron.riskyToFail'];
48 return $this->
lng->txt(
'prg_user_risky_to_fail_title');
53 return $this->
lng->txt(
'prg_user_risky_to_fail_desc');
73 return JobScheduleType::IN_DAYS;
84 $result->setStatus(JobResult::STATUS_NO_ACTION);
86 $programmes_to_send = $this->adapter->getRelevantProgrammeIds();
87 if (count($programmes_to_send) == 0) {
92 $programmes_and_due = [];
93 foreach ($programmes_to_send as $programme_obj_id => $days_offset_mail) {
94 $interval =
new DateInterval(
'P' . $days_offset_mail .
'D');
95 $due = $today->add($interval);
96 $programmes_and_due[$programme_obj_id] = $due;
101 $assignments = $this->assignment_repo->getRiskyToFail($programmes_and_due,
true);
103 if (count($assignments) == 0) {
107 foreach ($assignments as $ass) {
108 $pgs = $ass->getProgressTree();
111 'PRG, RiskyToFail: user %s at progress %s (prg obj_id %s)',
118 $this->adapter->actOnSingleAssignment($ass);
119 $this->assignment_repo->storeRiskyToFailSentFor($ass);
121 $result->setStatus(JobResult::STATUS_OK);
130 protected function log(
string $msg): void
132 $this->
log->write($msg);
ilPRGAssignmentDBRepository $assignment_repo
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Component logger with individual log levels by component id.
getDefaultScheduleValue()
ilPrgCronJobAdapter $adapter
Assignments are relations of users to a PRG; They hold progress-information for (sub-)nodes of the PR...