Indicate there are members-only events for non-members (Closes #772)
authorStéphane Jacob <jacou@m4x.org>
Tue, 25 Mar 2008 19:33:19 +0000 (20:33 +0100)
committerStéphane Jacob <jacou@m4x.org>
Tue, 25 Mar 2008 19:33:19 +0000 (20:33 +0100)
ChangeLog
modules/xnetevents.php
templates/xnetevents/index.tpl

index f1feaf4..3ff6d39 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -47,6 +47,7 @@ Bug/Wish:
         - #728: Update CSV                                                 -FRU
         - #743: Don't show a warning when subscriber has no forlife        -FRU
         - #730: XnetEvents are not synchronized with aliases               -VZA
+        - #772: Indicate there are members-only events for non-members     -JAC
 
     * XnetGrp:
         - #732: Adapt subscription text to sex                             -FRU
index 3910dbc..056ca5a 100644 (file)
@@ -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)
index c577130..eff4fd5 100644 (file)
 
 {foreachelse}
 
-
 <p class="descr">
 {if $archive}
   Aucun événement n'a été archivé par les animateurs du groupe.
 
 {/foreach}
 
+{if $undisplayed_events neq 0}
+<p class="descr">
+  Il y a {$undisplayed_events} événement{if $undisplayed_events > 1}s non affichés car ils sont réservés
+  {else} non affiché car il est réservé{/if} aux membres de ce groupe.
+</p>
+{/if}
+
 {if $evenements}
 <p class="descr">
   En cliquant sur l'icône {icon name=calendar_view_day title="Événement iCal"} associée à un événement,