Proof of concept:
[platal.git] / htdocs / marketing / relance.php
1 <?php
2 /***************************************************************************
3 * Copyright (C) 2003-2006 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
5 * *
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. *
10 * *
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. *
15 * *
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 *
18 * Foundation, Inc., *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
21
22 require_once("xorg.inc.php");
23 new_admin_page('marketing/relance.tpl');
24
25 /* une relance a été demandée - on envoit les mails correspondants */
26 if (Post::has('relancer')) {
27 $res = $globals->xdb->query("SELECT COUNT(*) FROM auth_user_md5 WHERE deces=0");
28 $nbdix = $res->fetchOneCell();
29
30 $sent = Array();
31 foreach (array_keys($_POST['relance']) as $uid) {
32 if ($tmp = relance($uid, $nbdix)) {
33 $sent[] = $tmp.' a été relancé';
34 }
35 }
36 $page->assign('sent', $sent);
37 }
38
39 $sql = "SELECT r.date, r.relance, r.uid, u.promo, u.nom, u.prenom
40 FROM register_pending AS r
41 INNER JOIN auth_user_md5 AS u ON r. uid = u.user_id
42 WHERE hash!='INSCRIT'
43 ORDER BY date DESC";
44 $page->assign('relance', $globals->xdb->iterator($sql));
45
46 $page->run();
47 ?>