PageRenderTime 45ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/plugins/events-manager/templates/forms/event/bookings.php

https://bitbucket.org/antonyravel/cape-resorts
PHP | 168 lines | 160 code | 1 blank | 7 comment | 19 complexity | 08823a9b248a70928907d442cec3cd3e MD5 | raw file
  1. <?php
  2. global $EM_Event, $post;
  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-tickets" style="<?php echo ($EM_Event->event_rsvp) ? '':'display:none;' ?>">
  10. <?php do_action('em_events_admin_bookings_header', $EM_Event); ?>
  11. <?php
  12. //get tickets here and if there are none, create a blank ticket
  13. $EM_Tickets = $EM_Event->get_tickets();
  14. if( count($EM_Tickets->tickets) == 0 ){
  15. $EM_Tickets->tickets[] = new EM_Ticket();
  16. $delete_temp_ticket = true;
  17. }
  18. if( get_option('dbem_bookings_tickets_single') && count($EM_Tickets->tickets) == 1 ){
  19. $EM_Ticket = $EM_Tickets->get_first();
  20. include( em_locate_template('forms/ticket-form.php') );
  21. }else{
  22. ?>
  23. <p><strong><?php _e('Tickets','dbem'); ?></strong></p>
  24. <p><em><?php _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 _e('Basic HTML is allowed in ticket labels and descriptions.','dbem'); ?></em></p>
  25. <table class="form-table">
  26. <thead>
  27. <tr valign="top">
  28. <th class="ticket-status">&nbsp;</th>
  29. <th><?php _e('Ticket Name','dbem'); ?></th>
  30. <th><?php _e('Price','dbem'); ?></th>
  31. <th><?php _e('Min/Max','dbem'); ?></th>
  32. <th><?php _e('Start/End','dbem'); ?></th>
  33. <th><?php _e('Avail. Spaces','dbem'); ?></th>
  34. <th><?php _e('Booked Spaces','dbem'); ?></th>
  35. <th>&nbsp;</th>
  36. </tr>
  37. </thead>
  38. <tfoot>
  39. <tr valign="top">
  40. <td colspan="8">
  41. <a href="#" id="em-tickets-add" rel="#em-tickets-form"><?php _e('Add new ticket','dbem'); ?></a>
  42. </td>
  43. </tr>
  44. </tfoot>
  45. <tbody id="em-tickets-body">
  46. <?php
  47. global $allowedposttags;
  48. array_unshift($EM_Tickets->tickets, new EM_Ticket()); //prepend template ticket for JS
  49. $count = 0;
  50. foreach( $EM_Tickets->tickets as $EM_Ticket){
  51. /* @var $EM_Ticket EM_Ticket */
  52. ?>
  53. <tr valign="top" id="em-tickets-row-<?php echo $count ?>" class="em-tickets-row" <?php if( $count == 0 ) echo 'style="display:none;"' ?>>
  54. <td class="ticket-status"><span class="<?php echo ($EM_Ticket->is_available()) ? 'ticket_on':'ticket_off'; ?>"></span></td>
  55. <td class="ticket-name"><span class="ticket_name"><?php if($EM_Ticket->ticket_members) echo '* ';?><?php echo wp_kses_data($EM_Ticket->ticket_name); ?></span><br /><span class="ticket_description"><?php echo wp_kses($EM_Ticket->ticket_description,$allowedposttags); ?></span></td>
  56. <td class="ticket-price">
  57. <span class="ticket_price"><?php echo ($EM_Ticket->ticket_price) ? $EM_Ticket->ticket_price : __('Free','dbem'); ?></span>
  58. </td>
  59. <td class="ticket-limit">
  60. <span class="ticket_min">
  61. <?php echo ( !empty($EM_Ticket->ticket_min) ) ? $EM_Ticket->ticket_min:'-'; ?>
  62. </span> /
  63. <span class="ticket_max"><?php echo ( !empty($EM_Ticket->ticket_max) ) ? $EM_Ticket->ticket_max:'-'; ?></span>
  64. </td>
  65. <td class="ticket-time">
  66. <span class="ticket_start"><?php echo ( !empty($EM_Ticket->ticket_start) ) ? date(get_option('dbem_date_format'), $EM_Ticket->start_timestamp):''; ?></span> -
  67. <span class="ticket_end"><?php echo ( !empty($EM_Ticket->ticket_end) ) ? date(get_option('dbem_date_format'), $EM_Ticket->end_timestamp):''; ?></span>
  68. </td>
  69. <td class="ticket-qty">
  70. <span class="ticket_available_spaces"><?php echo $EM_Ticket->get_available_spaces(); ?></span>/
  71. <span class="ticket_spaces">
  72. <?php
  73. if( $EM_Ticket->get_spaces() ){
  74. echo $EM_Ticket->get_spaces();
  75. echo (!empty($EM_Ticket->ticket_spaces_limit)) ? '':'*';
  76. }else{
  77. echo '-';
  78. }
  79. ?>
  80. </span>
  81. </td>
  82. <td class="ticket-booked-spaces">
  83. <span class="ticket_booked_spaces"><?php echo $EM_Ticket->get_booked_spaces(); ?></span>
  84. </td>
  85. <?php do_action('em_event_edit_ticket_td', $EM_Ticket); ?>
  86. <td class="ticket-actions">
  87. <a href="#" class="ticket-actions-edit"><?php _e('Edit','dbem'); ?></a>
  88. <?php if( count($EM_Ticket->get_bookings()->bookings) == 0 ): ?>
  89. | <a href="<?php bloginfo('wpurl'); ?>/wp-load.php" class="ticket-actions-delete"><?php _e('Delete','dbem'); ?></a>
  90. <?php else: ?>
  91. | <a href="<?php echo EM_ADMIN_URL; ?>&amp;page=events-manager-bookings&ticket_id=<?php echo $EM_Ticket->ticket_id ?>"><?php _e('View Bookings','dbem'); ?></a>
  92. <?php endif; ?>
  93. <input type="hidden" class="ticket_id" name="em_tickets[<?php echo $count; ?>][ticket_id]" value="<?php echo $EM_Ticket->ticket_id ?>" />
  94. <input type="hidden" class="ticket_name" name="em_tickets[<?php echo $count; ?>][ticket_name]" value="<?php echo esc_attr(stripslashes($EM_Ticket->ticket_name)) ?>" />
  95. <input type="hidden" class="ticket_description" name="em_tickets[<?php echo $count; ?>][ticket_description]" value="<?php echo esc_attr(stripslashes($EM_Ticket->ticket_description)) ?>" />
  96. <input type="hidden" class="ticket_price" name="em_tickets[<?php echo $count; ?>][ticket_price]" value="<?php echo $EM_Ticket->ticket_price ?>" />
  97. <input type="hidden" class="ticket_spaces" name="em_tickets[<?php echo $count; ?>][ticket_spaces]" value="<?php echo $EM_Ticket->ticket_spaces ?>" />
  98. <input type="hidden" class="ticket_start" name="em_tickets[<?php echo $count; ?>][ticket_start]" value="<?php echo ( !empty($EM_Ticket->ticket_start) ) ? date("Y-m-d", $EM_Ticket->start_timestamp):''; ?>" />
  99. <input type="hidden" class="ticket_end" name="em_tickets[<?php echo $count; ?>][ticket_end]" value="<?php echo ( !empty($EM_Ticket->ticket_end) ) ? date("Y-m-d", $EM_Ticket->end_timestamp):''; ?>" />
  100. <input type="hidden" class="ticket_min" name="em_tickets[<?php echo $count; ?>][ticket_min]" value="<?php echo $EM_Ticket->ticket_min ?>" />
  101. <input type="hidden" class="ticket_max" name="em_tickets[<?php echo $count; ?>][ticket_max]" value="<?php echo $EM_Ticket->ticket_max ?>" />
  102. <input type="hidden" class="ticket_members" name="em_tickets[<?php echo $count; ?>][ticket_members]" value="<?php echo $EM_Ticket->ticket_members ?>" />
  103. <input type="hidden" class="ticket_required" name="em_tickets[<?php echo $count; ?>][ticket_required]" value="<?php echo $EM_Ticket->ticket_required ?>" />
  104. <?php do_action('em_event_edit_ticket_hidden', $EM_Ticket); ?>
  105. </td>
  106. </tr>
  107. <?php
  108. $count++;
  109. }
  110. array_shift($EM_Tickets->tickets);
  111. ?>
  112. </tbody>
  113. </table>
  114. <?php
  115. }
  116. if( !empty($delete_temp_ticket) ){
  117. array_pop($EM_Tickets->tickets);
  118. }
  119. ?>
  120. <p>
  121. <label><strong><?php _e('Total Spaces','dbem'); ?></strong></label>
  122. <input type="text" name="event_spaces" value="<?php if( $EM_Event->event_spaces > 0 ){ echo $EM_Event->event_spaces; } ?>" /><br />
  123. <em><?php _e('Individual tickets with remaining spaces will not be available if total booking spaces reach this limit. Leave blank for no limit.','dbem'); ?></em>
  124. </p>
  125. <?php if( !$EM_Event->is_recurring() ): ?>
  126. <p>
  127. <label><strong><?php _e('Booking Cut-Off Date','dbem'); ?></strong></label>
  128. <span class="em-date-single">
  129. <input id="em-bookings-date-loc" class="em-date-input-loc" type="text" />
  130. <input id="em-bookings-date" class="em-date-input" type="hidden" name="event_rsvp_date" value="<?php echo $EM_Event->event_rsvp_date; ?>" />
  131. </span>
  132. <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 ); ?>">
  133. <br />
  134. <em><?php _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>
  135. </p>
  136. <?php endif; ?>
  137. <?php do_action('em_events_admin_bookings_footer', $EM_Event); ?>
  138. </div>
  139. <script type="text/javascript">
  140. jQuery(document).ready( function($) {
  141. //RSVP Warning
  142. $('#event-rsvp').click( function(event){
  143. if( !this.checked ){
  144. confirmation = confirm(EM.disable_bookings_warning);
  145. if( confirmation == false ){
  146. event.preventDefault();
  147. }else{
  148. $('#event-tickets').hide();
  149. $("div#rsvp-data").hide();
  150. }
  151. }else{
  152. $('#event-tickets').fadeIn();
  153. $("div#rsvp-data").fadeIn();
  154. }
  155. });
  156. if($('input#event-rsvp').attr("checked")) {
  157. $("div#rsvp-data").fadeIn();
  158. } else {
  159. $("div#rsvp-data").hide();
  160. }
  161. });
  162. </script>
  163. <?php
  164. /*
  165. * REMEMBER TO INCLUDE THE OVERLAY IN THE FOOTER, USING:
  166. * em_locate_template('forms/tickets-form.php', true); //put here as it can't be in the add event form
  167. */