ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilExcCronReminders.php
Go to the documentation of this file.
1 <?php
2 
20 
28 {
29  protected ilLanguage $lng;
30 
31  public function __construct()
32  {
33  global $DIC;
34 
35  $this->lng = $DIC->language();
36  }
37 
38  public function getId(): string
39  {
40  return "exc_reminders";
41  }
42 
43  public function getTitle(): string
44  {
45  $lng = $this->lng;
46 
47  $lng->loadLanguageModule("exc");
48 
49  return $lng->txt("exc_reminders_cron");
50  }
51 
52  public function getDescription(): string
53  {
54  $lng = $this->lng;
55 
56  $lng->loadLanguageModule("exc");
57 
58  return $lng->txt("exc_reminders_cron_info");
59  }
60 
62  {
63  return CronJobScheduleType::SCHEDULE_TYPE_DAILY;
64  }
65 
66  public function getDefaultScheduleValue(): ?int
67  {
68  return null;
69  }
70 
71  public function hasAutoActivation(): bool
72  {
73  return true;
74  }
75 
76  public function hasFlexibleSchedule(): bool
77  {
78  return true;
79  }
80 
84  public function run(): ilCronJobResult
85  {
87  $log->debug("--- Start Exercise Reminders Cron");
88 
89  $cron_status = ilCronJobResult::STATUS_NO_ACTION;
90  $message = "";
91  $reminder = new ilExAssignmentReminder();
92  $num_reminders = $reminder->checkReminders();
93 
94  $this->lng->loadLanguageModule("exc");
95 
96  if ($num_reminders !== 0) {
97  $cron_status = ilCronJobResult::STATUS_OK;
98  $message = $this->lng->txt('exc_reminder_cron_ok');
99  }
100 
101  $cron_result = new ilCronJobResult();
102  $cron_result->setStatus($cron_status);
103 
104  if ($message != "") {
105  $cron_result->setMessage($message . " " . $num_reminders . ' / ' . "#" . $num_reminders);
106  }
107 
108  return $cron_result;
109  }
110 }
static getLogger(string $a_component_id)
Get component logger.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
loadLanguageModule(string $a_module)
Load language module.
global $DIC
Definition: feed.php:28
$log
Definition: result.php:33
Cron for exercise reminders.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
final const STATUS_NO_ACTION
$message
Definition: xapiexit.php:32