ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilDAVCronDiskQuota.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 "rep_disk_quota";
17  }
18 
19  public function getTitle()
20  {
21  global $lng;
22 
23  $lng->loadLanguageModule("file");
24  return $lng->txt("repository_disk_quota");
25  }
26 
27  public function getDescription()
28  {
29  global $lng;
30 
31  $lng->loadLanguageModule("file");
32  return $lng->txt("repository_disk_quota_info");
33  }
34 
35  public function getDefaultScheduleType()
36  {
38  }
39 
40  public function getDefaultScheduleValue()
41  {
42  return;
43  }
44 
45  public function hasAutoActivation()
46  {
47  return false;
48  }
49 
50  public function hasFlexibleSchedule()
51  {
52  return false;
53  }
54 
55  public function hasCustomSettings()
56  {
57  return true;
58  }
59 
60  public function run()
61  {
62  require_once'./Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
64  {
65  require_once'./Services/WebDAV/classes/class.ilDiskQuotaChecker.php';
67 
69  {
71  }
72 
74  {
76  }
77  }
78 
79  $result = new ilCronJobResult();
81  return $result;
82  }
83 
84  public function addCustomSettingsToForm(ilPropertyFormGUI $a_form)
85  {
86  global $lng;
87 
88  $lng->loadLanguageModule("file");
89 
90  require_once 'Services/WebDAV/classes/class.ilObjDiskQuotaSettings.php';
91  $disk_quota_obj = ilObjDiskQuotaSettings::getInstance();
92 
93  // Enable disk quota reminder mail
94  $cb_prop_reminder = new ilCheckboxInputGUI($lng->txt("enable_disk_quota_reminder_mail"), "enable_disk_quota_reminder_mail");
95  $cb_prop_reminder->setValue('1');
96  $cb_prop_reminder->setChecked($disk_quota_obj->isDiskQuotaReminderMailEnabled());
97  $cb_prop_reminder->setInfo($lng->txt('disk_quota_reminder_mail_desc'));
98  $a_form->addItem($cb_prop_reminder);
99 
100  // Enable summary mail for certain users
101  $cb_prop_summary= new ilCheckboxInputGUI($lng->txt("enable_disk_quota_summary_mail"), "enable_disk_quota_summary_mail");
102  $cb_prop_summary->setValue(1);
103  $cb_prop_summary->setChecked($disk_quota_obj->isDiskQuotaSummaryMailEnabled());
104  $cb_prop_summary->setInfo($lng->txt('enable_disk_quota_summary_mail_desc'));
105  $a_form->addItem($cb_prop_summary);
106 
107  // Edit disk quota recipients
108  $summary_rcpt = new ilTextInputGUI($lng->txt("disk_quota_summary_rctp"), "disk_quota_summary_rctp");
109  $summary_rcpt->setValue($disk_quota_obj->getSummaryRecipients());
110  $summary_rcpt->setInfo($lng->txt('disk_quota_summary_rctp_desc'));
111  $cb_prop_summary->addSubItem($summary_rcpt);
112  }
113 
114  public function saveCustomSettings(ilPropertyFormGUI $a_form)
115  {
116  require_once 'Services/WebDAV/classes/class.ilObjDiskQuotaSettings.php';
117  $disk_quota_obj = ilObjDiskQuotaSettings::getInstance();
118  $disk_quota_obj->setDiskQuotaReminderMailEnabled($_POST['enable_disk_quota_reminder_mail'] == '1');
119  $disk_quota_obj->isDiskQuotaSummaryMailEnabled($_POST['enable_disk_quota_summary_mail'] == '1');
120  $disk_quota_obj->setSummaryRecipients(ilUtil::stripSlashes($_POST['disk_quota_summary_rctp']));
121  $disk_quota_obj->update();
122 
123  return true;
124  }
125 
126  public function addToExternalSettingsForm($a_form_id, array &$a_fields, $a_is_active)
127  {
128  global $lng;
129 
130  $lng->loadLanguageModule("file");
131 
132  switch($a_form_id)
133  {
136 
137  require_once('Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php');
138 
139  $subitems = array(
140  "enable_disk_quota_reminder_mail" => array(
143  ),
144  "enable_disk_quota_summary_mail" => array(
147  )
148  );
149  $a_fields["repository_disk_quota"] = array($a_is_active ?
150  $lng->txt("enabled") :
151  $lng->txt("disabled"),
152  null, $subitems);
153  break;
154  }
155  }
156 
157  public function activationWasToggled($a_currently_active)
158  {
159  // #12221
160  $settings = new ilSetting('disk_quota');
161  $settings->set('enabled', $a_currently_active);
162 
163  /* objDefinition is not available in setup, we cannot use ilObject
164  require_once 'Services/WebDAV/classes/class.ilObjDiskQuotaSettings.php';
165  $disk_quota_obj = ilObjDiskQuotaSettings::getInstance();
166  $disk_quota_obj->setDiskQuotaEnabled((bool)$a_currently_active);
167  $disk_quota_obj->update();
168  */
169  }
170 }
171 
172 ?>