Advertisement
eventsmanager

My-Bookings template

May 23rd, 2024
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.89 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4. * This page displays a printable view of bookings for a single event.
  5. * You can override the default display settings pages by copying this file to yourthemefolder/plugins/events-manager/templates/ and modifying it however you need.
  6. * Here you can assume that $EM_Event is globally available with the right EM_Event object.
  7. */
  8. global $EM_Event;
  9. $email_stack=array();
  10.  
  11. <div id="container">
  12. <h1><?php echo sprintf(__('%s','dbem'), $EM_Event->event_name); ?></h1>
  13. <?php echo $EM_Event->output("#d #M #Y"); ?>
  14.  
  15. <table id="bookings-table">
  16. <tr>
  17. <th scope='col'><?php _e('Name', 'dbem')?></th>
  18. <th scope='col'><?php _e('Contact', 'dbem')?></th>
  19. <th scope='col'><?php _e('Tickets', 'dbem')?></th>
  20. <th scope='col'><?php _e('Total', 'dbem')?></th>
  21. <th scope='col'><?php _e('Purchase Date', 'dbem')?></th>
  22.  
  23. <th scope='col'><?php _e('Ref', 'dbem')?></th>
  24. </tr>
  25. <?php
  26. $bookings = array();
  27. // print_r($EM_Event->get_bookings()->bookings);
  28. foreach($EM_Event->get_bookings()->bookings as $EM_Booking){
  29. if ($EM_Booking->booking_status == 1){
  30.  
  31. /*
  32. * you can replace "first_name" and "last_name" with your custom booking form first and last name Field ID
  33. */
  34.  
  35. if( !empty($EM_Booking->booking_meta['registration']['first_name']) ){
  36. $first_name = trim($EM_Booking->booking_meta['registration']['first_name']);
  37. }
  38. if( !empty($EM_Booking->booking_meta['registration']['last_name']) ){
  39. $last_name = trim($EM_Booking->booking_meta['registration']['last_name']);
  40. }
  41.  
  42. $name = $first_name.' '.$last_name;
  43.  
  44. array_push($bookings,
  45. array(
  46. 'lastname'=>ucwords($last_name),
  47. 'firstname'=>ucwords($first_name),
  48. 'person_name'=>$name,
  49. 'person_email'=>$EM_Booking->person->user_email,
  50. 'person_phone'=>$EM_Booking->person->phone,
  51. 'booking_space'=>$EM_Booking->get_spaces(),
  52. 'booking_price'=>number_format ( $EM_Booking->get_price_pre_taxes(), 2 ),
  53. 'booking_date'=>date("d-m-y",$EM_Booking->timestamp),
  54. 'booking_id'=>$EM_Booking->booking_id
  55. )
  56. );
  57. $email_stack[]=$EM_Booking->person->user_email;
  58. }
  59. }
  60. asort($bookings);
  61.  
  62. ?>
  63. <?php
  64. foreach($bookings as $EM_Booking) {
  65. ?>
  66. <tr>
  67.  
  68. <td><?php echo $EM_Booking['person_name'] ?></td>
  69. <td>Email: <?php echo $EM_Booking['person_email'];?> Tel: <?php echo $EM_Booking['person_phone'] ?></td>
  70. <td class='spaces-number'><?php echo $EM_Booking['booking_space'] ?></td>
  71. <td class="booking-total">£<?php echo $EM_Booking['booking_price'] ?></td>
  72.  
  73. <td><?php echo $EM_Booking['booking_date'] ?></td>
  74. <td><?php echo $EM_Booking['booking_id'] ?></td>
  75.  
  76. </tr>
  77. <?php } ?>
  78.  
  79. </table>
  80. <div id="booking-summary">
  81. <?php _e('Total Sold', 'dbem')?>: <?php echo $EM_Event->get_bookings()->get_booked_spaces(); ?>
  82.  
  83. <?php _e('Tickets Remaining', 'dbem')?>:<?php echo $EM_Event->get_bookings()->get_available_spaces(); ?>
  84.  
  85. </div>
  86.  
  87. <h2>Email list</h2>
  88. <p style="margin:10px 30px">
  89. <?php echo implode('; ',$email_stack);?>
  90.  
  91.  
  92. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement