808fc3e34ab3d947e3fa3ae51874bf899eb38630
2 /***************************************************************************
3 * Copyright (C) 2003-2011 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 $mlist = new MailingList($sub, $domain);
48 $this->UpdateOnDismiss();
57 public function Prepare($page)
59 parent
::Prepare($page);
61 $res = XDB
::iterRow("SELECT sub, domain
63 WHERE uid = {?} AND type = 'list'
67 while (list($sub, $domain) = $res->next()) {
68 $mlist = new MailingList($sub, $domain);
69 list($details, ) = $mlist->getMembers();
70 $lists["$sub@$domain"] = $details;
72 $page->assign_by_ref('lists', $lists);
75 public function template()
77 return 'reminder/ml.tpl';
79 public function title()
81 return "Inscription aux listes de diffusion";
84 public static function IsCandidate(User
$user, $candidate)
86 $res = XDB
::query("SELECT COUNT(*) AS lists
88 WHERE uid = {?} AND type = 'list'",
91 $mlCount = $res->fetchOneCell();
93 Reminder
::MarkCandidateAsAccepted($user->id(), $candidate);
95 return ($mlCount > 0);
99 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: