</a>
						<a href="#" class="em-cart-table-details-hide" rel="<?php 
    echo $EM_Booking->get_event()->event_id;
    ?>
" id="em-cart-table-details-hide-<?php 
    echo $EM_Booking->get_event()->event_id;
    ?>
">
							- <?php 
    _e('details', 'em-pro');
    ?>
						</a>
					</div>
					<?php 
    //get booking form information (aside from attendee info
    $booking_data = EM_Booking_Form::get_booking_data($EM_Booking);
    if (count($booking_data['booking'])) {
        ?>
						<div class="em-cart-table-event-details em-cart-table-event-details-<?php 
        echo $EM_Booking->get_event()->event_id;
        ?>
 em-cart-info">
							<div class="em-cart-info-booking-title"><?php 
        echo __('Booking Information', 'em-pro');
        ?>
</div>
							<div class="em-cart-info-values">
								<?php 
        foreach ($booking_data['booking'] as $booking_label => $booking_value) {
            ?>
								<label><?php 
 function admin_page_actions()
 {
     global $EM_Pro, $EM_Notices, $wpdb;
     if (!empty($_REQUEST['page']) && $_REQUEST['page'] == 'events-manager-forms-editor') {
         //Load the right form
         if (!empty($_REQUEST['form_id'])) {
             $sql = $wpdb->prepare("SELECT meta_value FROM " . EM_META_TABLE . " WHERE meta_key = 'booking-form' AND meta_id=%d", $_REQUEST['form_id']);
             $form_data = unserialize($wpdb->get_var($sql));
             $EM_Form = self::$form = new EM_Form($form_data['form'], 'em_bookings_form');
             self::$form_name = $form_data['name'];
             self::$form_id = $_REQUEST['form_id'];
         } else {
             $EM_Form = self::get_form();
         }
         if (!empty($_REQUEST['form_name']) && $EM_Form->form_name == $_REQUEST['form_name'] && empty($_REQUEST['bookings_form_action'])) {
             //set up booking form field map and save/retreive previous data
             if ($EM_Form->editor_get_post()) {
                 foreach ($EM_Form->form_fields as $form_field) {
                     if ($form_field['fieldid'] == 'user_email') {
                         $user_email_in_form = true;
                     }
                 }
                 //Save into DB rather than as an option
                 $booking_form_data = array('name' => self::$form_name, 'form' => $EM_Form->form_fields);
                 $saved = false;
                 if (empty($user_email_in_form)) {
                     $EM_Notices->add_error(__('You must include an E-mail field type for booking forms to work. These are used to create the user account and aren\'t shown to logged in users.', 'em-pro'));
                 } else {
                     $saved = $wpdb->update(EM_META_TABLE, array('meta_value' => serialize($booking_form_data)), array('meta_id' => self::$form_id));
                 }
                 //Update Values
                 if ($saved !== false) {
                     $EM_Notices->add_confirm(__('Changes Saved', 'em-pro'));
                 } elseif (count($EM_Form->get_errors()) > 0) {
                     $EM_Notices->add_error($EM_Form->get_errors());
                 }
             }
         } elseif (!empty($_REQUEST['bookings_form_action'])) {
             if ($_REQUEST['bookings_form_action'] == 'default' && wp_verify_nonce($_REQUEST['_wpnonce'], 'bookings_form_default')) {
                 //make this booking form the default
                 update_option('em_booking_form_fields', $_REQUEST['form_id']);
                 $EM_Notices->add_confirm(sprintf(__('The form <em>%s</em> is now the default booking form. All events without a pre-defined booking form will start using this form from now on.', 'em-pro'), self::$form_name));
             } elseif ($_REQUEST['bookings_form_action'] == 'delete' && wp_verify_nonce($_REQUEST['_wpnonce'], 'bookings_form_delete')) {
                 //load and save booking form object with new name
                 $saved = $wpdb->query($wpdb->prepare("DELETE FROM " . EM_META_TABLE . " WHERE meta_id='%s'", $_REQUEST['form_id']));
                 if ($saved) {
                     self::$form = false;
                     $EM_Notices->add_confirm(sprintf(__('%s Deleted', 'dbem'), __('Booking Form', 'em-pro')), 1);
                 }
             } elseif ($_REQUEST['bookings_form_action'] == 'rename' && wp_verify_nonce($_REQUEST['_wpnonce'], 'bookings_form_rename')) {
                 //load and save booking form object with new name
                 $booking_form_data = array('name' => wp_kses_data($_REQUEST['form_name']), 'form' => $EM_Form->form_fields);
                 self::$form_name = $booking_form_data['name'];
                 $saved = $wpdb->update(EM_META_TABLE, array('meta_value' => serialize($booking_form_data)), array('meta_id' => self::$form_id));
                 $EM_Notices->add_confirm(sprintf(__('Form renamed to <em>%s</em>.', 'em-pro'), self::$form_name));
             } elseif ($_REQUEST['bookings_form_action'] == 'add' && wp_verify_nonce($_REQUEST['_wpnonce'], 'bookings_form_add')) {
                 //create new form with this name and save first off
                 $EM_Form = new EM_Form(self::$form_template, 'em_bookings_form');
                 $booking_form_data = array('name' => wp_kses_data($_REQUEST['form_name']), 'form' => $EM_Form->form_fields);
                 self::$form = $EM_Form;
                 self::$form_name = $booking_form_data['name'];
                 $saved = $wpdb->insert(EM_META_TABLE, array('meta_value' => serialize($booking_form_data), 'meta_key' => 'booking-form', 'object_id' => 0));
                 self::$form_id = $wpdb->insert_id;
                 $EM_Notices->add_confirm(__('New form created. You are now editing your new form.', 'em-pro'), true);
                 wp_redirect(add_query_arg(array('form_id' => self::$form_id), wp_get_referer()));
                 exit;
             }
         }
     }
 }
do_action('em_checkout_form_after_summary', $EM_Multiple_Booking);
//do not delete
?>
		
	<form id='em-booking-form' class="em-booking-form" name='booking-form' method='post' action='<?php 
echo apply_filters('em_checkout_form_action_url', '');
?>
#em-booking'>
	 	<input type='hidden' name='action' value='emp_checkout'/>
	 	<input type='hidden' name='_wpnonce' value='<?php 
echo wp_create_nonce('emp_checkout');
?>
'/>
		<div class='em-booking-form-details'>
			<?php 
echo EM_Booking_Form::get_form(false, $EM_Multiple_Booking);
?>
			<?php 
do_action('em_checkout_form_footer', $EM_Multiple_Booking);
//do not delete
?>
			<div class="em-booking-buttons">
				<?php 
if (preg_match('/https?:\\/\\//', get_option('dbem_multiple_bookings_submit_button'))) {
    //Settings have an image url (we assume). Use it here as the button.
    ?>
				<input type="image" src="<?php 
    echo get_option('dbem_multiple_bookings_submit_button');
    ?>
" class="em-booking-submit" id="em-booking-submit" />
				<?php 
 public static function em_bookings_table_cols_template($template, $EM_Bookings_Table)
 {
     $EM_Form = EM_Booking_Form::get_form(false, get_option('dbem_multiple_bookings_form'));
     foreach ($EM_Form->form_fields as $field_id => $field) {
         if ($EM_Form->is_normal_field($field)) {
             //user fields already handled, htmls shouldn't show
             //prefix MB fields with mb_ to avoid clashes with normal booking forms
             $template['mb_' . $field_id] = $field['label'];
         }
     }
     return $template;
 }
    /**
     * Settings for Multiple Bookings Mode 
     */
    public static function settings()
    {
        global $save_button;
        ?>
        <div  class="postbox " id="em-opt-multiple-bookings" >
        	<div class="handlediv" title="<?php 
        esc_attr_e_emp('Click to toggle', 'dbem');
        ?>
"><br /></div><h3><span><?php 
        _e('Multiple Bookings Mode', 'em-pro');
        ?>
 <em>(Beta)</em></span></h3>
        	<div class="inside">
        		<table class='form-table'>
        			<tr class="em-boxheader"><td colspan='2'>
        				<p>
        					<?php 
        _e('Multiple Bookings Mode enables your visitors to make bookings follow a flow similar to that of a shopping cart, meaning users can book multiple events and pay for them in one go.', 'em-pro');
        ?>
        					<a href="http://wp-events-plugin.com/documentation/multiple-booking-mode/"><?php 
        echo sprintf(__('More about %s.', 'em-pro'), __('Multiple Bookings Mode', 'em-pro'));
        ?>
</a>
        				</p>
        			</td></tr>
        			<?php 
        em_options_radio_binary(__('Enable Muliple Bookings Mode?', 'em-pro'), 'dbem_multiple_bookings');
        ?>
        			<tbody id="dbem-js-multiple-bookings">
        				<tr>
							<th><?php 
        echo __('Checkout Page', 'em-pro');
        ?>
</th>
							<td>
								<?php 
        wp_dropdown_pages(array('name' => 'dbem_multiple_bookings_checkout_page', 'selected' => get_option('dbem_multiple_bookings_checkout_page'), 'show_option_none' => '[' . esc_html__emp('None', 'dbem') . ']'));
        ?>
								<br />
								<em>
									<?php 
        echo __('This page will be where the user reviews their bookings, enters additional information (such as user registration info) and proceeds with payment.', 'em-pro');
        echo ' ' . sprintf(__('Please <a href="%s">add a new page</a> and assign it here. This is required for Multiple Bookings Mode to work.', 'em-pro'), 'post-new.php?post_type=page');
        ?>
								</em>
							</td>
						</tr>
	        			<?php 
        em_options_radio_binary(__('Redirect To Checkout on Booking?', 'em-pro'), 'dbem_multiple_bookings_redirect', __('It set to yes, when a booking has been added to the cart, the user will be redirected to the checkout page. Whilst redirecting the confirmation message below will also be shown, you may also want to modify that too let them know they are being redirected.', 'em-pro'));
        em_options_select(__('Checkout Page Booking Form', 'em-pro'), 'dbem_multiple_bookings_form', EM_Booking_Form::get_forms_names(), __('This form will be shown on the checkout page, which should include user fields you may want when registering new users. Any non-user fields will be added as supplementary information to every booking, if you have identical Field IDs on the individual event booking form, that field value will be saved to the individual booking instead.', 'em-pro'));
        ?>
        				<tr>
							<th><?php 
        echo __('Cart Page', 'em-pro');
        ?>
</th>
							<td>
								<?php 
        wp_dropdown_pages(array('name' => 'dbem_multiple_bookings_cart_page', 'selected' => get_option('dbem_multiple_bookings_cart_page'), 'show_option_none' => '[' . esc_html__emp('None', 'dbem') . ']'));
        ?>
								<br />
								<em><?php 
        echo __('This page will display the events the user has chosen to book and allow them to edit their bookings before checkout.', 'em-pro');
        echo ' ' . sprintf(__('Please <a href="%s">add a new page</a> and assign it here. This is required for Multiple Bookings Mode to work.', 'em-pro'), 'post-new.php?post_type=page');
        ?>
								</em>
							</td>
						</tr>
	        			<?php 
        em_options_input_text(__('Successfully Added Message', 'em-pro'), 'dbem_multiple_bookings_feedback_added', __('A booking was successfull added to the bookings cart.', 'em-pro'));
        em_options_input_text(__('Loading Cart Contents', 'em-pro'), 'dbem_multiple_bookings_feedback_loading_cart', __('If caching plugins are used, cart contents are loaded after a page load and this text is shown whilst loading.', 'em-pro'));
        em_options_input_text(__('Event Already Booked', 'em-pro'), 'dbem_multiple_bookings_feedback_already_added', __('This event has already been added to the cart and cannot be added twice.', 'em-pro'));
        em_options_input_text(__('No Bookings', 'em-pro'), 'dbem_multiple_bookings_feedback_no_bookings', __('User has not booked any events yet, cart is empty.', 'em-pro'));
        em_options_input_text(__('Empty Cart Warning', 'em-pro'), 'dbem_multiple_bookings_feedback_empty_cart', __('Warning after the "empty cart" button is clicked.', 'em-pro'));
        em_options_input_text(__('Checkout Form Button', 'em-pro'), 'dbem_multiple_bookings_submit_button', __('The text shown in the checkout page form.', 'em-pro'));
        ?>
        			</tbody>
        			<?php 
        echo $save_button;
        ?>
        		</table>
        	</div> <!-- . inside -->
        </div> <!-- .postbox -->
		<script type="text/javascript">
			jQuery(document).ready(function($){
				$('input:radio[name="dbem_multiple_bookings"]').change(function(){
					if( $('input:radio[name="dbem_multiple_bookings"]:checked').val() == 1 ){
						$('tbody#dbem-js-multiple-bookings').show();
					}else{
						$('tbody#dbem-js-multiple-bookings').hide();					
					}
				}).first().trigger('change');
			});
		</script>
		<?php 
    }