$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);
$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);
// {{{ 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();
}
$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");
+ }
}
// }}}
+{**************************************************************************}
+{* *}
+{* 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">