From: x2000habouzit
Date: Tue, 11 Jul 2006 21:10:30 +0000 (+0000)
Subject: move orange.php
X-Git-Tag: xorg/0.9.11~453
X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=9b0fa32966e3fc87ca780d0f65dba69b2e423af1;p=platal.git
move orange.php
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@446 839d8a87-29fc-0310-9880-83ba4fa771e5
---
diff --git a/htdocs/orange.php b/htdocs/orange.php
deleted file mode 100644
index fd591cc..0000000
--- a/htdocs/orange.php
+++ /dev/null
@@ -1,70 +0,0 @@
-xdb->query(
- "SELECT u.promo,u.promo_sortie
- FROM auth_user_md5 AS u
- WHERE user_id={?}", Session::getInt('uid'));
-
-list($promo,$promo_sortie_old) = $res->fetchOneRow();
-$page->assign('promo_sortie_old', $promo_sortie_old);
-$page->assign('promo', $promo);
-
-$promo_sortie = Env::get('promo_sortie');
-
-if ($promo_sortie) {
- $sortie_req = false;
- if (!is_numeric($promo_sortie) || $promo_sortie < 1000 || $promo_sortie > 9999) {
- $page->trig('L\'année de sortie doit être un nombre de quatre chiffres');
- }
- elseif ($promo_sortie < $promo + 3) {
- $page->trig('Trop tôt');
- }
- elseif ($promo_sortie == $promo_sortie_old) {
- $page->trig('Tu appartiens déjà à la promotion correspondante à cette année de sortie.');
- }
- elseif ($promo_sortie == $promo + 3) {
- $globals->xdb->execute(
- "UPDATE auth_user_md5 set promo_sortie={?}
- WHERE user_id={?}",$promo_sortie,Session::getInt('uid'));
- $page->trig('Ton statut "orange" a été supprimé.');
- $page->assign('promo_sortie_old', $promo_sortie);
- }
- else {
- $page->assign('promo_sortie', $sortie_req = $promo_sortie);
- }
-
- if (Env::has('submit') && $sortie_req && ($promo_sortie_old != $sortie_req && $promo_sortie != $promo + 3)) {
- $myorange = new OrangeReq(Session::getInt('uid'), $sortie_req);
- $myorange->submit();
- $page->assign('myorange', $myorange);
- }
-}
-
-$page->run();
-# vim: set et sts=4 ts=4 sw=4:
-?>
diff --git a/modules/profile.php b/modules/profile.php
index a211b13..a8dbc1b 100644
--- a/modules/profile.php
+++ b/modules/profile.php
@@ -24,14 +24,15 @@ class ProfileModule extends PLModule
function handlers()
{
return array(
- 'photo' => $this->make_hook('photo', AUTH_PUBLIC),
- 'photo/change' => $this->make_hook('photo_change', AUTH_MDP),
+ 'photo' => $this->make_hook('photo', AUTH_PUBLIC),
+ 'photo/change' => $this->make_hook('photo_change', AUTH_MDP),
- 'profile/usage' => $this->make_hook('p_usage', AUTH_MDP),
+ 'profile/orange' => $this->make_hook('p_orange', AUTH_MDP),
+ 'profile/usage' => $this->make_hook('p_usage', AUTH_MDP),
- 'trombi' => $this->make_hook('trombi', AUTH_COOKIE),
+ 'trombi' => $this->make_hook('trombi', AUTH_COOKIE),
- 'vcard' => $this->make_hook('vcard', AUTH_COOKIE),
+ 'vcard' => $this->make_hook('vcard', AUTH_COOKIE),
);
}
@@ -144,6 +145,60 @@ class ProfileModule extends PLModule
return PL_OK;
}
+ function handler_p_orange(&$page)
+ {
+ global $globals;
+
+ $page->changeTpl('orange.tpl');
+
+ require_once 'validations.inc.php';
+ require_once 'xorg.misc.inc.php';
+
+ $res = $globals->xdb->query(
+ "SELECT u.promo,u.promo_sortie
+ FROM auth_user_md5 AS u
+ WHERE user_id={?}", Session::getInt('uid'));
+
+ list($promo,$promo_sortie_old) = $res->fetchOneRow();
+ $page->assign('promo_sortie_old', $promo_sortie_old);
+ $page->assign('promo', $promo);
+
+ if (!Env::has('promo_sortie')) {
+ return PL_OK;
+ }
+
+ $promo_sortie = Env::getInt('promo_sortie');
+
+ if ($promo_sortie < 1000 || $promo_sortie > 9999) {
+ $page->trig('L\'année de sortie doit être un nombre de quatre chiffres');
+ }
+ elseif ($promo_sortie < $promo + 3) {
+ $page->trig('Trop tôt');
+ }
+ elseif ($promo_sortie == $promo_sortie_old) {
+ $page->trig('Tu appartiens déjà à la promotion correspondante à cette année de sortie.');
+ }
+ elseif ($promo_sortie == $promo + 3) {
+ $globals->xdb->execute(
+ "UPDATE auth_user_md5 set promo_sortie={?}
+ WHERE user_id={?}",$promo_sortie,Session::getInt('uid'));
+ $page->trig('Ton statut "orange" a été supprimé.');
+ $page->assign('promo_sortie_old', $promo_sortie);
+ }
+ else {
+ $page->assign('promo_sortie', $promo_sortie);
+
+ if (Env::has('submit')) {
+ $myorange = new OrangeReq(Session::getInt('uid'),
+ $promo_sortie);
+ $myorange->submit();
+ $page->assign('myorange', $myorange);
+ }
+ }
+
+ return PL_OK;
+ }
+
function handler_p_usage(&$page)
{
global $globals;
@@ -172,7 +227,7 @@ class ProfileModule extends PLModule
// on vient de recevoir une requete, differente de l'ancien nom d'usage
if ($nom_usage == $nom) {
$page->assign('same', true);
- } else { // le nom de mariage est distinct du nom à l'X
+ } else { // le nom de mariage est distinct du nom à l'X
// on calcule l'alias pour l'afficher
$reason = Env::get('reason');
if ($reason == 'other') {
diff --git a/templates/orange.tpl b/templates/orange.tpl
index c3c8acb..be8a6df 100644
--- a/templates/orange.tpl
+++ b/templates/orange.tpl
@@ -20,42 +20,42 @@
{* *}
{**************************************************************************}
-
-
- Année de sortie
-
+Année de sortie
{if $myorange}
-
-
- Tu recevras un mail dès que les changements demandés auront été effectués.
- Encore merci de nous faire confiance pour tes e-mails !
-
+
+
+ Tu recevras un mail dès que les changements demandés auront été effectués.
+ Encore merci de nous faire confiance pour tes e-mails !
+
{else}
-
+
Afin de pouvoir être considéré(e) à la fois dans ta promotion d'origine et ta
ou tes promotions d'adoption tu peux entrer ici ton année de sortie de l'école.
- Plus précisément, il s'agit de l'année d'entrée en quatrième année ou année d'application. Pour tes cocons d'origine (X{$promo}) il s'agit de l'année {math equation="a + b" a=$promo b=3}.
-
-
-
-
-
- {/if}
+ Plus précisément, il s'agit de l'année d'entrée en quatrième année ou année d'application.
+ Pour tes cocons d'origine (X{$promo}) il s'agit de l'année {math equation="a + b" a=$promo b=3}.
+
+
+
+
+
+
+{/if}
+
[Revenir au profil]
{* vim:set et sw=2 sts=2 sws=2: *}
diff --git a/templates/profil/general.tpl b/templates/profil/general.tpl
index 1d518ea..91b8f64 100644
--- a/templates/profil/general.tpl
+++ b/templates/profil/general.tpl
@@ -68,7 +68,7 @@
X{$promo}{if ($promo != $promo_sortie - 3)} - X{math equation="a - b" a=$promo_sortie b=3}{/if}
- modifier{if ($promo_sortie -3 == $promo)} pour les oranges{/if}
+ modifier{if ($promo_sortie -3 == $promo)} pour les oranges{/if}
|