ILIAS  release_8 Revision v8.23
class.ilExcCronReminders.php
Go to the documentation of this file.
1 <?php
2 
26 {
27  protected ilLanguage $lng;
28 
29  public function __construct()
30  {
31  global $DIC;
32 
33  $this->lng = $DIC->language();
34  }
35 
36  public function getId(): string
37  {
38  return "exc_reminders";
39  }
40 
41  public function getTitle(): string
42  {
43  $lng = $this->lng;
44 
45  $lng->loadLanguageModule("exc");
46 
47  return $lng->txt("exc_reminders_cron");
48  }
49 
50  public function getDescription(): string
51  {
52  $lng = $this->lng;
53 
54  $lng->loadLanguageModule("exc");
55 
56  return $lng->txt("exc_reminders_cron_info");
57  }
58 
59  public function getDefaultScheduleType(): int
60  {
61  return self::SCHEDULE_TYPE_DAILY;
62  }
63 
64  public function getDefaultScheduleValue(): ?int
65  {
66  return null;
67  }
68 
69  public function hasAutoActivation(): bool
70  {
71  return true;
72  }
73 
74  public function hasFlexibleSchedule(): bool
75  {
76  return true;
77  }
78 
82  public function run(): ilCronJobResult
83  {
85  $log->debug("--- Start Exercise Reminders Cron");
86 
87  $cron_status = ilCronJobResult::STATUS_NO_ACTION;
88  $message = "";
89  $reminder = new ilExAssignmentReminder();
90  $num_reminders = $reminder->checkReminders();
91 
92  $this->lng->loadLanguageModule("exc");
93 
94  if ($num_reminders !== 0) {
95  $cron_status = ilCronJobResult::STATUS_OK;
96  $message = $this->lng->txt('exc_reminder_cron_ok');
97  }
98 
99  $cron_result = new ilCronJobResult();
100  $cron_result->setStatus($cron_status);
101 
102  if ($message != "") {
103  $cron_result->setMessage($message . " " . $num_reminders . ' / ' . "#" . $num_reminders);
104  }
105 
106  return $cron_result;
107  }
108 }
static getLogger(string $a_component_id)
Get component logger.
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
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...
$message
Definition: xapiexit.php:32