From 46355f05abb8b380429c03ff529e0d21dc5aa598 Mon Sep 17 00:00:00 2001 From: "Pierre Habouzit (MadCoder" Date: Sun, 19 Jun 2005 13:09:32 +0000 Subject: [PATCH] some u10y improvements git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-726 --- htdocs.net/groupe/evt-detail.php | 72 ++++++++++++++++++------------------ include/xnet/evenements.php | 19 +++++++--- templates/geoloc/form.address.tpl | 22 +++++++++++ templates/geoloc/index.tpl | 2 +- templates/xnet/groupe/evt-admin.tpl | 4 +- templates/xnet/groupe/evt-detail.tpl | 2 +- 6 files changed, 75 insertions(+), 46 deletions(-) diff --git a/htdocs.net/groupe/evt-detail.php b/htdocs.net/groupe/evt-detail.php index e3e8cb6..1bd28c2 100644 --- a/htdocs.net/groupe/evt-detail.php +++ b/htdocs.net/groupe/evt-detail.php @@ -11,35 +11,33 @@ $may_participate = !$members_only || is_member() || may_update(); $page->assign('may_participate', $may_participate); $participate = false; -for ($i=1; Env::has('item_id'.$i); $i++) { - $res = $globals->xdb->query("SELECT paid FROM groupex.evenements_participants WHERE eid = {?} AND uid = {?}", Env::get("eid"), Session::get("uid")); - $paid = $res->fetchOneCell(); - if (!$paid) $paid = 0; - $j = Env::get('item_id'.$i); - $nb = Env::get('item_'.$j); - if ($nb == '+') $nb = Env::get('itemnb_'.$j)+1; - if ($nb > 0) { - $globals->xdb->execute( - "REPLACE INTO groupex.evenements_participants - VALUES ({?}, {?}, {?}, {?}, {?})", - Env::get("eid"), Session::get("uid"), $j, $nb, $paid); - $participate = true; - } - else - $globals->xdb->execute( - "DELETE FROM groupex.evenements_participants - WHERE eid = {?} AND uid = {?} AND item_id = {?}", - Env::get("eid"), Session::get("uid"), $j); +for ($i=1; Env::has('item_id'.$i); $i++) +{ + $res = $globals->xdb->query("SELECT paid FROM groupex.evenements_participants WHERE eid = {?} AND uid = {?}", Env::get("eid"), Session::get("uid")); + $paid = $res->fetchOneCell(); + $j = Env::get('item_id'.$i); + $nb = Env::get('item_'.$j); + if (!$paid) $paid = 0; + if ($nb == '+') $nb = Env::get('itemnb_'.$j)+1; + if ($nb > 0) { + $globals->xdb->execute( + "REPLACE INTO groupex.evenements_participants + VALUES ({?}, {?}, {?}, {?}, {?})", + Env::get("eid"), Session::get("uid"), $j, $nb, $paid); + $participate = true; + } else { + $globals->xdb->execute( + "DELETE FROM groupex.evenements_participants + WHERE eid = {?} AND uid = {?} AND item_id = {?}", + Env::get("eid"), Session::get("uid"), $j); + } } require_once('xnet/evenements.php'); $evt = get_event_detail(Env::get('eid')); - -subscribe_lists_event($participate, Session::get("uid"), $evt['participant_list'], $evt['absent_list']); - -// return to the main page after modifying -if (Env::has("ins")) - header("Location: evenements.php"); +if (Env::has('ins')) { + subscribe_lists_event($participate, Session::get("uid"), $evt['participant_list'], $evt['absent_list']); +} $page->assign('evt', $evt); @@ -54,20 +52,20 @@ $moments = $globals->xdb->iterator( $page->assign('moments', $moments); if (!$paid) { - $res = $globals->xdb->query("SELECT paid FROM groupex.evenements_participants WHERE eid = {?} AND uid = {?}", Env::get("eid"), Session::get("uid")); - $paid = $res->fetchOneCell(); + $res = $globals->xdb->query("SELECT paid FROM groupex.evenements_participants WHERE eid = {?} AND uid = {?}", Env::get("eid"), Session::get("uid")); + $paid = $res->fetchOneCell(); } if ($evt['paiement_id']) { - $res = $globals->xdb->query( - "SELECT montant - FROM {$globals->money->mpay_tprefix}transactions AS t - WHERE ref = {?} AND uid = {?}", - $evt['paiement_id'], Session::getInt('uid', -1)); - $montants = $res->fetchColumn(); - foreach ($montants as $m) { - $p = strtr(substr($m, 0, strpos($m, "EUR")), ",", "."); - $paid += trim($p); - } + $res = $globals->xdb->query( + "SELECT montant + FROM {$globals->money->mpay_tprefix}transactions AS t + WHERE ref = {?} AND uid = {?}", + $evt['paiement_id'], Session::getInt('uid', -1)); + $montants = $res->fetchColumn(); + foreach ($montants as $m) { + $p = strtr(substr($m, 0, strpos($m, "EUR")), ",", "."); + $paid += trim($p); + } } $page->assign('paid', $paid); diff --git a/include/xnet/evenements.php b/include/xnet/evenements.php index 648348e..447a688 100644 --- a/include/xnet/evenements.php +++ b/include/xnet/evenements.php @@ -133,12 +133,13 @@ function get_event_participants($eid, $item_id, $where, $tri, $limit, $money, $p // {{{ function subscribe_lists_event() function subscribe_lists_event($participate, $uid, $participant_list, $absent_list) { - global $globals; + global $globals,$page; $email = Session::get('forlife'); - if ($email) $email .= '@'.$globals->mail->domain; - else { + if ($email) { + $email .= '@'.$globals->mail->domain; + } else { $res = $globals->xdb->query("SELECT email FROM groupex.membres WHERE uid = {?} AND asso_id = {?}", Session::get('uid'), $globals->asso('id')); $email = $res->fetchOneCell(); } @@ -146,15 +147,23 @@ function subscribe_lists_event($participate, $uid, $participant_list, $absent_li $subscribe = $participate?$participant_list:(is_member()?$absent_list:0); $unsubscri = $participate?$absent_list:$participant_list; - if ($subscribe) + if ($subscribe) { $globals->xdb->execute( "REPLACE INTO virtual_redirect VALUES({?},{?})", $subscribe, $email); + } - if ($unsubscri) + if ($unsubscri) { $globals->xdb->execute( "DELETE FROM virtual_redirect WHERE vid = {?} AND redirect = {?}", $unsubscri, $email); + } + + if ($participate) { + $page->trig("tu es maintenant inscrit à l'évenement, suis le lien en bas si tu souhaites procéder à un paiment par le web"); + } else { + $page->trig("tu es maintenant désinscrit de cet évenement"); + } } // }}} diff --git a/templates/geoloc/form.address.tpl b/templates/geoloc/form.address.tpl index d30b5c0..0879a31 100644 --- a/templates/geoloc/form.address.tpl +++ b/templates/geoloc/form.address.tpl @@ -1,3 +1,25 @@ +{**************************************************************************} +{* *} +{* 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 *} +{* *} +{**************************************************************************} + {if $adr.geoloc} diff --git a/templates/geoloc/index.tpl b/templates/geoloc/index.tpl index 555ce6d..4f506b7 100644 --- a/templates/geoloc/index.tpl +++ b/templates/geoloc/index.tpl @@ -1,6 +1,6 @@ {**************************************************************************} {* *} -{* Copyright (C) 2004-2005 Polytechnique.org *} +{* Copyright (C) 2003-2004 Polytechnique.org *} {* http://opensource.polytechnique.org/ *} {* *} {* This program is free software; you can redistribute it and/or modify *} diff --git a/templates/xnet/groupe/evt-admin.tpl b/templates/xnet/groupe/evt-admin.tpl index c292677..06b537a 100644 --- a/templates/xnet/groupe/evt-admin.tpl +++ b/templates/xnet/groupe/evt-admin.tpl @@ -114,7 +114,7 @@ Donne ici son mail (complet pour les ext nombre de participants.

-
+

@@ -139,7 +139,7 @@ du site X.org. Ce montant s'ajoutera aux montants d entrer un montant négatif.

- +

diff --git a/templates/xnet/groupe/evt-detail.tpl b/templates/xnet/groupe/evt-detail.tpl index 6bbdf36..3408aa6 100644 --- a/templates/xnet/groupe/evt-detail.tpl +++ b/templates/xnet/groupe/evt-detail.tpl @@ -24,7 +24,7 @@

{$evt.intitule}

- + -- 2.1.4
Annoncé par