ILIAS  release_8 Revision v8.24
class.ilPrgUpdateProgressCronJob.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
26{
27 private const ID = 'prg_update_progress';
28
29 protected Pimple\Container $dic;
30 protected ilLanguage $lng;
33 protected int $acting_user_id;
34
35 public function __construct()
36 {
37 global $DIC;
38 $this->lng = $DIC['lng'];
39 $this->lng->loadLanguageModule('prg');
40
42 $this->settings_repo = $dic['model.Settings.ilStudyProgrammeSettingsRepository'];
43 $this->assignment_repo = $dic['repo.assignment'];
44 $this->acting_user_id = $dic['current_user']->getId();
45 }
46
47 public function getTitle(): string
48 {
49 return $this->lng->txt('prg_update_progress_title');
50 }
51
52 public function getDescription(): string
53 {
54 return $this->lng->txt('prg_update_progress_description');
55 }
56
57 public function getId(): string
58 {
59 return self::ID;
60 }
61
62 public function hasAutoActivation(): bool
63 {
64 return true;
65 }
66
67 public function hasFlexibleSchedule(): bool
68 {
69 return true;
70 }
71
72 public function getDefaultScheduleType(): int
73 {
75 }
76
77 public function getDefaultScheduleValue(): ?int
78 {
79 return 1;
80 }
81
82 public function run(): ilCronJobResult
83 {
84 $result = new ilCronJobResult();
85 $result->setStatus(ilCronJobResult::STATUS_NO_ACTION);
86
87 $now = new DateTimeImmutable();
88
89 foreach ($this->assignment_repo->getPassedDeadline($now) as $assignment) {
90 $assignment = $assignment->markProgressesFailedForExpiredDeadline(
91 $this->settings_repo,
92 $this->acting_user_id
93 );
94 $this->assignment_repo->store($assignment);
95 }
96
97 $result->setStatus(ilCronJobResult::STATUS_OK);
98 return $result;
99 }
100}
const SCHEDULE_TYPE_IN_DAYS
@depracated This will be replaced with an ENUM in ILIAS 9
language handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilStudyProgrammeSettingsDBRepository $settings_repo
hasAutoActivation()
Is to be activated on "installation", does only work for ILIAS core cron jobs.
ilPRGAssignmentDBRepository $assignment_repo
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28