+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2006 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-require_once("xorg.inc.php");
-require_once("validations.inc.php");
-require_once("xorg.misc.inc.php");
-
-new_skinned_page('orange.tpl', AUTH_MDP);
-
-$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);
-
-$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:
-?>
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),
);
}
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;
// 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') {
{* *}
{**************************************************************************}
-
-<h1>
- Année de sortie
-</h1>
+<h1>Année de sortie</h1>
{if $myorange}
-
- <p>
- 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 !
- </p>
+
+<p>
+ 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 !
+</p>
{else}
- <p>
+<p>
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}.
- </p>
-
- <br />
-
- <form action="{$smarty.server.PHP_SELF}" method="post">
- <table class="bicol" cellpadding="4" summary="Année de sortie">
- <tr>
- <th>Année de sortie</th>
- </tr>
- <tr>
- <td class="center"><input type="text" name="promo_sortie" value="{$promo_sortie_old}" /></td>
- </tr>
- <tr>
- <td class="center"><input type="submit" name="submit" value="Envoyer" /></td>
- </tr>
- </table>
- </form>
- {/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}.
+</p>
+
+<br />
+
+<form action="{rel}/profile/orange" method="post">
+ <table class="bicol" cellpadding="4" summary="Année de sortie">
+ <tr>
+ <th>Année de sortie</th>
+ </tr>
+ <tr>
+ <td class="center"><input type="text" name="promo_sortie" value="{$promo_sortie_old}" /></td>
+ </tr>
+ <tr>
+ <td class="center"><input type="submit" name="submit" value="Envoyer" /></td>
+ </tr>
+ </table>
+</form>
+
+{/if}
+
<p>[<a href="profil.php">Revenir au profil</a>]</p>
{* vim:set et sw=2 sts=2 sws=2: *}
</td>
<td class="cold">
<span class="nom">X{$promo}{if ($promo != $promo_sortie - 3)} - X{math equation="a - b" a=$promo_sortie b=3}{/if}</span>
- <span class="lien"><a href="orange.php">modifier</a>{if ($promo_sortie -3 == $promo)} pour les oranges{/if}</span>
+ <span class="lien"><a href="{rel}/profile/orange">modifier</a>{if ($promo_sortie -3 == $promo)} pour les oranges{/if}</span>
</td>
</tr>
<tr>