ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilExcCronReminders.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once "Services/Cron/classes/class.ilCronJob.php";
6 
14 {
18  protected $lng;
19 
20 
24  public function __construct()
25  {
26  global $DIC;
27 
28  $this->lng = $DIC->language();
29  }
30 
31  public function getId()
32  {
33  return "exc_reminders";
34  }
35 
36  public function getTitle()
37  {
38  $lng = $this->lng;
39 
40  $lng->loadLanguageModule("exc");
41 
42  return $lng->txt("exc_reminders_cron");
43  }
44 
45  public function getDescription()
46  {
47  $lng = $this->lng;
48 
49  $lng->loadLanguageModule("exc");
50 
51  return $lng->txt("exc_reminders_cron_info");
52  }
53 
54  public function getDefaultScheduleType()
55  {
56  return self::SCHEDULE_TYPE_DAILY;
57  }
58 
59  public function getDefaultScheduleValue()
60  {
61  return;
62  }
63 
64  public function hasAutoActivation()
65  {
66  return true;
67  }
68 
69  public function hasFlexibleSchedule()
70  {
71  return true;
72  }
73 
74  public function run()
75  {
76  include_once "Modules/Exercise/classes/class.ilExAssignmentReminder.php";
77 
79  $log->debug("--- Start Exercise Reminders Cron");
80 
81  $cron_status = ilCronJobResult::STATUS_NO_ACTION;
82  $message = "";
83  $reminder = new ilExAssignmentReminder();
84  $num_reminders = $reminder->checkReminders();
85 
86  $this->lng->loadLanguageModule("exc");
87 
88  if ($num_reminders) {
89  $cron_status = ilCronJobResult::STATUS_OK;
90  $message = $this->lng->txt('exc_reminder_cron_ok');
91  }
92 
93  $cron_result = new ilCronJobResult();
94  $cron_result->setStatus($cron_status);
95 
96  if ($message != "") {
97  $cron_result->setMessage($message . " " . $num_reminders);
98  $cron_result->setCode("#" . $num_reminders);
99  }
100 
101  return $cron_result;
102  }
103 }
global $DIC
Definition: saml.php:7
Cron job application base class.
$log
Definition: sabredav.php:21
catch(Exception $e) $message
Cron for exercise reminders.
TODO: import/export reminder data with the exercise/assignment.
static getLogger($a_component_id)
Get component logger.
Cron job result data container.