git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-574
New :
+ * Profule :
+ - Stayed down students (orange) management. -Car
+
* Search :
- Last improvements (clean code for search now !). -MC
$watch = new Watch(Session::getInt('uid'));
+$res = $globals->xdb->query("SELECT promo_sortie FROM auth_user_md5 WHERE user_id = {?}", Session::getInt('uid', -1));
+$promo_sortie = $res->fetchOneCell();
+$page->assign('promo_sortie', $promo_sortie);
+
if(Env::has('promo')) {
if(preg_match('!^ *(\d{4}) *$!', Env::get('promo'), $matches)) {
$p = intval($matches[1]);
// manage the public fiche
$page->assign('logged', logged());
if (!logged()) {
+ // hide the orange status
+ $user['promo_sortie'] = $user['promo'] + 3;
if ($user['mobile_pub'] != 'public') $user['mobile'] = '';
if ($user['web_pub'] != 'public') $user['web'] = '';
if ($user['freetext_pub'] != 'public') $user['freetext'] = '';
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2004 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');
+ else
+ $page->assign('promo_sortie', $sortie_req = $promo_sortie);
+
+ if (Env::has('submit') && $sortie_req && ($promo_sortie_old != $sortie_req)) {
+ $myorange = new OrangeReq(Session::getInt('uid'), $sortie_req);
+ $myorange->submit();
+ $page->assign('myorange', $myorange);
+ }
+}
+
+$page->run();
+?>
'contact_sql' => '1'
),
'watch_promo' => Array('wfield' => 'promo', 'ufield' => 'promo', 'need_contact' => true,
- 'freq_sql' => ' AND ( wc.type = "basic" OR wc.type="near" AND (w.promo <= v.promo+1 AND w.promo >= v.promo-1) )',
+ 'freq_sql' => ' AND ( wc.type = "basic" OR wc.type="near" AND (u.promo <= v.promo_sortie-2 AND u.promo_sortie >= v.promo+2) )',
'contact_sql' => 'NOT (c.contact IS NULL)'
),
'watch_nonins' => Array('wfield' => 'ni_id', 'ufield' => 'user_id', 'need_contact' => false,
$page->assign('nom', $nom);
$page->assign('prenom', $prenom);
$page->assign('promo', $promo);
+$page->assign('promo_sortie', $promo_sortie);
$page->assign('nom_usage', $nom_usage);
$page->assign('nationalite',$nationalite);
***************************************************************************/
// on ramène les données du profil connecté (uid paramètre de session)
-$sql = "SELECT u.nom, u.prenom, u.nom_ini, u.prenom_ini, u.promo, u.nom_usage, u.nationalite,
+$sql = "SELECT u.nom, u.prenom, u.nom_ini, u.prenom_ini, u.promo, u.promo_sortie, u.nom_usage, u.nationalite,
q.profile_mobile, q.profile_mobile_pub, q.profile_web, q.profile_web_pub, q.profile_freetext, q.profile_freetext_pub, q.profile_nick,
a1.aid, a1.type, a2.aid, a2.type
FROM auth_user_md5 AS u
WHERE u.user_id = {?}";
$result = $globals->xdb->query($sql, Session::getInt('uid', -1));
-list($nom, $prenom, $nom_ini, $prenom_ini, $promo, $nom_usage, $nationalite,
+list($nom, $prenom, $nom_ini, $prenom_ini, $promo, $promo_sortie, $nom_usage, $nationalite,
$mobile, $mobile_pub, $web, $web_pub, $freetext, $freetext_pub, $nickname,
$appli_id1,$appli_type1, $appli_id2,$appli_type2) = $result->fetchOneRow();
function &get_user_details($login, $from_uid = '')
{
global $globals;
- $reqsql = "SELECT u.user_id, u.promo, u.prenom, u.nom, u.nom_usage, u.date, u.cv,
+ $reqsql = "SELECT u.user_id, u.promo, u.promo_sortie, u.prenom, u.nom, u.nom_usage, u.date, u.cv,
u.perms IN ('admin','user') AS inscrit, FIND_IN_SET('femme', u.flags) AS sexe, u.deces != 0 AS dcd, u.deces,
q.profile_nick AS nickname, q.profile_from_ax, q.profile_mobile AS mobile, q.profile_web AS web, q.profile_freetext AS freetext,
q.profile_mobile_pub AS mobile_pub, q.profile_web_pub AS web_pub, q.profile_freetext_pub AS freetext_pub,
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2004 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 *
+ ***************************************************************************/
+
+// {{{ class OrangeReq
+
+class OrangeReq extends Validate
+{
+ // {{{ properties
+
+ var $unique = true;
+
+ var $promo;
+ var $promo_sortie;
+
+ var $rules = "A priori accepter (la validation sert à repousser les
+ petits malins). Refuse si tu connais la personne et que tu es sure
+ qu'elle n'est pas orange.";
+
+ // }}}
+ // {{{ constructor
+
+ function OrangeReq($_uid, $_sortie)
+ {
+ global $globals;
+ $this->Validate($_uid, true, 'orange');
+ $this->promo_sortie = $_sortie;
+ $res = $globals->xdb->query("SELECT promo FROM auth_user_md5 WHERE user_id = {?}", $_uid);
+ $this->promo = $res->fetchOneCell();
+ }
+
+ // }}}
+ // {{{ function get_request()
+
+ function get_request($uid)
+ {
+ return parent::get_request($uid,'orange');
+ }
+
+ // }}}
+ // {{{ function formu()
+
+ function formu()
+ { return 'include/form.valid.orange.tpl'; }
+
+ // }}}
+ // {{{ function _mail_subj()
+
+ function _mail_subj()
+ {
+ return "[Polytechnique.org/ORANGE] Changement de nom de promo de sortie";
+ }
+
+ // }}}
+ // {{{ function _mail_body
+
+ function _mail_body($isok)
+ {
+ global $globals;
+ if ($isok) {
+ $res = " La demande de changement de promo de sortie que tu as demandée vient d'être effectuée.";
+ return $res;
+ } else {
+ return " La demande de changement de promo de sortie tu avais faite a été refusée.";
+ }
+ }
+
+ // }}}
+ // {{{ function commit()
+
+ function commit()
+ {
+ global $globals;
+
+ $globals->xdb->execute("UPDATE auth_user_md5 set promo_sortie={?} WHERE user_id={?}",$this->promo_sortie ,$this->uid);
+ return true;
+ }
+
+ // }}}
+}
+// }}}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
+?>
{$s.short} {if $s.type eq near}<sup>o</sup>{elseif $s.type eq often}<sup>*</sup>{/if}<br />
{/foreach}
<span class='smaller'><sup>*</sup>: ne concerne pas les promos (évènements très fréquents)</span><br />
- <span class='smaller'><sup>o</sup>: ne concerne que les promos entre {$smarty.session.promo-1} et {$smarty.session.promo+1} que tu surveilles</span>
+ <span class='smaller'><sup>o</sup>: ne concerne que les promos entre {$smarty.session.promo-1} et {$promo_sortie-2} que tu surveilles</span>
</fieldset>
<div class='center'>
<input type='submit' name='subs' value='valider' />
{if $x.iso3166}
<img src='{rel}/images/flags/{$x.iso3166}.gif' alt='{$x.nationalite}' height='14' title='{$x.nationalite}' />
{/if}
- X {$x.promo}{if $x.applis_join} - Formation : {$x.applis_join|smarty:nodefaults} {/if}
+ X {$x.promo}
+ {if ($x.promo_sortie-3 > $x.promo)}
+ - X {math equation="a-b" a=$x.promo_sortie b=3}
+ {/if}
+ {if $x.applis_join}
+ - Formation : {$x.applis_join|smarty:nodefaults}
+ {/if}
{min_auth level="cookie"}
{if $x.is_referent}
[<a href="fiche_referent.php?user={$x.forlife}" class='popup2'>Ma fiche référent</a>]
--- /dev/null
+{***************************************************************************
+ * Copyright (C) 2003-2004 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 *
+ ***************************************************************************}
+
+
+<tr class="impair">
+ <td class="titre">Promotion :</td>
+ <td>{$valid->promo}</td>
+</tr>
+<tr class="impair">
+ <td class="titre">Année de sortie :</td>
+ <td>{$valid->promo_sortie} au lieu de {math equation="a + b" a=$valid->promo b=3}</td>
+</tr>
+
+{* vim:set et sw=2 sts=2 sws=2: *}
--- /dev/null
+{***************************************************************************
+ * Copyright (C) 2003-2004 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 *
+ ***************************************************************************}
+
+
+<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>
+
+{else}
+
+ <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}
+<p>[<a href="profil.php">Revenir au profil</a>]</p>
+
+{* vim:set et sw=2 sts=2 sws=2: *}
<span class="titre">Promotion</span>
</td>
<td class="cold">
- <span class="nom">X{$promo}</span>
+ <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>
</td>
</tr>
<tr>
--- /dev/null
+ALTER TABLE auth_user_md5 ADD promo_sortie SMALLINT(4) UNSIGNED NOT NULL AFTER promo;
+UPDATE auth_user_md5 SET promo_sortie = promo + 3;
+