ILIAS  release_8 Revision v8.24
class.ilPrgInvalidateExpiredProgressesCronJob.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
21/*
22 * This invalidates a successful progress if validityOfQualification is reached.
23 *
24 * This is deprecated, I think.
25 * It is perfectly feasible to raise some event for this, though,
26 * but invalidation is reached by a date rather than a flag set by a cron job.
27 */
29{
30 private const ID = 'prg_invalidate_expired_progresses';
31
33 protected ilLanguage $lng;
36
37 public function __construct()
38 {
39 global $DIC;
40 $this->log = $DIC['ilLog'];
41 $this->lng = $DIC['lng'];
42 $this->lng->loadLanguageModule('prg');
43
45 $this->assignment_repo = $dic['repo.assignment'];
46 $this->settings_repo = $dic['model.Settings.ilStudyProgrammeSettingsRepository'];
47 }
48
49 public function getTitle(): string
50 {
51 return $this->lng->txt('prg_invalidate_expired_progresses_title');
52 }
53
54 public function getDescription(): string
55 {
56 return $this->lng->txt('prg_invalidate_expired_progresses_desc');
57 }
58
59 public function getId(): string
60 {
61 return self::ID;
62 }
63
64 public function hasAutoActivation(): bool
65 {
66 return true;
67 }
68
69 public function hasFlexibleSchedule(): bool
70 {
71 return true;
72 }
73
74 public function getDefaultScheduleType(): int
75 {
77 }
78
79 public function getDefaultScheduleValue(): ?int
80 {
81 return 1;
82 }
83
84 public function run(): ilCronJobResult
85 {
86 $result = new ilCronJobResult();
87 foreach ($this->assignment_repo->getExpiredAndNotInvalidated() as $assignment) {
88 try {
89 $assignment = $assignment->invalidate($this->settings_repo);
90 $this->assignment_repo->store($assignment);
91 } catch (ilException $e) {
92 $this->log->write('an error occured: ' . $e->getMessage());
93 }
94 }
95 $result->setStatus(ilCronJobResult::STATUS_OK);
96 return $result;
97 }
98}
Component logger with individual log levels by component id.
const SCHEDULE_TYPE_IN_DAYS
@depracated This will be replaced with an ENUM in ILIAS 9
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
hasAutoActivation()
Is to be activated on "installation", does only work for ILIAS core cron jobs.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
$dic
Definition: result.php:32