ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilMailCronNotification.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once "Services/Cron/classes/class.ilCronJob.php";
6 
13 {
17  protected $lng;
18 
22  protected $settings;
23 
27  protected $initDone = false;
28 
32  protected function init()
33  {
34  global $DIC;
35 
36  if (!$this->initDone) {
37  $this->settings = $DIC->settings();
38  $this->lng = $DIC->language();
39 
40  $this->initDone = true;
41  }
42  }
43 
44  public function getId()
45  {
46  return "mail_notification";
47  }
48 
49  public function getTitle()
50  {
51  $this->init();
52  return $this->lng->txt("cron_mail_notification");
53  }
54 
55  public function getDescription()
56  {
57  $this->init();
58  return $this->lng->txt("cron_mail_notification_desc");
59  }
60 
61  public function getDefaultScheduleType()
62  {
63  return self::SCHEDULE_TYPE_DAILY;
64  }
65 
66  public function getDefaultScheduleValue()
67  {
68  return;
69  }
70 
71  public function hasAutoActivation()
72  {
73  return false;
74  }
75 
76  public function hasFlexibleSchedule()
77  {
78  return false;
79  }
80 
81  public function hasCustomSettings()
82  {
83  return true;
84  }
85 
86  public function run()
87  {
88  require_once 'Services/Mail/classes/class.ilMailSummaryNotification.php';
89  $msn = new ilMailSummaryNotification();
90  $msn->send();
91 
92  $result = new ilCronJobResult();
94  return $result;
95  }
96 
97  public function addCustomSettingsToForm(ilPropertyFormGUI $a_form)
98  {
99  $this->init();
100  $cb = new ilCheckboxInputGUI($this->lng->txt("cron_mail_notification_message"), "mail_notification_message");
101  $cb->setInfo($this->lng->txt("cron_mail_notification_message_info"));
102  $cb->setChecked($this->settings->get("mail_notification_message"));
103  $a_form->addItem($cb);
104  }
105 
106  public function saveCustomSettings(ilPropertyFormGUI $a_form)
107  {
108  $this->init();
109  $this->settings->set('mail_notification_message', $_POST['mail_notification_message'] ? 1 : 0);
110  return true;
111  }
112 
113  public function activationWasToggled($a_currently_active)
114  {
115  $this->init();
116  $this->settings->set('mail_notification', (bool) $a_currently_active);
117  }
118 }
saveCustomSettings(ilPropertyFormGUI $a_form)
settings()
Definition: settings.php:2
$result
This class represents a property form user interface.
global $DIC
Definition: saml.php:7
Cron job application base class.
This class represents a checkbox property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
setInfo($a_info)
Set Information Text.
addCustomSettingsToForm(ilPropertyFormGUI $a_form)
activationWasToggled($a_currently_active)
Cron job result data container.
$_POST["username"]