<?php
/***************************************************************************
- * Copyright (C) 2003-2009 Polytechnique.org *
+ * Copyright (C) 2003-2011 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
S::i('uid'));
while (list($sub, $domain) = $res->next()) {
if (array_shift($subs) == "$sub@$domain") {
- list($sub, $domain) = explode('@', $list);
if ($domain != $current_domain) {
$current_domain = $domain;
- $client = new MMList(S::v('uid'), S::v('password'), $domain);
}
+ $client = new MMList(S::user(), $domain);
$client->subscribe($sub);
}
}
}
}
- protected function GetDisplayText() {}
-
- public function Display(&$page)
+ public function Prepare($page)
{
- header('Content-Type: text/html; charset=utf-8');
- $page->changeTpl('reminder/ml.tpl', NO_SKIN);
- $page->assign('baseurl', $this->GetBaseUrl());
+ parent::Prepare($page);
$res = XDB::iterRow("SELECT sub, domain
FROM register_subs
while (list($sub, $domain) = $res->next()) {
if ($current_domain != $domain) {
$current_domain = $domain;
- $client = new MMList(S::v('uid'), S::v('password'), $domain);
+ $client = new MMList(S::user(), $domain);
}
list($details, ) = $client->get_members($sub);
$lists["$sub@$domain"] = $details;
$page->assign_by_ref('lists', $lists);
}
- public static function IsCandidate(User &$user, $candidate)
+ public function template()
{
- $res = XDB::execute("SELECT COUNT(*) AS lists
- FROM register_subs
- WHERE uid = {?} AND type = 'list'",
- $user->id());
+ return 'reminder/ml.tpl';
+ }
+ public function title()
+ {
+ return "Inscription aux listes de diffusion";
+ }
+
+ public static function IsCandidate(User $user, $candidate)
+ {
+ $res = XDB::query("SELECT COUNT(*) AS lists
+ FROM register_subs
+ WHERE uid = {?} AND type = 'list'",
+ $user->id());
- return $res->fetchOneCell();
+ $mlCount = $res->fetchOneCell();
+ if (!$mlCount) {
+ Reminder::MarkCandidateAsAccepted($user->id(), $candidate);
+ }
+ return ($mlCount > 0);
}
}