ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 {
14  public function getId()
15  {
16  return "mail_notification";
17  }
18 
19  public function getTitle()
20  {
21  global $lng;
22 
23  return $lng->txt("cron_mail_notification");
24  }
25 
26  public function getDescription()
27  {
28  global $lng;
29 
30  return $lng->txt("cron_mail_notification_desc");
31  }
32 
33  public function getDefaultScheduleType()
34  {
36  }
37 
38  public function getDefaultScheduleValue()
39  {
40  return;
41  }
42 
43  public function hasAutoActivation()
44  {
45  return false;
46  }
47 
48  public function hasFlexibleSchedule()
49  {
50  return false;
51  }
52 
53  public function hasCustomSettings()
54  {
55  return true;
56  }
57 
58  public function run()
59  {
60  require_once 'Services/Mail/classes/class.ilMailSummaryNotification.php';
61  $msn = new ilMailSummaryNotification();
62  $msn->send();
63 
64  $result = new ilCronJobResult();
66  return $result;
67  }
68 
69  public function addCustomSettingsToForm(ilPropertyFormGUI $a_form)
70  {
71  global $lng, $ilSetting;
72 
73  $cb = new ilCheckboxInputGUI($lng->txt("cron_mail_notification_message"), "mail_notification_message");
74  $cb->setInfo($lng->txt("cron_mail_notification_message_info"));
75  $cb->setChecked($ilSetting->get("mail_notification_message"));
76  $a_form->addItem($cb);
77  }
78 
79  public function saveCustomSettings(ilPropertyFormGUI $a_form)
80  {
81  global $ilSetting;
82 
83  $ilSetting->set('mail_notification_message', $_POST['mail_notification_message'] ? 1 : 0);
84 
85  return true;
86  }
87 
88  public function activationWasToggled($a_currently_active)
89  {
90  global $ilSetting;
91 
92  // propagate cron-job setting to object setting
93  $ilSetting->set('mail_notification', (bool)$a_currently_active);
94  }
95 }
96 
97 ?>