Adds email_backup reminder.
authorStéphane Jacob <jacou@melix.net>
Sun, 10 May 2009 22:16:35 +0000 (00:16 +0200)
committerStéphane Jacob <jacou@melix.net>
Sun, 31 May 2009 12:35:33 +0000 (14:35 +0200)
include/reminder/email_backup.inc.php [new file with mode: 0644]
upgrade/0.10.1/00_inscription.sql

diff --git a/include/reminder/email_backup.inc.php b/include/reminder/email_backup.inc.php
new file mode 100644 (file)
index 0000000..53eb021
--- /dev/null
@@ -0,0 +1,60 @@
+<?php
+/***************************************************************************
+ *  Copyright (C) 2003-2009 Polytechnique.org                              *
+ *  http://opensource.polytechnique.org/                                   *
+ *                                                                         *
+ *  This program is free software; you can redistribute it and/or modify   *
+ *  it under the terms of the GNU General Public License as published by   *
+ *  the Free Software Foundation; either version 2 of the License, or      *
+ *  (at your option) any later version.                                    *
+ *                                                                         *
+ *  This program is distributed in the hope that it will be useful,        *
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
+ *  GNU General Public License for more details.                           *
+ *                                                                         *
+ *  You should have received a copy of the GNU General Public License      *
+ *  along with this program; if not, write to the Free Software            *
+ *  Foundation, Inc.,                                                      *
+ *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
+ ***************************************************************************/
+
+class ReminderEmailBackup extends Reminder
+{
+    public function HandleAction($action)
+    {
+        if ($action == 'yes') {
+            require_once 'emails.inc.php';
+            $user = S::user();
+            $storage = new EmailStorage($user, 'imap');
+            $storage->activate();
+
+            $this->UpdateOnYes();
+        }
+
+        if ($action == 'dismiss') {
+            $this->UpdateOnDismiss();
+        }
+
+        if ($action == 'no') {
+            $this->UpdateOnNo();
+        }
+    }
+
+    protected function GetDisplayText()
+    {
+        return "Tu peux bénéficier d'une sauvegarde des emails. Cela permet
+            d'avoir un accès de secours aux 30 derniers jours d'emails reçus
+            sur ton adresse Polytechnique.org.";
+    }
+
+    public static function IsCandidate(User &$user)
+    {
+        require_once 'emails.inc.php';
+        $storage = new EmailStorage($user, 'imap');
+        return $storage->active;
+    }
+}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
index 4534770..4eed42d 100644 (file)
@@ -17,6 +17,7 @@ INSERT INTO  reminder_type (name, weight, remind_delay_yes, remind_delay_no, rem
              ('profile_update', 90, 0, 0,   2),
              ('nl',             80, 0, 365, 7),
              ('promotion_ml',   70, 0, 365, 7),
+             ('email_backup',   60, 0, 365, 7),
              ('ax_letter',      50, 0, 365, 14);
 
 DROP TABLE IF EXISTS reminder;