/** * espresso_event_tickets_available * returns the ticket types available for purchase for an event * * @param int $EVT_ID * @param bool $echo * @param bool $format * @return string */ function espresso_event_tickets_available($EVT_ID = 0, $echo = TRUE, $format = TRUE) { EE_Registry::instance()->load_helper('Event_View'); $tickets = EEH_Event_View::event_tickets_available($EVT_ID); if (is_array($tickets) && !empty($tickets)) { // if formatting then $html will be a string, else it will be an array of ticket objects $html = $format ? '<ul id="ee-event-tickets-ul-' . $EVT_ID . '" class="ee-event-tickets-ul">' : array(); foreach ($tickets as $ticket) { if ($ticket instanceof EE_Ticket) { if ($format) { $html .= '<li id="ee-event-tickets-li-' . $ticket->ID() . '" class="ee-event-tickets-li">'; $html .= $ticket->name() . ' ' . EEH_Template::format_currency($ticket->get_ticket_total_with_taxes()); $html .= '</li>'; } else { $html[] = $ticket; } } } if ($format) { $html .= '</ul>'; } if ($echo && !$format) { echo $html; return ''; } return $html; } return ''; }