id(), $user->profile()->yearPromo()); MailingList::subscribePromo($user->profile()->yearPromo()); $this->UpdateOnYes(); break; case 'dismiss': $this->UpdateOnDismiss(); break; case 'no': $this->UpdateOnNo(); break; } } public function text() { 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 " . $this->user->promo() . '.'; } public function title() { return "Inscription à la liste de diffusion de ta promotion"; } public static function IsCandidate(User $user, $candidate) { $profile = $user->profile(); if (!$profile) { return false; } // 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 group_members WHERE uid = {?} AND asso_id = (SELECT id FROM groups WHERE diminutif = {?})', $user->id(), $user->profile()->yearPromo()); $mlCount = $res->fetchOneCell(); if ($mlCount) { Reminder::MarkCandidateAsAccepted($user->id(), $candidate); } if ($mlCount == 0) { $mlist = MailingList::promo($user->profile()->yearPromo()); try { $mlist->getMembersLimit(0, 0); } catch (Exception $e) { return false; } } return false; } } // vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8: ?>