//The offset of 2 since this is attendee 2 and on
                    //adding 1 since the primary attendee is added
                    //in the above function call (c.a. line 104)
                    //Used for "Attendee #" display
                    for ($i = $attendee_number, $cnt = $meta['attendee_quantity'] + $attendee_number - 1; $i < $cnt; $i++) {
                        $price_group_att_counter++;
                        //echo 'price_group_att_counter = '.$price_group_att_counter;
                        $meta['attendee_number'] = $price_group_att_counter;
                        ?>
								<hr class="hr_additional_attendee" />
								<div class="multi_regis_wrapper_attendee-additional">
									<div class="event-display-boxes">
										<?php 
                        echo '<h3 class="section-heading">' . __('Attendee ', 'event_espresso') . $i . '</h3>';
                        echo event_espresso_copy_dd($event_id, $meta);
                        echo event_espresso_add_question_groups($question_groups, $events_in_session[$event_id], $event_id, 1, $meta);
                        ?>
									</div>
								</div>
								<?php 
                    }
                }
            }
        } else {
        }
        //End allow multiple
        break;
}
//End Switch statement to check the status of the event
?>
	</div>
Пример #2
0
    function event_espresso_additional_attendees($event_id = 0, $additional_limit = 2, $available_spaces = 999, $label = '', $show_label = true, $event_meta = '', $qstn_class = '')
    {
        global $espresso_premium;
        $event_id = $event_id == 0 ? $_REQUEST['event_id'] : $event_id;
        if ($event_meta == 'admin') {
            $admin = true;
            $event_meta = '';
        }
        if ($event_meta == '' && ($event_id != '' || $event_id != 0)) {
            $event_meta = event_espresso_get_event_meta($event_id);
        }
        //If the additional attednee questions are empty, then default to the first question group
        if (empty($event_meta['add_attendee_question_groups'])) {
            $event_meta['add_attendee_question_groups'] = array(1 => 1);
        }
        $i = 0;
        if (isset($event_meta['additional_attendee_reg_info']) && $event_meta['additional_attendee_reg_info'] == 1 || $espresso_premium == FALSE) {
            $label = $label == '' ? __('Number of Tickets', 'event_espresso') : $label;
            $html = '<p class="espresso_additional_limit highlight-bg">';
            $html .= $show_label == true ? '<label for="num_people">' . $label . '</label>' : '';
            $html .= '<select name="num_people" id="num_people-' . $event_id . '" style="width:70px;">';
            while ($i < $additional_limit && $i < $available_spaces) {
                $i++;
                $html .= '<option value="' . $i . '">' . $i . '</option>';
            }
            $html .= '</select>';
            //$html .= '<br />';
            $html .= '<input type="hidden" name="espresso_addtl_limit_dd" value="true">';
            $html .= '</p>';
            $buffer = '';
        } else {
            //			while (($i < $additional_limit) && ($i < $available_spaces)) {
            //				$i++;
            //			}
            $i = min($additional_limit, $available_spaces) - 1;
            $html = '<div id="additional_header" class="event_form_field additional_header espresso_add_subtract_attendees">';
            // fixed for translation string, previous string untranslatable - http://events.codebasehq.com/projects/event-espresso/tickets/11
            $html .= '<a id="add-additional-attendee-1" rel="1" class="add-additional-attendee-lnk additional-attendee-lnk ui-state-highlight">' . sprintf(__('Add More Attendees? (click to toggle, limit %s)', 'event_espresso'), $i) . '</a></div>';
            //ob_start();
            $attendee_form = '<div id="additional_attendee_XXXXXX" class="espresso_add_attendee">';
            $attendee_form .= '<h4 class="additional-attendee-nmbr-h4">' . __('Attendee #', 'event_espresso') . 'XXXXXX</h4>';
            /*
             * Added for seating chart addon
             */
            if (defined('ESPRESSO_SEATING_CHART')) {
                if (seating_chart::check_event_has_seating_chart($_REQUEST['event_id']) !== false) {
                    $attendee_form .= '<p>';
                    $attendee_form .= '<label>' . __('Select a Seat:', 'event_espresso') . '</label>';
                    $attendee_form .= '<input type="text" name="x_seat_id[XXXXXX]" value="" class="ee_s_select_seat" event_id="' . $_REQUEST['event_id'] . '" readonly="readonly" />';
                    $attendee_form .= '<br/>[' . __('If you do not select a seat this attendee will not be added', 'event_espresso') . ']';
                    $attendee_form .= '</p>';
                }
            }
            if ($event_meta['additional_attendee_reg_info'] == 2) {
                $attendee_form .= '<p>';
                $attendee_form .= '<label for="x_attendee_fname">' . __('First Name:', 'event_espresso') . '</label>';
                $attendee_form .= '<input type="text" name="x_attendee_fname[XXXXXX]" class="ee-reg-page-text-input fname"/>';
                $attendee_form .= '</p>';
                $attendee_form .= '<p>';
                $attendee_form .= '<label for="x_attendee_lname">' . __('Last Name:', 'event_espresso') . '</label>';
                $attendee_form .= '<input type="text" name="x_attendee_lname[XXXXXX]" class="ee-reg-page-text-input lname"/>';
                $attendee_form .= '</p>';
                $attendee_form .= '<p>';
                $attendee_form .= '<label for="x_attendee_email">' . __('Email:', 'event_espresso') . '</label>';
                $attendee_form .= '<input type="text" name="x_attendee_email[XXXXXX]" class="ee-reg-page-text-input email"/>';
                $attendee_form .= '</p>';
            } else {
                $attendee_form .= '<input type="hidden" name="x_attendee_nmbr[XXXXXX]" class="x_attendee_nmbr" value="XXXXXX"/>';
                $meta = array("x_attendee" => true);
                if (!empty($admin)) {
                    $meta['admin_only'] = true;
                }
                $attendee_form .= event_espresso_add_question_groups($event_meta['add_attendee_question_groups'], '', null, 0, $meta, $qstn_class);
            }
            $attendee_form .= '<div class="espresso_add_subtract_attendees">';
            $attendee_form .= '
			<div class="additional-attendee-div"><a id="remove-additional-attendee-XXXXXX" rel="XXXXXX" class="remove-additional-attendee-lnk additional-attendee-lnk ui-priority-primary " title="' . __('Remove Attendee Above', 'event_espresso') . '">
				<img src="' . EVENT_ESPRESSO_PLUGINFULLURL . 'images/icons/remove.gif" alt="' . __('Remove Attendee', 'event_espresso') . '" />
				' . __('Remove Attendee Above', 'event_espresso') . '
			</a></div>';
            $attendee_form .= '
			<div class="additional-attendee-div"><a id="add-additional-attendee-XXXXXX" rel="XXXXXX" class="add-additional-attendee-lnk additional-attendee-lnk ui-priority-primary " title="' . __('Add Additional Attendee', 'event_espresso') . '">
				<img src="' . EVENT_ESPRESSO_PLUGINFULLURL . 'images/icons/add.png" alt="' . __('Add Additional Attendee', 'event_espresso') . '" />
				' . __('Add Additional Attendee', 'event_espresso') . '
			</a></div>';
            $attendee_form .= '</div></div>';
            wp_register_script('espresso_add_reg_attendees', EVENT_ESPRESSO_PLUGINFULLURL . 'scripts/espresso_add_reg_attendees.js', array('jquery'), '0.1', TRUE);
            wp_enqueue_script('espresso_add_reg_attendees');
            $espresso_add_reg_attendees = array('additional_limit' => min($additional_limit, $available_spaces), 'attendee_form' => stripslashes($attendee_form));
            wp_localize_script('espresso_add_reg_attendees', 'espresso_add_reg_attendees', $espresso_add_reg_attendees);
        }
        return $html;
    }
