6declare(strict_types=1);
11 const ID =
'prg_user_risky_to_fail';
41 $this->
log = $DIC[
'ilLog'];
42 $this->lng =
$DIC[
'lng'];
43 $this->lng->loadLanguageModule(
'prg');
55 return $this->lng->txt(
'prg_user_risky_to_fail_title');
65 return $this->lng->txt(
'prg_user_risky_to_fail_desc');
124 ->getProgrammeIdsWithRiskyToFailSettings();
126 if (count($programmes_to_send) == 0) {
131 $programmes_and_due = [];
132 foreach ($programmes_to_send as $programme_obj_id => $days_offset_mail) {
133 $interval =
new DateInterval(
'P' . $days_offset_mail .
'D');
134 $due = $today->add($interval);
135 $programmes_and_due[$programme_obj_id] = $due;
139 ->getRiskyToFail($programmes_and_due);
141 if (count($progresses) == 0) {
146 foreach ($progresses as $progress) {
149 'PRG, RiskyToFail: user %s at progress %s (prg obj_id %s)',
150 $progress->getUserId(),
152 $progress->getNodeId()
155 $events->userRiskyToFail($progress);
161 protected function getNow() : \DateTimeImmutable
163 return new DateTimeImmutable();
168 return $this->dic[
'model.Settings.ilStudyProgrammeSettingsRepository'];
173 return $this->dic[
'ilStudyProgrammeUserProgressDB'];
178 return $this->dic[
'ilStudyProgrammeEvents'];
181 protected function log(
string $msg) : void
183 $this->
log->write($msg);
An exception for terminatinating execution or to throw for unit testing.
Cron job result data container.
Cron job application base class.
const SCHEDULE_TYPE_IN_DAYS
getDefaultScheduleType()
Get schedule type.
getDefaultScheduleValue()
Get schedule value.
hasFlexibleSchedule()
Can the schedule be configured?
hasAutoActivation()
Is to be activated on "installation".
getDescription()
Get description.