From 841b4cd3eb24c4f4392be7161e64cdb5b58abcc8 Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 14 Oct 2007 20:13:59 +0000 Subject: [PATCH] - added functionality behind index.html git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@51 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- www/inc/event.php | 13 +++++++++---- www/inc/event_listing.php | 26 +++++++++++++++----------- www/template/de/eventdetails.html | 4 ++-- www/template/de/index.html | 7 +------ 4 files changed, 27 insertions(+), 23 deletions(-) diff --git a/www/inc/event.php b/www/inc/event.php index 06d76d5..ccd3186 100644 --- a/www/inc/event.php +++ b/www/inc/event.php @@ -117,19 +117,24 @@ class Event /**returns the reason why the event is cancelled if isCancelled() returns true*/ public function getCancelReason(){return $this->cancelreason;} /**returns the date of the event*/ - public function getDate() + public function getStDate() { return date("d.m.Y", $this->getStartTime()); } /**returns the time of the event*/ - public function getTime() + public function getStTime() { return date("H:i", $this->getStartTime()); } + /**returns the price in euro*/ + public function getPriceInEuro() + { + return number_format($this->getDefaultPrice()/100, 2, ",", "."); + } /**returns the data in an array*/ - public function getDataArray() + public function getParserData() { - return array("DATE"=>$this->getDate(), "TIME"=>$this->getTime(), "PLACE"=>$this->getRoomId(), "EVENTNAME"=>$this->getTitle(), "ARTIST"=>$this->getArtist(),"PRICE"=>$this->getDefaultPrice(), "ID"=>$this->getEventId(), "DESCRIPTION"=>$this->getDescription()); + return array("DATE"=>$this->getStDate(), "TIME"=>$this->getStTime(), "PLACE"=>$this->getRoomId(), "EVENTNAME"=>$this->getTitle(), "ARTIST"=>$this->getArtist(),"PRICE"=>$this->getPriceInEuro(), "ID"=>$this->getEventId(), "DESCRIPTION"=>$this->getDescription()); } }; diff --git a/www/inc/event_listing.php b/www/inc/event_listing.php index b420a1f..a85daa2 100644 --- a/www/inc/event_listing.php +++ b/www/inc/event_listing.php @@ -14,15 +14,17 @@ function createEventList() global $parser; //pass 1: get layout of single event $p=new Parser("index.html"); - $p->setVar("ROLE","buyer"); $list=""; - $temp=$p->getVar("EVENT"); - //fake1 - $p->setVars(array("DATE"=>"heute","PLACE"=>"nirgendwo","EVENTNAME"=>"Hurrah Jazz Club","ARTIST"=>"Broken Blech","PRICE"=>"567,00","ID"=>"1")); - $list.=$p->parse($temp); - //fake2 - $p->setVars(array("DATE"=>"morgen","PLACE"=>"irgendwo","EVENTNAME"=>"Verschwindibus","ARTIST"=>"Merlin","PRICE"=>"77,99","ID"=>"2")); - $list.=$p->parse($temp); + $eventTmpl=$p->getVar("EVENT"); + $events = getAllEvents(); + foreach ($events as $event) + { + $eventID = $event["eventid"]; + $event = new Event($eventID); + $p->setVars($event->getParserData()); + $list .= $p->parse($eventTmpl); + } + //pass 2: create page $p->setVar("LIST",$list); $parser->setVar("PAGE",$p->parseFile("index.html")); @@ -33,8 +35,8 @@ function createEventDetails() global $parser; global $_GET; - if (isset($_GET["eventID"])) { - $eventID = $_GET["eventId"]; + if (isset($_GET["event"])) { + $eventID = $_GET["event"]; } $p = new Parser("eventdetails.html"); @@ -42,9 +44,11 @@ function createEventDetails() // set event details $event = new Event($eventID); - $p->setVars($event->getDataArray()); + $p->setVars($event->getParserData()); $details = $p->parse($eventTmpl); $p->setVar("EVENTDETAILS",$details); + $p->setVar("fieldAMOUNT", ""); + $p->setVar("buttonSAVE", "ms_save"); $parser->setVAR("PAGE", $p->parseFile("eventdetails.html")); } diff --git a/www/template/de/eventdetails.html b/www/template/de/eventdetails.html index a3f15d4..f81d391 100644 --- a/www/template/de/eventdetails.html +++ b/www/template/de/eventdetails.html @@ -36,13 +36,13 @@
- +@fieldAMOUNT@
#endset
- +
\ No newline at end of file diff --git a/www/template/de/index.html b/www/template/de/index.html index 41a50f5..c13bef8 100644 --- a/www/template/de/index.html +++ b/www/template/de/index.html @@ -17,11 +17,6 @@ Ort: @PLACE@
@ARTIST@
Kartenpreis: @PRICE@ EUR
Info -#if:ROLE==buyer -| Vorbestellen -#endif -#if:ROLE==seller -| Verkaufen -#endif +Bestellen

#endset \ No newline at end of file -- 1.7.2.5