Пример #3
0
    function event_espresso_additional_attendees($event_id = 0, $additional_limit = 2, $available_spaces = 999, $label = '', $show_label = true, $event_meta = '')
    {
        $event_id = $event_id == 0 ? $_REQUEST['event_id'] : $event_id;
        if ($event_meta == '' && ($event_id != '' || $event_id != 0)) {
            $event_meta = event_espresso_get_event_meta($event_id);
        }
        $i = 0;
        if ($event_meta['additional_attendee_reg_info'] == 1) {
            $label = $label == '' ? __('Number of Tickets', 'event_espresso') : $label;
            $html = '<span class="espresso_additional_limit">';
            $html .= $show_label == true ? '<label for="num_people">' . $label . '</label>' : '';
            $html .= '<select name="num_people" id="num_people-' . $event_id . '" style="width:70px;">';
            while ($i <= $additional_limit && $i < $available_spaces) {
                $i++;
                $html .= '<option value="' . $i . '">' . $i . '</option>';
            }
            $html .= '</select>';
            //$html .= '<br />';
            $html .= '<input type="hidden" name="espresso_addtl_limit_dd" value="true">';
            $html .= '</span>';
            $buffer = '';
        } else {
            while ($i <= $additional_limit && $i < $available_spaces) {
                $i++;
            }
            $i = $i - 1;
            $html = '<p class="event_form_field additional_header" id="additional_header">';
            // fixed for translation string, previous string untranslatable - http://events.codebasehq.com/projects/event-espresso/tickets/11
            //$html .= '<a onclick="return false;" href="#">' . __('Add More Attendees? (click to toggle, limit ' . $i . ')', 'event_espresso') . '</a>';
            $html .= '<a onclick="return false;" href="#">' . __('Add More Attendees? (click to toggle, limit ', 'event_espresso');
            $html .= $i . ')</a>';
            $html .= '</p>';
            $html .= '<div id="additional_attendees">';
            $html .= '<div class="clone espresso_add_attendee">';
            /*
             * Added for seating chart addon
             */
            if (defined('ESPRESSO_SEATING_CHART')) {
                if (seating_chart::check_event_has_seating_chart($_REQUEST['event_id']) !== false) {
                    $html .= '<p>';
                    $html .= '<label>' . __('Select a Seat:', 'event_espresso') . '</label>';
                    $html .= '<input type="text" name="x_seat_id[]" value="" class="ee_s_select_seat" event_id="' . $_REQUEST['event_id'] . '" readonly="readonly" />';
                    $html .= '<br/>[' . __('If you do not select a seat this attendee will not be added', 'event_espresso') . ']';
                    $html .= '</p>';
                }
            }
            if ($event_meta['additional_attendee_reg_info'] == 2) {
                $html .= '<p>';
                $html .= '<label for="x_attendee_fname">' . __('First Name:', 'event_espresso') . '</label>';
                $html .= '<input type="text" name="x_attendee_fname[]" class="input"/>';
                $html .= '</p>';
                $html .= '<p>';
                $html .= '<label for="x_attendee_lname">' . __('Last Name:', 'event_espresso') . '</label>';
                $html .= '<input type="text" name="x_attendee_lname[]" class="input"/>';
                $html .= '</p>';
                $html .= '<p>';
                $html .= '<label for="x_attendee_email">' . __('Email:', 'event_espresso') . '</label>';
                $html .= '<input type="text" name="x_attendee_email[]" class="input"/>';
                $html .= '</p>';
            } else {
                $html .= event_espresso_add_question_groups($event_meta['add_attendee_question_groups'], '', null, 0, array("x_attendee" => true));
            }
            $html .= '<a href="#" class="add" rel=".clone" title="' . __('Add an Additonal Attendee', 'event_espresso') . '"><img src="' . EVENT_ESPRESSO_PLUGINFULLURL . 'images/icons/add.png" alt="' . __('Add an Additonal Attendee', 'event_espresso') . '" /></a>';
            $html .= '</div>';
            $html .= '<hr />';
            $html .= '</div>';
            ob_start();
            ?>
			<script type="text/javascript">$jaer = jQuery.noConflict();jQuery(document).ready(function($jaer) { $jaer(function(){var removeLink = '<a style="" class="remove" href="#" onclick="$jaer(this).parent().slideUp(function(){ $jaer(this).remove() }); return false"><img src="<?php 
            echo EVENT_ESPRESSO_PLUGINFULLURL . "images/icons/remove.gif";
            ?>
" alt="<?php 
            _e('Remove Attendee', 'event_espresso');
            ?>
" /></a>';$jaer('a.add').relCopy({limit: <?php 
            echo $i;
            ?>
, append: removeLink});$jaer("#additional_attendees").hide();/*toggle the componenet with class msg_body*/$jaer("#additional_header").click(function(){$jaer(this).next("#additional_attendees").slideToggle(500);});});});</script>
			<?php 
            $buffer = ob_get_contents();
            ob_end_clean();
        }
        return $html . $buffer;
    }
