eventsmanager

bookings.php - custom

Oct 10th, 2014
584
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. global $EM_Event, $post, $allowedposttags, $EM_Ticket, $col_count;
  3. ?>
  4. <div id="event-rsvp-box">
  5. <input id="event-rsvp" name='event_rsvp' value='1' type='checkbox' <?php echo ($EM_Event->event_rsvp) ? 'checked="checked"' : ''; ?> />
  6. &nbsp;&nbsp;
  7. <?php _e ( 'Enable registration for this event', 'dbem' )?>
  8. </div>
  9. <div id="event-rsvp-options" style="<?php echo ($EM_Event->event_rsvp) ? '':'display:none;' ?>">
  10. <?php do_action('em_events_admin_bookings_header', $EM_Event); ?>
  11. <div id="em-tickets-form">
  12. <?php
  13. //get tickets here and if there are none, create a blank ticket
  14. $EM_Tickets = $EM_Event->get_tickets();
  15. if( count($EM_Tickets->tickets) == 0 ){
  16. $EM_Tickets->tickets[] = new EM_Ticket();
  17. $delete_temp_ticket = true;
  18. }
  19. if( get_option('dbem_bookings_tickets_single') && count($EM_Tickets->tickets) == 1 ){
  20. ?>
  21. <h4><?php esc_html_e('Ticket Options','dbem'); ?></h4>
  22. <?php
  23. $col_count = 1;
  24. $EM_Ticket = $EM_Tickets->get_first();
  25. include( em_locate_template('forms/ticket-form.php') ); //in future we'll be accessing forms/event/bookings-ticket-form.php directly
  26. }else{
  27. ?>
  28. <h4><?php esc_html_e('Tickets','dbem'); ?></h4>
  29. <p><em><?php esc_html_e('You can have single or multiple tickets, where certain tickets become availalble under certain conditions, e.g. early bookings, group discounts, maximum bookings per ticket, etc.', 'dbem'); ?> <?php esc_html_e('Basic HTML is allowed in ticket labels and descriptions.','dbem'); ?></em></p>
  30. <table class="form-table">
  31. <thead>
  32. <tr valign="top">
  33. <th colspan="2"><?php esc_html_e('Ticket Name','dbem'); ?></th>
  34. <th><?php esc_html_e('Price','dbem'); ?></th>
  35. <th><?php esc_html_e('Min/Max','dbem'); ?></th>
  36. <th><?php esc_html_e('Start/End','dbem'); ?></th>
  37. <th><?php esc_html_e('Avail. Spaces','dbem'); ?></th>
  38. <th><?php esc_html_e('Booked Spaces','dbem'); ?></th>
  39. <th>&nbsp;</th>
  40. </tr>
  41. </thead>
  42. <tfoot>
  43. <tr valign="top">
  44. <td colspan="8">
  45. <a href="#" id="em-tickets-add"><?php esc_html_e('Add new ticket','dbem'); ?></a>
  46. </td>
  47. </tr>
  48. </tfoot>
  49. <?php
  50. $EM_Ticket = new EM_Ticket();
  51. $EM_Ticket->event_id = $EM_Event->event_id;
  52. array_unshift($EM_Tickets->tickets, $EM_Ticket); //prepend template ticket for JS
  53. $col_count = 0;
  54. foreach( $EM_Tickets->tickets as $EM_Ticket){
  55. /* @var $EM_Ticket EM_Ticket */
  56. ?>
  57. <tbody id="em-ticket-<?php echo $col_count ?>" <?php if( $col_count == 0 ) echo 'style="display:none;"' ?>>
  58. <tr class="em-tickets-row">
  59. <td class="ticket-status"><span class="<?php if($EM_Ticket->ticket_id && $EM_Ticket->is_available()){ echo 'ticket_on'; }elseif($EM_Ticket->ticket_id > 0){ echo 'ticket_off'; }else{ echo 'ticket_new'; } ?>"></span></td>
  60. <td class="ticket-name">
  61. <span class="ticket_name"><?php if($EM_Ticket->ticket_members) echo '* ';?><?php echo wp_kses_data($EM_Ticket->ticket_name); ?></span>
  62. <div class="ticket_description"><?php echo wp_kses($EM_Ticket->ticket_description,$allowedposttags); ?></div>
  63. <div class="ticket-actions">
  64. <a href="#" class="ticket-actions-edit"><?php esc_html_e('Edit','dbem'); ?></a>
  65. <?php if( count($EM_Ticket->get_bookings()->bookings) == 0 ): ?>
  66. | <a href="<?php bloginfo('wpurl'); ?>/wp-load.php" class="ticket-actions-delete"><?php esc_html_e('Delete','dbem'); ?></a>
  67. <?php else: ?>
  68. | <a href="<?php echo EM_ADMIN_URL; ?>&amp;page=events-manager-bookings&ticket_id=<?php echo $EM_Ticket->ticket_id ?>"><?php esc_html_e('View Bookings','dbem'); ?></a>
  69. <?php endif; ?>
  70. </div>
  71. </td>
  72. <td class="ticket-price">
  73. <!---<span class="ticket_price"><?php echo ($EM_Ticket->ticket_price) ? esc_html($EM_Ticket->get_price_precise()) : esc_html__('Free','dbem'); ?></span>--->
  74.  
  75. <span class="ticket_price"><?php echo ($EM_Ticket->ticket_price) ? esc_html(number_format($EM_Ticket->ticket_price,2,'.','')) : esc_html__('Free','dbem'); ?></span>
  76.  
  77. </td>
  78. <td class="ticket-limit">
  79. <span class="ticket_min">
  80. <?php echo ( !empty($EM_Ticket->ticket_min) ) ? esc_html($EM_Ticket->ticket_min):'-'; ?>
  81. </span> /
  82. <span class="ticket_max"><?php echo ( !empty($EM_Ticket->ticket_max) ) ? esc_html($EM_Ticket->ticket_max):'-'; ?></span>
  83. </td>
  84. <td class="ticket-time">
  85. <span class="ticket_start ticket-dates-from-normal"><?php echo ( !empty($EM_Ticket->ticket_start) ) ? date(get_option('dbem_date_format'), $EM_Ticket->start_timestamp):''; ?></span>
  86. <span class="ticket_start_recurring_days ticket-dates-from-recurring"><?php if( !empty($EM_Ticket->ticket_meta['recurrences']) ) echo $EM_Ticket->ticket_meta['recurrences']['start_days']; ?></span>
  87. <span class="ticket_start_recurring_days_text ticket-dates-from-recurring <?php if( !empty($EM_Ticket->ticket_meta['recurrences']) && !is_numeric($EM_Ticket->ticket_meta['recurrences']['start_days']) ) echo 'hidden'; ?>"><?php _e('day(s)','dbem'); ?></span>
  88. <span class="ticket_start_time"><?php echo ( !empty($EM_Ticket->ticket_start) ) ? date( em_get_hour_format(), $EM_Ticket->start_timestamp):''; ?></span>
  89. <br />
  90. <span class="ticket_end ticket-dates-from-normal"><?php echo ( !empty($EM_Ticket->ticket_end) ) ? date(get_option('dbem_date_format'), $EM_Ticket->end_timestamp):''; ?></span>
  91. <span class="ticket_end_recurring_days ticket-dates-from-recurring"><?php if( !empty($EM_Ticket->ticket_meta['recurrences']) ) echo $EM_Ticket->ticket_meta['recurrences']['end_days']; ?></span>
  92. <span class="ticket_end_recurring_days_text ticket-dates-from-recurring <?php if( !empty($EM_Ticket->ticket_meta['recurrences']) && !is_numeric($EM_Ticket->ticket_meta['recurrences']['end_days']) ) echo 'hidden'; ?>"><?php _e('day(s)','dbem'); ?></span>
  93. <span class="ticket_end_time"><?php echo ( !empty($EM_Ticket->ticket_end) ) ? date( em_get_hour_format(), $EM_Ticket->end_timestamp):''; ?></span>
  94. </td>
  95. <td class="ticket-qty">
  96. <span class="ticket_available_spaces"><?php echo $EM_Ticket->get_available_spaces(); ?></span>/
  97. <span class="ticket_spaces"><?php echo $EM_Ticket->get_spaces() ? $EM_Ticket->get_spaces() : '-'; ?></span>
  98. </td>
  99. <td class="ticket-booked-spaces">
  100. <span class="ticket_booked_spaces"><?php echo $EM_Ticket->get_booked_spaces(); ?></span>
  101. </td>
  102. <?php do_action('em_event_edit_ticket_td', $EM_Ticket); ?>
  103. </tr>
  104. <tr class="em-tickets-row-form" style="display:none;">
  105. <td colspan="<?php echo apply_filters('em_event_edit_ticket_td_colspan', 7); ?>">
  106. <?php include( em_locate_template('forms/event/bookings-ticket-form.php')); ?>
  107. <div class="em-ticket-form-actions">
  108. <button type="button" class="ticket-actions-edited"><?php esc_html_e('Close Ticket Editor','dbem')?></button>
  109. </div>
  110. </td>
  111. </tr>
  112. </tbody>
  113. <?php
  114. $col_count++;
  115. }
  116. array_shift($EM_Tickets->tickets);
  117. ?>
  118. </table>
  119. <?php
  120. }
  121. ?>
  122. </div>
  123. <div id="em-booking-options">
  124. <?php if( !get_option('dbem_bookings_tickets_single') || count($EM_Ticket->get_event()->get_tickets()->tickets) > 1 ): ?>
  125. <h4><?php esc_html_e('Event Options','dbem'); ?></h4>
  126. <p>
  127. <label><?php esc_html_e('Total Spaces','dbem'); ?></label>
  128. <input type="text" name="event_spaces" value="<?php if( $EM_Event->event_spaces > 0 ){ echo $EM_Event->event_spaces; } ?>" /><br />
  129. <em><?php esc_html_e('Individual tickets with remaining spaces will not be available if total booking spaces reach this limit. Leave blank for no limit.','dbem'); ?></em>
  130. </p>
  131. <p>
  132. <label><?php esc_html_e('Maximum Spaces Per Booking','dbem'); ?></label>
  133. <input type="text" name="event_rsvp_spaces" value="<?php if( $EM_Event->event_rsvp_spaces > 0 ){ echo $EM_Event->event_rsvp_spaces; } ?>" /><br />
  134. <em><?php esc_html_e('If set, the total number of spaces for a single booking to this event cannot exceed this amount.','dbem'); ?><?php esc_html_e('Leave blank for no limit.','dbem'); ?></em>
  135. </p>
  136. <p>
  137. <label><?php esc_html_e('Booking Cut-Off Date','dbem'); ?></label>
  138. <span class="em-booking-date-normal">
  139. <span class="em-date-single">
  140. <input id="em-bookings-date-loc" class="em-date-input-loc" type="text" />
  141. <input id="em-bookings-date" class="em-date-input" type="hidden" name="event_rsvp_date" value="<?php echo $EM_Event->event_rsvp_date; ?>" />
  142. </span>
  143. </span>
  144. <span class="em-booking-date-recurring">
  145. <input type="text" name="recurrence_rsvp_days" size="3" value="<?php if( !empty($EM_Event->recurrence_rsvp_days) ) echo absint($EM_Event->recurrence_rsvp_days); ?>" />
  146. <?php _e('day(s)','dbem'); ?>
  147. <select name="recurrence_rsvp_days_when">
  148. <option value="before" <?php if( !empty($EM_Event->recurrence_rsvp_days) && $EM_Event->recurrence_rsvp_days <= 0) echo 'selected="selected"'; ?>><?php echo sprintf(_x('%s the event starts','before or after','dbem'),__('Before','dbem')); ?></option>
  149. <option value="after" <?php if( !empty($EM_Event->recurrence_rsvp_days) && $EM_Event->recurrence_rsvp_days > 0) echo 'selected="selected"'; ?>><?php echo sprintf(_x('%s the event starts','before or after','dbem'),__('After','dbem')); ?></option>
  150. </select>
  151. <?php _e('at','dbem'); ?>
  152. </span>
  153. <input type="text" name="event_rsvp_time" class="em-time-input" maxlength="8" size="8" value="<?php echo date( em_get_hour_format(), $EM_Event->rsvp_end ); ?>" />
  154. <br />
  155. <em><?php esc_html_e('This is the definite date after which bookings will be closed for this event, regardless of individual ticket settings above. Default value will be the event start date.','dbem'); ?></em>
  156. </p>
  157. <?php endif; ?>
  158. </div>
  159. <?php
  160. if( !empty($delete_temp_ticket) ){
  161. array_pop($EM_Tickets->tickets);
  162. }
  163. do_action('em_events_admin_bookings_footer', $EM_Event);
  164. ?>
  165. </div>
RAW Paste Data