From 0abc16b1a2c7816a223dba2e1aff6f539c3cc241 Mon Sep 17 00:00:00 2001 From: Raphael Marichez Date: Sun, 16 Jan 2005 19:05:38 +0000 Subject: [PATCH] matricule disponible sur le site pour les non-inscrits git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-358 --- htdocs/marketing/private.php | 8 ++++++-- include/register.inc.php | 16 ++++++++++++++++ templates/include/minifiche_pvt.tpl | 2 +- templates/marketing/private.tpl | 5 +++++ templates/register/step2.tpl | 2 +- 5 files changed, 29 insertions(+), 4 deletions(-) diff --git a/htdocs/marketing/private.php b/htdocs/marketing/private.php index 0fbf106..90ab01a 100644 --- a/htdocs/marketing/private.php +++ b/htdocs/marketing/private.php @@ -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'); } diff --git a/include/register.inc.php b/include/register.inc.php index df38f16..840cd9c 100644 --- a/include/register.inc.php +++ b/include/register.inc.php @@ -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) diff --git a/templates/include/minifiche_pvt.tpl b/templates/include/minifiche_pvt.tpl index 52e03a6..e01717e 100644 --- a/templates/include/minifiche_pvt.tpl +++ b/templates/include/minifiche_pvt.tpl @@ -31,7 +31,7 @@ {/if} {perms level='admin'} {* - *}admin + *}admin {* *}AX {/perms} diff --git a/templates/marketing/private.tpl b/templates/marketing/private.tpl index 6bc8c48..a4b3b77 100644 --- a/templates/marketing/private.tpl +++ b/templates/marketing/private.tpl @@ -21,6 +21,11 @@

Marketing de {$prenom} {$nom}

+

Matricules

+Matricule École (à rentrer lors de l'inscription) : {$matricule_X} +
+Matricule polytechnique.org : {$matricule} + {if $pending}

Inscription en cours

diff --git a/templates/register/step2.tpl b/templates/register/step2.tpl index 2c8a46f..25ebfa2 100644 --- a/templates/register/step2.tpl +++ b/templates/register/step2.tpl @@ -45,7 +45,7 @@ 6 chiffres terminant par le numéro d'entrée (ex: 960532 ou 101532)
Voir sur le GU ou un bulletin de solde pour trouver cette information

Pour les élèves étrangers voie 2, il est du type :
- Promotion: 1995, Matricule: 960XXX - Promotion: 2001, Matricule 102XXX. + Promotion: 1996, Matricule: 970XXX - Promotion: 2001, Matricule 102XXX. {/if} -- 2.1.4