transmit more statistics in event list
authorkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Sat, 16 Jan 2010 22:41:04 +0000 (22:41 +0000)
committerkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Sat, 16 Jan 2010 22:41:04 +0000 (22:41 +0000)
git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@429 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33

wob/event.wolf
www/inc/wext/event.php

index 28fb4c2..ca28f00 100644 (file)
                        <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>
        
index b4e2311..9595974 100644 (file)
@@ -35,6 +35,25 @@ class WOEventPrice extends WOEventPriceAbstract
 
 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)
        {