<Map property="price">
<Call lang="php" method="WOEventPrice::fromTableArrayeventprice(WTeventprice::selectFromDB('eventid='.$GLOBALS['db']->escapeInt($table->eventid)))"/>
</Map>
+ <Map property="amountSold">
+ <Call lang="php" method="$data->getAmountSoldFromDB()"/>
+ </Map>
+ <Map property="amountReserved">
+ <Call lang="php" method="$data->getAmountReservedFromDB()"/>
+ </Map>
</Mapping>
</Class>
class WOEvent extends WOEventAbstract
{
+ /**get amount of sold tickets from DB*/
+ public function getAmountSoldFromDB()
+ {
+ global $db;
+ $res=$db->select("ticket","status", "eventid=".$db->escapeInt($this->prop_id));
+ $cnt=0;
+ foreach($res as $r)
+ if($r["status"] == WTticket::Ordered || $r["status"] == WTticket::Used)
+ $cnt++;
+ return $cnt;
+ }
+ /**get amount of reserved tickets from DB*/
+ public function getAmountReservedFromDB()
+ {
+ global $db;
+ $res=$db->select("ticket","status", "eventid=".$db->escapeInt($this->prop_id)." AND status=".$db->escapeInt(WTticket::Reserved));
+ return count($res);
+ }
+
/**XML iface: get all events*/
public static function getAllEvents($trans)
{