some u10y improvements
authorPierre Habouzit (MadCoder <pierre.habouzit@m4x.org>
Sun, 19 Jun 2005 13:09:32 +0000 (13:09 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:29:20 +0000 (23:29 +0200)
git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-726

htdocs.net/groupe/evt-detail.php
include/xnet/evenements.php
templates/geoloc/form.address.tpl
templates/geoloc/index.tpl
templates/xnet/groupe/evt-admin.tpl
templates/xnet/groupe/evt-detail.tpl

index e3e8cb6..1bd28c2 100644 (file)
@@ -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);
 
index 648348e..447a688 100644 (file)
@@ -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");
+    }
 }
 // }}}
 
index d30b5c0..0879a31 100644 (file)
@@ -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}
     <tr>
       <td class="cold" colspan="5">
index 555ce6d..4f506b7 100644 (file)
@@ -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  *}
index c292677..06b537a 100644 (file)
@@ -114,7 +114,7 @@ Donne ici son mail (complet pour les ext
 nombre de participants.
 </p>
 
-<form action="{$smarty.server.PHP_SELF}" method="post">
+<form action="{$smarty.server.REQUEST_URI}" method="post">
   <p class="descr">
   <input type="hidden" name="eid" value="{$smarty.request.eid}" />
   <input type="hidden" name="adm" value="nbs" />
@@ -139,7 +139,7 @@ du site X.org. Ce montant s'ajoutera aux montants d
 entrer un montant négatif.
 </p>
 
-<form action="{$smarty.server.PHP_SELF}" method="post">
+<form action="{$smarty.server.REQUEST_URI}" method="post">
   <p class="descr">
   <input type="hidden" name="eid" value="{$smarty.request.eid}" />
   <input type="hidden" name="adm" value="prix" />
index 6bbdf36..3408aa6 100644 (file)
@@ -24,7 +24,7 @@
 
 <h2>{$evt.intitule}</h2>
 
-<form method='post' action='{$smarty.server.PHP_SELF}'>
+<form method='post' action='{$smarty.server.REQUEST_URI}'>
   <table class="tiny" cellspacing="0" cellpadding="0">
     <tr>
       <td class="titre">Annoncé par</td>