1156e2a4ce4a62b23099d1b5126766cfecd3401c
2 /***************************************************************************
3 * Copyright (C) 2003-2010 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 ReminderPromotionMl
extends Reminder
24 public function HandleAction($action)
29 XDB
::execute('INSERT IGNORE INTO group_members (uid, asso_id)
32 WHERE diminutif = {?}'
33 $user->id(), $user->profile()->yearPromo());
34 $mmlist = new MMList($user);
35 $mmlist->subscribe('promo' . $user->profile()->yearPromo());
41 $this->UpdateOnDismiss();
50 public function text()
52 return "La liste de diffusion de ta promotion permet de recevoir les
53 informations plus spécifiques de ta promotion pour pouvoir
54 participer plus facilement aux événements qu'elle organise. Tu
55 seras aussi inscrit dans le groupe de la promotion " .
56 $this->user
->promo() . '.';
58 public function title()
60 return "Inscription à la liste de diffusion de ta promotion";
63 public static function IsCandidate(User
&$user, $candidate)
65 $profile = $user->profile();
70 // We only test if the user is in her promotion group for it is too
71 // expensive to check if she is in the corresponding ML as well.
72 $res = XDB
::query('SELECT COUNT(*)
74 WHERE uid = {?} AND asso_id = (SELECT id
76 WHERE diminutif = {?})',
77 $user->id(), $user->profile()->yearPromo());
78 $mlCount = $res->fetchOneCell();
80 Reminder
::MarkCandidateAsAccepted($user->id(), $candidate);
82 return ($mlCount == 0);
86 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: