marketing, needs to code private.php now
authorPierre Habouzit (MadCoder <pierre.habouzit@m4x.org>
Mon, 10 Jan 2005 16:20:37 +0000 (16:20 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:27:22 +0000 (23:27 +0200)
git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-265

htdocs/marketing/public.php
htdocs/marketing/volontaire.php
templates/include/minifiche.tpl
templates/marketing/promo.tpl
templates/marketing/public.tpl
templates/marketing/volontaire.tpl

index 9a66d24..068df30 100644 (file)
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
-require_once("xorg.inc.php");
+require_once('xorg.inc.php');
 new_skinned_page('marketing/public.tpl', AUTH_MDP);
 
 if (! Env::has('num')) { exit; }
 
-$mat = Env::get('num');
+$uid = Env::get('num');
+
+$res = $globals->xdb->query("SELECT nom, prenom, promo FROM auth_user_md5 WHERE user_id={?} AND perms='pending'", $uid);
 
-$res = $globals->xdb->query("SELECT nom,prenom,promo FROM auth_user_md5 WHERE matricule={?} AND perms='pending'", $mat);
 if (list($nom, $prenom, $promo) = $res->fetchOneRow()) {
     $page->assign('prenom', $prenom);
     $page->assign('nom', $nom);
     $page->assign('promo', $promo);
-}
 
-if (isset($_REQUEST["valide"])) {
-    $globals->xdb->execute("INSERT INTO marketing SET expe={?}, dest={?}, email={?}, flags={?}",
-            Session::getInt('uid'), $mat, Env::get('mail'), (Env::get('origine') == 'perso' ? 'mail_perso', ''));
+    if (Env::has('valide')) {
+        require_once('xorg.misc.inc.php');
+
+        $email = trim(Env::get('mail'));
+        $res   = $globals->xdb->query('SELECT COUNT(*) FROM register_marketing WHERE uid={?} AND email={?}', $uid, $email);
+
+        if (!isvalid_email_redirection($email)) {
+            $page->trig("Email invalide !");
+        } elseif ($res->fetchOneCell()) {
+            $page->assign('already', true);
+        } else {
+            $page->assign('ok', true);
+            $globals->xdb->execute(
+                    "INSERT INTO  register_marketing (uid,sender,email,date,last,nb,type,hash)
+                          VALUES  ({?}, {?}, {?}, NOW(), 0, 0, {?}, '')",
+                    $uid, Session::getInt('uid'), $email, Env::get('origine'));
+        }
+    }
 }
 
 $page->run();
index bcc9c7b..b9797c6 100644 (file)
@@ -32,7 +32,7 @@ $page->assign('promos', $res->fetchColumn());
 
 
 if (Env::has('promo')) {
-    $sql = "SELECT  a.nom, a.prenom,
+    $sql = "SELECT  a.nom, a.prenom, a.user_id,
                     m.email, sa.alias AS forlife
               FROM  register_marketing AS m
         INNER JOIN  auth_user_md5      AS a  ON a.user_id = m.uid AND a.promo = {?}
index 20b365d..069c98b 100644 (file)
@@ -44,7 +44,7 @@
     {if $c.dcd}décédé{if $c.sexe}e{/if} le {$c.deces|date_format}{/if}
     {min_auth level="cookie"}
     {if !$c.dcd && !$c.wasinscrit}
-    <a href="{"marketing/public.php"|url}?num={$c.matricule}" class='popup'>clique ici si tu connais son adresse email !</a>
+    <a href="{rel}/marketing/public.php?num={$c.user_id}" class='popup'>clique ici si tu connais son adresse email !</a>
     {/if}
     {/min_auth}
   </div>
index cc9c2a0..25b6a43 100644 (file)
@@ -79,7 +79,6 @@
       <th>Nom</th>
       <th>Dernière adresse connue</th>
       <th>Statut</th>
-      <th>AX</th>
       <th>&nbsp;</th>
     </tr>
     {iterate from=$nonins item=it}
         {/if}
       </td>
       <td class="center">
+        <a href="private.php?uid={$it.user_id}">{*
+          *}<img src="{rel}/images/admin.png" alt='Marketing' title="Marketing" /></a>
         <a href="http://www.polytechniciens.com/index.php?page=AX_FICHE_ANCIEN&amp;anc_id={$it.matricule_ax}">{*
           *}<img src="{rel}/images/ax.png" alt='AX' title="fiche AX" /></a>
       </td>
-      <td>
-        <a href="utilisateurs_marketing.php?xmat={$it.user_id}">Marketing</a>
-      </td>
     </tr>
     {/iterate}
   </table>
index 3ac9066..99683d9 100644 (file)
  ***************************************************************************}
 
 
-{if $smarty.request.num}
+{if $already}
 
-{if $smarty.request.valide}
+<p>
+Merci de nous avoir communiqué cette information !
+</p>
+<p>
+Nous avions déjà connaissance de cette adresse, nous espérons donc comme toi que {$prenom} va s'inscrire au plus vite.
+</p>
+<p>
+Si tu le connais personnellement, un petit mail pour lui expliquer les atouts de Polytechnique.org
+peut sans aucun doute l'aider à se décider !
+</p>
+
+{elseif $ok}
 
 <p>
   Merci de nous avoir communiqué cette information !  Un administrateur de Polytechnique.org va
@@ -74,8 +85,8 @@
     <tr class="impair">
       <td>Nous lui écrirons :</td>
       <td>
-        <input type="radio" name="origine" value="perso" checked="checked" /> en ton nom<br />
-        <input type="radio" name="origine" value="equipe" /> au nom de l'équipe Polytechnique.org
+        <input type="radio" name="origine" value="user" checked="checked" /> en ton nom<br />
+        <input type="radio" name="origine" value="staff" /> au nom de l'équipe Polytechnique.org
       </td>
     </tr>
   </table>
 
 {/if}
 
-{/if}
-
 
 {* vim:set et sw=2 sts=2 sws=2: *}
index 09a2be5..d59c169 100644 (file)
@@ -44,7 +44,7 @@ Choix de la promo :
   </tr>
   {iterate from=$addr item=it}
   <tr class="{cycle values="pair,impair"}">
-    <td>{$it.nom} {$it.prenom}</td>
+    <td><a href="private.php?uid={$it.user_id}">{$it.nom} {$it.prenom}</a></td>
     <td>{$it.email}</td>
     <td>{$it.forlife}</td>
   </tr>