function event_espresso_run() { global $wpdb, $org_options, $load_espresso_scripts; do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, ''); $load_espresso_scripts = true; //This tells the plugin to load the required scripts ob_start(); //Make sure scripts are loading echo espresso_check_scripts(); // Get action type $regevent_action = isset($_REQUEST['regevent_action']) ? $_REQUEST['regevent_action'] : ''; if (isset($_REQUEST['ee'])) { $regevent_action = "register"; $_REQUEST['event_id'] = $_REQUEST['ee']; } if (isset($_REQUEST['form_action']) && $_REQUEST['form_action'] == 'edit_attendee' || isset($_REQUEST['edit_attendee']) && $_REQUEST['edit_attendee'] == 'true') { $regevent_action = "edit_attendee"; } switch ($regevent_action) { case "register": register_attendees(); break; case "post_attendee": event_espresso_add_attendees_to_db(NULL, NULL, FALSE); break; case "show_shopping_cart": // MER ONLY - This is the form page for registering the attendee event_espresso_require_template('shopping_cart.php'); event_espresso_shopping_cart(); break; case "load_checkout_page": // MER ONLY if ($_POST) { event_espresso_update_item_in_session('details'); } event_espresso_load_checkout_page(); break; case "post_multi_attendee": // MER ONLY event_espresso_update_item_in_session('attendees'); event_espresso_add_attendees_to_db_multi(); break; case "confirm_registration": espresso_confirm_registration(); break; case "edit_attendee": require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/process-registration/attendee_edit_record.php'; attendee_edit_record(); break; default: display_all_events(); } $content = ob_get_contents(); ob_end_clean(); return $content; }
function event_espresso_add_attendees_to_db_multi() { global $wpdb, $org_options; //Added by Imon $primary_registration_id = NULL; $events_in_session = $_SESSION['espresso_session']['events_in_session']; if (event_espresso_invoke_cart_error($events_in_session)) { return false; } $count_of_events = count($events_in_session); $current_session_id = $_SESSION['espresso_session']['id']; //Debug //echo "<pre>", print_r($_SESSION), "</pre>"; //echo '<pre>'.print_r($_POST, true).'</pre>'; //echo "<pre>", print_r($events_in_session), "</pre>"; //echo "<pre>", print_r($org_options), "</pre>"; $event_name = $count_of_events . ' ' . $org_options['organization'] . __(' events', 'event_espresso'); $event_cost = $_SESSION['espresso_session']['grand_total']; $multi_reg = true; // If there are events in the session, add them one by one to the attendee table if ($count_of_events > 0) { //first event key will be used to find the first attendee $first_event_id = key($events_in_session); //Debug //echo '<pre>$events_in_session - '.print_r($events_in_session, true).'</pre>'; reset($events_in_session); foreach ($events_in_session as $key => $_event_id) { //Debug //echo '<p>$_event_id - '. $_event_id.'</p>'; //echo '<pre>'.print_r($_event_id, true).'</pre>'; $event_meta = event_espresso_get_event_meta($key); $event_attendees = $_event_id['event_attendees']; $session_vars['data'] = $_event_id; //Debug //echo '<p>$_event_id - '. $_event_id.'</p>'; //echo '<pre>'.print_r($session_vars['data'], true).'</pre>'; if (is_array($event_attendees)) { $counter = 1; foreach ($event_attendees as $k_price_id => $v_attendees) { //foreach price type in event attendees $session_vars['data'] = $_event_id; //Debug //echo '<pre>$session_vars[\'data\' - ]'.print_r($session_vars['data'], true).'</pre>'; foreach ($v_attendees as $vkey => $vval) { //Added by Imon $vval['price_id'] = $k_price_id; $session_vars['event_attendees'] = $vval; //this has all the attendee information, name, questions.... $session_vars['data']['price_type'] = $_event_id['price_id'][$k_price_id]['price_type']; if (isset($event_meta['additional_attendee_reg_info']) && $event_meta['additional_attendee_reg_info'] == 1) { //Getting he wrong number of attendees at this point //Debug //echo '<p>$_REQUEST[\'num_people\'] - '.$_REQUEST['num_people'].'</p>'; //echo '<p>$_event_id[\'price_id\'][$k_price_id] - '.$_event_id['price_id'][$k_price_id].'</p>'; //echo '<pre>$_event_id[\'price_id\'][$k_price_id] - '.print_r($_event_id['price_id'][$k_price_id]['attendee_quantity'], true).'</pre>'; //echo '<pre>'.print_r($_POST, true).'</pre>'; $num_people = $_event_id['price_id'][$k_price_id]['attendee_quantity']; $session_vars['data']['num_people'] = empty($num_people) || $num_people == 0 ? 1 : $num_people; //Debug //echo '<p>$session_vars[\'data\'][\'num_people\'] - '.$session_vars['data']['num_people'].'</p>'; } //Debug /* echo $key.'<br />'; echo '<pre>$session_vars - '.print_r($session_vars, true).'</pre>'; echo '<br />'; */ $tmp_registration_id = event_espresso_add_attendees_to_db($key, $session_vars); //Debug //echo 'tmp_registration_id =' . $tmp_registration_id.'<br />'; if ($primary_registration_id === NULL) { $primary_registration_id = $tmp_registration_id; } $c2_sql = "select * from " . EVENTS_MULTI_EVENT_REGISTRATION_ID_GROUP_TABLE . " where primary_registration_id = '{$primary_registration_id}' and registration_id = '{$tmp_registration_id}'"; //Debug //echo $c2_sql.'<br />'; $check = $wpdb->get_row($c2_sql); if ($check === NULL) { $tmp_data = array("primary_registration_id" => $primary_registration_id, "registration_id" => $tmp_registration_id); $wpdb->insert(EVENTS_MULTI_EVENT_REGISTRATION_ID_GROUP_TABLE, $tmp_data); } } $counter++; } } } //Post the gateway page with the payment options if ($event_cost != '0.00') { //find first registrant's name, email, count of registrants $sql = "SELECT id, fname, lname, email, address, city, state, zip, event_id, registration_id,\n\t\t\t\t\t\t(SELECT count( id )\n\t\t\t\t\t\t\tFROM " . EVENTS_ATTENDEE_TABLE . " WHERE attendee_session = '" . $wpdb->escape($current_session_id) . "'\n\t\t\t\t\t\t\t) AS quantity\n\t\t\t\t\t\t\tFROM " . EVENTS_ATTENDEE_TABLE . " WHERE event_id = " . $wpdb->escape($first_event_id) . " AND attendee_session = '" . $wpdb->escape($current_session_id) . "' LIMIT 1"; //echo $sql; $r = $wpdb->get_row($sql); $event_id = $r->event_id; $attendee_id = $r->id; $fname = $r->fname; $lname = $r->lname; $address = $r->address; $city = $r->city; $state = $r->state; $zip = $r->zip; $attendee_email = $r->email; $registration_id = $r->registration_id; $quantity = espresso_count_attendees_for_registration($r->registration_id); ?> <?php /* //removing edit links for now...will fix edit attendee page in 3.2 cb #830 <a href="?page_id=<?php echo $org_options['event_page_id']; ?>®event_action=show_shopping_cart"> <?php _e('Edit Cart', 'event_espresso'); ?> </a> <?php _e(' or ', 'event_espresso'); ?> <a href="?page_id=<?php echo $org_options['event_page_id']; ?>®event_action=load_checkout_page"> <?php _e('Edit Registrant Information', 'event_espresso'); ?></a> */ ?> <h3><?php _e('Your registration is not complete until payment is received.', 'event_espresso'); ?> </h3> <p><strong class="event_espresso_name"> <?php _e('Amount due: ', 'event_espresso'); ?> </strong> <span class="event_espresso_value"><?php echo $org_options['currency_symbol']; echo $event_cost; ?> </span></p> <p><?php echo $org_options['email_before_payment'] == 'Y' ? __('A confirmation email has been sent with additional details of your registration.', 'event_espresso') : ''; ?> </p> <?php //Show payment options if (file_exists(EVENT_ESPRESSO_GATEWAY_DIR . "gateway_display.php")) { require_once EVENT_ESPRESSO_GATEWAY_DIR . "gateway_display.php"; } else { require_once EVENT_ESPRESSO_PLUGINFULLPATH . "gateways/gateway_display.php"; } //Check to see if the site owner wants to send an confirmation eamil before payment is recieved. if ($org_options['email_before_payment'] == 'Y') { event_espresso_email_confirmations(array('session_id' => $_SESSION['espresso_session']['id'], 'send_admin_email' => 'true', 'send_attendee_email' => 'true', 'multi_reg' => true)); } } else { ?> <p><?php _e('Thank you! Your registration is confirmed for', 'event_espresso'); ?> <strong><?php echo stripslashes_deep($event_name); ?> </strong></p> <p><?php _e('A confirmation email has been sent with additional details of your registration.', 'event_espresso'); ?> </p> <?php event_espresso_email_confirmations(array('session_id' => $_SESSION['espresso_session']['id'], 'send_admin_email' => 'true', 'send_attendee_email' => 'true', 'multi_reg' => true)); event_espresso_clear_session(); } } }
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 }
function event_espresso_add_attendees_to_db_multi() { //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, ''); global $wpdb, $org_options; if (espresso_verify_recaptcha()) { $primary_registration_id = NULL; $multi_reg = true; $events_in_session = $_SESSION['espresso_session']['events_in_session']; if (event_espresso_invoke_cart_error($events_in_session)) { return false; } $count_of_events = count($events_in_session); $current_session_id = $_SESSION['espresso_session']['id']; $biz_name = $count_of_events . ' ' . $org_options['organization'] . __(' events', 'event_espresso'); $event_cost = $_SESSION['espresso_session']['grand_total']; $event_cost = apply_filters('filter_hook_espresso_cart_grand_total', $event_cost); // If there are events in the session, add them one by one to the attendee table if ($count_of_events > 0) { //first event key will be used to find the first attendee $first_event_id = key($events_in_session); reset($events_in_session); foreach ($events_in_session as $event_id => $event) { $event_meta = event_espresso_get_event_meta($event_id); $session_vars['data'] = $event; if (is_array($event['event_attendees'])) { $counter = 1; //foreach price type in event attendees foreach ($event['event_attendees'] as $price_id => $event_attendees) { $session_vars['data'] = $event; foreach ($event_attendees as $attendee) { $attendee['price_id'] = $price_id; //this has all the attendee information, name, questions.... $session_vars['event_attendees'] = $attendee; $session_vars['data']['price_type'] = $event['price_id'][$price_id]['price_type']; if (isset($event_meta['additional_attendee_reg_info']) && $event_meta['additional_attendee_reg_info'] == 1) { $num_people = (int) $event['price_id'][$price_id]['attendee_quantity']; $session_vars['data']['num_people'] = empty($num_people) || $num_people == 0 ? 1 : $num_people; } // ADD ATTENDEE TO DB $return_data = event_espresso_add_attendees_to_db($event_id, $session_vars, TRUE); $tmp_registration_id = $return_data['registration_id']; $notifications = $return_data['notifications']; if ($primary_registration_id === NULL) { $primary_registration_id = $tmp_registration_id; } $SQL = "SELECT * FROM " . EVENTS_MULTI_EVENT_REGISTRATION_ID_GROUP_TABLE . " "; $SQL .= "WHERE primary_registration_id = %s AND registration_id = %s"; $check = $wpdb->get_row($wpdb->prepare($SQL, $primary_registration_id, $tmp_registration_id)); if ($check === NULL) { $tmp_data = array('primary_registration_id' => $primary_registration_id, 'registration_id' => $tmp_registration_id); $wpdb->insert(EVENTS_MULTI_EVENT_REGISTRATION_ID_GROUP_TABLE, $tmp_data, array('%s', '%s')); } $counter++; } } } } $SQL = "SELECT a.*, ed.id AS event_id, ed.event_name, dc.coupon_code_price, dc.use_percentage "; $SQL .= "FROM " . EVENTS_ATTENDEE_TABLE . " a JOIN " . EVENTS_DETAIL_TABLE . " ed ON a.event_id=ed.id "; $SQL .= "LEFT JOIN " . EVENTS_DISCOUNT_CODES_TABLE . " dc ON a.coupon_code=dc.coupon_code "; $SQL .= "WHERE attendee_session=%s ORDER BY a.id ASC"; $attendees = $wpdb->get_results($wpdb->prepare($SQL, $current_session_id)); //printr( $attendees, '$attendees <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); $quantity = 0; $final_total = 0; $sub_total = 0; $discounted_total = 0; $discount_amount = 0; //$coupon_amount = ! empty($attendees[0]->coupon_code_price) ? $attendees[0]->coupon_code_price : 0; $is_coupon_pct = !empty($attendees[0]->use_percentage) && $attendees[0]->use_percentage == 'Y' ? TRUE : FALSE; //printr( $attendees, '$attendees <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); foreach ($attendees as $attendee) { if ($attendee->is_primary) { $primary_attendee_id = $attendee_id = $attendee->id; $coupon_code = $attendee->coupon_code; $event_id = $attendee->event_id; $fname = $attendee->fname; $lname = $attendee->lname; $address = $attendee->address; $city = $attendee->city; $state = $attendee->state; $zip = $attendee->zip; $attendee_email = $attendee->email; $registration_id = $attendee->registration_id; } $final_total += $attendee->final_price; $sub_total += (int) $attendee->quantity * $attendee->orig_price; $discounted_total += (int) $attendee->quantity * $attendee->final_price; $quantity += (int) $attendee->quantity; //echo '<h2>$attendee->id : ' . $attendee->id . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h2>'; //echo '<h4>$attendee->orig_price : ' . $attendee->orig_price . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; //echo '<h4>$attendee->final_price : ' . $attendee->final_price . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; //echo '<h4>$attendee->quantity : ' . (int)$attendee->quantity . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; //echo '<h4>$sub_total : ' . $sub_total . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; //echo '<h4>$discounted_total : ' . $discounted_total . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; } $discount_amount = $sub_total - $discounted_total; $total_cost = $discounted_total; //echo '<h4>$discount_amount : ' . $discount_amount . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; //echo '<h4>$total_cost : ' . $total_cost . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; //echo '<h4>$final_total : ' . $final_total . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4><br/>'; $total_cost = $total_cost < 0 ? 0.0 : (double) $total_cost; if (function_exists('espresso_update_attendee_coupon_info') && $primary_attendee_id && !empty($attendee->coupon_code)) { espresso_update_attendee_coupon_info($primary_attendee_id, $attendee->coupon_code); } if (function_exists('espresso_update_groupon') && $primary_attendee_id && !empty($coupon_code)) { espresso_update_groupon($primary_attendee_id, $coupon_code); } espresso_update_primary_attendee_total_cost($primary_attendee_id, $total_cost, __FILE__); //echo '<h4>$total_cost : ' . $total_cost . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; if (!empty($notifications['coupons']) || !empty($notifications['groupons'])) { echo '<div id="event_espresso_notifications" class="clearfix event-data-display no-hide">'; echo $notifications['coupons']; // add space between $coupon_notifications and $groupon_notifications ( if any $groupon_notifications exist ) echo !empty($notifications['coupons']) && !empty($notifications['groupons']) ? '<br/>' : ''; echo $notifications['groupons']; echo '</div>'; } //Post the gateway page with the payment options if ($total_cost > 0) { ?> <div class="espresso_payment_overview event-display-boxes ui-widget" > <h3 class="section-heading ui-widget-header ui-corner-top"> <?php _e('Payment Overview', 'event_espresso'); ?> </h3> <div class="event-data-display ui-widget-content ui-corner-bottom" > <div class="event-messages ui-state-highlight"> <span class="ui-icon ui-icon-alert"></span> <p class="instruct"> <?php _e('Your registration is not complete until payment is received.', 'event_espresso'); ?> </p> </div> <p><?php echo $org_options['email_before_payment'] == 'Y' ? __('A confirmation email has been sent with additional details of your registration.', 'event_espresso') : ''; ?> </p> <table> <?php foreach ($attendees as $attendee) { ?> <tr> <td width="70%"> <?php echo '<strong>' . stripslashes_deep($attendee->event_name) . '</strong>'; ?> - <?php echo stripslashes_deep($attendee->price_option); ?> <?php echo $attendee->final_price < $attendee->orig_price ? '<br /> <span style="font-size:.8em;">' . $org_options['currency_symbol'] . number_format($attendee->orig_price - $attendee->final_price, 2) . __(' discount per registration', 'event_espresso') . '</span>' : ''; ?> <br/> <?php echo __('Attendee:', 'event_espresso') . ' ' . stripslashes_deep($attendee->fname . ' ' . $attendee->lname); ?> </td> <td width="10%"><?php echo $org_options['currency_symbol'] . number_format($attendee->final_price, 2); ?> </td> <td width="10%"><?php echo 'x ' . (int) $attendee->quantity; ?> </td> <td width="10%" style="text-align:right;"><?php echo $org_options['currency_symbol'] . number_format($attendee->final_price * (int) $attendee->quantity, 2); ?> </td> </tr> <?php } ?> <tr> <td colspan="3"><?php _e('Sub-Total:', 'event_espresso'); ?> </td> <td colspan="" style="text-align:right"><?php echo $org_options['currency_symbol'] . number_format($sub_total, 2); ?> </td> </tr> <?php if (!empty($discount_amount)) { ?> <tr> <td colspan="3"><?php _e('Total Discounts:', 'event_espresso'); ?> </td> <td colspan="" style="text-align:right"><?php echo '-' . $org_options['currency_symbol'] . number_format($discount_amount, 2); ?> </td> </tr> <?php } ?> <tr> <td colspan="3"><strong class="event_espresso_name"> <?php _e('Total Amount due: ', 'event_espresso'); ?> </strong></td> <td colspan="" style="text-align:right"><?php echo $org_options['currency_symbol']; echo number_format($total_cost, 2); ?> </td> </tr> </table> <p class="event_espresso_refresh_total"> <a href="?page_id=<?php echo $org_options['event_page_id']; ?> ®event_action=show_shopping_cart"> <?php _e('Edit Cart', 'event_espresso'); ?> </a> <?php _e(' or ', 'event_espresso'); ?> <a href="?page_id=<?php echo $org_options['event_page_id']; ?> ®istration_id=<?php echo $registration_id; ?> &id=<?php echo $attendee_id; ?> ®event_action=edit_attendee&primary=<?php echo $primary_attendee_id; ?> &event_id=<?php echo $event_id; ?> &attendee_num=1"> <?php _e('Edit Registrant Information', 'event_espresso'); ?> </a> </p> </div> </div> <br/><br/> <?php //Show payment options if (file_exists(EVENT_ESPRESSO_GATEWAY_DIR . "gateway_display.php")) { require_once EVENT_ESPRESSO_GATEWAY_DIR . "gateway_display.php"; } else { require_once EVENT_ESPRESSO_PLUGINFULLPATH . "gateways/gateway_display.php"; } //Check to see if the site owner wants to send an confirmation eamil before payment is recieved. if ($org_options['email_before_payment'] == 'Y') { event_espresso_email_confirmations(array('session_id' => $_SESSION['espresso_session']['id'], 'send_admin_email' => 'true', 'send_attendee_email' => 'true', 'multi_reg' => true)); } } elseif ($total_cost == 0.0) { ?> <p> <?php _e('Thank you! Your registration is confirmed for', 'event_espresso'); ?> <strong><?php echo stripslashes_deep($biz_name); ?> </strong></p> <p> <?php _e('A confirmation email has been sent with additional details of your registration.', 'event_espresso'); ?> </p> <?php event_espresso_email_confirmations(array('session_id' => $_SESSION['espresso_session']['id'], 'send_admin_email' => 'true', 'send_attendee_email' => 'true', 'multi_reg' => true)); event_espresso_clear_session(); } } } }
function event_espresso_run() { global $wpdb, $org_options, $load_espresso_scripts, $espresso_content; do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, ''); $load_espresso_scripts = true; //This tells the plugin to load the required scripts ob_start(); //Make sure scripts are loading echo espresso_check_scripts(); // Get action type $regevent_action = isset($_REQUEST['regevent_action']) ? $_REQUEST['regevent_action'] : ''; if (isset($_REQUEST['event_id']) && !empty($_REQUEST['event_id'])) { $_REQUEST['event_id'] = wp_strip_all_tags(absint($_REQUEST['event_id'])); } if (isset($_REQUEST['form_action']) && !empty($_REQUEST['form_action'])) { if (isset($_REQUEST['form_action']) && !$_REQUEST['form_action'] == 'edit_attendee') { $_REQUEST['primary'] = wp_strip_all_tags(absint($_REQUEST['primary'])); } } if (isset($_REQUEST['ee']) && !empty($_REQUEST['ee'])) { $regevent_action = "register"; $_REQUEST['ee'] = wp_strip_all_tags(absint($_REQUEST['ee'])); $_REQUEST['event_id'] = $_REQUEST['ee']; } if (isset($_REQUEST['form_action']) && $_REQUEST['form_action'] == 'edit_attendee' || isset($_REQUEST['edit_attendee']) && $_REQUEST['edit_attendee'] == 'true') { $regevent_action = "edit_attendee"; } switch ($regevent_action) { case "register": register_attendees(); break; case "post_attendee": //Various attendee functions require_once "includes/functions/attendee_functions.php"; //Add attendees to the database require_once "includes/process-registration/add_attendees_to_db.php"; //Payment/Registration Processing - Used to display the payment options and the payment link in the email. Used with the [ESPRESSO_PAYMENTS] tag require_once "includes/process-registration/payment_page.php"; event_espresso_add_attendees_to_db(NULL, NULL, FALSE); break; case "show_shopping_cart": // MER ONLY - This is the form page for registering the attendee event_espresso_require_template('shopping_cart.php'); event_espresso_shopping_cart(); break; case "load_checkout_page": // MER ONLY if ($_POST) { event_espresso_update_item_in_session('details'); } event_espresso_load_checkout_page(); break; case "post_multi_attendee": // MER ONLY //Various attendee functions require_once "includes/functions/attendee_functions.php"; //Add attendees to the database require_once "includes/process-registration/add_attendees_to_db.php"; event_espresso_update_item_in_session('attendees'); event_espresso_add_attendees_to_db_multi(); break; case "confirm_registration": //Various attendee functions require_once "includes/functions/attendee_functions.php"; //Payment/Registration Processing - Used to display the payment options and the payment link in the email. Used with the [ESPRESSO_PAYMENTS] tag require_once "includes/process-registration/payment_page.php"; espresso_confirm_registration(); break; case "edit_attendee": //Various attendee functions require_once "includes/functions/attendee_functions.php"; //Payment/Registration Processing - Used to display the payment options and the payment link in the email. Used with the [ESPRESSO_PAYMENTS] tag require_once "includes/process-registration/payment_page.php"; require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/process-registration/attendee_edit_record.php'; attendee_edit_record(); break; default: display_all_events(); } $content = ob_get_contents(); ob_end_clean(); $espresso_content = $content; add_shortcode('ESPRESSO_EVENTS', 'espresso_return_espresso_content'); }
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 }
function event_espresso_run() { global $wpdb, $org_options, $load_espresso_scripts; $load_espresso_scripts = true; //This tells the plugin to load the required scripts ob_start(); //Make sure scripts are loading echo espresso_check_scripts(); // Get action type $regevent_action = isset($_REQUEST['regevent_action']) ? $_REQUEST['regevent_action'] : ''; if (isset($_REQUEST['ee'])) { $regevent_action = "register"; $_REQUEST['event_id'] = $_REQUEST['ee']; } if (isset($_REQUEST['edit_attendee'])) { $regevent_action = "register"; } switch ($regevent_action) { case "post_attendee": event_espresso_add_attendees_to_db(); break; case "register": register_attendees(); break; case "add_to_session": break; case "show_shopping_cart": //This is the form page for registering the attendee event_espresso_require_template('shopping_cart.php'); event_espresso_shopping_cart(); break; case "load_checkout_page": if ($_POST) { event_espresso_calculate_total('details'); } event_espresso_load_checkout_page(); break; case "post_multi_attendee": //echo " YESssss"; event_espresso_update_item_in_session('attendees'); event_espresso_add_attendees_to_db_multi(); break; default: display_all_events(); } $content = ob_get_contents(); ob_end_clean(); return $content; }