From 470bf9eb1de077e23c1964b9d2c3d4b36851cde7 Mon Sep 17 00:00:00 2001 From: konrad Date: Sun, 16 Mar 2008 15:13:44 +0000 Subject: [PATCH] make event list more userfriendly git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@127 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- www/inc/classes/event.php | 19 ++++++++++++++++++- www/inc/rendering/event_listing.php | 2 +- www/template/de/index.html | 4 ++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/www/inc/classes/event.php b/www/inc/classes/event.php index 7ac3883..057a143 100644 --- a/www/inc/classes/event.php +++ b/www/inc/classes/event.php @@ -20,6 +20,13 @@ function getAllEvents() return $db->select("event","eventid,title,starttime",""); } +/**Get an overview of events: returns an array of array("eventid"=>int); used by createEventList; returns only events in the future and ordered*/ +function getAllEventsForListing() +{ + global $db; + return $db->select("event","eventid","starttime>=".time()." ORDER BY starttime"); +} + /**Machine-wrapper for getAllEvents() */ function getAllEventsXml() { @@ -122,7 +129,17 @@ class Event { $lang = LanguageManager::singleton(); - return array("DATE"=>$lang->getDate($this->getStartTime()), "TIME"=>$lang->getTime($this->getStartTime()), "PLACE"=>$this->getRoomId(), "EVENTNAME"=>$this->getTitle(), "ARTIST"=>$this->getArtist(),"PRICE"=>$lang->getPrice($this->getDefaultPrice()), "ID"=>$this->getEventId(), "DESCRIPTION"=>$this->getDescription(), "LINK"=>"","AVAILABLETICKETS"=>$this->availableTicketAmount()); + return array( + "DATE"=>$lang->getDate($this->getStartTime()), + "TIME"=>$lang->getTime($this->getStartTime()), + "PLACE"=>$this->getRoomId(), + "EVENTNAME"=>$this->getTitle(), + "ARTIST"=>$this->getArtist(), + "PRICE"=>$lang->getPrice($this->getDefaultPrice()), + "ID"=>$this->getEventId(), + "DESCRIPTION"=>$this->getDescription(), + "AVAILABLETICKETS"=>$this->availableTicketAmount() + ); } /**returns how many tickets can still be sold*/ diff --git a/www/inc/rendering/event_listing.php b/www/inc/rendering/event_listing.php index 542163c..bb1e98d 100644 --- a/www/inc/rendering/event_listing.php +++ b/www/inc/rendering/event_listing.php @@ -18,7 +18,7 @@ function createEventList() $p=new Parser("index.html"); $list=""; $eventTmpl=$p->getVar("EVENT"); - $events = getAllEvents(); + $events = getAllEventsForListing(); foreach ($events as $event) { $eventID = $event["eventid"]; diff --git a/www/template/de/index.html b/www/template/de/index.html index 9549833..21ad29c 100644 --- a/www/template/de/index.html +++ b/www/template/de/index.html @@ -11,12 +11,12 @@ @LIST@ #set:EVENT: -

Datum: @DATE@
+

Datum: @DATE@ @TIME@
Ort: @PLACE@
@EVENTNAME@
@ARTIST@
+@DESCRIPTION@
Kartenpreis: @PRICE@ EUR
-Info #if:AVAILABLETICKETS>0 Bestellen #if:AVAILABLETICKETS<=5 -- 1.7.2.5