2 /***************************************************************************
3 * Copyright (C) 2003-2013 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
22 class ReminderMl
extends Reminder
24 public function HandleAction($action)
28 S
::assert_xsrf_token();
29 $subs = array_keys(Post
::v('sub_ml'));
31 $res = XDB
::iterRow("SELECT sub, domain
33 WHERE uid = {?} AND type = 'list'
36 while (list($sub, $domain) = $res->next()) {
37 if (array_shift($subs) == "$sub@$domain") {
38 MailingList
::subscribeTo($sub, $domain);
47 $this->UpdateOnDismiss();
56 public function Prepare($page)
58 parent
::Prepare($page);
60 $res = XDB
::iterRow("SELECT sub, domain
62 WHERE uid = {?} AND type = 'list'
66 while (list($sub, $domain) = $res->next()) {
67 $mlist = new MailingList($sub, $domain);
68 list($details, ) = $mlist->getMembers();
69 $lists["$sub@$domain"] = $details;
71 $page->assign_by_ref('lists', $lists);
74 public function template()
76 return 'reminder/ml.tpl';
78 public function title()
80 return "Inscription aux listes de diffusion";
83 public static function IsCandidate(User
$user, $candidate)
85 $res = XDB
::query("SELECT COUNT(*) AS lists
87 WHERE uid = {?} AND type = 'list'",
90 $mlCount = $res->fetchOneCell();
92 Reminder
::MarkCandidateAsAccepted($user->id(), $candidate);
94 return ($mlCount > 0);
98 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: