matricule disponible sur le site pour les non-inscrits
authorRaphael Marichez <falco@m4x.org>
Sun, 16 Jan 2005 19:05:38 +0000 (19:05 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:27:42 +0000 (23:27 +0200)
git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-358

htdocs/marketing/private.php
include/register.inc.php
templates/include/minifiche_pvt.tpl
templates/marketing/private.tpl
templates/register/step2.tpl

index 0fbf106..90ab01a 100644 (file)
@@ -23,12 +23,16 @@ require_once('xorg.inc.php');
 new_admin_page('marketing/private.tpl');
 
 $uid = Env::get('uid');
-$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, matricule FROM auth_user_md5 WHERE user_id={?} AND perms='pending'", $uid);
 
-if (list($nom, $prenom, $promo) = $res->fetchOneRow()) {
+if (list($nom, $prenom, $promo, $matricule) = $res->fetchOneRow()) {
+    require_once('register.inc.php');
+    $matricule_X = get_X_mat($matricule);
     $page->gassign('nom');
     $page->gassign('prenom');
     $page->gassign('promo');
+    $page->gassign('matricule');
+    $page->assign('matricule_X',$matricule_X);
 } else {
     $page->kill('uid invalide');
 }
index df38f16..840cd9c 100644 (file)
@@ -44,6 +44,22 @@ function user_cmp($prenom, $nom, $_prenom, $_nom)
 }
 
 // }}}
+// {{{ function get_X_mat
+function get_X_mat($ourmat)
+{
+    if (!preg_match('/^[0-9]{8}$/', $ourmat)) {
+       // le matricule de notre base doit comporter 8 chiffres
+        return 0;
+    }
+
+    $year = intval(substr($ourmat, 0, 4));
+    $rang = intval(substr($ourmat, 5, 3));
+    $year = intval(substr(1900 - $year, 1, 3));
+
+    return sprintf('%03u%03u', $year, $rang);
+}
+    
+// }}}
 // {{{ function check_mat
 
 function check_mat($promo, $mat, $nom, $prenom, &$ourmat, &$ourid)
index 52e03a6..e01717e 100644 (file)
@@ -31,7 +31,7 @@
     {/if}
     {perms level='admin'}
     <a href="{rel}/marketing/private.php?uid={$c.user_id}">{*
-      *}<img src="{rel}/images/admin.png" alt='admin' title="administrer user" /></a>
+      *}<img src="{rel}/images/admin.png" alt='admin' title="marketter user" /></a>
     <a href="http://www.polytechniciens.com/index.php?page=AX_FICHE_ANCIEN&amp;anc_id={$c.matricule_ax}">{*
       *}<img src="{rel}/images/ax.png" alt='AX' title="fiche AX" /></a>
     {/perms}
index 6bc8c48..a4b3b77 100644 (file)
 
 <h1>Marketing de {$prenom} {$nom}</h1>
 
+<h2>Matricules</h2>
+Matricule &Eacute;cole (à rentrer lors de l'inscription) : <strong>{$matricule_X}</strong>
+<br />
+Matricule polytechnique.org : {$matricule}
+
 {if $pending}
 
 <h2>Inscription en cours</h2>
index 2c8a46f..25ebfa2 100644 (file)
@@ -45,7 +45,7 @@
         6 chiffres terminant par le numéro d'entrée (ex: 960532 ou 101532)<br />
         Voir sur le GU ou un bulletin de solde pour trouver cette information<br /><br />
         Pour les élèves étrangers voie 2, il est du type :<br />
-        Promotion: 1995, Matricule: 960XXX - Promotion: 2001, Matricule 102XXX.
+        Promotion: 1996, Matricule: 970XXX - Promotion: 2001, Matricule 102XXX.
       </td>
     </tr>
     {/if}