ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
5include_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
59 $this->lng->loadLanguageModule('mail');
60
61 return sprintf(
62 $this->lng->txt("cron_mail_notification_desc"),
63 $this->lng->txt('mail_allow_external')
64 );
65 }
66
67 public function getDefaultScheduleType()
68 {
70 }
71
72 public function getDefaultScheduleValue()
73 {
74 return;
75 }
76
77 public function hasAutoActivation()
78 {
79 return false;
80 }
81
82 public function hasFlexibleSchedule()
83 {
84 return false;
85 }
86
87 public function hasCustomSettings()
88 {
89 return true;
90 }
91
92 public function run()
93 {
94 require_once 'Services/Mail/classes/class.ilMailSummaryNotification.php';
95 $msn = new ilMailSummaryNotification();
96 $msn->send();
97
100 return $result;
101 }
102
104 {
105 $this->init();
106 $cb = new ilCheckboxInputGUI($this->lng->txt("cron_mail_notification_message"), "mail_notification_message");
107 $cb->setInfo($this->lng->txt("cron_mail_notification_message_info"));
108 $cb->setChecked($this->settings->get("mail_notification_message"));
109 $a_form->addItem($cb);
110 }
111
112 public function saveCustomSettings(ilPropertyFormGUI $a_form)
113 {
114 $this->init();
115 $this->settings->set('mail_notification_message', $_POST['mail_notification_message'] ? 1 : 0);
116 return true;
117 }
118
119 public function activationWasToggled($a_currently_active)
120 {
121 $this->init();
122 $this->settings->set('mail_notification', (bool) $a_currently_active);
123 }
124}
$result
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
This class represents a checkbox property in a property form.
Cron job result data container.
Cron job application base class.
const SCHEDULE_TYPE_DAILY
hasAutoActivation()
Is to be activated on "installation".
hasCustomSettings()
Has cron job any custom setting which can be edited?
addCustomSettingsToForm(ilPropertyFormGUI $a_form)
Add custom settings to form.
hasFlexibleSchedule()
Can the schedule be configured?
getDefaultScheduleValue()
Get schedule value.
saveCustomSettings(ilPropertyFormGUI $a_form)
Save custom settings.
activationWasToggled($a_currently_active)
Cron job status was changed.
getDefaultScheduleType()
Get schedule type.
This class represents a property form user interface.
addItem($a_item)
Add Item (Property, SectionHeader).
settings()
Definition: settings.php:2
$DIC
Definition: xapitoken.php:46