one more
authorx2000habouzit <x2000habouzit>
Sat, 17 Jul 2004 14:16:46 +0000 (14:16 +0000)
committerx2000habouzit <x2000habouzit>
Sat, 17 Jul 2004 14:16:46 +0000 (14:16 +0000)
+--------+--------+--------+--------+
|  todo  |  post  |  done  |  tot.  |
+--------+--------+--------+--------+
|    31  |    32  |   111  |   174  |
|   18%  |   18%  |   64%  |  100%  |
+--------+--------+--------+--------+

configs/mails.conf
etat_migration
htdocs/marketing/relance.php [new file with mode: 0644]
templates/mails/marketing.relance.tpl [new file with mode: 0644]
templates/marketing/relance.tpl [new file with mode: 0644]

index f21223f..6dae23f 100644 (file)
@@ -29,3 +29,5 @@ cc=Equipe Polytechnique.org <validation+sondages@polytechnique.org>
 [pattecassee_nl]
 from=Polytechnique.org <support@polytechnique.org>
 
+[marketing_relance]
+from=Pré Inscription <register@polytechnique.org>
index affd6b9..d652910 100644 (file)
@@ -20,7 +20,6 @@ Etat  | Ancien nom                                                              | Nouveau nom
 ;        | admin/correction_adr.php                              | 
 ;        | admin/evenements.php                                          | 
 ------+-[ marketing ]-----------------------------+----------------
-;        | admin/relance.php                                             | marketing/ 
 ;        | admin/utilisateurs_identification.php         | marketing/
 ;        | admin/utilisateurs_marketing.php              | marketing/
 ------+-[ docs ]----------------------------------+----------------
@@ -127,6 +126,7 @@ xx    | admin/newsletter_prep.php                             | -
 xx       | admin/postfix_blacklist.php                           | -
 xx       | admin/postfix_perm.php                                        | -
 xx       | admin/postfix_retardes.php                            | -
+xx       | admin/relance.php                                             | marketing/ 
 xx       | admin/stats_promo.php                                         | stats/stats_promo.php
 xx       | admin/valider.php                                             | -
 xx       | alias.php                                                             | -
