From: Stéphane Jacob Date: Sun, 10 May 2009 21:40:33 +0000 (+0200) Subject: Adds promotion_ml reminder. X-Git-Tag: xorg/0.10.1~75 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=cccf3cc08626d6a1613afc359fa2ced99126c265;p=platal.git Adds promotion_ml reminder. --- diff --git a/include/reminder/promotion_ml.inc.php b/include/reminder/promotion_ml.inc.php new file mode 100644 index 0000000..6a70e67 --- /dev/null +++ b/include/reminder/promotion_ml.inc.php @@ -0,0 +1,77 @@ +fetchOneCell(); + XDB::execute('REPLACE INTO groupex.membres (uid, asso_id) + VALUES ({?}, {?})', + S::v('uid'), $asso_id); + $mmlist = new MMList(S::v('uid'), S::v('password')); + $mmlist->subscribe('promo' . S::v('promo')); + + $this->UpdateOnYes(); + break; + + case 'dismiss': + $this->UpdateOnDismiss(); + break; + + case 'no': + $this->UpdateOnNo(); + break; + } + } + + protected function GetDisplayText() + { + return "La liste de diffusion de ta promotion permet de recevoir les + informations plus spécifiques de ta promotion pour pouvoir + participer plus facilement aux événements qu'elle organise. Tu + seras aussi inscrit dans le groupe de la promotion " . + S::user()->promo() . '.'; + } + + public static function IsCandidate(User &$user) + { + // We only test if the user is in her promotion group for it is too + // expensive to check if she is in the corresponding ML as well. + $res = XDB::query('SELECT COUNT(*) + FROM groupex.membres + WHERE uid = {?} AND asso_id = (SELECT id + FROM groupex.asso + WHERE diminutif = {?})', + $user->id(), S::v('promo')); + + return ($res->fetchOneCell() > 0); + } +} + +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: +?>