X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fxnetevents.php;h=417fb3f9e2032a12b8a24431e1aa62977315e948;hb=732e5855cffcd5e2eaaf5bd66760c4432d437244;hp=56fc7663a7c8e01b33592e480759af42fa957686;hpb=756ff73fbb0cdd01cce2eda27ba18e1cc99bd735;p=platal.git diff --git a/modules/xnetevents.php b/modules/xnetevents.php index 56fc766..417fb3f 100644 --- a/modules/xnetevents.php +++ b/modules/xnetevents.php @@ -127,13 +127,18 @@ class XnetEventsModule extends PLModule LEFT JOIN groupex.evenements_participants AS ep ON (ep.eid = e.eid AND ep.uid = {?}) WHERE asso_id = {?} AND archive = " . ($archive ? "1 " : "0 ") - . (is_member() || may_update() ? "" : " AND accept_nonmembre != 0 ") . "GROUP BY e.eid ORDER BY inscr_open DESC, debut DESC", S::v('uid'), $globals->asso('id')); $evts = array(); + $undisplayed_events = 0; while ($e = $evenements->next()) { + if (!is_member() && !may_update() && !$e['accept_nonmembre']) { + $undisplayed_events ++; + continue; + } + $e['show_participants'] = ($e['show_participants'] && (is_member() || may_update())); $res = XDB::query( "SELECT titre, details, montant, ei.item_id, nb, ep.paid @@ -168,6 +173,7 @@ class XnetEventsModule extends PLModule } $page->assign('evenements', $evts); + $page->assign('undisplayed_events', $undisplayed_events); } function handler_sub(&$page, $eid = null) @@ -210,7 +216,7 @@ class XnetEventsModule extends PLModule if (!isset($pers[$j]) || !is_numeric($pers[$j]) || $pers[$j] < 0) { - $page->trig('Tu dois choisir un nombre d\'invités correct !'); + $page->trigError('Tu dois choisir un nombre d\'invités correct !'); return; } $subs[$j] = 1 + $pers[$j]; @@ -219,11 +225,11 @@ class XnetEventsModule extends PLModule // impossible to unsubscribe if you already paid sthing if (!array_sum($subs) && $evt['paid'] != 0) { - $page->trig("Impossible de te désinscrire complètement ". - "parce que tu as fait un paiement par ". - "chèque ou par liquide. Contacte un ". - "administrateur du groupe si tu es sûr de ". - "ne pas venir"); + $page->trigError("Impossible de te désinscrire complètement ". + "parce que tu as fait un paiement par ". + "chèque ou par liquide. Contacte un ". + "administrateur du groupe si tu es sûr de ". + "ne pas venir"); return; } @@ -244,7 +250,7 @@ class XnetEventsModule extends PLModule XDB::execute( "DELETE FROM groupex.evenements_participants WHERE eid = {?} AND uid = {?} AND item_id = {?}", - $eid, S::v("uid"), $j); + $eid, S::v("uid"), $j); $updated = $eid; } $total += $nb; @@ -356,7 +362,8 @@ class XnetEventsModule extends PLModule if (Post::v('intitule')) { require_once dirname(__FILE__).'/xnetevents/xnetevents.inc.php'; - $short_name = event_change_shortname($page, $infos['short_name'], + $short_name = event_change_shortname($page, $eid, + $infos['short_name'], Env::v('short_name', '')); if ($short_name != Env::v('short_name')) { $error = true; @@ -520,7 +527,7 @@ class XnetEventsModule extends PLModule if (may_update() && Post::v('adm')) { $member = get_infos(Post::v('mail')); if (!$member) { - $page->trig("Membre introuvable"); + $page->trigError("Membre introuvable"); } // change the price paid by a participant @@ -556,7 +563,7 @@ class XnetEventsModule extends PLModule GROUP BY uid", $member['uid'], $evt['eid']); $u = $res->fetchOneAssoc(); - $u = $u['cnt'] ? null : $u['nb']; + $u = $u['cnt'] ? $u['nb'] : null; subscribe_lists_event($u, $member['uid'], $evt); }