diff --git a/htdocs/marketing/relance.php b/htdocs/marketing/relance.php
new file mode 100644 (file)
index 0000000..0707115
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+require("auto.prepend.inc.php");
+new_admin_page('marketing/relance.tpl');
+
+
+/* une relance a été demandée - on envoit les mails correspondants */
+if (isset($_POST["relancer"]) && isset($_POST["relancer"]) != "") {
+    require("tpl.mailer.inc.php");
+    
+    
+    $res=mysql_query("SELECT COUNT(*) FROM auth_user_md5");
+    list($nbdix) = mysql_fetch_row($res);
+    mysql_free_result($res);
+
+    $res = mysql_query("SELECT  e.date,e.promo,e.nom,e.prenom,e.matricule,e.email,e.username
+                          FROM  en_cours      AS e
+                     LEFT JOIN  auth_user_md5 AS a ON e.matricule=a.matricule
+                         WHERE  a.nom IS null");
+
+    $sent = Array();
+
+    while (list($ldate, $lpromo, $lnom, $lprenom, $lmatricule, $lemail, $lusername) = mysql_fetch_row($res)) {
+        if (isset($_POST[$lmatricule]) && $_POST[$lmatricule] == "1") {
+            $lins_id = rand_url_id(12);
+            $nveau_pass = rand_pass();
+            $lpass = md5($nveau_pass);
+            $fdate = substr($ldate, 8, 2)."/".substr($ldate, 5, 2)."/".substr($ldate, 0, 4);
+            
+            $mymail = new TplMailer('marketing.relance.tpl');
+            $mymail->assign('nbdix',$nbdix);
+            $mymail->assign('fdate',$fdate);
+            $mymail->assign('lusername',$lusername);
+            $mymail->assign('nveau_pass',$nveau_pass);
+            $mymail->assign('baseurl',$baseurl);
+            $mymail->assign('lins_id',$lins_id);
+            
+            $mymail->assign('lemail',$lemail);
+            $mymail->assign('subj',$lusername."@polytechnique.org");
+
+            mysql_query("UPDATE  en_cours
+                            SET  ins_id='$lins_id',password='$lpass',relance='".date("Y-m-j")."'
+                          WHERE  matricule = '$lmatricule'");
+            // envoi du mail à l'utilisateur
+
+            $mymail->send();
+
+            $sent[] = "$lprenom $lnom ($lpromo) a été relancé !";
+        }
+    }
+    $page->assign_by_ref('sent', $sent);
+
+/* pas d'action particulière => on affiche la liste des relançables... */
+}
+
+$sql = "SELECT  e.date,e.relance,e.promo,e.nom,e.prenom,e.matricule
+          FROM  en_cours      AS e
+     LEFT JOIN  auth_user_md5 AS a ON e.matricule=a.matricule
+         WHERE  a.nom IS null
+      ORDER BY  date DESC";
+
+$page ->mysql_assign($sql, 'relance','nb');
+
+$page->run();
+?>
diff --git a/templates/mails/marketing.relance.tpl b/templates/mails/marketing.relance.tpl
new file mode 100644 (file)
index 0000000..e1fcaf7
--- /dev/null
@@ -0,0 +1,31 @@
+{* $Id: marketing.relance.tpl,v 1.1 2004-07-17 14:16:47 x2000habouzit Exp $ *}
+{config_load file="mails.conf" section="valid_alias"}
+{subject text="$subj"}
+{from full=#from#}
+{to addr="$lemail"}
+Bonjour,
+
+Il y a quelques temps, le {$fdate}, tu as commencé ton inscription à Polytechnique.org ! Tu n'as toutefois pas tout à fait terminé cette inscription, aussi nous nous permettons de te renvoyer cet email pour te rappeler tes paramètres de connexion, au cas où tu souhaiterais terminer cette inscription, et accéder à l'ensemble des services que nous offrons aux {$nbdix} Polytechniciens déjà inscrits (email à vie, annuaire en ligne, etc...).
+
+UN SIMPLE CLIC sur le lien ci-dessous et ton compte sera activé !
+
+Après activation, tes paramètres seront :
+
+login        : {$lusername}
+mot de passe : {$nveau_pass}
+
+(ceci annule les paramètres envoyés par le mail initial)
+
+Rends-toi sur la page web suivante afin d'activer ta pré-inscription, et de changer ton mot de passe en quelque chose de plus facile à mémoriser :
+
+{$baseurl}/step4.php?ref={$lins_id}
+
+Si en cliquant dessus tu n'y arrives pas, copie intégralement l'adresse dans la barre de ton navigateur.
+
+En cas de difficulté, nous sommes bien entendu à ton entière disposition !
+
+Bien cordialement,
+Polytechnique.org
+"Le portail des élèves & anciens élèves de l'Ecole polytechnique"
+
+{* vim:set nocindent noautoindent textwidth=0: *}
diff --git a/templates/marketing/relance.tpl b/templates/marketing/relance.tpl
new file mode 100644 (file)
index 0000000..0af4d81
--- /dev/null
@@ -0,0 +1,45 @@
+{* $Id: relance.tpl,v 1.1 2004-07-17 14:16:48 x2000habouzit Exp $ *}
+
+<div class="rubrique">
+  Relance
+</div>
+
+{dynamic}
+{foreach from=$sent item=l}
+<p>{$l}</p>
+{/foreach}
+
+<form action="{$smarty.server.PHP_SELF}" method="post">
+  <table class="bicol" summary="liste des inscriptions non confirmées">
+    <tr>
+      <th>Date</th>
+      <th>Promo</th> 
+      <th>Nom</th>
+      <th>Dernière relance</th>
+      <th>&nbsp;</th>
+    </tr>
+    {foreach from=$relance item=it}
+    <tr class="{cycle values="pair,impair"}">
+      <td class="center">{$it.date}</td>
+      <td class="center">{$it.promo}</td>
+      <td>{$it.nom} {$it.prenom}</td>
+      <td class="center">
+        {if $it.relance eq "0000-00-00"}Jamais{else}{$it.relance}{/if}
+      </td>
+      <td class="center">
+        <input type="checkbox" name="{$it.matricule}" value="1" />
+      </td>
+    </tr>
+    {/foreach}
+  </table>
+
+  <p>
+  {$nb} Polytechniciens n'ont pas effectué jusqu'au bout leur inscription.
+  </p>
+  <div class="center">
+    <input type="submit" name="relancer" value="Relancer" />
+  </div>
+</form>
+{/dynamic}
+
+{* vim:set et sw=2 sts=2 sws=2: *}