function add_new_attendee($event_id)
{
    if (isset($_REQUEST['regevent_action_admin']) && $_REQUEST['regevent_action_admin'] == 'post_attendee') {
        require_once EVENT_ESPRESSO_PLUGINFULLPATH . "includes/functions/attendee_functions.php";
        require_once EVENT_ESPRESSO_PLUGINFULLPATH . "includes/process-registration/add_attendees_to_db.php";
        $attendee_id = event_espresso_add_attendees_to_db();
        if ($attendee_id) {
            // SEND CONFIRMATION EMAIL MESSAGES
            event_espresso_email_confirmations(array('attendee_id' => $attendee_id, 'send_admin_email' => 'true', 'send_attendee_email' => 'true'));
            //echo $attendee_id;
            ?>
			<div id="message" class="updated fade">
			  <p><strong>
			    <?php 
            _e('Added Attendee to Database', 'event_espresso');
            ?>
			    </strong></p>
			</div>
		<?php 
        } else {
            global $notifications;
            $error_msg = implode($notifications['error'], '<br />');
            ?>
			<div id="message" class="error">
				<p>
					<strong><?php 
            echo $error_msg;
            ?>
</strong>
				</p>
			</div>
			<?php 
        }
    }
    wp_register_script('reCopy', EVENT_ESPRESSO_PLUGINFULLURL . "scripts/reCopy.js", false, '1.1.0');
    wp_print_scripts('reCopy');
    global $wpdb;
    $sql = "SELECT * FROM " . EVENTS_DETAIL_TABLE . " WHERE is_active='Y' AND event_status != 'D' AND id = '" . $event_id . "' LIMIT 0,1";
    //Build the registration page
    if ($wpdb->get_results($sql)) {
        $events = $wpdb->get_results($sql);
        //These are the variables that can be used throughout the regsitration page
        foreach ($events as $event) {
            $event_id = $event->id;
            $event_name = stripslashes($event->event_name);
            $event_desc = stripslashes($event->event_desc);
            $display_desc = $event->display_desc;
            $event_address = $event->address;
            $event_city = $event->city;
            $event_state = $event->state;
            $event_zip = $event->zip;
            $event_description = stripslashes($event->event_desc);
            $event_identifier = $event->event_identifier;
            $event_cost = isset($event->event_cost) ? $event->event_cost : '';
            $member_only = isset($event->member_only) ? $event->member_only : '';
            $reg_limit = isset($event->reg_limit) ? $event->reg_limit : '';
            $allow_multiple = $event->allow_multiple;
            $start_date = $event->start_date;
            $end_date = $event->end_date;
            $reg_limit = $event->reg_limit;
            $additional_limit = $event->additional_limit;
            $is_active = array();
            $question_groups = unserialize($event->question_groups);
            //This function gets the status of the event.
            $is_active = event_espresso_get_is_active($event_id);
            //If the coupon code system is intalled then use it
            if (function_exists('event_espresso_coupon_registration_page')) {
                $use_coupon_code = $event->use_coupon_code;
            }
            //If the groupon code addon is installed, then use it
            if (function_exists('event_espresso_groupon_payment_page')) {
                $use_groupon_code = $event->use_groupon_code;
            }
            //Set a default value for additional limit
            if ($additional_limit == '') {
                $additional_limit = '5';
            }
        }
        //End foreach ($events as $event)
        //This is the start of the registration form. This is where you can start editing your display.
        $num_attendees = get_number_of_attendees_reg_limit($event_id, 'num_attendees');
        //Get the number of attendees
        $available_spaces = get_number_of_attendees_reg_limit($event_id, 'available_spaces');
        //Gets a count of the available spaces
        $number_available_spaces = get_number_of_attendees_reg_limit($event_id, 'number_available_spaces');
        //Gets the number of available spaces
        ?>
<script>$jaer = jQuery.noConflict();
	jQuery(document).ready(function($jaer) {
	jQuery(function(){
		//Registration form validation
		jQuery('#espresso-admin-add-new-attendee-frm').validate();
	});
});

	</script>
<div class="metabox-holder">
  <div class="postbox">
    <div id="espresso-admin-add-new-attendee-dv">

        <form method="post" action="<?php 
        echo $_SERVER['REQUEST_URI'];
        ?>
" onsubmit="return validateForm(this)"  id="registration_form" class="espresso_form">
			<?php 
        wp_nonce_field('reg_nonce', 'reg_form_nonce');
        ?>
          <h3 class="h3_event_title" id="h3_event_title-<?php 
        echo $event_id;
        ?>
"><?php 
        echo $event_name;
        ?>
</h3>
           <div  class="padding">
     	     <div  class="inside">
				<fieldset>
		 		<h4 class="reg-quest-title section-title"><?php 
        _e('Event Dates and Times', 'event_espresso');
        ?>
</h4>
					<p class="start_date">
						<span class="span_event_date_label"><?php 
        _e('Start Date:', 'event_espresso');
        ?>
</span><span class="span_event_date_value"><?php 
        echo event_date_display($start_date);
        ?>
</span>
					</p>
		          	<p class="event_time">
		            <?php 
        $time_selected = '';
        //This block of code is used to display the times of an event in either a dropdown or text format.
        if (!empty($time_selected) && $time_selected == true) {
            //If the customer is coming from a page where the time was preselected.
            echo event_espresso_display_selected_time($time_id);
            //Optional parameters start, end, default
        } else {
            if ($time_selected == false) {
                echo event_espresso_time_dropdown($event_id);
            }
        }
        //End time selected
        ?>
	          		</p>
	          		<?php 
        // Added for seating chart addon
        do_action('ee_seating_chart_css');
        do_action('ee_seating_chart_js');
        do_action('ee_seating_chart_flush_expired_seats');
        do_action('espresso_seating_chart_select', $event_id);
        ?>
				</fieldset>
			  <?php 
        echo event_espresso_add_question_groups($question_groups, '', null, 0, array('admin_only' => true), 'inline');
        //Coupons
        if (function_exists('event_espresso_coupon_registration_page')) {
            echo event_espresso_coupon_registration_page($use_coupon_code, $event_id);
        }
        //End coupons display
        //Groupons
        if (function_exists('event_espresso_groupon_registration_page')) {
            echo event_espresso_groupon_registration_page($use_groupon_code, $event_id);
        }
        //End groupons display
        ?>


	          <p class="event_form_field">
	            <label for="event_cost" class="inline">
	              <?php 
        _e('Amount Paid:', 'event_espresso');
        ?>
	            </label>
	            <input tabindex="9" type="text" maxlength="10" size="15" name="event_cost" id="event_cost-<?php 
        echo $event_id;
        ?>
" <?php 
        echo $event_cost ? 'value="' . $event_cost . '"' : "";
        ?>
 />
	            <input type="hidden" name="regevent_action_admin" id="regevent_action-<?php 
        echo $event_id;
        ?>
" value="post_attendee" />
	            <input type="hidden" name="event_id" id="event_id-<?php 
        echo $event_id;
        ?>
" value="<?php 
        echo $event_id;
        ?>
" />
	            <input type="hidden" name="admin" value="true" />
	          </p>
			 
			<?php 
        echo event_espresso_additional_attendees($event_id, $additional_limit, $number_available_spaces, __('Number of Tickets', 'event_espresso'), true, 'admin', 'inline');
        ?>
			
	          <p class="event_form_submit" id="event_form_submit-<?php 
        echo $event_id;
        ?>
">
	            <input class="btn_event_form_submit button-primary" id="event_form_field-<?php 
        echo $event_id;
        ?>
" type="submit" name="Submit" value="<?php 
        _e('Submit', 'event_espresso');
        ?>
" />
	          </p>
	      </div>
	      </div>
        </form>
      </div>
    </div>
  </div>
<?php 
        event_list_attendees();
    }
    //End Build the registration page
}
            }
        }
        // * * This section shows the registration form if it is an active event * *
        if ($display_reg_form == 'Y') {
            do_action('action_hook_espresso_registration_form_top', $event_id, $event_meta, $all_meta);
            ?>
				<div id="event-reg-form-groups">
				
					<h3 class="section-heading"><?php 
            _e('Registration Details', 'event_espresso');
            ?>
</h3>
					
	<?php 
            //Outputs the custom form questions. This function can be overridden using the custom files addon
            echo event_espresso_add_question_groups($question_groups, '', NULL, FALSE, array('attendee_number' => 1), 'ee-reg-page-questions');
            ?>
				</div>
				
	<?php 
            //Coupons
            ?>
				<input type="hidden" name="use_coupon[<?php 
            echo $event_id;
            ?>
]" value="<?php 
            echo $use_coupon_code;
            ?>
