migrate events.
authorx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sat, 15 Jul 2006 18:59:17 +0000 (18:59 +0000)
committerx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sat, 15 Jul 2006 18:59:17 +0000 (18:59 +0000)
that code is a REAL noodle soup, it's pure horror, it's a miracle it works :|

git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@505 839d8a87-29fc-0310-9880-83ba4fa771e5

htdocs.net/groupe/evt-admin.php [deleted file]
htdocs.net/groupe/evt-modif.php [deleted file]
modules/xnetevents.php
templates/xnet/groupe/evenements.tpl
templates/xnet/groupe/evt-admin.tpl
templates/xnet/groupe/evt-modif.tpl

diff --git a/htdocs.net/groupe/evt-admin.php b/htdocs.net/groupe/evt-admin.php
deleted file mode 100644 (file)
index 5749e61..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-<?php
-require 'xnet.inc.php';
-
-define('NB_PER_PAGE', 25);
-
-require_once('xnet/evenements.php');
-
-$evt = get_event_detail(Env::get('eid'), Env::get('item_id'));
-
-// the event doesn't exist or doesn't belong to this assoif (!$evt)
-if (!$evt) {
-       redirect("evenements.php");
-}
-
-if ($evt['show_participants']) {
-    new_group_page('xnet/groupe/evt-admin.tpl');
-} else {
-    new_groupadmin_page('xnet/groupe/evt-admin.tpl');
-}
-
-$admin = may_update();
-
-// select a member from his mail
-if ($admin && Env::get('adm') && Env::get('mail')) {
-    if (strpos(Env::get('mail'), '@') === false) {
-        $res = $globals->xdb->query(
-                "SELECT m.uid
-                   FROM groupex.membres AS m
-             INNER JOIN aliases AS a ON (a.id = m.uid)
-                  WHERE a.alias = {?} AND m.asso_id = {?}",
-                Env::get('mail'), $globals->asso('id'));
-    } else {
-       $res = $globals->xdb->query(
-               "SELECT m.uid
-                  FROM groupex.membres AS m
-                 WHERE m.email = {?} AND m.asso_id = {?}",
-               Env::get('mail'), $globals->asso('id'));
-    }
-    $member = $res->fetchOneCell();
-    if (!$member) $page->trig("Membre introuvable");
-}
-
-// change the price paid by a participant
-if ($admin && Env::get('adm') == 'prix' && $member) {
-       $globals->xdb->execute("UPDATE groupex.evenements_participants SET paid = IF(paid + {?} > 0, paid + {?}, 0) WHERE uid = {?} AND eid = {?}",
-               strtr(Env::get('montant'), ',', '.'),
-               strtr(Env::get('montant'), ',', '.'),
-               $member, Env::get('eid'));
-}
-
-// change the number of personns coming with a participant
-if ($admin && Env::get('adm') == 'nbs' && $member) {
-       $res = $globals->xdb->query("SELECT paid FROM groupex.evenements_participants WHERE uid = {?} AND eid = {?}", $member, Env::get('eid'));
-       $paid = $res->fetchOneCell();
-       $participate = false;
-       foreach ($evt['moments'] as $m) if (Env::has('nb'.$m['item_id'])) {
-               $nb = Env::getInt('nb'.$m['item_id'], 0);
-               if ($nb < 0) $nb = 0;
-               if ($nb) {
-                       $participate = true;
-                       if (!$paid) $paid = 0;
-                       $globals->xdb->execute("REPLACE INTO groupex.evenements_participants VALUES ({?}, {?}, {?}, {?}, {?})",
-                       Env::get('eid'), $member, $m['item_id'], $nb, $paid);
-               }
-               else
-               $globals->xdb->execute("DELETE FROM groupex.evenements_participants WHERE uid = {?} AND eid = {?} AND item_id = {?}", $member, Env::get('eid'), $m['item_id']);
-       }
-       if ($participate) 
-               subscribe_lists_event(true, $member, $evt['participant_list'], $evt['absent_list']);
-       else {
-               $res = $globals->xdb->query("SELECT uid FROM groupex.evenements_participants WHERE uid = {?} AND eid = {?}", $member, Env::get('eid'));
-               $u = $res->fetchOneCell();
-               subscribe_lists_event($u, $member, $evt['participant_list'], $evt['absent_list']);
-       }
-       $evt = get_event_detail(Env::get('eid'), Env::get('item_id'));
-}
-
-$page->assign('admin', $admin);
-$page->assign('evt', $evt);
-$page->assign('url_page', Env::get('PHP_SELF')."?eid=".Env::get('eid').(Env::has('item_id')?("&item_id=".Env::getInt('item_id')):''));
-$page->assign('tout', !Env::has('item_id'));
-if (count($evt['moments'])) $page->assign('moments', $evt['moments']);
-$page->assign('money', $evt['money']);
-
-$tri = (Env::get('order') == 'alpha' ? 'promo, nom, prenom' : 'nom, prenom, promo');
-$whereitemid = Env::has('item_id')?('AND ep.item_id = '.Env::getInt('item_id', 1)):'';
-$res = $globals->xdb->iterRow(
-            'SELECT  UPPER(SUBSTRING(IF(u.nom IS NULL,m.nom,IF(u.nom_usage<>"", u.nom_usage, u.nom)), 1, 1)), COUNT(DISTINCT ep.uid)
-               FROM  groupex.evenements_participants AS ep
-        INNER JOIN  groupex.evenements AS e ON (ep.eid = e.eid)
-         LEFT JOIN  groupex.membres AS m ON ( ep.uid = m.uid AND e.asso_id = m.asso_id)
-          LEFT JOIN  auth_user_md5   AS u ON ( u.user_id = ep.uid )
-              WHERE  ep.eid = {?} '.$whereitemid.'
-           GROUP BY  UPPER(SUBSTRING(IF(u.nom IS NULL,m.nom,u.nom), 1, 1))', Env::get('eid'));
-
-$alphabet = array();
-$nb_tot = 0;
-while (list($char, $nb) = $res->next()) {
-    $alphabet[ord($char)] = $char;
-    $nb_tot += $nb;
-    if (Env::has('initiale') && $char == strtoupper(Env::get('initiale'))) {
-        $tot = $nb;
-    }
-}
-ksort($alphabet);
-$page->assign('alphabet', $alphabet);
-
-$ofs   = Env::getInt('offset');
-$tot   = Env::get('initiale') ? $tot : $nb_tot;
-$nbp   = intval(($tot-1)/NB_PER_PAGE);
-$links = array();
-if ($ofs) {
-    $links['précédent'] = $ofs-1;
-}
-for ($i = 0; $i <= $nbp; $i++) {
-    $links[(string)($i+1)] = $i;
-}
-if ($ofs < $nbp) {
-    $links['suivant'] = $ofs+1;
-}
-if (count($links)>1) {
-    $page->assign('links', $links);
-}
-
-$ini = Env::has('initiale') ? 'AND IF(u.nom IS NULL,m.nom,IF(u.nom_usage<>"", u.nom_usage, u.nom)) LIKE "'.addslashes(Env::get('initiale')).'%"' : '';
-
-$participants = get_event_participants(Env::get('eid'), Env::get('item_id'), $ini, $tri, "LIMIT ".($ofs*NB_PER_PAGE).", ".NB_PER_PAGE, $evt['money'] && $admin, $evt['paiement_id']);
-
-if ($evt['paiement_id']) {
-       $res = $globals->xdb->iterator(
-        "SELECT IF(u.nom_usage<>'', u.nom_usage, u.nom) AS nom, u.prenom,
-               u.promo, a.alias AS email, t.montant
-          FROM {$globals->money->mpay_tprefix}transactions AS t
-        INNER JOIN auth_user_md5 AS u ON(t.uid = u.user_id)
-         INNER JOIN aliases AS a ON (a.id = t.uid AND a.type='a_vie' )
-         LEFT JOIN groupex.evenements_participants AS ep ON(ep.uid = t.uid AND ep.eid = {?})
-         WHERE t.ref = {?} AND ep.uid IS NULL",
-         $evt['eid'], $evt['paiement_id']);
-       $page->assign('oublis', $res->total());
-       $page->assign('oubliinscription', $res);
-}
-
-       
-$page->assign('participants', $participants);
-
-$page->run();
-
-?>
diff --git a/htdocs.net/groupe/evt-modif.php b/htdocs.net/groupe/evt-modif.php
deleted file mode 100644 (file)
index db86668..0000000
+++ /dev/null
@@ -1,249 +0,0 @@
-<?php
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
-/***************************************************************************
- *  Copyright (C) 2003-2006 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 'xnet.inc.php';
-
-new_group_page('xnet/groupe/evt-modif.tpl');
-
-$page->assign('logged', logged());
-$page->assign('admin', may_update());
-
-$moments = range(1, 4);
-$page->assign('moments', $moments);
-
-$page->assign('eid', Env::get('eid'));
-
-if (!may_update())
-    redirect("evenements.php");
-
-if ($eid = Env::get('eid')) {
-       $res = $globals->xdb->query("SELECT asso_id, short_name FROM groupex.evenements WHERE eid = {?}", $eid);
-       $infos = $res->fetchOneAssoc();
-       if ($infos['asso_id'] != $globals->asso('id')) {
-               unset($eid);
-               unset($infos);
-       }
-}
-
-$get_form = true;
-
-if (Post::get('intitule')) {
-    $get_form = false;
-    $short_name = Env::get('short_name');
-    //Quelques vérifications sur l'alias (caractères spéciaux)
-    if ($short_name && !preg_match( "/^[a-zA-Z0-9\-.]{3,20}$/", $short_name))
-    {
-        $page->trig("Le raccourci demandé n'est pas valide.
-                    Vérifie qu'il comporte entre 3 et 20 caractères
-                    et qu'il ne contient que des lettres non accentuées,
-                    des chiffres ou les caractères - et .");
-        $short_name = $infos['short_name'];
-        $get_form = true;
-    }
-    //vérifier que l'alias n'est pas déja pris
-    if ($short_name && $short_name != $infos['short_name']) {
-        $res = $globals->xdb->query('SELECT COUNT(*) FROM virtual WHERE alias LIKE {?}', $short_name."-%");
-        if ($res->fetchOneCell() > 0) {
-            $page->trig("Le raccourci demandé est déjà utilisé. Choisis en un autre.");
-            $short_name = $infos['short_name'];
-            $get_form = true;
-        }
-    }
-
-    // if had a previous shortname change the old lists
-    if ($short_name && $infos['short_name'] && $short_name != $infos['short_name']) {
-        $globals->xdb->execute("UPDATE virtual SET alias = REPLACE(alias, {?}, {?}) WHERE type = 'evt' AND alias LIKE {?}",
-                $infos['short_name'], $short_name, $infos['short_name']."-%");
-    } 
-    // if we have a first new short_name create the lists
-    elseif ($short_name && !$infos['short_name'])
-    {
-        $globals->xdb->execute("INSERT INTO virtual SET type = 'evt', alias = {?}",
-                $short_name."-participants@".$globals->xnet->evts_domain);
-            
-        $res = $globals->xdb->query("SELECT LAST_INSERT_ID()");
-        $globals->xdb->execute("INSERT INTO virtual_redirect (
-            SELECT {?} AS vid, IF(u.nom IS NULL, m.email, CONCAT(a.alias, {?})) AS redirect
-              FROM groupex.evenements_participants AS ep
-         LEFT JOIN groupex.membres AS m ON (ep.uid = m.uid)
-         LEFT JOIN auth_user_md5 AS u ON (u.user_id = ep.uid)
-         LEFT JOIN aliases AS a ON (a.id = ep.uid AND a.type = 'a_vie')
-             WHERE ep.eid = {?}
-          GROUP BY ep.uid)",
-                 $res->fetchOneCell(), "@".$globals->mail->domain, $eid);
-
-        $globals->xdb->execute("INSERT INTO virtual SET type = 'evt', alias = {?}",
-                $short_name."-absents@".$globals->xnet->evts_domain);
-                
-        $res = $globals->xdb->query("SELECT LAST_INSERT_ID()");
-        $globals->xdb->execute("INSERT INTO virtual_redirect (
-            SELECT {?} AS vid, IF(u.nom IS NULL, m.email, CONCAT(a.alias, {?})) AS redirect
-                  FROM groupex.membres AS m
-             LEFT JOIN groupex.evenements_participants AS ep ON (ep.uid = m.uid)
-             LEFT JOIN auth_user_md5 AS u ON (u.user_id = m.uid)
-             LEFT JOIN aliases AS a ON (a.id = m.uid AND a.type = 'a_vie')
-                 WHERE m.asso_id = {?} AND ep.uid IS NULL
-              GROUP BY m.uid)",
-                 $res->fetchOneCell(), "@".$globals->mail->domain, $globals->asso('id'));
-    }
-    // if we delete the old short name, delete the lists
-    elseif (!$short_name && $infos['short_name']) {
-        $globals->xdb->execute("DELETE virtual, virtual_redirect FROM virtual LEFT JOIN virtual_redirect USING(vid) WHERE virtual.alias LIKE {?}",
-                $infos['short_name']."-%");
-    }
-
-    $evt = array();
-    $evt['eid'] = $eid;
-    $evt['asso_id'] = $globals->asso('id');
-    $evt['organisateur_uid'] = Session::get('uid');
-    $evt['intitule'] = Post::get('intitule');
-    $evt['paiement_id'] =(Post::get('paiement_id')>0)?Post::get('paiement_id'):null;
-    $evt['descriptif'] =Post::get('descriptif');
-    $evt['debut'] = Post::get('deb_Year')."-".Post::get('deb_Month')."-".Post::get('deb_Day')." ".Post::get('deb_Hour').":".Post::get('deb_Minute').":00";
-    $evt['fin'] = Post::get('fin_Year')."-".Post::get('fin_Month')."-".Post::get('fin_Day')." ".Post::get('fin_Hour').":".Post::get('fin_Minute').":00";
-    $evt['membres_only'] = Post::get('membres_only');
-    $evt['advertise'] = Post::get('advertise');
-    $evt['show_participants'] = Post::get('show_participants');
-    $evt['noinvite'] = Post::get('noinvite');
-    if (!$short_name) $short_name = '';
-    $evt['short_name'] = $short_name;
-    $evt['deadline_inscription'] = (Post::get('deadline', 'off')=='on')?null:(Post::get('inscr_Year')."-".Post::get('inscr_Month')."-".Post::get('inscr_Day'));
-
-    // Store the modifications in the database
-    $globals->xdb->execute("REPLACE INTO groupex.evenements 
-        SET eid={?}, asso_id={?}, organisateur_uid={?}, intitule={?},
-            paiement_id = {?}, descriptif = {?},
-            debut = {?}, fin = {?},
-            membres_only = {?}, advertise = {?}, show_participants = {?}, 
-            short_name = {?}, deadline_inscription = {?}, noinvite = {?}",
-            $evt['eid'], $evt['asso_id'], $evt['organisateur_uid'], $evt['intitule']
-            , $evt['paiement_id'], $evt['descriptif'],
-            $evt['debut'], $evt['fin'],
-            $evt['membres_only'], $evt['advertise'], $evt['show_participants'],
-            $evt['short_name'], $evt['deadline_inscription'], $evt['noinvite']);
-
-    // if new event, get its id
-    if (!$eid) {
-        $res = $globals->xdb->query("SELECT LAST_INSERT_ID()");
-        $eid = $res->fetchOneCell();
-        $evt['eid'] = $eid;
-    }
-
-    $nb_moments = 0;
-    $money_defaut = 0;
-    foreach ($moments as $i) 
-    {
-        if (Post::get('titre'.$i)) {
-            $nb_moments++;
-            if (!($money_defaut > 0))
-                $money_defaut = strtr(Post::get('montant'.$i), ',', '.');
-            $globals->xdb->execute("
-                REPLACE INTO groupex.evenements_items VALUES (
-                    {?}, {?},
-                    {?}, {?}, {?})",
-                    $eid, $i,
-                    Post::get('titre'.$i), Post::get('details'.$i), strtr(Post::get('montant'.$i), ',', '.'));
-        }
-        else
-        {
-            $globals->xdb->execute("DELETE FROM groupex.evenements_items WHERE eid = {?} AND item_id = {?}", $eid, $i);
-        }
-    }
-
-    // request for a new payment
-    if (Post::get('paiement_id') == -1 && $money_defaut >= 0) {
-        require_once ('validations.inc.php');
-        $p = new PayReq(
-        Session::get('uid'),
-        Post::get('intitule')." - ".$globals->asso('nom'),
-        Post::get('site'),
-        $money_defaut,
-        Post::get('confirmation'),
-        0,
-        999,
-        $globals->asso('id'),
-        $eid);
-        $p->submit();
-    }
-
-    // events with no sub-event: add a sub-event with no name
-    if ($nb_moments == 0)
-        $globals->xdb->execute("INSERT INTO groupex.evenements_items VALUES ({?}, {?}, '', '', 0)", $eid, 1);
-}
-
-if (Env::has('sup') && $eid) {
-    // deletes the event
-    $globals->xdb->execute("DELETE FROM groupex.evenements WHERE eid = {?} AND asso_id = {?}", $eid, $globals->asso('id'));
-    // deletes the event items
-    $globals->xdb->execute("DELETE FROM groupex.evenements_items WHERE eid = {?}", $eid);
-    // deletes the event participants
-    $globals->xdb->execute("DELETE FROM groupex.evenements_participants WHERE eid = {?}", $eid);
-    // deletes the event mailing aliases
-    if ($infos['short_name'])
-            $globals->xdb->execute("DELETE FROM virtual WHERE type = 'evt' AND alias LIKE {?}", $infos['short_name']."-%");
-    // delete the requests for payments
-    require_once('validations.inc.php');
-    $globals->xdb->execute("DELETE FROM requests WHERE type = 'paiements' AND data  LIKE {?}", PayReq::same_event($eid, $globals->asso('id')));
-    redirect("evenements.php");
-}
-
-if (!$get_form)
-    redirect("evenements.php");
-
-// get a list of all the payment for this asso
-$res = $globals->xdb->iterator
-        ("SELECT id, text FROM {$globals->money->mpay_tprefix}paiements WHERE asso_id = {?}", $globals->asso('id'));
-$paiements = array();
-while ($a = $res->next()) $paiements[$a['id']] = $a['text'];
-    $page->assign('paiements', $paiements);
-
-// when modifying an old event retreive the old datas
-if ($eid) {
-    $res = $globals->xdb->query(
-            "SELECT    eid, intitule, descriptif, debut, fin, membres_only, advertise, show_participants, paiement_id, short_name, deadline_inscription, noinvite
-               FROM    groupex.evenements
-              WHERE eid = {?}", $eid);
-    $evt = $res->fetchOneAssoc();
-    // find out if there is already a request for a payment for this event
-    require_once('validations.inc.php');
-    $res = $globals->xdb->query("SELECT stamp FROM requests WHERE type = 'paiements' AND data LIKE {?}", PayReq::same_event($eid, $globals->asso('id')));
-    $stamp = $res->fetchOneCell();
-    if ($stamp) {
-            $evt['paiement_id'] = -2;
-            $evt['paiement_req'] = $stamp;
-    }
-    $page->assign('evt', $evt);
-    // get all the different moments infos
-    $res = $globals->xdb->iterator(
-            "SELECT item_id, titre, details, montant
-               FROM groupex.evenements_items AS ei
-         INNER JOIN groupex.evenements AS e ON(e.eid = ei.eid)
-              WHERE e.eid = {?}
-           ORDER BY item_id", $eid);
-    $items = array();
-    while ($item = $res->next()) $items[$item['item_id']] = $item;
-    $page->assign('items', $items);
-}
-
-$page->run();
-
-?>
index 460bedb..957153e 100644 (file)
@@ -24,8 +24,10 @@ class XnetEventsModule extends PLModule
     function handlers()
     {
         return array(
-            'grp/events'      => $this->make_hook('events',  AUTH_MDP),
-            'grp/events/csv'  => $this->make_hook('csv',     AUTH_MDP),
+            'grp/events'       => $this->make_hook('events',  AUTH_MDP),
+            'grp/events/csv'   => $this->make_hook('csv',     AUTH_MDP),
+            'grp/events/edit'  => $this->make_hook('edit',    AUTH_MDP),
+            'grp/events/admin' => $this->make_hook('admin',   AUTH_MDP),
         );
     }
 
@@ -123,25 +125,22 @@ class XnetEventsModule extends PLModule
         $page->assign('admin', may_update());
 
         $evenements = $globals->xdb->iterator(
-            "SELECT  e.eid, 
-                     IF(e.intitule = '', ' ', e.intitule) AS intitule,
-                     IF(e.descriptif = '', ' ', e.descriptif) AS descriptif,
-                     e.debut, e.fin,
-                     LEFT(10,e.debut) AS debut_day,
-                     LEFT(10,e.fin) AS fin_day,
-                     e.paiement_id, e.membres_only, e.noinvite,
-                     e.show_participants, u.nom, u.prenom, u.promo, a.alias, MAX(ep.nb) AS inscrit,
-                     MAX(ep.paid) AS paid,
-                     e.short_name,
-                     IF(e.deadline_inscription, e.deadline_inscription >= LEFT(NOW(), 10),
-                        1) AS inscr_open, e.deadline_inscription
+                "SELECT  e.eid, IF(e.intitule = '', ' ', e.intitule) AS intitule,
+                         IF(e.descriptif = '', ' ', e.descriptif) AS descriptif,
+                         e.debut, e.fin, LEFT(10,e.debut) AS debut_day,
+                         LEFT(10,e.fin) AS fin_day, e.paiement_id, e.membres_only,
+                         e.noinvite, e.show_participants, u.nom, u.prenom,
+                         u.promo, a.alias, MAX(ep.nb) AS inscrit,
+                         MAX(ep.paid) AS paid, e.short_name,
+                         IF(e.deadline_inscription, e.deadline_inscription >= LEFT(NOW(), 10),
+                            1) AS inscr_open, e.deadline_inscription
                   FROM  groupex.evenements AS e
             INNER JOIN  x4dat.auth_user_md5 AS u ON u.user_id = e.organisateur_uid
              LEFT JOIN  x4dat.aliases AS a ON (a.type = 'a_vie' AND a.id = u.user_id)
              LEFT JOIN  groupex.evenements_participants AS ep ON (ep.eid = e.eid AND ep.uid = {?})
                  WHERE  asso_id = {?}
               GROUP BY  e.eid
-              ORDER BY  debut",Session::get('uid'),$globals->asso('id'));
+              ORDER BY  debut", Session::get('uid'), $globals->asso('id'));
 
         $evts = array();
         while ($e = $evenements->next()) {
@@ -172,6 +171,10 @@ class XnetEventsModule extends PLModule
     {
         require_once('xnet/evenements.php');
 
+        if (!is_numeric($item_id)) {
+            $item_id = null;
+        }
+
         $evt = get_event_detail($eid, $item_id);
         if (!$evt) {
             return PL_NOT_FOUND;
@@ -205,6 +208,410 @@ class XnetEventsModule extends PLModule
         $page->assign('money', $evt['money']);
         $page->assign('tout', !Env::get('item_id', false));
     }
+
+    function handler_edit(&$page, $eid = null)
+    {
+        global $globals;
+
+        new_groupadmin_page('xnet/groupe/evt-modif.tpl');
+
+        $page->assign('logged', logged());
+        $page->assign('admin', may_update());
+
+        $moments = range(1, 4);
+        $page->assign('moments', $moments);
+
+        if (!is_null($eid)) {
+            $res = $globals->xdb->query("SELECT short_name, asso_id
+                                           FROM groupex.evenements
+                                          WHERE eid = {?}", $eid);
+            $infos = $res->fetchOneAssoc();
+            if ($infos['asso_id'] != $globals->asso('id')) {
+                return PL_NOT_ALLOWED;
+            }
+        }
+
+        $get_form = true;
+
+        if (Post::get('intitule')) {
+            $get_form = false;
+            $short_name = Env::get('short_name');
+
+            // Quelques vérifications sur l'alias (caractères spéciaux)
+            if ($short_name && !preg_match( "/^[a-zA-Z0-9\-.]{3,20}$/", $short_name)) {
+                $page->trig("Le raccourci demandé n'est pas valide.
+                            Vérifie qu'il comporte entre 3 et 20 caractères
+                            et qu'il ne contient que des lettres non accentuées,
+                            des chiffres ou les caractères - et .");
+                $short_name = $infos['short_name'];
+                $get_form = true;
+            }
+
+            //vérifier que l'alias n'est pas déja pris
+            if ($short_name && $short_name != $infos['short_name']) {
+                $res = $globals->xdb->query('SELECT COUNT(*) FROM virtual WHERE alias LIKE {?}', $short_name."-%");
+                if ($res->fetchOneCell() > 0) {
+                    $page->trig("Le raccourci demandé est déjà utilisé. Choisis en un autre.");
+                    $short_name = $infos['short_name'];
+                    $get_form = true;
+                }
+            }
+
+            // if had a previous shortname change the old lists
+            if ($short_name && $infos['short_name'] && $short_name != $infos['short_name']) {
+                $globals->xdb->execute("UPDATE virtual
+                                           SET alias = REPLACE(alias, {?}, {?})
+                                         WHERE type = 'evt' AND alias LIKE {?}",
+                                         $infos['short_name'], $short_name,
+                                         $infos['short_name']."-%");
+            }
+            elseif ($short_name && !$infos['short_name']) {
+                // if we have a first new short_name create the lists
+                //
+                $globals->xdb->execute("INSERT INTO virtual SET type = 'evt', alias = {?}",
+                        $short_name."-participants@".$globals->xnet->evts_domain);
+
+                $res = $globals->xdb->query("SELECT LAST_INSERT_ID()");
+                $globals->xdb->execute("INSERT INTO virtual_redirect (
+                    SELECT {?} AS vid, IF(u.nom IS NULL, m.email, CONCAT(a.alias, {?})) AS redirect
+                      FROM groupex.evenements_participants AS ep
+                 LEFT JOIN groupex.membres AS m ON (ep.uid = m.uid)
+                 LEFT JOIN auth_user_md5 AS u ON (u.user_id = ep.uid)
+                 LEFT JOIN aliases AS a ON (a.id = ep.uid AND a.type = 'a_vie')
+                     WHERE ep.eid = {?}
+                  GROUP BY ep.uid)",
+                         $res->fetchOneCell(), "@".$globals->mail->domain, $eid);
+
+                $globals->xdb->execute("INSERT INTO virtual SET type = 'evt', alias = {?}",
+                        $short_name."-absents@".$globals->xnet->evts_domain);
+
+                $res = $globals->xdb->query("SELECT LAST_INSERT_ID()");
+                $globals->xdb->execute("INSERT INTO virtual_redirect (
+                    SELECT {?} AS vid, IF(u.nom IS NULL, m.email, CONCAT(a.alias, {?})) AS redirect
+                          FROM groupex.membres AS m
+                     LEFT JOIN groupex.evenements_participants AS ep ON (ep.uid = m.uid)
+                     LEFT JOIN auth_user_md5 AS u ON (u.user_id = m.uid)
+                     LEFT JOIN aliases AS a ON (a.id = m.uid AND a.type = 'a_vie')
+                         WHERE m.asso_id = {?} AND ep.uid IS NULL
+                      GROUP BY m.uid)",
+                         $res->fetchOneCell(), "@".$globals->mail->domain, $globals->asso('id'));
+            }
+            elseif (!$short_name && $infos['short_name']) {
+                // if we delete the old short name, delete the lists
+                $globals->xdb->execute("DELETE virtual, virtual_redirect FROM virtual
+                                     LEFT JOIN virtual_redirect USING(vid)
+                                         WHERE virtual.alias LIKE {?}",
+                                       $infos['short_name']."-%");
+            }
+
+            $evt = array();
+            $evt['eid']          = $eid;
+            $evt['asso_id']      = $globals->asso('id');
+            $evt['organisateur_uid'] = Session::get('uid');
+            $evt['intitule']     = Post::get('intitule');
+            $evt['paiement_id']  = (Post::get('paiement_id')>0) ? Post::get('paiement_id') : null;
+            $evt['descriptif']   = Post::get('descriptif');
+            $evt['debut']        = Post::get('deb_Year')."-".Post::get('deb_Month')
+                                 . "-".Post::get('deb_Day')." ".Post::get('deb_Hour')
+                                 . ":".Post::get('deb_Minute').":00";
+            $evt['fin']          = Post::get('fin_Year')."-".Post::get('fin_Month')
+                                 . "-".Post::get('fin_Day')." ".Post::get('fin_Hour')
+                                 . ":".Post::get('fin_Minute').":00";
+            $evt['membres_only'] = Post::get('membres_only');
+            $evt['advertise']    = Post::get('advertise');
+            $evt['show_participants'] = Post::get('show_participants');
+            $evt['noinvite']     = Post::get('noinvite');
+            if (!$short_name) {
+                $short_name = '';
+            }
+            $evt['short_name']   = $short_name;
+            $evt['deadline_inscription'] = Post::get('deadline', 'off') == 'on' ? null
+                                         : (Post::get('inscr_Year')."-".Post::get('inscr_Month')
+                                            ."-".Post::get('inscr_Day'));
+
+            // Store the modifications in the database
+            $globals->xdb->execute("REPLACE INTO groupex.evenements 
+                SET eid={?}, asso_id={?}, organisateur_uid={?}, intitule={?},
+                    paiement_id = {?}, descriptif = {?},
+                    debut = {?}, fin = {?},
+                    membres_only = {?}, advertise = {?}, show_participants = {?}, 
+                    short_name = {?}, deadline_inscription = {?}, noinvite = {?}",
+                    $evt['eid'], $evt['asso_id'], $evt['organisateur_uid'], $evt['intitule']
+                    , $evt['paiement_id'], $evt['descriptif'],
+                    $evt['debut'], $evt['fin'],
+                    $evt['membres_only'], $evt['advertise'], $evt['show_participants'],
+                    $evt['short_name'], $evt['deadline_inscription'], $evt['noinvite']);
+
+            // if new event, get its id
+            if (!$eid) {
+                $res = $globals->xdb->query("SELECT LAST_INSERT_ID()");
+                $eid = $res->fetchOneCell();
+                $evt['eid'] = $eid;
+            }
+
+            $nb_moments = 0;
+            $money_defaut = 0;
+
+            foreach ($moments as $i) {
+                if (Post::get('titre'.$i)) {
+                    $nb_moments++;
+                    if (!($money_defaut > 0))
+                        $money_defaut = strtr(Post::get('montant'.$i), ',', '.');
+                    $globals->xdb->execute("
+                        REPLACE INTO groupex.evenements_items
+                        VALUES ({?}, {?}, {?}, {?}, {?})",
+                        $eid, $i, Post::get('titre'.$i),
+                        Post::get('details'.$i),
+                        strtr(Post::get('montant'.$i), ',', '.'));
+                } else {
+                    $globals->xdb->execute("DELETE FROM groupex.evenements_items 
+                                            WHERE eid = {?} AND item_id = {?}", $eid, $i);
+                }
+            }
+
+            // request for a new payment
+            if (Post::get('paiement_id') == -1 && $money_defaut >= 0) {
+                require_once 'validations.inc.php';
+                $p = new PayReq(Session::get('uid'),
+                                Post::get('intitule')." - ".$globals->asso('nom'),
+                                Post::get('site'), $money_defaut,
+                                Post::get('confirmation'), 0, 999,
+                                $globals->asso('id'), $eid);
+                $p->submit();
+            }
+
+            // events with no sub-event: add a sub-event with no name
+            if ($nb_moments == 0) {
+                $globals->xdb->execute("INSERT INTO groupex.evenements_items
+                                        VALUES ({?}, {?}, '', '', 0)", $eid, 1);
+            }
+        }
+
+        if (Env::has('sup') && $eid) {
+            // deletes the event
+            $globals->xdb->execute("DELETE FROM groupex.evenements
+                                    WHERE eid = {?} AND asso_id = {?}",
+                                   $eid, $globals->asso('id'));
+
+            // deletes the event items
+            $globals->xdb->execute("DELETE FROM groupex.evenements_items WHERE eid = {?}", $eid);
+
+            // deletes the event participants
+            $globals->xdb->execute("DELETE FROM groupex.evenements_participants
+                                    WHERE eid = {?}", $eid);
+
+            // deletes the event mailing aliases
+            if ($infos['short_name']) {
+                $globals->xdb->execute("DELETE FROM virtual
+                                        WHERE type = 'evt' AND alias LIKE {?}",
+                                       $infos['short_name']."-%");
+            }
+
+            // delete the requests for payments
+            require_once 'validations.inc.php';
+            $globals->xdb->execute("DELETE FROM requests
+                                    WHERE type = 'paiements' AND data  LIKE {?}",
+                                   PayReq::same_event($eid, $globals->asso('id')));
+            redirect("evenements.php");
+        }
+
+        if (!$get_form) {
+            redirect("evenements.php");
+        }
+
+        // get a list of all the payment for this asso
+        $res = $globals->xdb->iterator("SELECT id, text
+                                        FROM {$globals->money->mpay_tprefix}paiements
+                                        WHERE asso_id = {?}", $globals->asso('id'));
+        $paiements = array();
+        while ($a = $res->next()) $paiements[$a['id']] = $a['text']; {
+            $page->assign('paiements', $paiements);
+        }
+
+        // when modifying an old event retreive the old datas
+        if ($eid) {
+            $res = $globals->xdb->query(
+                    "SELECT    eid, intitule, descriptif, debut, fin,
+                                membres_only, advertise, show_participants,
+                                paiement_id, short_name, deadline_inscription,
+                                noinvite
+                       FROM    groupex.evenements
+                      WHERE eid = {?}", $eid);
+            $evt = $res->fetchOneAssoc();
+            // find out if there is already a request for a payment for this event
+            require_once 'validations.inc.php';
+            $res = $globals->xdb->query("SELECT stamp FROM requests
+                                         WHERE type = 'paiements' AND data LIKE {?}",
+                                        PayReq::same_event($eid, $globals->asso('id')));
+            $stamp = $res->fetchOneCell();
+            if ($stamp) {
+                $evt['paiement_id'] = -2;
+                $evt['paiement_req'] = $stamp;
+            }
+            $page->assign('evt', $evt);
+            // get all the different moments infos
+            $res = $globals->xdb->iterator(
+                    "SELECT item_id, titre, details, montant
+                       FROM groupex.evenements_items AS ei
+                 INNER JOIN groupex.evenements AS e ON(e.eid = ei.eid)
+                      WHERE e.eid = {?}
+                   ORDER BY item_id", $eid);
+            $items = array();
+            while ($item = $res->next()) {
+                $items[$item['item_id']] = $item;
+            }
+            $page->assign('items', $items);
+        }
+    }
+
+    function handler_admin(&$page, $eid = null, $item_id = null)
+    {
+        global $globals;
+
+        define('NB_PER_PAGE', 25);
+
+        require_once('xnet/evenements.php');
+
+        $evt = get_event_detail($eid, $item_id);
+
+        // the event doesn't exist or doesn't belong to this assoif (!$evt)
+        if (!$evt) {
+            return PL_NOT_FOUND;
+        }
+
+        if ($evt['show_participants']) {
+            new_group_page('xnet/groupe/evt-admin.tpl');
+        } else {
+            new_groupadmin_page('xnet/groupe/evt-admin.tpl');
+        }
+
+        $admin = may_update();
+
+        // select a member from his mail
+        if ($admin && Env::get('adm') && Env::get('mail')) {
+            if (strpos(Env::get('mail'), '@') === false) {
+                $res = $globals->xdb->query(
+                        "SELECT m.uid
+                           FROM groupex.membres AS m
+                     INNER JOIN aliases AS a ON (a.id = m.uid)
+                          WHERE a.alias = {?} AND m.asso_id = {?}",
+                        Env::get('mail'), $globals->asso('id'));
+            } else {
+                $res = $globals->xdb->query(
+                        "SELECT m.uid
+                           FROM groupex.membres AS m
+                          WHERE m.email = {?} AND m.asso_id = {?}",
+                        Env::get('mail'), $globals->asso('id'));
+            }
+            $member = $res->fetchOneCell();
+            if (!$member) $page->trig("Membre introuvable");
+        }
+
+        // change the price paid by a participant
+        if ($admin && Env::get('adm') == 'prix' && $member) {
+                $globals->xdb->execute("UPDATE groupex.evenements_participants SET paid = IF(paid + {?} > 0, paid + {?}, 0) WHERE uid = {?} AND eid = {?}",
+                        strtr(Env::get('montant'), ',', '.'),
+                        strtr(Env::get('montant'), ',', '.'),
+                        $member, Env::get('eid'));
+        }
+
+        // change the number of personns coming with a participant
+        if ($admin && Env::get('adm') == 'nbs' && $member) {
+            $res = $globals->xdb->query("SELECT paid FROM groupex.evenements_participants WHERE uid = {?} AND eid = {?}", $member, Env::get('eid'));
+            $paid = $res->fetchOneCell();
+            $participate = false;
+            foreach ($evt['moments'] as $m) if (Env::has('nb'.$m['item_id'])) {
+                $nb = Env::getInt('nb'.$m['item_id'], 0);
+                if ($nb < 0) $nb = 0;
+                if ($nb) {
+                    $participate = true;
+                    if (!$paid) $paid = 0;
+                    $globals->xdb->execute("REPLACE INTO groupex.evenements_participants VALUES ({?}, {?}, {?}, {?}, {?})",
+                    Env::get('eid'), $member, $m['item_id'], $nb, $paid);
+                } else {
+                    $globals->xdb->execute("DELETE FROM groupex.evenements_participants WHERE uid = {?} AND eid = {?} AND item_id = {?}", $member, Env::get('eid'), $m['item_id']);
+                }
+            }
+            if ($participate)  {
+                    subscribe_lists_event(true, $member, $evt['participant_list'], $evt['absent_list']);
+            } else {
+                $res = $globals->xdb->query(
+                    "SELECT uid FROM groupex.evenements_participants
+                    WHERE uid = {?} AND eid = {?}", $member, $eid);
+                $u = $res->fetchOneCell();
+                subscribe_lists_event($u, $member, $evt['participant_list'], $evt['absent_list']);
+            }
+            $evt = get_event_detail($eid, $item_id);
+        }
+
+        $page->assign('admin', $admin);
+        $page->assign('evt', $evt);
+        $page->assign('url_page', Env::get('PHP_SELF')."?eid=".Env::get('eid').(Env::has('item_id')?("&item_id=".Env::getInt('item_id')):''));
+        $page->assign('tout', !Env::has('item_id'));
+
+        if (count($evt['moments'])) $page->assign('moments', $evt['moments']);
+        $page->assign('money', $evt['money']);
+
+        $tri = (Env::get('order') == 'alpha' ? 'promo, nom, prenom' : 'nom, prenom, promo');
+        $whereitemid = Env::has('item_id')?('AND ep.item_id = '.Env::getInt('item_id', 1)):'';
+        $res = $globals->xdb->iterRow(
+                    'SELECT  UPPER(SUBSTRING(IF(u.nom IS NULL,m.nom,IF(u.nom_usage<>"", u.nom_usage, u.nom)), 1, 1)), COUNT(DISTINCT ep.uid)
+                       FROM  groupex.evenements_participants AS ep
+                 INNER JOIN  groupex.evenements AS e ON (ep.eid = e.eid)
+                  LEFT JOIN  groupex.membres AS m ON ( ep.uid = m.uid AND e.asso_id = m.asso_id)
+                  LEFT JOIN  auth_user_md5   AS u ON ( u.user_id = ep.uid )
+                      WHERE  ep.eid = {?} '.$whereitemid.'
+                   GROUP BY  UPPER(SUBSTRING(IF(u.nom IS NULL,m.nom,u.nom), 1, 1))', Env::get('eid'));
+
+        $alphabet = array();
+        $nb_tot = 0;
+        while (list($char, $nb) = $res->next()) {
+            $alphabet[ord($char)] = $char;
+            $nb_tot += $nb;
+            if (Env::has('initiale') && $char == strtoupper(Env::get('initiale'))) {
+                $tot = $nb;
+            }
+        }
+        ksort($alphabet);
+        $page->assign('alphabet', $alphabet);
+
+        $ofs   = Env::getInt('offset');
+        $tot   = Env::get('initiale') ? $tot : $nb_tot;
+        $nbp   = intval(($tot-1)/NB_PER_PAGE);
+        $links = array();
+        if ($ofs) {
+            $links['précédent'] = $ofs-1;
+        }
+        for ($i = 0; $i <= $nbp; $i++) {
+            $links[(string)($i+1)] = $i;
+        }
+        if ($ofs < $nbp) {
+            $links['suivant'] = $ofs+1;
+        }
+        if (count($links)>1) {
+            $page->assign('links', $links);
+        }
+
+        $ini = Env::has('initiale') ? 'AND IF(u.nom IS NULL,m.nom,IF(u.nom_usage<>"", u.nom_usage, u.nom)) LIKE "'.addslashes(Env::get('initiale')).'%"' : '';
+
+        $participants = get_event_participants(Env::get('eid'), Env::get('item_id'), $ini, $tri, "LIMIT ".($ofs*NB_PER_PAGE).", ".NB_PER_PAGE, $evt['money'] && $admin, $evt['paiement_id']);
+
+        if ($evt['paiement_id']) {
+                $res = $globals->xdb->iterator(
+                "SELECT IF(u.nom_usage<>'', u.nom_usage, u.nom) AS nom, u.prenom,
+                        u.promo, a.alias AS email, t.montant
+                   FROM {$globals->money->mpay_tprefix}transactions AS t
+                 INNER JOIN auth_user_md5 AS u ON(t.uid = u.user_id)
+                 INNER JOIN aliases AS a ON (a.id = t.uid AND a.type='a_vie' )
+                  LEFT JOIN groupex.evenements_participants AS ep ON(ep.uid = t.uid AND ep.eid = {?})
+                  WHERE t.ref = {?} AND ep.uid IS NULL",
+                  $evt['eid'], $evt['paiement_id']);
+                $page->assign('oublis', $res->total());
+                $page->assign('oubliinscription', $res);
+        }
+
+        $page->assign('participants', $participants);
+    }
 }
 
 ?>
index 96f3832..4339b79 100644 (file)
@@ -30,29 +30,29 @@ Ev
   </p>
 {else}
 
-  {if $admin}
-  <p class="center">
-  [<a href="evt-modif.php?add=1">Annoncer un nouvel événement</a>]
-  </p>
-  {/if}
+{if $admin}
+<p class="center">
+[<a href="{rel}/{$platal->ns}events/edit">Annoncer un nouvel événement</a>]
+</p>
+{/if}
 
-  {if $nb_evt eq 0}
+{if !$evenements}
 
-  <p class="descr">
-    Aucun événement n'a été référencé par les animateurs du groupe.
-  </p>
+<p class="descr">
+  Aucun événement n'a été référencé par les animateurs du groupe.
+</p>
 
-  {else}
+{else}
 
-  <form action="{rel}/{$platal->ns}events" method="post">
+<form action="{rel}/{$platal->ns}events" method="post">
   {foreach from=$evenements item=e}
-  <table class="tiny" cellspacing="0" cellpadding="0">
+  <table class="bicol" cellspacing="0" cellpadding="0">
     <tr {popup caption=$e.intitule" text=$e.descriptif}>
       <th colspan="2">
         {$e.intitule}
         {if $admin}
-        <a href="evt-modif.php?mod=1&amp;eid={$e.eid}"><img src="{rel}/images/profil.png" title="Edition de l'événement" alt="Edition de l'événement" /></a>
-        <a href="evt-modif.php?sup=1&amp;eid={$e.eid}" onclick="return confirm('Supprimer l\'événement effacera la liste des inscrits et des paiements.\n Es-tu sûr de vouloir supprimer l\'événement ?')"><img src="{rel}/images/del.png" alt="Suppression de {$e.intitule}" title="Suppression de {$e.intitule}" /></a>
+        <a href="{rel}/{$platal->ns}events/edit/{$e.eid}?mod=1"><img src="{rel}/images/profil.png" title="Edition de l'événement" alt="Edition de l'événement" /></a>
+        <a href="{rel}/{$platal->ns}events/edit/{$e.eid}?sup=1" onclick="return confirm('Supprimer l\'événement effacera la liste des inscrits et des paiements.\n Es-tu sûr de vouloir supprimer l\'événement ?')"><img src="{rel}/images/del.png" alt="Suppression de {$e.intitule}" title="Suppression de {$e.intitule}" /></a>
         {/if}
       </th>
     </tr>
@@ -80,7 +80,7 @@ Ev
     {if $admin || $e.show_participants}
     <tr {popup caption=$e.intitule text=$e.descriptif}>
       <td class="titre" colspan="2">
-        <a href="evt-admin.php?eid={$e.eid}">
+        <a href="{rel}/{$platal->ns}events/admin/{$e.eid}">
           Liste des participants
           <img src="{rel}/images/loupe.gif" title="Liste des participants" alt="Liste des participants" />
         </a>
@@ -162,8 +162,8 @@ Ev
   <div>
     <input type="hidden" name="ins" />
   </div>
-  </form>
-  {/if}
+</form>
+{/if}
 
 {/if}
 
index 5d970df..5fee68f 100644 (file)
@@ -36,9 +36,9 @@ L'
 
 {if $moments}
 <p class="center">
-[<a href="{$smarty.server.PHP_SELF}?eid={$smarty.request.eid}"{if !$smarty.request.item_id}class="erreur"{/if}>tout</a>]
+[<a href="{rel}/{$platal->ns}events/admin/{$page->argv[1]}"{if !$platal->argv[2]}class="erreur"{/if}>tout</a>]
 {foreach from=$moments item=m}
-[<a href="{$smarty.server.PHP_SELF}?eid={$m.eid}&amp;item_id={$m.item_id}" {if $smarty.request.item_id eq $m.item_id}class="erreur"{/if}>{$m.titre}</a>]
+[<a href="{rel}/{$platal->ns}events/admin/{$page->argv[1]}/{$m.item_id}" {if $platal->argv[2] eq $m.item_id}class="erreur"{/if}>{$m.titre}</a>]
 {/foreach}
 </p>
 {/if}
@@ -46,7 +46,7 @@ L'
 <p class="center">
 [<a href="{$url_page}" {if !$smarty.request.initiale}class="erreur"{/if}>tout</a>]
 {foreach from=$alphabet item=c}
-[<a href="{$url_page}&amp;initiale={$c}"{if $smarty.request.initiale eq $c} class="erreur"{/if}>{$c}</a>]
+[<a href="{$url_page}?initiale={$c}"{if $smarty.request.initiale eq $c} class="erreur"{/if}>{$c}</a>]
 {/foreach}
 </p>
 
@@ -156,14 +156,14 @@ Ils ont pay
 
 <p class="descr">
 {foreach from=$links item=ofs key=txt}
-<a href="{$url_page}&amp;offset={$ofs}&amp;initiale={$smarty.request.initiale}"{if $smarty.request.offset eq $ofs} class="erreur"{/if}>{$txt}</a>
+<a href="{$url_page}?offset={$ofs}&amp;initiale={$smarty.request.initiale}"{if $smarty.request.offset eq $ofs} class="erreur"{/if}>{$txt}</a>
 {/foreach}
 </p>
 
 {if $admin}
 
 <p class="descr">
-[<a href="{rel}/{$platal->ns}events/csv/{$smarty.request.eid}/{$smarty.request.item_id}/{$evt.intitule}{if $evt.titre}.{$evt.titre}{/if}.csv?">Télécharger le fichier Excel</a>]
+[<a href="{rel}/{$platal->ns}events/csv/{$platal->argv[1]}/{$platal->argv[2]}/{$evt.intitule}{if $evt.titre}.{$evt.titre}{/if}.csv">Télécharger le fichier Excel</a>]
 </p>
 
 <hr />
@@ -174,15 +174,15 @@ Donne ici son mail (complet pour les ext
 nombre de participants.
 </p>
 
-<form action="{$smarty.server.REQUEST_URI}" method="post" id="inscription">
+<form action="{rel}/{$platal->ns}events/admin/{$evt.eid}/{$platal->argv[2]}" method="post" id="inscription">
   <p class="descr">
-  <input type="hidden" name="eid" value="{$smarty.request.eid}" />
+  <input type="hidden" name="eid" value="{$platal->argv[1]}" />
   <input type="hidden" name="adm" value="nbs" />
-  
+
   Mail: <input name="mail" size="20" />
-  {if $smarty.request.item_id}
-  <input type="hidden" name="item_id" value="{$smarty.request.item_id}" />
-  {$evt.titre}: <input name="nb{$smarty.request.item_id}" size="1" value="1" />
+  {if $platal->argv[2]}
+  <input type="hidden" name="item_id" value="{$platal->argv[2]}" />
+  {$evt.titre}: <input name="nb{$platal->argv[2]}" size="1" value="1" />
   {else}
     {if $moments}
       {foreach from=$moments item=m}
@@ -210,7 +210,7 @@ Note que tu peux cliquer sur les noms des membres pour remplir automatiquement l
 
 <form action="{$smarty.server.REQUEST_URI}" method="post" id="montant">
   <p class="descr">
-  <input type="hidden" name="eid" value="{$smarty.request.eid}" />
+  <input type="hidden" name="eid" value="{$platal->argv[1]}" />
   <input type="hidden" name="adm" value="prix" />
   Mail: <input name="mail" size="20" />
   montant: <input name="montant" size="3" value="0,00" /> &euro;
index ba2ef67..b0013fc 100644 (file)
@@ -35,7 +35,7 @@
   restaurant.
 </p>
 
-<form method="post" action="{$smarty.server.PHP_SELF}">
+<form method="post" action="{rel}/{$platal->ns}events/edit/{$platal->argv[1]}">
   <hr />
   <table>
     <tr>