X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=modules%2Fevents.php;h=6e7cb1fa54c49cf6d4dcd361df4b5ed951122212;hb=a0b453227e9433d2bd4dea1e07a7463800702839;hp=1076a6a17786ad81a15628d107b7956eee0703d5;hpb=595697054aaa737e11580a9921f58f2009141f6f;p=platal.git diff --git a/modules/events.php b/modules/events.php index 1076a6a..6e7cb1f 100644 --- a/modules/events.php +++ b/modules/events.php @@ -158,18 +158,6 @@ class EventsModule extends PLModule pl_redirect('events#newsid'.$eid); } - function next_event(PlIterator &$it) - { - $user = S::user(); - while ($body = $it->next()) { - $uf = UserFilter::getLegacy($body['promo_min'], $body['promo_max']); - if ($uf->checkUser($user)) { - return $body; - } - } - return null; - } - // Fetch the events to display, along with their metadata. $array = array(); $it = XDB::iterator("SELECT e.id, e.titre, e.texte, e.post_id, e.user_id, @@ -185,7 +173,10 @@ class EventsModule extends PLModule ORDER BY important DESC, news DESC, end DESC, e.peremption, e.creation_date DESC", S::i('uid')); $cats = array('important', 'news', 'end', 'body'); - $body = next_event($it); + + $this->load('feed.inc.php'); + $user = S::user(); + $body = EventFeed::nextEvent($it, $user); foreach ($cats as $cat) { $data = array(); if (!$body) { @@ -197,7 +188,7 @@ class EventsModule extends PLModule } else { break; } - $body = next_event($it); + $body = EventFeed::nextEvent($it); } while ($body); if (!empty($data)) { $array[$cat] = $data;