Beispiel #1
0
 /**
  * Provides the ticket type by ID.
  * 
  * @param int $ticketTypeID
  * @param int $eventID If null then active event is used.
  * @return TicketType
  */
 public function getTicketTypeByID($ticketTypeID, $eventID = null)
 {
     global $sessioninfo, $sql_prefix;
     if (intval($ticketTypeID) < 1) {
         return null;
     }
     if (array_key_exists($ticketTypeID, $this->_ticketTypes)) {
         return $this->_ticketTypes[$ticketTypeID];
     }
     if ($eventID == null) {
         $eventID = $sessioninfo->eventID;
     }
     $result = db_query(sprintf("SELECT * FROM `%s_ticketTypes` WHERE `eventID` = %d AND ticketTypeID = %d", $sql_prefix, $eventID, $ticketTypeID));
     $num = db_num($result);
     $ticketType = null;
     if ($num > 0) {
         $row = db_fetch_assoc($result);
         $ticketType = new TicketType($row['ticketTypeID']);
         $ticketType->fillInfo($row);
         // Store to runtime cache
         $this->_ticketTypes[$row['ticketTypeID']] = $ticketType;
     }
     return $ticketType;
 }