}
};
$dbScheme=new DbScheme;
-
-/**ticket has been reserved by a seller*/
-define("TICKET_RESERVED",0);
-/**ticket is part of an order or has been sold independently*/
-define("TICKET_SOLD",10);
-/**ticket has been used*/
-define("TICKET_USED",20);
-/**the ticket has been paid, not used, but is to be reimbursed*/
-define("TICKET_REVERSE",30);
-/**ticket has been cancelled*/
-define("TICKET_CANCELLED",40);
-
?>
\ No newline at end of file
public function getDescription(){return $this->description;}
/**returns the reason why the event is cancelled if isCancelled() returns true*/
public function getCancelReason(){return $this->cancelreason;}
- /**returns the data in an array*/
+
+ /**returns the data in an array suitable for the web-page-renderer*/
public function getParserData()
{
$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());
}
+
+ /**returns how many tickets can still be sold*/
+ public function availableTicketAmount()
+ {
+ global $db;
+ //is it valid?
+ if($this->evid<0)return 0;
+ //is it cancelled?
+ if($this->isCancelled())return 0;
+ //is it already over?
+ if(time()>$this->endtime)return 0;
+ //get existing tickets
+ $res=$db->select("ticket","status","eventid=".$db->escapeInt($this->evid));
+ $amt=0;
+ if(count($res)>0)
+ foreach($res as $tk){
+ if(!($tk["status"]&TICKET_CANCELLED))$amt++;
+ }
+ return $this->capacity - $amt;
+ }
};
/**machine-function: get the requested events as XML data*/
include('./inc/room.php');
include("./inc/random.php");
include("./inc/order.php");
+include("./inc/ticket.php");
include("./inc/cart.php");
include('./inc/error.php');
include('./inc/language_manager.php');
--- /dev/null
+<?
+//
+// PHP Implementation: ticket
+//
+// Description:
+//
+//
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007
+//
+// Copyright: See README/COPYING files that come with this distribution
+//
+//
+
+
+/**ticket has been reserved by a seller*/
+define("TICKET_RESERVED",1);
+/**ticket is part of an order or has been sold independently*/
+define("TICKET_SOLD",2);
+/**ticket has been used*/
+define("TICKET_USED",4);
+/**the ticket has been paid*/
+define("TICKET_PAID",8);
+/**ticket has been cancelled by some entity*/
+define("TICKET_CANCELLED",16);
+
+?>
\ No newline at end of file