show when tickets go low for an event
authorkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Sun, 16 Mar 2008 15:04:33 +0000 (15:04 +0000)
committerkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Sun, 16 Mar 2008 15:04:33 +0000 (15:04 +0000)
git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@126 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33

www/inc/classes/event.php
www/template/de/index.html

index 482202a..7ac3883 100644 (file)
@@ -122,7 +122,7 @@ class Event
        {
                $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(), "LINK"=>"");
+               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(), "LINK"=>"","AVAILABLETICKETS"=>$this->availableTicketAmount());
        }
        
        /**returns how many tickets can still be sold*/
@@ -138,10 +138,9 @@ class Event
                //get existing tickets
                $res=$db->select("ticket","status","eventid=".$db->escapeInt($this->evid));
                $amt=0;
-               reset($res);
                if(count($res)>0)
                foreach($res as $tk){
-                       if(!($tk["status"]&TICKET_MBLOCK))$amt++;
+                       if(($tk["status"] & TICKET_MBLOCK)!=0)$amt++;
                }
                return $this->capacity - $amt;
        }
index 6d331e6..9549833 100644 (file)
@@ -17,6 +17,15 @@ Ort: @PLACE@<br/>
 <i>@ARTIST@</i><br/>
 Kartenpreis: @PRICE@ EUR<br/>
 <a href="@SCRIPT@?mode=info&event=@ID@">Info</a>
+#if:AVAILABLETICKETS>0
 <a href="@SCRIPT@?mode=eventDetails&event=@ID@">Bestellen</a>
+#if:AVAILABLETICKETS<=5
+<font color="red">*nur noch Restkarten*</font>
+#endif
+#endif
+#if:AVAILABLETICKETS==0
+<font color="red">*ausverkauft*</font>
+#endif
+
 </p>
 #endset