ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilPrgUpdateProgressCronJob.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
24
30{
31 private const ID = 'prg_update_progress';
32
33 protected Pimple\Container $dic;
34 protected ilLanguage $lng;
37 protected int $acting_user_id;
38
39 public function __construct()
40 {
41 global $DIC;
42 $this->lng = $DIC['lng'];
43 $this->lng->loadLanguageModule('prg');
44
46 $this->settings_repo = $dic['model.Settings.ilStudyProgrammeSettingsRepository'];
47 $this->assignment_repo = $dic['repo.assignment'];
48 $this->acting_user_id = $dic['current_user']->getId();
49 }
50
51 public function getTitle(): string
52 {
53 return $this->lng->txt('prg_update_progress_title');
54 }
55
56 public function getDescription(): string
57 {
58 return $this->lng->txt('prg_update_progress_description');
59 }
60
61 public function getId(): string
62 {
63 return self::ID;
64 }
65
66 public function hasAutoActivation(): bool
67 {
68 return true;
69 }
70
71 public function hasFlexibleSchedule(): bool
72 {
73 return true;
74 }
75
77 {
78 return JobScheduleType::IN_DAYS;
79 }
80
81 public function getDefaultScheduleValue(): ?int
82 {
83 return 1;
84 }
85
86 public function run(): JobResult
87 {
88 $result = new JobResult();
89 $result->setStatus(JobResult::STATUS_NO_ACTION);
90
91 $now = new DateTimeImmutable();
92
93 foreach ($this->assignment_repo->getPassedDeadline($now) as $assignment) {
94 $assignment = $assignment->markProgressesFailedForExpiredDeadline(
95 $this->settings_repo,
96 $this->acting_user_id
97 );
98 $this->assignment_repo->store($assignment);
99 }
100
101 $result->setStatus(JobResult::STATUS_OK);
102 return $result;
103 }
104}
language handling
Assignments are relations of users to a PRG; They hold progress-information for (sub-)nodes of the PR...
This will set progresses to FAILED, if they are past the deadline (and not successful,...
ilStudyProgrammeSettingsDBRepository $settings_repo
hasAutoActivation()
Is to be activated on "installation", does only work for ILIAS core cron jobs.
ilPRGAssignmentDBRepository $assignment_repo
global $DIC
Definition: shib_login.php:26