From: Pascal Corpet Date: Mon, 18 Apr 2005 20:52:50 +0000 (+0000) Subject: gestion des oranges : modification, validation, anniversaires, fiche X-Git-Tag: xorg/old~188 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=f252204ac83fdcb7b48e04d142a3e4d20d34aac8;p=platal.git gestion des oranges : modification, validation, anniversaires, fiche git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-574 --- diff --git a/ChangeLog b/ChangeLog index 5a59d9b..ae42aa0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ VERSION 0.9.6 -- May 2004 New : + * Profule : + - Stayed down students (orange) management. -Car + * Search : - Last improvements (clean code for search now !). -MC diff --git a/htdocs/carnet/notifs.php b/htdocs/carnet/notifs.php index 6665995..e8bb1cf 100644 --- a/htdocs/carnet/notifs.php +++ b/htdocs/carnet/notifs.php @@ -25,6 +25,10 @@ require_once('notifs.inc.php'); $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]); diff --git a/htdocs/fiche.php b/htdocs/fiche.php index a7a1bdf..1842dc1 100644 --- a/htdocs/fiche.php +++ b/htdocs/fiche.php @@ -77,6 +77,8 @@ if($user['x'] < 160){ // 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'] = ''; diff --git a/htdocs/orange.php b/htdocs/orange.php new file mode 100644 index 0000000..dd1d791 --- /dev/null +++ b/htdocs/orange.php @@ -0,0 +1,56 @@ +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(); +?> diff --git a/include/notifs.inc.php b/include/notifs.inc.php index 1205a21..b27d4d5 100644 --- a/include/notifs.inc.php +++ b/include/notifs.inc.php @@ -65,7 +65,7 @@ function _select_notifs_base($table, $mail, $where) '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, diff --git a/include/profil/assign_general.inc.php b/include/profil/assign_general.inc.php index 8f14bc5..1823b75 100644 --- a/include/profil/assign_general.inc.php +++ b/include/profil/assign_general.inc.php @@ -26,6 +26,7 @@ $page->assign('freetext_pub',$freetext_pub); $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); diff --git a/include/profil/get_general.inc.php b/include/profil/get_general.inc.php index 3200775..2def19a 100644 --- a/include/profil/get_general.inc.php +++ b/include/profil/get_general.inc.php @@ -20,7 +20,7 @@ ***************************************************************************/ // 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 @@ -30,7 +30,7 @@ $sql = "SELECT u.nom, u.prenom, u.nom_ini, u.prenom_ini, u.promo, u.nom_usage, 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(); diff --git a/include/user.func.inc.php b/include/user.func.inc.php index 86cf616..c70a9e8 100644 --- a/include/user.func.inc.php +++ b/include/user.func.inc.php @@ -155,7 +155,7 @@ function get_user_forlife($data) { 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, diff --git a/include/validations/orange.inc.php b/include/validations/orange.inc.php new file mode 100644 index 0000000..4e285a6 --- /dev/null +++ b/include/validations/orange.inc.php @@ -0,0 +1,101 @@ +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: +?> diff --git a/templates/carnet/notifs.tpl b/templates/carnet/notifs.tpl index 6f998d6..925efdc 100644 --- a/templates/carnet/notifs.tpl +++ b/templates/carnet/notifs.tpl @@ -41,7 +41,7 @@ S'il n'y a rien {$s.short} {if $s.type eq near}o{elseif $s.type eq often}*{/if}
{/foreach} *: ne concerne pas les promos (évènements très fréquents)
- o: ne concerne que les promos entre {$smarty.session.promo-1} et {$smarty.session.promo+1} que tu surveilles + o: ne concerne que les promos entre {$smarty.session.promo-1} et {$promo_sortie-2} que tu surveilles
diff --git a/templates/fiche.tpl b/templates/fiche.tpl index c16e8fa..aeb1264 100644 --- a/templates/fiche.tpl +++ b/templates/fiche.tpl @@ -88,7 +88,13 @@ function chgMainWinLoc( strPage ) { {if $x.iso3166} {$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} [Ma fiche référent] diff --git a/templates/include/form.valid.orange.tpl b/templates/include/form.valid.orange.tpl new file mode 100644 index 0000000..377bbf0 --- /dev/null +++ b/templates/include/form.valid.orange.tpl @@ -0,0 +1,31 @@ +{*************************************************************************** + * 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 * + ***************************************************************************} + + + + Promotion : + {$valid->promo} + + + Année de sortie : + {$valid->promo_sortie} au lieu de {math equation="a + b" a=$valid->promo b=3} + + +{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/orange.tpl b/templates/orange.tpl new file mode 100644 index 0000000..7f0acc3 --- /dev/null +++ b/templates/orange.tpl @@ -0,0 +1,59 @@ +{*************************************************************************** + * 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 * + ***************************************************************************} + + +

+ 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 ! +

+ +{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}. +

+ +
+ +
+ + + + + + + + + + +
Année de sortie
+
+ {/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 acf508c..ad8aa76 100644 --- a/templates/profil/general.tpl +++ b/templates/profil/general.tpl @@ -65,7 +65,8 @@ Promotion - X{$promo} + 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} diff --git a/upgrade/0.9.6/30_auth_user_md5.sql b/upgrade/0.9.6/30_auth_user_md5.sql new file mode 100644 index 0000000..61a4fe1 --- /dev/null +++ b/upgrade/0.9.6/30_auth_user_md5.sql @@ -0,0 +1,3 @@ +ALTER TABLE auth_user_md5 ADD promo_sortie SMALLINT(4) UNSIGNED NOT NULL AFTER promo; +UPDATE auth_user_md5 SET promo_sortie = promo + 3; +