Advertisement
eventsmanager

bookings-ticket-form.php - custom

Oct 10th, 2014
793
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.01 KB | None | 0 0
  1. <?php
  2. /*
  3. * Used for both multiple and single tickets. $col_count will always be 1 in single ticket mode, and be a unique number for each ticket starting from 1
  4. * This form should have $EM_Ticket and $col_count available globally.
  5. */
  6. global $col_count, $EM_Ticket;
  7. ?>
  8. <div class="em-ticket-form">
  9. <input type="hidden" name="em_tickets[<?php echo $col_count; ?>][ticket_id]" class="ticket_id" value="<?php echo esc_attr($EM_Ticket->ticket_id) ?>" />
  10. <div class="em-ticket-form-main">
  11. <div class="ticket-name">
  12. <label title="<?php __('Enter a ticket name.','dbem'); ?>"><?php _e('Name','dbem') ?></label>
  13. <input type="text" name="em_tickets[<?php echo $col_count; ?>][ticket_name]" value="<?php echo esc_attr($EM_Ticket->ticket_name) ?>" class="ticket_name" />
  14. </div>
  15. <div class="ticket-description">
  16. <label><?php _e('Description','dbem') ?></label>
  17. <textarea name="em_tickets[<?php echo $col_count; ?>][ticket_description]" class="ticket_description"><?php echo esc_html(stripslashes($EM_Ticket->ticket_description)) ?></textarea>
  18. </div>
  19.  
  20. <!---<div class="ticket-price"><label><?php _e('Price','dbem') ?></label><input type="text" name="em_tickets[<?php echo $col_count; ?>][ticket_price]" class="ticket_price" value="<?php echo esc_attr($EM_Ticket->get_price_precise()) ?>" /></div>--->
  21.  
  22. <div class="ticket-price"><label><?php _e('Price','dbem') ?></label><input type="text" name="em_tickets[<?php echo $col_count; ?>][ticket_price]" class="ticket_price" value="<?php echo esc_attr(number_format($EM_Ticket->ticket_price,2,'.','')) ?>" /></div>
  23.  
  24. <div class="ticket-spaces">
  25. <label title="<?php __('Enter a maximum number of spaces (required).','dbem'); ?>"><?php _e('Spaces','dbem') ?></label>
  26. <input type="text" name="em_tickets[<?php echo $col_count; ?>][ticket_spaces]" value="<?php echo esc_attr($EM_Ticket->ticket_spaces) ?>" class="ticket_spaces" />
  27. </div>
  28. </div>
  29. <div class="em-ticket-form-advanced" style="display:none;">
  30. <div class="ticket-spaces ticket-spaces-min">
  31. <label title="<?php _e('Leave either blank for no upper/lower limit.','dbem'); ?>"><?php _ex('At least','spaces per booking','dbem') ?></label>
  32. <input type="text" name="em_tickets[<?php echo $col_count; ?>][ticket_min]" value="<?php echo esc_attr($EM_Ticket->ticket_min) ?>" class="ticket_min" />
  33. <?php _e('spaces per booking', 'dbem')?>
  34. </div>
  35. <div class="ticket-spaces ticket-spaces-max">
  36. <label title="<?php _e('Leave either blank for no upper/lower limit.','dbem'); ?>"><?php _ex('At most','spaces per booking', 'dbem') ?></label>
  37. <input type="text" name="em_tickets[<?php echo $col_count; ?>][ticket_max]" value="<?php echo esc_attr($EM_Ticket->ticket_max) ?>" class="ticket_max" />
  38. <?php _e('spaces per booking', 'dbem')?>
  39. </div>
  40. <div class="ticket-dates em-time-range em-date-range">
  41. <div class="ticket-dates-from">
  42. <label title="<?php _e('Add a start or end date (or both) to impose time constraints on ticket availability. Leave either blank for no upper/lower limit.','dbem'); ?>">
  43. <?php _e('Available from','dbem') ?>
  44. </label>
  45. <div class="ticket-dates-from-normal">
  46. <input type="text" name="ticket_start_pub" class="em-date-input-loc em-date-start" />
  47. <input type="hidden" name="em_tickets[<?php echo $col_count; ?>][ticket_start]" class="em-date-input ticket_start" value="<?php echo ( !empty($EM_Ticket->ticket_start) ) ? date("Y-m-d", $EM_Ticket->start_timestamp):''; ?>" />
  48. </div>
  49. <div class="ticket-dates-from-recurring">
  50. <input type="text" name="em_tickets[<?php echo $col_count; ?>][ticket_start_recurring_days]" size="3" value="<?php if( !empty($EM_Ticket->ticket_meta['recurrences']) && is_numeric($EM_Ticket->ticket_meta['recurrences']['start_days'])) echo absint($EM_Ticket->ticket_meta['recurrences']['start_days']); ?>" />
  51. <?php _e('day(s)','dbem'); ?>
  52. <select name="em_tickets[<?php echo $col_count; ?>][ticket_start_recurring_when]" class="ticket-dates-from-recurring-when">
  53. <option value="before" <?php if( !empty($EM_Ticket->ticket_meta['recurrences']['start_days']) && $EM_Ticket->ticket_meta['recurrences']['start_days'] <= 0) echo 'selected="selected"'; ?>><?php echo sprintf(_x('%s the event starts','before or after','dbem'),__('Before','dbem')); ?></option>
  54. <option value="after" <?php if( !empty($EM_Ticket->ticket_meta['recurrences']['start_days']) && $EM_Ticket->ticket_meta['recurrences']['start_days'] > 0) echo 'selected="selected"'; ?>><?php echo sprintf(_x('%s the event starts','before or after','dbem'),__('After','dbem')); ?></option>
  55. </select>
  56. </div>
  57. <?php _ex('at', 'time','dbem'); ?>
  58. <input id="start-time" class="em-time-input em-time-start" type="text" size="8" maxlength="8" name="em_tickets[<?php echo $col_count; ?>][ticket_start_time]" value="<?php echo ( !empty($EM_Ticket->ticket_start) ) ? date( em_get_hour_format(), $EM_Ticket->start_timestamp):''; ?>" />
  59. </div>
  60. <div class="ticket-dates-to">
  61. <label title="<?php _e('Add a start or end date (or both) to impose time constraints on ticket availability. Leave either blank for no upper/lower limit.','dbem'); ?>">
  62. <?php _e('Available until','dbem') ?>
  63. </label>
  64. <div class="ticket-dates-to-normal">
  65. <input type="text" name="ticket_end_pub" class="em-date-input-loc em-date-end" />
  66. <input type="hidden" name="em_tickets[<?php echo $col_count; ?>][ticket_end]" class="em-date-input ticket_end" value="<?php echo ( !empty($EM_Ticket->ticket_end) ) ? date("Y-m-d", $EM_Ticket->end_timestamp):''; ?>" />
  67. </div>
  68. <div class="ticket-dates-to-recurring">
  69. <input type="text" name="em_tickets[<?php echo $col_count; ?>][ticket_end_recurring_days]" size="3" value="<?php if( !empty($EM_Ticket->ticket_meta['recurrences']['end_days']) ) echo absint($EM_Ticket->ticket_meta['recurrences']['end_days']); ?>" />
  70. <?php _e('day(s)','dbem'); ?>
  71. <select name="em_tickets[<?php echo $col_count; ?>][ticket_end_recurring_when]" class="ticket-dates-to-recurring-when">
  72. <option value="before" <?php if( !empty($EM_Ticket->ticket_meta['recurrences']['end_days']) && $EM_Ticket->ticket_meta['recurrences']['end_days'] <= 0) echo 'selected="selected"'; ?>><?php echo sprintf(_x('%s the event starts','before or after','dbem'),__('Before','dbem')); ?></option>
  73. <option value="after" <?php if( !empty($EM_Ticket->ticket_meta['recurrences']['end_days']) && $EM_Ticket->ticket_meta['recurrences']['end_days'] > 0) echo 'selected="selected"'; ?>><?php echo sprintf(_x('%s the event starts','before or after','dbem'),__('After','dbem')); ?></option>
  74. </select>
  75. </div>
  76. <?php _ex('at', 'time','dbem'); ?>
  77. <input id="end-time" class="em-time-input em-time-end" type="text" size="8" maxlength="8" name="em_tickets[<?php echo $col_count; ?>][ticket_end_time]" value="<?php echo ( !empty($EM_Ticket->ticket_end) ) ? date( em_get_hour_format(), $EM_Ticket->end_timestamp):''; ?>" />
  78. </div>
  79. </div>
  80. <?php if( !get_option('dbem_bookings_tickets_single') || count($EM_Ticket->get_event()->get_tickets()->tickets) > 1 ): ?>
  81. <div class="ticket-required">
  82. <label title="<?php _e('If checked every booking must select one or the minimum number of this ticket.','dbem'); ?>"><?php _e('Required?','dbem') ?></label>
  83. <input type="checkbox" value="1" name="em_tickets[<?php echo $col_count; ?>][ticket_required]" <?php if($EM_Ticket->ticket_required) echo 'checked="checked"'; ?> class="ticket_required" />
  84. </div>
  85. <?php endif; ?>
  86. <div class="ticket-type">
  87. <label><?php _e('Available for','dbem') ?></label>
  88. <select name="em_tickets[<?php echo $col_count; ?>][ticket_type]" class="ticket_type">
  89. <option value=""><?php _e('Everyone','dbem'); ?></option>
  90. <option value="members" <?php if($EM_Ticket->ticket_members) echo 'selected="selected"'; ?>><?php _e('Logged In Users','dbem'); ?></option>
  91. <option value="guests" <?php if($EM_Ticket->ticket_guests) echo 'selected="selected"'; ?>><?php _e('Guest Users','dbem'); ?></option>
  92. </select>
  93. </div>
  94. <div class="ticket-roles" <?php if( !$EM_Ticket->ticket_members ): ?>style="display:none;"<?php endif; ?>>
  95. <label><?php _e('Restrict to','dbem'); ?></label>
  96. <div>
  97. <?php
  98. $WP_Roles = new WP_Roles();
  99. foreach($WP_Roles->roles as $role => $role_data){ /* @var $WP_Role WP_Role */
  100. ?>
  101. <input type="checkbox" name="em_tickets[<?php echo $col_count; ?>][ticket_members_roles][]" value="<?php echo $role; ?>" <?php if( in_array($role, $EM_Ticket->ticket_members_roles) ) echo 'checked="checked"' ?> class="ticket_members_roles" /> <?php echo $role_data['name']; ?><br />
  102. <?php
  103. }
  104. ?>
  105. </div>
  106. </div>
  107. <?php do_action('em_ticket_edit_form_fields', $col_count, $EM_Ticket); //do not delete, add your extra fields this way, remember to save them too! ?>
  108. </div>
  109. <div class="ticket-options">
  110. <a href="#" class="ticket-options-advanced show"><span class="show"><?php _e('Show Advanced Options','dbem'); ?></span><span class="hide" style="display:none;"><?php _e('Hide Advanced Options','dbem'); ?></span></a>
  111. </div>
  112. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement