/**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());
}
};
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"));
global $parser;
global $_GET;
- if (isset($_GET["eventID"])) {
- $eventID = $_GET["eventId"];
+ if (isset($_GET["event"])) {
+ $eventID = $_GET["event"];
}
$p = new Parser("eventdetails.html");
// 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", "<input type='text' id='ms_textfield_amount' name='ms_amount' size='2' maxlength='2'/>");
+ $p->setVar("buttonSAVE", "ms_save");
$parser->setVAR("PAGE", $p->parseFile("eventdetails.html"));
}
</div>
<div class="ms_FormRow">
<label for="ms_textfield_amount">Kartenanzahl:</label>
-<input type="text" id="ms_textfield_amount" name="ms_amount" value="3" size="2" maxlength="2"/>
+@fieldAMOUNT@
</div>
</fieldset>
#endset
<div class="ms_ButtonArea">
-<input type="button" id="ms_button_save" name="ms_save" value="In den Warenkorb" />
+<input type="button" id="ms_button_save" name="@buttonSAVE@" value="In den Warenkorb" />
</div>
</form>
</div>
\ No newline at end of file
<i>@ARTIST@</i><br/>
Kartenpreis: @PRICE@ EUR<br/>
<a href="@SCRIPT@?mode=info&event=@ID@">Info</a>
-#if:ROLE==buyer
-| <a href="@SCRIPT@?mode=reserve&event=@ID@">Vorbestellen</a>
-#endif
-#if:ROLE==seller
-| <a href="@SCRIPT@?mode=sell&event=@ID@">Verkaufen</a>
-#endif
+<a href="@SCRIPT@?mode=eventDetails&event=@ID@">Bestellen</a>
</p>
#endset
\ No newline at end of file