Advertisement
eventsmanager

custom ticket-list

Sep 16th, 2013
1,016
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.92 KB | None | 0 0
  1. <?php
  2. /*
  3. * This file generates a tabular list of tickets for the event booking forms with input values for choosing ticket spaces.
  4. * If you want to add to this form this, you'd be better off hooking into the actions below.
  5. */
  6. /* @var $EM_Event EM_Event */
  7. global $allowedposttags;
  8. $EM_Tickets = $EM_Event->get_bookings()->get_tickets(); //already instantiated, so should be a quick retrieval.
  9. /*
  10. * This variable can be overriden, by hooking into the em_booking_form_tickets_cols filter and adding your collumns into this array.
  11. * Then, you should create a em_booking_form_tickets_col_arraykey action for your collumn data, which will pass a ticket and event object.
  12. */
  13. $collumns = $EM_Tickets->get_ticket_collumns(); //array of collumn type => title
  14. ?>
  15.  
  16. <table class="em-tickets" cellspacing="0" cellpadding="0">
  17. <tr>
  18. <?php foreach($collumns as $type => $name): ?>
  19. <th class="em-bookings-ticket-table-<?php echo $type; ?>"><?php echo $name; ?></th>
  20. <?php endforeach; ?>
  21. </tr>
  22. <?php foreach( $EM_Tickets->tickets as $EM_Ticket ): /* @var $EM_Ticket EM_Ticket */ ?>
  23. <?php if( $EM_Ticket->is_displayable() ): ?>
  24. <?php do_action('em_booking_form_tickets_loop_header', $EM_Ticket); //do not delete ?>
  25. <tr class="em-ticket" id="em-ticket-<?php echo $EM_Ticket->ticket_id; ?>">
  26. <?php foreach( $collumns as $type => $name ): ?>
  27. <?php
  28. //output collumn by type, or call a custom action
  29. switch($type){
  30. case 'type':
  31. ?>
  32. <td class="em-bookings-ticket-table-type"><?php echo wp_kses_data($EM_Ticket->ticket_name); ?><?php if(!empty($EM_Ticket->ticket_description)) :?><br><span class="ticket-desc"><?php echo wp_kses($EM_Ticket->ticket_description,$allowedposttags); ?></span><?php endif; ?></td>
  33. <?php
  34. break;
  35. case 'price':
  36. ?>
  37. <td class="em-bookings-ticket-table-price"><?php echo $EM_Ticket->get_price(true); ?></td>
  38. <?php
  39. break;
  40. case 'spaces':
  41. ?>
  42. <td class="em-bookings-ticket-table-spaces">
  43. <?php
  44. $default = !empty($_REQUEST['em_tickets'][$EM_Ticket->ticket_id]['spaces']) ? $_REQUEST['em_tickets'][$EM_Ticket->ticket_id]['spaces']:0;
  45. $spaces_options = $EM_Ticket->get_spaces_options(true,$default);
  46. echo ( $spaces_options ) ? $spaces_options:"<strong>".__('N/A','dbem')."</strong>";
  47. ?>
  48. </td>
  49. <?php
  50. break;
  51. case 'available_spaces':
  52. ?>
  53. <td class="em-bookings-ticket-table-available-spaces">
  54. <?php echo $EM_Ticket->get_available_spaces()."/".$EM_Ticket->ticket_spaces; ?>
  55. </td>
  56. <?php
  57. break;
  58. default:
  59. do_action('em_booking_form_tickets_col_'.$type, $EM_Ticket, $EM_Event);
  60. break;
  61. }
  62. ?>
  63. <?php endforeach; ?>
  64.  
  65. </tr>
  66. <?php do_action('em_booking_form_tickets_loop_footer', $EM_Ticket); //do not delete ?>
  67. <?php endif; ?>
  68. <?php endforeach; ?>
  69. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement