From af759dfd51d0c60ad8e0c8a934ead64e726f2cb2 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sun, 17 Jan 2016 12:28:19 +0100 Subject: fix all-closed display --- model/Conferences.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'model') diff --git a/model/Conferences.php b/model/Conferences.php index ab7fe0e..5562e1f 100644 --- a/model/Conferences.php +++ b/model/Conferences.php @@ -43,8 +43,18 @@ class Conferences extends ModelBase return $sorted; } + public static function getFinishedConferencesSorted() { + $sorted = Conferences::getConferencesSorted(); + + $finished = array_values(array_filter($sorted, function($c) { + return @$c['CONFIG']['CONFERENCE']['ENDS_AT'] < time(); + })); + + return $finished; + } + public static function getLastConference() { - return Conferences::getConferencesSorted()[0]; + return Conferences::getFinishedConferencesSorted()[0]; } public static function exists($mandator) { @@ -64,8 +74,8 @@ class Conferences extends ModelBase 'title' => $conf->getTitle(), 'description' => $conf->getDescription(), - 'relive' => forceslash($mandator).$conf->getReliveUrl(), - 'releases' => $conf->getReleasesUrl(), + 'relive' => $conf->hasRelive() ? forceslash($mandator).$conf->getReliveUrl() : null, + 'releases' => $conf->hasReleases() ? $conf->getReleasesUrl() : null, 'CONFIG' => $GLOBALS['CONFIG'], ]; -- cgit v1.2.3