" />
	<?php 
            if (in_array($use_coupon_code, array('Y', 'G', 'A')) && function_exists('event_espresso_coupon_registration_page')) {
            //Groupons
            if (function_exists('event_espresso_groupon_registration_page')) {
                echo event_espresso_groupon_registration_page($use_groupon_code, $event_id);
            }
            //End groupons display
            ?>

						<fieldset id="event-reg-form-groups">
							<h3 class="section-heading">
							<?php 
            _e('Registration Details', 'event_espresso');
            ?>
							</h3>
							<?php 
            //Outputs the custom form questions. This function can be overridden using the custom files addon
            echo event_espresso_add_question_groups($question_groups, '', null, 0, array('attendee_number' => 1));
            ?>
						</fieldset>
						<?php 
            //Multiple Attendees
            if ($allow_multiple == "Y" && $number_available_spaces > 1) {
                //This returns the additional attendee form fields. Can be overridden in the custom files addon.
                echo event_espresso_additional_attendees($event_id, $additional_limit, $number_available_spaces, __('Number of Tickets', 'event_espresso'), true, $event_meta);
            } else {
                ?>
							<input type="hidden" name="num_people" id="num_people-<?php 
                echo $event_id;
                ?>
" value="1">
							<?php 
            }
Пример #7
0
    function espresso_reg_form_sc($atts)
    {
        global $wpdb, $org_options;
        global $load_espresso_scripts;
        $load_espresso_scripts = true;
        //This tells the plugin to load the required scripts
        extract(shortcode_atts(array('event_id' => '0'), $atts));
        $event_id = "{$event_id}";
        //The following variables are used to get information about your organization
        $event_page_id = $org_options['event_page_id'];
        $Organization = stripslashes_deep($org_options['organization']);
        $Organization_street1 = $org_options['organization_street1'];
        $Organization_street2 = $org_options['organization_street2'];
        $Organization_city = $org_options['organization_city'];
        $Organization_state = $org_options['organization_state'];
        $Organization_zip = $org_options['organization_zip'];
        $contact = $org_options['contact_email'];
        $registrar = $org_options['contact_email'];
        $currency_format = $org_options['currency_format'];
        $message = $org_options['message'];
        $use_captcha = $org_options['use_captcha'];
        $paypal_id = $org_options['paypal_id'];
        $sql = "SELECT * FROM " . EVENTS_DETAIL_TABLE;
        $sql .= " WHERE is_active='Y' ";
        $sql .= " AND event_status != 'D' ";
        $sql .= " AND id = '" . $event_id . "' LIMIT 0,1";
        if ($wpdb->get_results($sql)) {
            $events = $wpdb->get_results($sql);
            //These are the variables that can be used throughout the regsitration page
            foreach ($events as $event) {
                $event_id = $event->id;
                $event_name = stripslashes_deep($event->event_name);
                $event_desc = stripslashes_deep($event->event_desc);
                $display_desc = $event->display_desc;
                $display_reg_form = $event->display_reg_form;
                $event_address = $event->address;
                $event_address2 = $event->address2;
                $event_city = $event->city;
                $event_state = $event->state;
                $event_zip = $event->zip;
                $event_country = $event->country;
                $event_description = stripslashes_deep($event->event_desc);
                $event_identifier = $event->event_identifier;
                $event_cost = $event->event_cost;
                $member_only = $event->member_only;
                $reg_limit = $event->reg_limit;
                $allow_multiple = $event->allow_multiple;
                $start_date = $event->start_date;
                $end_date = $event->end_date;
                $allow_overflow = $event->allow_overflow;
                $overflow_event_id = $event->overflow_event_id;
                $virtual_url = stripslashes_deep($event->virtual_url);
                $virtual_phone = stripslashes_deep($event->virtual_phone);
                //Address formatting
                $location = ($event_address != '' ? $event_address : '') . ($event_address2 != '' ? '<br />' . $event_address2 : '') . ($event_city != '' ? '<br />' . $event_city : '') . ($event_state != '' ? ', ' . $event_state : '') . ($event_zip != '' ? '<br />' . $event_zip : '') . ($event_country != '' ? '<br />' . $event_country : '');
                //Google map link creation
                $google_map_link = espresso_google_map_link(array('address' => $event_address, 'city' => $event_city, 'state' => $event_state, 'zip' => $event_zip, 'country' => $event_country, 'text' => 'Map and Directions', 'type' => 'text'));
                $reg_start_date = $event->registration_start;
                $reg_end_date = $event->registration_end;
                $today = date("Y-m-d");
                $reg_limit = $event->reg_limit;
                $additional_limit = $event->additional_limit;
                $question_groups = unserialize($event->question_groups);
                global $all_meta;
                $all_meta = array('event_name' => stripslashes_deep($event_name), 'event_desc' => stripslashes_deep($event_desc), 'event_address' => $event_address, 'event_address2' => $event_address2, 'event_city' => $event_city, 'event_state' => $event_state, 'event_zip' => $event_zip, 'is_active' => $event->is_active, 'event_status' => $event->event_status, 'start_time' => $event->start_time, 'registration_startT' => $event->registration_startT, 'registration_start' => $event->registration_start, 'registration_endT' => $event->registration_endT, 'registration_end' => $event->registration_end, 'is_active' => $is_active, 'event_country' => $event_country, 'start_date' => event_date_display($start_date, get_option('date_format')), 'end_date' => event_date_display($end_date, get_option('date_format')), 'time' => $event->start_time, 'google_map_link' => $google_map_link, 'price' => $event->event_cost, 'event_cost' => $event->event_cost);
                //This function gets the status of the event.
                $is_active = array();
                $is_active = event_espresso_get_is_active(0, $all_meta);
                //If the coupon code system is intalled then use it
                if (function_exists('event_espresso_coupon_registration_page')) {
                    $use_coupon_code = $event->use_coupon_code;
                }
                //If the groupon code addon is installed, then use it
                if (function_exists('event_espresso_groupon_payment_page')) {
                    $use_groupon_code = $event->use_groupon_code;
                }
                //Set a default value for additional limit
                if ($additional_limit == '') {
                    $additional_limit = '5';
                }
            }
            //End foreach ($events as $event)
        }
        //This is the registration form.
        //This is a template file for displaying a registration form for an event on a page.
        //There should be a copy of this file in your wp-content/uploads/espresso/ folder.
        ?>
		<div id="event_espresso_registration_form">
			<form method="post" action="<?php 
        echo home_url();
        ?>
/?page_id=<?php 
        echo $event_page_id;
        ?>
" id="registration_form">
				<?php 
        //print_r( event_espresso_get_is_active($event_id));
        switch ($is_active['status']) {
            case 'EXPIRED':
                //only show the event description.
                _e('<h3 class="expired_event">This event has passed.</h3>', 'event_espresso');
                break;
            case 'REGISTRATION_CLOSED':
                //only show the event description.
                // if todays date is after $reg_end_date
                ?>
						<p class="event_full"><strong><?php 
                _e('We are sorry but registration for this event is now closed.', 'event_espresso');
                ?>
</strong></p>
						<p class="event_full"><strong><?php 
                _e('Please <a href="contact" title="contact us">contact us</a> if you would like to know if spaces are still available.', 'event_espresso');
                ?>
</strong></p>
						<?php 
                break;
            case 'REGISTRATION_NOT_OPEN':
                //only show the event description.
                // if todays date is after $reg_end_date
                // if todays date is prior to $reg_start_date
                ?>
						<p class="event_full"><strong><?php 
                _e('We are sorry but this event is not yet open for registration.', 'event_espresso');
                ?>
</strong></p>
						<p class="event_full"><strong><?php 
                _e('You will be able to register starting ', 'event_espresso');
                echo event_espresso_no_format_date($reg_start_date, 'F d, Y');
                ?>
</strong></p>
							<?php 
                break;
            default:
                //If the event is in an active or ongoing status, then show the registration form.
                //echo $is_active['status'];//Show event status
                if ($display_reg_form == 'Y') {
                    ?>
							<p class="event_time">
					<?php 
                    //This block of code is used to display the times of an event in either a dropdown or text format.
                    if ($time_selected == true) {
                        //If the customer is coming from a page where the time was preselected.
                        echo event_espresso_display_selected_time($time_id);
                        //Optional parameters start, end, default
                    } else {
                        if ($time_selected == false) {
                            echo event_espresso_time_dropdown($event_id);
                        }
                    }
                    //End time selected
                    ?>
							</p>

							<p class="event_prices"><?php 
                    echo event_espresso_price_dropdown($event_id);
                    //Show pricing in a dropdown or text
                    ?>
</p>
							<?php 
                    //Outputs the custom form questions. This function can be overridden using the custom files addon
                    echo event_espresso_add_question_groups($question_groups);
                    //Coupons
                    if (function_exists('event_espresso_coupon_registration_page')) {
                        echo event_espresso_coupon_registration_page($use_coupon_code, $event_id);
                    }
                    //End coupons display
                    //Groupons
                    if (function_exists('event_espresso_groupon_registration_page')) {
                        echo event_espresso_groupon_registration_page($use_groupon_code, $event_id);
                    }
                    //End groupons display
                    ?>
							<input type="hidden" name="num_people" id="num_people-<?php 
                    echo $event_id;
                    ?>
" value="1">


							<input type="hidden" name="regevent_action" id="regevent_action-<?php 
                    echo $event_id;
                    ?>
" value="post_attendee">
							<input type="hidden" name="event_id" id="event_id-<?php 
                    echo $event_id;
                    ?>
" value="<?php 
                    echo $event_id;
                    ?>
">
							<?php 
                    //Recaptcha portion
                    if ($use_captcha == 'Y') {
                        if (!function_exists('recaptcha_get_html')) {
                            require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/recaptchalib.php';
                        }
                        //End require captcha library
                        # the response from reCAPTCHA
                        $resp = null;
                        # the error code from reCAPTCHA, if any
                        $error = null;
                        ?>
								<p class="event_form_field" id="captcha-<?php 
                        echo $event_id;
                        ?>
"><?php 
                        _e('Anti-Spam Measure: Please enter the following phrase', 'event_espresso');
                        ?>
								<?php 
                        echo recaptcha_get_html($org_options['recaptcha_publickey'], $error);
                        ?>
								</p>
							<?php 
                    }
                    //End use captcha
                    ?>
							<p class="event_form_submit" id="event_form_submit-<?php 
                    echo $event_id;
                    ?>
">

								<input class="btn_event_form_submit" id="event_form_field-<?php 
                    echo $event_id;
                    ?>
" type="submit" name="Submit" value="<?php 
                    _e('Submit', 'event_espresso');
                    ?>
">
							</p>
					<?php 
                }
                break;
        }
        //End Switch statement to check the status of the event
        ?>
			</form>
		</div><?php 
    }
function add_new_attendee($event_id)
{
    if (isset($_REQUEST['regevent_action_admin']) && $_REQUEST['regevent_action_admin'] == 'post_attendee') {
        $attendee_id = event_espresso_add_attendees_to_db();
        // SEND CONFIRMATION EMAIL MESSAGES
        event_espresso_email_confirmations(array('attendee_id' => $attendee_id, 'send_admin_email' => 'true', 'send_attendee_email' => 'true'));
        //echo $attendee_id;
        ?>
<div id="message" class="updated fade">
  <p><strong>
    <?php 
        _e('Added Attendee to Database', 'event_espresso');
        ?>
    </strong></p>
</div>
<?php 
    }
    wp_register_script('reCopy', EVENT_ESPRESSO_PLUGINFULLURL . "scripts/reCopy.js", false, '1.1.0');
    wp_print_scripts('reCopy');
    global $wpdb;
    $sql = "SELECT * FROM " . EVENTS_DETAIL_TABLE . " WHERE is_active='Y' AND event_status != 'D' AND id = '" . $event_id . "' LIMIT 0,1";
    //Build the registration page
    if ($wpdb->get_results($sql)) {
        $events = $wpdb->get_results($sql);
        //These are the variables that can be used throughout the regsitration page
        foreach ($events as $event) {
            $event_id = $event->id;
            $event_name = stripslashes($event->event_name);
            $event_desc = stripslashes($event->event_desc);
            $display_desc = $event->display_desc;
            $event_address = $event->address;
            $event_city = $event->city;
            $event_state = $event->state;
            $event_zip = $event->zip;
            $event_description = stripslashes($event->event_desc);
            $event_identifier = $event->event_identifier;
            $event_cost = isset($event->event_cost) ? $event->event_cost : '';
            $member_only = isset($event->member_only) ? $event->member_only : '';
            $reg_limit = isset($event->reg_limit) ? $event->reg_limit : '';
            $allow_multiple = $event->allow_multiple;
            $start_date = $event->start_date;
            $end_date = $event->end_date;
            $reg_limit = $event->reg_limit;
            $additional_limit = $event->additional_limit;
            $is_active = array();
            $question_groups = unserialize($event->question_groups);
            //This function gets the status of the event.
            $is_active = event_espresso_get_is_active($event_id);
            //If the coupon code system is intalled then use it
            if (function_exists('event_espresso_coupon_registration_page')) {
                $use_coupon_code = $event->use_coupon_code;
            }
            //If the groupon code addon is installed, then use it
            if (function_exists('event_espresso_groupon_payment_page')) {
                $use_groupon_code = $event->use_groupon_code;
            }
            //Set a default value for additional limit
            if ($additional_limit == '') {
                $additional_limit = '5';
            }
        }
        //End foreach ($events as $event)
        //This is the start of the registration form. This is where you can start editing your display.
        $num_attendees = get_number_of_attendees_reg_limit($event_id, 'num_attendees');
        //Get the number of attendees
        $available_spaces = get_number_of_attendees_reg_limit($event_id, 'available_spaces');
        //Gets a count of the available spaces
        $number_available_spaces = get_number_of_attendees_reg_limit($event_id, 'number_available_spaces');
        //Gets the number of available spaces
        ?>
<script>$jaer = jQuery.noConflict();
	jQuery(document).ready(function($jaer) {
	jQuery(function(){
		//Registration form validation
		jQuery('#registration_form').validate();
	});
});

	</script>
<div class="metabox-holder">
  <div class="postbox">
    <div id="event_espressotration_form">
     
        <form method="post" action="<?php 
        echo $_SERVER['REQUEST_URI'];
        ?>
" onsubmit="return validateForm(this)"  id="registration_form">
          <h3 class="h3_event_title" id="h3_event_title-<?php 
        echo $event_id;
        ?>
"><?php 
        echo $event_name;
        ?>
</h3>
           <div  class="padding">
          <p class="start_date">
            <?php 
        _e('Start Date:', 'event_espresso');
        ?>
            <?php 
        echo event_date_display($start_date);
        ?>
</p>
          <p class="event_time">
            <?php 
        $time_selected = '';
        //This block of code is used to display the times of an event in either a dropdown or text format.
        if (!empty($time_selected) && $time_selected == true) {
            //If the customer is coming from a page where the time was preselected.
            echo event_espresso_display_selected_time($time_id);
            //Optional parameters start, end, default
        } else {
            if ($time_selected == false) {
                echo event_espresso_time_dropdown($event_id);
            }
        }
        //End time selected
        ?>
          </p>
          <?php 
        /*
         * Added for seating chart addon
         */
        if (defined('ESPRESSO_SEATING_CHART')) {
            $seating_chart_id = seating_chart::check_event_has_seating_chart($event_id);
            if ($seating_chart_id !== false) {
                ?>
								<p class="event_form_field">
									<label>Select a Seat:</label>
                                    <input type="text" name="seat_id" value="" class="ee_s_select_seat required" title="Please select a seat." event_id="<?php 
                echo $event_id;
                ?>
" readonly="readonly"  />
                           <?php 
                $seating_chart = $wpdb->get_row("select * from " . EVENTS_SEATING_CHART_TABLE . " where id = {$seating_chart_id}");
                if (trim($seating_chart->image_name) != "" && file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'seatingchart/images/' . $seating_chart->image_name)) {
                    ?>
                                    <br/>
                                    <a href="<?php 
                    echo EVENT_ESPRESSO_UPLOAD_URL . 'seatingchart/images/' . $seating_chart->image_name;
                    ?>
" target="_blank">Seating chart image</a>		
                            <?php 
                }
                ?>
                                </p>
          			<?php 
            }
        }
        /*
         * End
         */
        ?>
		  <?php 
        echo event_espresso_add_question_groups($question_groups);
        //Coupons
        if (function_exists('event_espresso_coupon_registration_page')) {
            echo event_espresso_coupon_registration_page($use_coupon_code, $event_id);
        }
        //End coupons display
        //Groupons
        if (function_exists('event_espresso_groupon_registration_page')) {
            echo event_espresso_groupon_registration_page($use_groupon_code, $event_id);
        }
        //End groupons display
        ?>
          <p class="event_form_field">
            <label for="event_cost">
              <?php 
        _e('Amount Paid:', 'event_espresso');
        ?>
            </label>
            <input tabindex="9" type="text" maxlength="10" size="15" name="event_cost" id="event_cost-<?php 
        echo $event_id;
        ?>
" <?php 
        echo $event_cost ? 'value="' . $event_cost . '"' : "";
        ?>
 />
            <input type="hidden" name="regevent_action_admin" id="regevent_action-<?php 
        echo $event_id;
        ?>
" value="post_attendee" />
            <input type="hidden" name="event_id" id="event_id-<?php 
        echo $event_id;
        ?>
" value="<?php 
        echo $event_id;
        ?>
" />
            <input type="hidden" name="admin" value="true" />
          </p>
          <p class="event_form_submit" id="event_form_submit-<?php 
        echo $event_id;
        ?>
">
            <input class="btn_event_form_submit" id="event_form_field-<?php 
        echo $event_id;
        ?>
" type="submit" name="Submit" value="<?php 
        _e('Submit', 'event_espresso');
        ?>
" />
          </p>
          <?php 
        echo event_espresso_additional_attendees($event_id, $additional_limit, $number_available_spaces, __('Number of Tickets', 'event_espresso'), true, $event_meta);
        ?>
        </form>
      </div>
    </div>
  </div>
<?php 
        event_list_attendees();
    }
    //End Build the registration page
}