/** * Checks if the specified event still has $tickets_requested available, and returns true or false. * Takes into account INCOMPLETE registrations for a few minutes (specified by admin by the "Ticket Reservation Time". * @param int $event_id * @param array $data_source like $_POST * @return boolean */ function espresso_verify_sufficient_remaining_tickets($event_id, $data_source) { //query for availables spaces, counting INCOMPLETE tickets being purchased by OTHERS within the last X //minutes as being 'reserved' $available_spaces = get_number_of_attendees_reg_limit($event_id, 'number_available_spaces'); $tickets_requested = espresso_count_tickets_requested($data_source); if ($available_spaces >= $tickets_requested) { return true; } else { //the global $only_show_event_full_message_once_for is ONLY used here. //it is used to make sure that for MER, we only show this message once per event //because code will pass through this function once for EACH attendee global $wpdb, $only_show_event_full_message_once_for; $event_name = $wpdb->get_var($wpdb->prepare("SELECT event_name FROM " . EVENTS_DETAIL_TABLE . " WHERE id=%d", $event_id)); if ($only_show_event_full_message_once_for[$event_id]) { echo '<div class="attention-icon"><p class="event_espresso_attention"><strong>' . sprintf(__('Sorry, you have requested %1$d ticket(s) for \'%2$s\', but only %3$d remains(s). ', 'event_espresso'), $tickets_requested, $event_name, $available_spaces) . __("All other tickets for this event have been sold, or are being purchased. You may want to try registering later, in case someone doesn't finish registering or cancels", "event_espresso") . '</strong></p></div>'; } $only_show_event_full_message_once_for[$event_id] = true; return false; } }
function espresso_get_table($sql) { global $wpdb, $org_options; //echo 'This page is located in ' . get_option( 'upload_path' ); $event_page_id = $org_options['event_page_id']; $currency_symbol = $org_options['currency_symbol']; $events = $wpdb->get_results($sql); $category_name = $wpdb->last_result[0]->category_name; $category_desc = $wpdb->last_result[0]->category_desc; $display_desc = $wpdb->last_result[0]->display_desc; if ($display_desc == 'Y') { echo '<p>' . stripslashes_deep($category_name) . '</p>'; echo '<p>' . stripslashes_deep($category_desc) . '</p>'; } ?> <table class="espresso-table" width="100%"> <thead class="espresso-table-header-row"> <tr> <th class="th-group"><?php _e('Course', 'event_espresso'); ?> </th> <th class="th-group"><?php _e('Location', 'event_espresso'); ?> </th> <th class="th-group"><?php _e('City', 'event_espresso'); ?> </th> <th class="th-group"><?php _e('State', 'event_espresso'); ?> </th> <th class="th-group"><?php _e('Date', 'event_espresso'); ?> </th> <th class="th-group"><?php _e('Time', 'event_espresso'); ?> </th> <th class="th-group"><?php _e('', 'event_espresso'); ?> </th> </tr> </thead> <tbody> <?php foreach ($events as $event) { $reg_limit = $event->reg_limit; $event_desc = wpautop($event->event_desc); $register_button = '<a id="a_register_link-' . $event->id . '" href="' . get_option('siteurl') . '/?page_id=' . $event_page_id . '®event_action=register&event_id=' . $event->id . '&name_of_event=' . stripslashes_deep($event->event_name) . '">Register</a>'; //Check to see how many open spots are available $open_spots = get_number_of_attendees_reg_limit($event->id, 'available_spaces') == 'Unlimited' ? 999 : get_number_of_attendees_reg_limit($event->id, 'available_spaces'); //echo $open_spots; if ($open_spots < 1) { $live_button = 'Closed'; } ?> <tr class="espresso-table-row"> <td class="td-group"> <?php echo $event->event_name; ?> </td> <td class="td-group"> <?php echo $event->address; ?> </td> <td class="td-group"> <?php echo $event->city; ?> </td> <td class="td-group"> <?php echo $event->state; ?> </td> <td class="td-group"> <?php echo event_date_display($event->start_date, $format = 'l, M d, Y'); ?> </td> <td class="td-group"> <?php echo espresso_event_time($event->id, 'start_time', get_option('time_format')); ?> </td> <td class="td-group"> <?php echo $register_button; ?> </td> </tr> <?php } //close foreach ?> </tbody> </table> <?php }
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 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_edit_list() { global $wpdb, $org_options; define('EVT_ADMIN_URL', admin_url('admin.php?page=events')); $max_rows = isset($_REQUEST['max_rows']) & !empty($_REQUEST['max_rows']) ? absint($_REQUEST['max_rows']) : 50; $start_rec = isset($_REQUEST['start_rec']) && !empty($_REQUEST['start_rec']) ? absint($_REQUEST['start_rec']) : 0; $records_to_show = " LIMIT {$max_rows} OFFSET {$start_rec} "; //Dates $curdate = date('Y-m-d'); $this_year_r = date('Y'); $this_month_r = date('m'); $days_this_month = date('t', strtotime($curdate)); $month_range = isset($_REQUEST['month_range']) && !empty($_REQUEST['month_range']) ? sanitize_text_field($_REQUEST['month_range']) : FALSE; $category_id = isset($_REQUEST['category_id']) && !empty($_REQUEST['category_id']) ? sanitize_text_field($_REQUEST['category_id']) : FALSE; $today_filter = isset($_REQUEST['today']) && $_REQUEST['today'] == 'true' ? TRUE : FALSE; $this_month_filter = isset($_REQUEST['this_month']) && $_REQUEST['this_month'] == 'true' ? TRUE : FALSE; $event_status = isset($_POST['event_status']) && !empty($_POST['event_status']) ? sanitize_text_field($_REQUEST['event_status']) : FALSE; if (isset($_POST['delete_event'])) { if (is_array($_POST['checkbox'])) { while (list($key, $value) = each($_POST['checkbox'])) { $del_id = $key; event_espresso_delete_event($del_id); } } ?> <div id="message" class="updated fade"> <p><strong> <?php _e('Event(s) have been permanently deleted.', 'event_espresso'); ?> </strong></p> </div> <?php } if (isset($_POST['perm_delete_event'])) { if (is_array($_POST['checkbox'])) { while (list($key, $value) = each($_POST['checkbox'])) { $del_id = $key; event_espresso_empty_event_trash($del_id); } } ?> <div id="message" class="updated fade"> <p><strong> <?php _e('Event(s) have been permanently deleted.', 'event_espresso'); ?> </strong></p> </div> <?php } $recurrence_icon = ''; if (defined('EVENT_ESPRESSO_RECURRENCE_MODULE_ACTIVE')) { $recurrence_icon = '<img src="' . EVENT_ESPRESSO_PLUGINFULLURL . 'images/arrow_rotate_clockwise.png" alt="Recurring Event" title="Recurring Event" class="re_fr" />'; } require_once 'queries.php'; if (file_exists(EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/admin_reports_filters.php')) { require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/admin_reports_filters.php'; } else { echo '<p><strong>' . __('Advanced filters are now available in the premium versions.', 'event_espresso') . '</strong> <a href="http://eventespresso.com/download/" target="_blank">' . __('Upgrade Now!', 'event_espresso') . '</a></p>'; //$total_events = espresso_total_events(); } if ($month_range !== FALSE) { $pieces = explode('-', $month_range, 3); $year_r = $pieces[0]; $month_r = $pieces[1]; } $group = ''; $sql = ''; //Check if the venue manager is turned on $use_venue_manager = isset($org_options['use_venue_manager']) && $org_options['use_venue_manager'] == 'Y' ? TRUE : FALSE; $is_regional_manager = FALSE; //This checks to see if the user is a regional manager and creates a union to join the events that are in the users region based on the venue/locale combination if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_group_admin') { $is_regional_manager = TRUE; $group = get_user_meta(espresso_member_data('id'), "espresso_group", TRUE); if ($group != '0' && !empty($group)) { $sql = "(SELECT e.id event_id, e.event_name, e.event_identifier, e.reg_limit, e.registration_start, "; $sql .= " e.start_date, e.is_active, e.recurrence_id, e.registration_startT, e.wp_user "; //Get the venue information if ($use_venue_manager) { $sql .= ", v.name AS venue_title, v.address AS venue_address, v.address2 AS venue_address2, v.city AS venue_city, v.state AS venue_state, v.zip AS venue_zip, v.country AS venue_country "; } else { $sql .= ", e.venue_title, e.phone, e.address, e.address2, e.city, e.state, e.zip, e.country "; } //Get the locale fields if ($use_venue_manager) { $sql .= ", lc.name AS locale_name, e.wp_user "; } $sql .= " FROM " . EVENTS_DETAIL_TABLE . " e "; //Join the categories if ($today_filter) { $sql .= " JOIN " . EVENTS_CATEGORY_REL_TABLE . " cr ON cr.event_id = e.id "; $sql .= " JOIN " . EVENTS_CATEGORY_TABLE . " c ON c.id = cr.cat_id "; } //Join the venues and locales if (!empty($group) && $use_venue_manager) { $sql .= " LEFT JOIN " . EVENTS_VENUE_REL_TABLE . " vr ON vr.event_id = e.id "; $sql .= " LEFT JOIN " . EVENTS_VENUE_TABLE . " v ON v.id = vr.venue_id "; $sql .= " LEFT JOIN " . EVENTS_LOCALE_REL_TABLE . " l ON l.venue_id = vr.venue_id "; $sql .= " LEFT JOIN " . EVENTS_LOCALE_TABLE . " lc ON lc.id = l.locale_id "; } //Event status filter $sql .= $event_status !== FALSE && $event_status != 'IA' ? " WHERE e.event_status = '" . $event_status . "' " : " WHERE e.event_status != 'D' "; //Category filter $sql .= $category_id !== FALSE ? " AND c.id = '" . $category_id . "' " : ''; //Find events in the locale $sql .= !empty($group) && $use_venue_manager == true ? " AND l.locale_id IN (" . implode(",", $group) . ") " : ''; //Month filter if ($month_range !== FALSE) { $sql .= " AND e.start_date BETWEEN '" . date('Y-m-d', strtotime($year_r . '-' . $month_r . '-01')) . "' AND '" . date('Y-m-d', strtotime($year_r . '-' . $month_r . '-31')) . "' "; } //Todays events filter if ($today_filter) { $sql .= " AND e.start_date = '" . $curdate . "' "; } //This months events filter if ($this_month_filter) { $sql .= " AND e.start_date BETWEEN '" . date('Y-m-d', strtotime($this_year_r . '-' . $this_month_r . '-01')) . "' AND '" . date('Y-m-d', strtotime($this_year_r . '-' . $this_month_r . '-' . $days_this_month)) . "' "; } $sql .= ") UNION "; } } //This is the standard query to retrieve the events $sql .= "(SELECT e.id event_id, e.event_name, e.event_identifier, e.reg_limit, e.registration_start, "; $sql .= " e.start_date, e.is_active, e.recurrence_id, e.registration_startT, e.wp_user "; //Get the venue information if ($use_venue_manager) { //If using the venue manager, we need to get those fields $sql .= ", v.name AS venue_title, v.address AS venue_address, v.address2 AS venue_address2, v.city AS venue_city, v.state AS venue_state, v.zip AS venue_zip, v.country AS venue_country "; } else { //Otherwise we need to get the address fields from the individual events $sql .= ", e.venue_title, e.phone, e.address, e.address2, e.city, e.state, e.zip, e.country "; } //get the locale fields if ($is_regional_manager && $use_venue_manager) { $sql .= ", lc.name AS locale_name, e.wp_user "; } $sql .= " FROM " . EVENTS_DETAIL_TABLE . " e "; //Join the categories if ($category_id != FALSE) { $sql .= " JOIN " . EVENTS_CATEGORY_REL_TABLE . " cr ON cr.event_id = e.id "; $sql .= " JOIN " . EVENTS_CATEGORY_TABLE . " c ON c.id = cr.cat_id "; } //Join the venues if ($use_venue_manager == true) { $sql .= " LEFT JOIN " . EVENTS_VENUE_REL_TABLE . " vr ON vr.event_id = e.id "; $sql .= " LEFT JOIN " . EVENTS_VENUE_TABLE . " v ON v.id = vr.venue_id "; } //Join the locales if (isset($is_regional_manager) && $is_regional_manager == true && $use_venue_manager == true) { $sql .= " LEFT JOIN " . EVENTS_LOCALE_REL_TABLE . " l ON l.venue_id = vr.venue_id "; $sql .= " LEFT JOIN " . EVENTS_LOCALE_TABLE . " lc ON lc.id = l.locale_id "; } //Event status filter $sql .= isset($_POST['event_status']) && ($_POST['event_status'] != '' && $_POST['event_status'] != 'IA') ? " WHERE e.event_status = '" . $_POST['event_status'] . "' " : " WHERE e.event_status != 'D' "; //Category filter $sql .= $category_id !== FALSE ? " AND c.id = '" . $category_id . "' " : ''; //Month filter if ($_POST['month_range'] != '') { $sql .= " AND e.start_date BETWEEN '" . date('Y-m-d', strtotime($year_r . '-' . $month_r . '-01')) . "' AND '" . date('Y-m-d', strtotime($year_r . '-' . $month_r . '-31')) . "' "; } //Todays events filter if (isset($_REQUEST['today']) && $_REQUEST['today'] == 'true') { $sql .= " AND e.start_date = '" . $curdate . "' "; } //This months events filter if (isset($_REQUEST['this_month']) && $_REQUEST['this_month'] == 'true') { $sql .= " AND e.start_date BETWEEN '" . date('Y-m-d', strtotime($this_year_r . '-' . $this_month_r . '-01')) . "' AND '" . date('Y-m-d', strtotime($this_year_r . '-' . $this_month_r . '-' . $days_this_month)) . "' "; } //If user is an event manager, then show only their events if (function_exists('espresso_member_data') && (espresso_member_data('role') == 'espresso_event_manager' || espresso_member_data('role') == 'espresso_group_admin')) { $sql .= " AND e.wp_user = '******'id') . "' "; } $sql .= ") ORDER BY start_date DESC "; $sql .= $records_to_show; $events = $wpdb->get_results($sql); $total_events = $wpdb->num_rows; ?> <form id="event-admin-list-page-select-frm" name="event_admin_list_page_select_frm" method="post" action="<?php echo EVT_ADMIN_URL; ?> "> <div id="event-admin-list-page-select-dv" class="admin-list-page-select-dv"> <input name="navig" value="<?php _e('Retrieve', 'event_espresso'); ?> " type="submit" class="button-secondary"> <?php $rows = array(50 => 50, 100 => 100, 250 => 250, 500 => 500, 100000 => 'all'); ?> <select name="max_rows" size="1"> <?php foreach ($rows as $key => $value) { ?> <?php $selected = $key == $max_rows ? ' selected="selected"' : ''; ?> <option value="<?php echo $key; ?> "<?php echo $selected; ?> ><?php echo $value; ?> </option> <?php } ?> </select> <?php _e('rows from the db at a time', 'event_espresso'); ?> <input name="start_rec" value="<?php echo $start_rec; ?> " class="textfield" type="hidden"> <?php if ($start_rec > 0 && $max_rows < 100000) { $prev_rows = $start_rec > $max_rows ? $start_rec - $max_rows - 1 : 0; $prev_rows_url = add_query_arg(array('max_rows' => $max_rows, 'start_rec' => $prev_rows), EVT_ADMIN_URL); ?> <a id="event-admin-load-prev-rows-btn" href="<?php echo $prev_rows_url; ?> " title="load prev rows" class="button-secondary"> <?php echo __('Previous', 'event_espresso') . ' ' . $max_rows . ' ' . __('rows', 'event_espresso'); ?> </a> <?php } ?> <?php if ($total_events >= $max_rows && $max_rows < 100000) { $next_rows = $start_rec + $max_rows + 1; $next_rows_url = add_query_arg(array('max_rows' => $max_rows, 'start_rec' => $next_rows), EVT_ADMIN_URL); ?> <a id="event-admin-load-next-rows-btn" href="<?php echo $next_rows_url; ?> " title="load next rows" class="button-secondary"> <?php echo __('Next', 'event_espresso') . ' ' . $max_rows . ' ' . __('rows', 'event_espresso'); ?> </a> <?php } ?> </div> </form> <form id="form1" name="form1" method="post" action="admin.php?page=events<?php //echo $_SERVER["REQUEST_URI"] ?> "> <table id="table" class="widefat event-list" width="100%"> <thead> <tr> <th class="manage-column column-cb check-column" id="cb" scope="col" style="width:28px;"><input type="checkbox"></th> <th class="manage-column column-comments num" id="id" style="padding-top:7px; width:3%;" scope="col" title="Click to Sort"> <span><?php _e('ID', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-title" id="name" scope="col" title="Click to Sort" style="width:26%;"> <span><?php _e('Name', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-title" id="name" scope="col" title="Click to Sort" style="width:12%;"> <span><?php _e('Venue', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-author" id="start" scope="col" title="Click to Sort" style="width:12%;"> <span><?php _e('Start Date', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-author" id="start" scope="col" title="Click to Sort" style="width:10%;"> <span><?php _e('Start Time', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-date" id="dow" scope="col" title="Click to Sort" style="width:6%;";> <span><?php _e('DoW', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-date" id="begins" scope="col" title="Click to Sort" style="width:12%;"> <span><?php _e('Reg Begins', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-date" id="status" scope="col" title="Click to Sort" style="width:10%;"> <span><?php _e('Status', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <?php if (function_exists('espresso_is_admin') && espresso_is_admin() == true && $espresso_premium == true) { ?> <th class="manage-column column-date" id="status" scope="col" title="Click to Sort" style="width:10%;"> <span><?php _e('Creator', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <?php } ?> <th class="manage-column column-date" id="attendees" scope="col" title="Click to Sort" style="width:9%;"> <span><?php _e('Attendees', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-author" id="actions" scope="col" style="width:25%;"> <?php _e('Actions', 'event_espresso'); ?> </th> </tr> </thead> <tbody> <?php if ($total_events > 0) { foreach ($events as $event) { //print_r ($event); $event_id = $event->event_id; $event_name = stripslashes_deep($event->event_name); $event_identifier = stripslashes_deep($event->event_identifier); $reg_limit = isset($event->reg_limit) ? $event->reg_limit : ''; $registration_start = isset($event->registration_start) ? $event->registration_start : ''; $start_date = isset($event->start_date) ? $event->start_date : ''; $end_date = isset($event->end_date) ? $event->end_date : ''; $is_active = isset($event->is_active) ? $event->is_active : ''; $status = array(); $status = event_espresso_get_is_active($event_id); $recurrence_id = isset($event->recurrence_id) ? $event->recurrence_id : ''; $registration_startT = isset($event->registration_startT) ? $event->registration_startT : ''; $event_address = isset($event->address) ? $event->address : ''; $event_address2 = isset($event->address2) ? $event->address2 : ''; $event_city = isset($event->city) ? $event->city : ''; $event_state = isset($event->state) ? $event->state : ''; $event_zip = isset($event->zip) ? $event->zip : ''; $event_country = isset($event->country) ? $event->country : ''; //added new $venue_title = isset($event->venue_title) ? $event->venue_title : ''; $venue_locale = isset($event->locale_name) ? $event->locale_name : ''; $wp_user = isset($event->wp_user) ? $event->wp_user : ''; $location = (!empty($event_address) ? $event_address : '') . (!empty($event_address2) ? '<br />' . $event_address2 : '') . (!empty($event_city) ? '<br />' . $event_city : '') . (!empty($event_state) ? ', ' . $event_state : '') . (!empty($event_zip) ? '<br />' . $event_zip : '') . (!empty($event_country) ? '<br />' . $event_country : ''); $dow = date("D", strtotime($start_date)); ob_start(); ?> <tr> <td class="check-column" style="padding:7px 0 22px 7px; vertical-align:top;"><!--Delete Events--> <?php echo '<input name="checkbox[' . $event_id . ']" type="checkbox" title="Delete Event ' . $event_name . '" />'; ?> </td> <td class="column-comments" style="padding-top:3px;"><?php echo $event_id; ?> </td> <td class="post-title page-title"><strong><a class="row-title" href="admin.php?page=events&action=edit&event_id=<?php echo $event_id; ?> "><?php echo $event_name; ?> </a> <?php echo $recurrence_id > 0 ? $recurrence_icon : ''; ?> </strong> <div class="row-actions"><span><a href="<?php echo espresso_reg_url($event_id); ?> " target="_blank"><?php _e('View', 'event_espresso'); ?> </a> | </span><span class='edit'><a href="admin.php?page=events&action=edit&event_id=<?php echo $event_id; ?> "><?php _e('Edit', 'event_espresso'); ?> </a> | </span><span class='delete'><a onclick="return confirmDelete();" href='admin.php?page=events&action=delete&event_id=<?php echo $event_id; ?> '><?php _e('Delete', 'event_espresso'); ?> </a></span> | <span><a href="admin.php?page=events&event_admin_reports=list_attendee_payments&event_id=<?php echo $event_id; ?> "><?php _e('Attendees', 'event_espresso'); ?> </a> | </span><span><a href="#" onclick="window.location='<?php echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&event_id=" . $event_id . "&export=report&action=payment&type=excel"; ?> '" title="<?php _e('Export to Excel', 'event_espresso'); ?> "><?php _e('Export', 'event_espresso'); ?> </a></span></div></td> <td class="author"><?php echo $venue_title != '' ? $venue_title : ''; echo $venue_locale != '' ? '<br />[' . $venue_locale . ']' : ''; ?> </td> <td class="author"><?php echo event_date_display($start_date, get_option('date_format')); ?> </td> <td class="author"><?php echo event_espresso_get_time($event_id, 'start_time'); ?> </td> <td class="date"><?php echo $dow; ?> </td> <td class="date"><?php echo event_date_display($registration_start, get_option('date_format')); ?> <br /> <?php echo $registration_startT; ?> </td> <td class="date"><?php echo $status['display']; ?> </td> <?php if (function_exists('espresso_is_admin') && espresso_is_admin() == true && $espresso_premium == true) { $user_company = espresso_user_meta($wp_user, 'company') != '' ? espresso_user_meta($wp_user, 'company') : ''; $user_organization = espresso_user_meta($wp_user, 'organization') != '' ? espresso_user_meta($wp_user, 'organization') : ''; $user_co_org = $user_company != '' ? $user_company : $user_organization; ?> <td class="date"><?php echo espresso_user_meta($wp_user, 'user_firstname') != '' ? espresso_user_meta($wp_user, 'user_firstname') . ' ' . espresso_user_meta($wp_user, 'user_lastname') . ' (<a href="user-edit.php?user_id=' . $wp_user . '">' . espresso_user_meta($wp_user, 'user_nicename') . '</a>)' : espresso_user_meta($wp_user, 'display_name') . ' (<a href="user-edit.php?user_id=' . $wp_user . '">' . espresso_user_meta($wp_user, 'user_nicename') . '</a>)'; ?> <?php echo $user_co_org != '' ? '<br />[' . espresso_user_meta($wp_user, 'company') . ']' : ''; ?> </td> <?php } ?> <td class="author"><a href="admin.php?page=events&event_admin_reports=list_attendee_payments&event_id=<?php echo $event_id; ?> "><?php echo get_number_of_attendees_reg_limit($event_id, 'num_attendees_slash_reg_limit'); ?> </a></td> <td class="date"><div style="width:180px;"><a href="<?php echo espresso_reg_url($event_id); ?> " title="<?php _e('View Event', 'event_espresso'); ?> " target="_blank"><div class="view_btn"></div></a> <a href="admin.php?page=events&action=edit&event_id=<?php echo $event_id; ?> " title="<?php _e('Edit Event', 'event_espresso'); ?> "><div class="edit_btn"></div></a> <a href="admin.php?page=events&event_id=<?php echo $event_id; ?> &event_admin_reports=list_attendee_payments" title="<?php _e('View Attendees', 'event_espresso'); ?> "><div class="complete_btn"></div></a> <a href="admin.php?page=events&event_admin_reports=charts&event_id=<?php echo $event_id; ?> " title="<?php _e('View Report', 'event_espresso'); ?> "><div class="reports_btn"></div></a> <a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=unique_id_info_<?php echo $event_id; ?> " title="<?php _e('Get Short URL/Shortcode', 'event_espresso'); ?> "><div class="shortcode_btn"></div></a> <a href="#" onclick="window.location='<?php echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&event_id=" . $event_id . "&export=report&action=payment&type=excel"; ?> '" title="<?php _e('Export to Excel', 'event_espresso'); ?> "><div class="excel_exp_btn"></div></a> <a href="#" onclick="window.location='<?php echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&event_id=" . $event_id . "&export=report&action=payment&type=csv"; ?> '" title="<?php _e('Export to CSV', 'event_espresso'); ?> "><div class="csv_exp_btn"></div></a> <a href="admin.php?page=events&event_admin_reports=event_newsletter&event_id=<?php echo $event_id; ?> " title="<?php _e('Email Attendees', 'event_espresso'); ?> "><div class="newsletter_btn"></div></a></div> <div id="unique_id_info_<?php echo $event_id; ?> " style="display:none"> <?php _e('<h2>Short URL/Shortcode</h2><p>This is the short URL to this event:</p><p><span class="updated fade">' . espresso_reg_url($event_id) . '</span></p><p>This will show the registration form for this event just about anywhere. Copy and paste the following shortcode into any page or post.</p><p><span class="updated fade">[SINGLEEVENT single_event_id="' . $event_identifier . '"]</span></p> <p class="red_text"> Do not use in place of the main events page that is set in the Organization Settings page.', 'event_espresso'); ?> </div></td> </tr> <?php //echo $_REQUEST['event_status']; if (!empty($_REQUEST['event_status'])) { $content = ob_get_contents(); ob_end_clean(); switch ($_REQUEST['event_status']) { case 'A': switch (event_espresso_get_status($event_id, empty($event_meta) ? '' : $event_meta)) { case 'NOT_ACTIVE': //Don't show the event if any of the above are true break; default: echo $content; break; } break; case 'IA': switch (event_espresso_get_status($event_id)) { case 'NOT_ACTIVE': echo $content; break; default: //Don't show the event if any of the above are true break; } break; default: echo $content; break; } } } //End foreach ($events as $event){ } ?> </tbody> </table> <div style="clear:both; margin-bottom:30px;"> <input type="checkbox" name="sAll" onclick="selectAll(this)" /> <strong> <?php _e('Check All', 'event_espresso'); ?> </strong><?php if (isset($_POST['event_status']) && $_POST['event_status'] == 'D') { ?> <input name="perm_delete_event" type="submit" class="button-secondary" id="perm_delete_event" value="<?php _e('Permanently Delete Events(s)', 'event_espresso'); ?> " style="margin:10px 0 0 10px;" onclick="return confirmDelete();" /> <?php } else { ?> <input name="delete_event" type="submit" class="button-secondary" id="delete_event" value="<?php _e('Delete Events(s)', 'event_espresso'); ?> " style="margin:10px 0 0 10px;" onclick="return confirmDelete();" /> <a style="margin-left:5px"class="button-secondary" href="admin.php?page=events&action=csv_import"><?php _e('Import Events', 'event_espresso'); ?> </a> <?php if (function_exists('espresso_attendee_import') && $espresso_premium == true) { ?> <a style="margin-left:5px" class="button-secondary" href="admin.php?page=espresso_attendee_import"><?php _e('Import Attendees', 'event_espresso'); ?> </a><?php } ?> <a style="margin-left:5px" class="button-secondary" href="#" onclick="window.location='<?php echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&id=" . $event_id . "&export=report&action=payment&type=excel&all_events=true"; ?> '" title="<?php _e('Export to Excel', 'event_espresso'); ?> "><?php _e('Export All Attendee Data', 'event_espresso'); ?> </a> <a class="button-secondary" href="#" onclick="window.location='<?php echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&id=" . $event_id . "&export=report&action=event&type=excel&all_events=true"; ?> '" title="<?php _e('Export to Excel', 'event_espresso'); ?> "><?php _e('Export All Event Data', 'event_espresso'); ?> </a> <a style="margin-left:5px" class="button-primary" href="admin.php?page=events&action=add_new_event"><?php _e('Add New Event', 'event_espresso'); ?> </a> <?php } ?> </div> </form> <h4 style="clear:both"><?php _e('Legend', 'event_espresso'); ?> </h4> <dl style="float:left; margin-left:10px; width:200px"> <?php echo defined('EVENT_ESPRESSO_RECURRENCE_MODULE_ACTIVE') ? '<dt><img src="' . EVENT_ESPRESSO_PLUGINFULLURL . 'images/arrow_rotate_clockwise.png" alt="Recurring Event" title="Recurring Event" /> - ' . __('Recurring Event', 'event_espresso') . '</dt>' : ''; ?> <dt><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/magnifier.png" width="16" height="16" alt="<?php _e('View Event', 'event_espresso'); ?> " /> - <?php _e('View Event', 'event_espresso'); ?> </dt> <dt><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/calendar_edit.png" width="16" height="16" alt="<?php _e('Edit Event', 'event_espresso'); ?> " /> - <?php _e('Edit Event', 'event_espresso'); ?> </dt> <dt><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/group.png" width="16" height="16" alt="<?php _e('Event Attendees', 'event_espresso'); ?> " /> - <?php _e('Event Attendees', 'event_espresso'); ?> </dt> <dt><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/chart_bar.png" width="16" height="16" alt="<?php _e('Send Event Email', 'event_espresso'); ?> " /> - <?php _e('View Report', 'event_espresso'); ?> </dt> </dl> <dl style="float:left; margin-left:10px;"> <dt><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/tag.png" width="16" height="16" alt="<?php _e('Short Code', 'event_espresso'); ?> " /> - <?php _e('Short Code', 'event_espresso'); ?> </dt> <dt><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/excel_icon.png" width="16" height="16" alt="<?php _e('Excel Spreadsheet', 'event_espresso'); ?> " /> - <?php _e('Excel Export', 'event_espresso'); ?> </dt> <dt><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/csv_icon_sm.gif" width="16" height="16" alt="<?php _e('CSV Spreadsheet', 'event_espresso'); ?> " /> - <?php _e('CSV Export', 'event_espresso'); ?> </dt> <dt><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/email_go.png" width="16" height="16" alt="<?php _e('View Report', 'event_espresso'); ?> " /> - <?php _e('Event Newsletter', 'event_espresso'); ?> </dt> </dl> <script> jQuery(document).ready(function($) { /* show the table data */ var mytable = $('#table').dataTable( { "sDom": 'Clfrtip', "aoColumns": [ { "bSortable": false }, null, null, null, null, null, null, null, null, <?php echo function_exists('espresso_is_admin') && espresso_is_admin() == true ? 'null,' : ''; ?> null, { "bSortable": false } ], "aoColumnDefs": [ { "bVisible": false, "aTargets": [ <?php echo $org_options['use_venue_manager'] == 'Y' ? '' : '3,'; ?> 6 ] } ], "oColVis": { "aiExclude": [ 0, 1, 2 ], "buttonText": "Filter: Show / Hide Columns", "bRestore": true }, "bAutoWidth": false, "bStateSave": true, "sPaginationType": "full_numbers", "oLanguage": { "sSearch": "<strong><?php _e('Live Search Filter', 'event_espresso'); ?> :</strong>", "sZeroRecords": "<?php _e('No Records Found!', 'event_espresso'); ?> " } }); }); </script> <div id="coupon_code_info" style="display:none"> <h2><?php _e('Coupon/Promo Code', 'event_espresso'); ?> </h2><p><?php _e('This is used to apply discounts to events.', 'event_espresso'); ?> </p><p><?php _e('A coupon or promo code could can be anything you want. For example: Say you have an event that costs', 'event_espresso'); ?> <?php echo $org_options['currency_symbol']; ?> 200. <?php _e('If you supplied a promo like "PROMO50" and entered 50.00 into the "Discount w/Promo Code" field your event will be discounted', 'event_espresso'); ?> <?php echo $org_options['currency_symbol']; ?> 50.00, <?php _e('Bringing the cost of the event to', 'event_espresso'); ?> <?php echo $org_options['currency_symbol']; ?> 150.</p> </div> <div id="unique_id_info" style="display:none"> <h2><?php _e('Event Identifier', 'event_espresso'); ?> </h2><p><?php _e('This should be a unique identifier for the event. Example: "Event1" (without qoutes.)</p><p>The unique ID can also be used in individual pages using the', 'event_espresso'); ?> [SINGLEEVENT single_event_id="<?php _e('Unique Event ID', 'event_espresso'); ?> "] <?php _e('shortcode', 'event_espresso'); ?> .</p> </div> <?php echo event_espresso_custom_email_info(); }
function espresso_event_export($ename) { global $wpdb, $org_options; $sql = ''; $htables = array(); $htables[] = 'Event Id'; $htables[] = 'Name'; $htables[] = 'Venue'; $htables[] = 'Start Date'; $htables[] = 'Start Time'; $htables[] = 'DoW'; $htables[] = 'Reg Begins'; if (function_exists('espresso_is_admin') && espresso_is_admin() == true && (isset($espresso_premium) && $espresso_premium == true)) { $htables[] = 'Submitter'; } $htables[] = 'Status'; $htables[] = 'Attendees'; if (isset($_REQUEST['month_range'])) { $pieces = explode('-', $_REQUEST['month_range'], 3); $year_r = $pieces[0]; $month_r = $pieces[1]; } $group = ''; if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_group_admin') { $group = get_user_meta(espresso_member_data('id'), "espresso_group", true); $group = maybe_unserialize($group); $sql = "(SELECT e.id event_id, e.event_name, e.event_identifier, e.reg_limit, e.registration_start, "; $sql .= " e.start_date, e.is_active, e.recurrence_id, e.registration_startT, "; $sql .= " e.address, e.address2, e.city, e.state, e.zip, e.country, "; $sql .= " e.venue_title, e.phone, e.wp_user "; if (isset($org_options['use_venue_manager']) && $org_options['use_venue_manager'] == 'Y') { $sql .= ", v.name venue_name, v.address venue_address, v.address2 venue_address2, v.city venue_city, v.state venue_state, v.zip venue_zip, v.country venue_country, v.meta venue_meta "; } $sql .= " FROM " . EVENTS_DETAIL_TABLE . " e "; if (isset($org_options['use_venue_manager']) && $org_options['use_venue_manager'] == 'Y') { $sql .= " LEFT JOIN " . EVENTS_VENUE_REL_TABLE . " r ON r.event_id = e.id LEFT JOIN " . EVENTS_VENUE_TABLE . " v ON v.id = r.venue_id "; } if ($_REQUEST['category_id'] != '') { $sql .= " JOIN " . EVENTS_CATEGORY_REL_TABLE . " r ON r.event_id = e.id "; $sql .= " JOIN " . EVENTS_CATEGORY_TABLE . " c ON c.id = r.cat_id "; } if ($group != '') { $sql .= " JOIN " . EVENTS_VENUE_REL_TABLE . " r ON r.event_id = e.id "; $sql .= " JOIN " . EVENTS_LOCALE_REL_TABLE . " l ON l.venue_id = r.venue_id "; } $sql .= $_POST['event_status'] != '' && $_POST['event_status'] != 'IA' ? " WHERE event_status = '" . $_POST['event_status'] . "' " : " WHERE event_status != 'D' "; $sql .= $_REQUEST['category_id'] != '' ? " AND c.id = '" . $_REQUEST['category_id'] . "' " : ''; $sql .= $group != '' ? " AND l.locale_id IN (" . implode(",", $group) . ") " : ''; if ($_POST['month_range'] != '') { $sql .= " AND start_date BETWEEN '" . date('Y-m-d', strtotime($year_r . '-' . $month_r . '-01')) . "' AND '" . date('Y-m-d', strtotime($year_r . '-' . $month_r . '-31')) . "' "; } if ($_REQUEST['today'] == 'true') { $sql .= " AND start_date = '" . $curdate . "' "; } if ($_REQUEST['this_month'] == 'true') { $sql .= " AND start_date BETWEEN '" . date('Y-m-d', strtotime($this_year_r . '-' . $this_month_r . '-01')) . "' AND '" . date('Y-m-d', strtotime($this_year_r . '-' . $this_month_r . '-' . $days_this_month)) . "' "; } $sql .= ") UNION "; } $sql .= "(SELECT e.id event_id, e.event_name, e.event_identifier, e.reg_limit, e.registration_start, "; $sql .= " e.start_date, e.end_date, e.is_active, e.recurrence_id, e.registration_startT, "; $sql .= " e.address, e.address2, e.city, e.state, e.zip, e.country, "; $sql .= " e.venue_title, e.phone, e.wp_user "; if (isset($org_options['use_venue_manager']) && $org_options['use_venue_manager'] == 'Y') { $sql .= ", v.name venue_name, v.address venue_address, v.address2 venue_address2, v.city venue_city, v.state venue_state, v.zip venue_zip, v.country venue_country, v.meta venue_meta "; } $sql .= " FROM " . EVENTS_DETAIL_TABLE . " e "; if (isset($org_options['use_venue_manager']) && $org_options['use_venue_manager'] == 'Y') { $sql .= " LEFT JOIN " . EVENTS_VENUE_REL_TABLE . " r ON r.event_id = e.id LEFT JOIN " . EVENTS_VENUE_TABLE . " v ON v.id = r.venue_id "; } if (isset($_REQUEST['category_id']) && $_REQUEST['category_id'] != '') { $sql .= " JOIN " . EVENTS_CATEGORY_REL_TABLE . " r ON r.event_id = e.id "; $sql .= " JOIN " . EVENTS_CATEGORY_TABLE . " c ON c.id = r.cat_id "; } $sql .= isset($_POST['event_status']) && $_POST['event_status'] != '' && $_POST['event_status'] != 'IA' ? " WHERE event_status = '" . $_POST['event_status'] . "' " : " WHERE event_status != 'D' "; $sql .= isset($_REQUEST['category_id']) && $_REQUEST['category_id'] != '' ? " AND c.id = '" . $_REQUEST['category_id'] . "' " : ''; if (isset($_POST['month_range']) && $_POST['month_range'] != '') { $sql .= " AND start_date BETWEEN '" . date('Y-m-d', strtotime($year_r . '-' . $month_r . '-01')) . "' AND '" . date('Y-m-d', strtotime($year_r . '-' . $month_r . '-31')) . "' "; } if (isset($_REQUEST['today']) && $_REQUEST['today'] == 'true') { $sql .= " AND start_date = '" . $curdate . "' "; } if (isset($_REQUEST['this_month']) && $_REQUEST['this_month'] == 'true') { $sql .= " AND start_date BETWEEN '" . date('Y-m-d', strtotime($this_year_r . '-' . $this_month_r . '-01')) . "' AND '" . date('Y-m-d', strtotime($this_year_r . '-' . $this_month_r . '-' . $days_this_month)) . "' "; } if (function_exists('espresso_member_data') && (espresso_member_data('role') == 'espresso_event_manager' || espresso_member_data('role') == 'espresso_group_admin')) { $sql .= " AND wp_user = '******'id') . "' "; } $sql .= ") ORDER BY start_date = '0000-00-00' ASC, start_date ASC, event_name ASC"; ob_start(); //echo $sql; $today = date("Y-m-d-Hi", time()); $filename = $_REQUEST['all_events'] == "true" ? __('all-events', 'event_espresso') : sanitize_title_with_dashes($event_name); $filename = $filename . "-" . $today; switch ($_REQUEST['type']) { case "csv": $st = ""; $et = ","; $s = $et . $st; header("Content-type: application/x-msdownload"); header("Content-Disposition: attachment; filename=" . $filename . ".csv"); header("Pragma: no-cache"); header("Expires: 0"); echo implode($s, $htables) . "\r\n"; break; default: $st = ""; $et = "\t"; $s = $et . $st; header("Content-Disposition: attachment; filename=" . $filename . ".xls"); header("Content-Type: application/vnd.ms-excel"); header("Pragma: no-cache"); header("Expires: 0"); echo implode($s, $htables) . $et . "\r\n"; break; } $events = $wpdb->get_results($sql); foreach ($events as $event) { $event_id = $event->event_id; $event_name = stripslashes_deep($event->event_name); $event_identifier = stripslashes_deep($event->event_identifier); $reg_limit = $event->reg_limit; $registration_start = $event->registration_start; $start_date = event_date_display($event->start_date, 'Y-m-d'); $end_date = event_date_display($event->end_date, 'Y-m-d'); $is_active = $event->is_active; $status = array(); $status = event_espresso_get_is_active($event_id); $recurrence_id = $event->recurrence_id; $registration_startT = $event->registration_startT; //Venue variables if (isset($org_options['use_venue_manager']) && $org_options['use_venue_manager'] == 'Y') { //$data = new stdClass; //$data->event->venue_meta = unserialize($event->venue_meta); //Debug //echo "<pre>".print_r($data->event->venue_meta,true)."</pre>"; $venue_title = $event->venue_name; /*$data->event->venue_url = $data->event->venue_meta['website']; $data->event->venue_phone = $data->event->venue_meta['phone']; $data->event->venue_image = '<img src="'.$data->event->venue_meta['image'].'" />'; $data->event->address = $data->event->venue_address; $data->event->address2 = $data->event->venue_address2; $data->event->city = $data->event->venue_city; $data->event->state = $data->event->venue_state; $data->event->zip = $data->event->venue_zip; $data->event->country = $data->event->venue_country;*/ } else { $venue_title = $event->venue_title; /*$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_phone = $event->phone;*/ } $wp_user = $event->wp_user; //$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 :''); $dow = date("D", strtotime($start_date)); echo $event_id . $s . $event_name . $s . $venue_title . $s . $start_date . $s . event_espresso_get_time($event_id, 'start_time') . $s . $dow . $s . str_replace(',', ' ', event_date_display($registration_start, get_option('date_format'))); // ticket 570 if (function_exists('espresso_is_admin') && espresso_is_admin() == true && (isset($espresso_premium) && $espresso_premium == true)) { $user_company = espresso_user_meta($wp_user, 'company') != '' ? espresso_user_meta($wp_user, 'company') : ''; $user_organization = espresso_user_meta($wp_user, 'organization') != '' ? espresso_user_meta($wp_user, 'organization') : ''; $user_co_org = $user_company != '' ? $user_company : $user_organization; echo $s . (espresso_user_meta($wp_user, 'user_firstname') != '' ? espresso_user_meta($wp_user, 'user_firstname') . ' ' . espresso_user_meta($wp_user, 'user_lastname') : espresso_user_meta($wp_user, 'display_name')); } echo $s . strip_tags($status['display']) . $s . str_replace('/', ' of ', get_number_of_attendees_reg_limit($event_id, 'num_attendees_slash_reg_limit')); switch ($_REQUEST['type']) { case "csv": echo "\r\n"; break; default: echo $et . "\r\n"; break; } } }
_e('Join Waiting List', 'event_espresso'); ?> </a></p> <?php } } else { if ($display_reg_form == 'Y' && $externalURL == '') { ?> <p id="available_spaces-<?php echo $event_id; ?> " class="spaces-available"><span class="section-title"><?php _e('Available Spaces:', 'event_espresso'); ?> </span> <?php echo get_number_of_attendees_reg_limit($event_id, 'available_spaces'); ?> </p> <?php } /** * Load the multi event link. * */ //Un-comment these next lines to check if the event is active //echo event_espresso_get_status($event_id); //print_r( event_espresso_get_is_active($event_id)); if ($multi_reg && event_espresso_get_status($event_id) == 'ACTIVE') { $params = array('event_id' => $event_id, 'anchor' => __("Add to Cart", 'event_espresso'), 'event_name' => $event_name, 'separator' => __(" or ", 'event_espresso')); $cart_link = event_espresso_cart_link($params); } if ($display_reg_form == 'Y') {
function multi_register_attendees($single_event_id = NULL, $event_id_sc = 0, $meta = array(), $event = FALSE) { global $wpdb, $org_options; $events_in_session = $_SESSION['espresso_session']['events_in_session']; $event_count = count($events_in_session); static $event_counter = 1; static $attendee_number = 1; //The following variables are used to get information about your organization $event_page_id = $org_options['event_page_id']; $Organization = isset($org_options['organization']) && !empty($org_options['organization']) ? stripslashes_deep($org_options['organization']) : ''; $Organization_street1 = isset($org_options['organization_street1']) && !empty($org_options['organization_street1']) ? $org_options['organization_street1'] : ''; $Organization_street2 = isset($org_options['organization_street2']) && !empty($org_options['organization_street2']) ? $org_options['organization_street2'] : ''; $Organization_city = isset($org_options['organization_city']) && !empty($org_options['organization_city']) ? $org_options['organization_city'] : ''; $Organization_state = isset($org_options['organization_state']) && !empty($org_options['organization_state']) ? $org_options['organization_state'] : ''; $Organization_zip = isset($org_options['organization_zip']) && !empty($org_options['organization_zip']) ? $org_options['organization_zip'] : ''; $contact = isset($org_options['contact_email']) && !empty($org_options['contact_email']) ? $org_options['contact_email'] : ''; $registrar = isset($org_options['contact_email']) && !empty($org_options['contact_email']) ? $org_options['contact_email'] : ''; $currency_format = isset($org_options['currency_format']) && !empty($org_options['currency_format']) ? $org_options['currency_format'] : ''; $message = isset($org_options['message']) && !empty($org_options['message']) ? $org_options['message'] : ''; $paypal_id = isset($org_options['paypal_id']) && !empty($org_options['paypal_id']) ? $org_options['paypal_id'] : ''; if (!$event) { // the key we will eventually use in our query to find the event $ID = $event_id_sc != '0' ? $event_id_sc : $_REQUEST['event_id']; if (!empty($_REQUEST['event_id_time'])) { $pieces = explode('|', $_REQUEST['event_id_time'], 3); $ID = $pieces[0]; $start_time = $pieces[1]; $time_id = $pieces[2]; $time_selected = true; } //If a single event needs to be displayed, get its ID if ($single_event_id != NULL) { $sql = "SELECT id FROM " . EVENTS_DETAIL_TABLE; $sql .= " WHERE event_identifier = %s"; $sql .= " LIMIT 0,1"; $result = $wpdb->get_row($wpdb->prepare($sql, $single_event_id)); $ID = $result->id; } //Build event queries $sql = "SELECT * FROM " . EVENTS_DETAIL_TABLE; $sql .= " WHERE is_active='Y' "; $sql .= " AND event_status != 'D' "; $sql .= " AND id =%d LIMIT 0,1"; //Support for diarise if (!empty($_REQUEST['post_event_id'])) { $sql = "SELECT * FROM " . EVENTS_DETAIL_TABLE; $sql .= " WHERE post_id = %d "; $sql .= " LIMIT 0,1"; $ID = absint($_REQUEST['post_event_id']); } $event = $wpdb->get_row($wpdb->prepare($sql, $ID)); } //Build the registration page if ($event) { //These are the variables that can be used throughout the regsitration page $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 = !empty($event->event_cost) ? $event->event_cost : 0; //echo '<h4>$event_cost : ' . $event_cost . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; $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); $item_groups = unserialize($event->item_groups); $event_meta = maybe_unserialize($event->event_meta); //printr( $event_meta, '$event_meta <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); //This function gets the status of the event. //$is_active = event_espresso_get_status($event_id, $event_meta); $is_active = event_espresso_get_is_active($event_id, $event_meta); //If the coupon code system is intalled then use it $use_coupon_code = function_exists('event_espresso_coupon_registration_page') ? $event->use_coupon_code : FALSE; //If the groupon code addon is installed, then use it $use_groupon_code = function_exists('event_espresso_groupon_payment_page') ? $event->use_groupon_code : FALSE; //Set a default value for additional limit if ($additional_limit == '') { $additional_limit = '5'; } $add_attendee_question_groups = $event_meta['add_attendee_question_groups']; if ($org_options['use_captcha'] == 'Y' && isset($_REQUEST['edit_details']) && $_REQUEST['edit_details'] != 'true') { ?> <script type="text/javascript"> var RecaptchaOptions = { theme : '<?php echo $org_options['recaptcha_theme'] == '' ? 'red' : $org_options['recaptcha_theme']; ?> ', lang : '<?php echo $org_options['recaptcha_language'] == '' ? 'en' : $org_options['recaptcha_language']; ?> ' }; </script> <?php } //************* This is the start of the registration form. This is where you can start editing your display. ************* //Get the number of attendees $num_attendees = get_number_of_attendees_reg_limit($event_id, 'num_attendees'); //Gets a count of the available spaces $available_spaces = get_number_of_attendees_reg_limit($event_id, 'available_spaces'); //Gets the number of available spaces $number_available_spaces = get_number_of_attendees_reg_limit($event_id, 'number_available_spaces'); //Please visit http://eventespresso.com/forums/?p=247 for available parameters for the get_number_of_attendees_reg_limit() function. if ($available_spaces == "Unlimited" || $available_spaces >= $number_available_spaces) { //(Shows the regsitration form if enough spaces exist) // SOLD OUT !!! if ($num_attendees >= $reg_limit) { ?> <div class="espresso_event_full event-display-boxes" id="espresso_event_full-<?php echo $event_id; ?> "> <h3 class="event_title"><?php echo stripslashes_deep($event_name); ?> </h3> <p class="event_full"><strong><?php _e('We are sorry but this event has reached the maximum number of attendees!', 'event_espresso'); ?> </strong></p> <p class="event_full"><strong><?php _e('Please check back in the event someone cancels.', 'event_espresso'); ?> </strong></p> <p class="num_attendees"><?php _e('Current Number of Attendees:', 'event_espresso'); ?> <?php echo $num_attendees; ?> </p> <?php // is there an overflow event ???? if ($num_attendees >= $reg_limit && ($allow_overflow == 'Y' && $overflow_event_id != 0)) { ?> <p id="register_link-<?php echo $overflow_event_id; ?> " class="register-link-footer"> <a id="a_register_link-<?php echo $overflow_event_id; ?> " class="a_register_link" href="<?php echo espresso_reg_url($overflow_event_id); ?> " title="<?php echo stripslashes_deep($event_name); ?> " > <?php _e('Join Waiting List', 'event_espresso'); ?> </a> </p> <?php } ?> </div> <?php // event_espresso_clear_session(); } else { //If enough spaces exists then serve up the registration form //As of version 3.0.17 the registration details have been moved to registration_form.php include 'multi_registration_page_display.php'; $event_counter++; echo '<input type="hidden" name="regevent_action" value="post_multi_attendee" />'; } //End if ($num_attendees >= $reg_limit) (Shows the regsitration form if enough spaces exist) } //End ($available_spaces == "Unlimited" || $available_spaces >= $number_available_spaces) } else { //If there are no results from the query, display this message _e('<h3>This event has expired or is no longer available.</h3>', 'event_espresso'); } //Check to see how many database queries were performed //echo '<p>Database Queries: ' . get_num_queries() .'</p>'; }
function espresso_calendar_do_stuff($show_expired) { global $wpdb, $org_options, $espresso_calendar, $event_category_id, $events, $eventsArray; remove_shortcode('LISTATTENDEES'); $throttle = ''; if (isset($espresso_calendar['throttle']['enable']) && $espresso_calendar['throttle']['enable'] == true) { if ($espresso_calendar['throttle']['amount'] > 1) { $throttle = 'LIMIT ' . $espresso_calendar['throttle']['amount']; } } // set boolean for categories $use_categories = isset($espresso_calendar['disable_categories']) && $espresso_calendar['disable_categories'] == FALSE ? TRUE : FALSE; //Build the SQL to run //Get the categories if (!empty($event_category_id)) { $type = 'cat'; $sql = "SELECT e.*, c.category_meta, c.category_identifier, c.category_name, c.category_desc, c.display_desc, ese.start_time, ese.end_time FROM " . EVENTS_DETAIL_TABLE . " e "; $sql .= " JOIN " . EVENTS_CATEGORY_REL_TABLE . " r ON r.event_id = e.id "; $sql .= " JOIN " . EVENTS_CATEGORY_TABLE . " c ON c.id = r.cat_id "; $sql .= " LEFT JOIN " . EVENTS_START_END_TABLE . " ese ON ese.event_id= e.id "; if (function_exists('espresso_version')) { if (espresso_version() >= '3.2.P') { // if we're using ee 3.2+, is_active is true/false $sql .= " WHERE e.is_active != false "; } else { $sql .= " WHERE e.is_active != 'N' "; } } $sql .= " AND e.event_status != 'D' "; //Deleted $sql .= " AND e.event_status != 'S' "; //Secondary/Waitlist $sql .= " AND e.event_status != 'P' "; //Pending $sql .= " AND e.event_status != 'X' "; $sql .= " AND e.event_status != 'R' "; //Draft $sql .= " AND c.category_identifier = '" . $event_category_id . "' "; if ($show_expired == "false") { $sql .= " AND start_date >= '" . date('Y-m-d') . "' "; $sql .= " AND e.registration_start <= '" . date('Y-m-d') . "' "; $sql .= " AND e.registration_end >= '" . date('Y-m-d') . "' "; } } else { //Get all events $type = 'all'; $sql = "SELECT e.*, ese.start_time, ese.end_time"; $sql .= " FROM " . EVENTS_DETAIL_TABLE . " e "; $sql .= " LEFT JOIN " . EVENTS_START_END_TABLE . " ese ON ese.event_id= e.id "; if (function_exists('espresso_version')) { if (espresso_version() >= '3.2.P') { // if we're using ee 3.2+, is_active is true/false $sql .= " WHERE e.is_active != false "; } else { $sql .= " WHERE e.is_active != 'N' "; } } $sql .= " AND e.event_status != 'D' "; //Deleted $sql .= " AND e.event_status != 'S' "; //Secondary/Waitlist $sql .= " AND e.event_status != 'P' "; //Pending $sql .= " AND e.event_status != 'X' "; $sql .= " AND e.event_status != 'R' "; //Draft if ($show_expired == "false") { $sql .= " AND e.start_date >= '" . date('Y-m-d') . "' "; $sql .= " AND e.registration_start <= '" . date('Y-m-d') . "' "; $sql .= " AND e.registration_end >= '" . date('Y-m-d') . "' "; } } $sql .= " GROUP BY e.id ORDER BY e.start_date = '0000-00-00' ASC " . $throttle; //Debug //echo '<h4>$sql : ' . $sql . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4><br /><br /><br />'; $events = array(); // grab event data with event IDs as the array keys $events_data = $wpdb->get_results($wpdb->prepare($sql, ''), OBJECT_K); //echo '<h3>$events_data</h3><pre style="height:auto;border:2px solid lightblue;">' . print_r( $events_data, TRUE ) . '</pre><br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>'; //Do we need to get Category data ? if ($use_categories && $type == 'all') { // grab event_ids from query results above to use in category query $EVT_IDs = array_keys($events_data); $SQL = "SELECT event_id, c.category_meta, c.category_identifier, c.category_name, c.category_desc, c.display_desc"; $SQL .= " FROM " . EVENTS_CATEGORY_REL_TABLE . ' r '; $SQL .= " LEFT JOIN " . EVENTS_CATEGORY_TABLE . " c ON c.id = r.cat_id "; $SQL .= " WHERE event_id IN ( '" . implode("', '", $EVT_IDs) . "' )"; $categories = $wpdb->get_results($wpdb->prepare($SQL, '')); $event_categories = array(); foreach ($categories as $category) { $event_categories[$category->event_id][] = $category; } } foreach ($events_data as $event) { global $this_event_id; $this_event_id = $event->id; //Get details about the category of the event if ($use_categories) { // extract info from separate array of category data ? if (isset($event_categories[$event->id]) && $type == 'all') { // get first element of array without modifying original array $primary_cat = array_shift(array_values($event_categories[$event->id])); $category_data['category_meta'] = unserialize($primary_cat->category_meta); } else { if ($type == 'cat') { // or was one category set via the shortcode $category_data['category_meta'] = unserialize($event->category_meta); } else { $category_data['category_meta'] = array(); } } //Assign colors to events by category if (isset($category_data['category_meta']['use_pickers']) && $category_data['category_meta']['use_pickers'] == 'Y') { $eventArray['color'] = $category_data['category_meta']['event_background']; $eventArray['textColor'] = $category_data['category_meta']['event_text_color']; } } $event_meta = unserialize($event->event_meta); //If the version of Event Espresso is 3.2 or older, we need to use the new permalink structure. If not, then we need to default to the structure. if (function_exists('espresso_version')) { if (espresso_version() >= '3.2.P') { switch ($espresso_calendar['espresso_page_post']) { case 'P': $registration_url = get_permalink($event->post_id); break; case 'R': default: //$registration_url = get_home_url(). '/?page_id=' . $org_options['event_page_id'] . '®event_action=register&event_id=' . $event->id; $registration_url = espresso_reg_url($event->id, $event->slug); break; } } else { switch ($espresso_calendar['espresso_page_post']) { case 'P': $registration_url = get_home_url() . '/?p=' . $event->post_id; break; case 'R': default: $registration_url = get_home_url() . '/?page_id=' . $org_options['event_page_id'] . '®event_action=register&event_id=' . $event->id; break; } } } //Checkthe status of the event. If the event is expired, the link to the registration page will be deactivated. $eventArray['url'] = ''; $status = ''; //Changed 8-30-2011 by Seth /* switch (event_espresso_get_status($event->id)){ case 'NOT_ACTIVE': $status = ' - ' . __('Expired','event_espresso'); break; case 'ACTIVE': $status = ''; break; } */ //End Seth // Build calendar array from $event data //Gets the URL of the event and links the event to the registration form. $eventArray['url'] = $event->externalURL != '' ? htmlspecialchars_decode($event->externalURL) : $registration_url; //Id of the event $eventArray['id'] = $event->id; if (isset($espresso_calendar['show_attendee_limit']) && $espresso_calendar['show_attendee_limit'] == true) { $orig_attendee_limit = get_number_of_attendees_reg_limit($event->id, $type = 'num_attendees_slash_reg_limit'); $parse_limits = explode('/', $orig_attendee_limit, 2); $num_completed = $parse_limits[0]; $reg_limit = $parse_limits[1]; if ($reg_limit >= 999999) { $eventArray['attendee_limit'] = __('UNL', 'event_espresso'); } else { $eventArray['attendee_limit'] = $num_completed . '/' . $reg_limit; } } //Get the title of the event $ee_event_title = htmlspecialchars_decode(stripslashes_deep($event->event_name . $status), ENT_QUOTES); $eventArray['title'] = $ee_event_title; //Gets the description of the event. This can be used for hover effects such as jQuery Tooltips or QTip if (isset($espresso_calendar['show_tooltips']) && $espresso_calendar['show_tooltips'] == true) { $eventArray['description'] = espresso_format_content($event->event_desc); } //Supports 3.2 short descriptions if (isset($org_options['template_settings']['display_short_description_in_event_list']) && $org_options['template_settings']['display_short_description_in_event_list'] == true) { $eventArray['description'] = array_shift(explode('<!--more-->', $eventArray['description'])); } //Supports 3.1 short descriptions if (isset($org_options['display_short_description_in_event_list']) && $org_options['display_short_description_in_event_list'] == 'Y') { $eventArray['description'] = array_shift(explode('<!--more-->', $eventArray['description'])); } $eventArray['display_reg_form'] = $event->display_reg_form; //Get the start and end times for each event //important! time must be in iso8601 format 2010-05-10T08:30!! $eventArray['start'] = date("c", strtotime($event->start_date . ' ' . event_date_display($event->start_time, get_option('time_format')))); $eventArray['end'] = date("c", strtotime($event->end_date . ' ' . event_date_display($event->end_time, get_option('time_format')))); $eventArray['day'] = date("j", strtotime($event->end_date)); $eventArray['month'] = date("n", strtotime($event->end_date)); if ($eventArray['end'] < date('Y-m-d')) { $eventArray['expired'] = 'expired'; } else { $eventArray['expired'] = ''; } $eventArray['today'] = date('Y-m-d'); $eventArray['this_month'] = date('m'); $eventArray['startTime'] = !empty($event->start_time) ? event_date_display($event->start_time, $espresso_calendar['time_format']) : ''; $eventArray['endTime'] = !empty($event->end_time) ? event_date_display($event->end_time, $espresso_calendar['time_format']) : ''; // Add thumb to eventArray $eventArray['event_img_thumb'] = ''; if (isset($espresso_calendar['enable_calendar_thumbs']) && $espresso_calendar['enable_calendar_thumbs'] == true) { if (isset($event_meta['event_thumbnail_url'])) { $calendar_thumb = $event_meta['event_thumbnail_url']; //Debug: //echo '<a href="' . $registration_url . '"><img class="event-id-'. $event->id . '" src="'. $calendar_thumb . '" alt="" title="' . $ee_event_title . '" / ></a>'; $eventArray['event_img_thumb'] = $calendar_thumb; } } //Custom fields: //These can be used to perform special functions in your display. //This decalares the category ID as the CSS class name $eventArray['className'] = ''; $eventArray['eventType'] = ''; if ($use_categories) { if (isset($espresso_calendar['enable_cat_classes']) && $espresso_calendar['enable_cat_classes'] == TRUE) { if (isset($event_categories[$event->id]) && $type == 'all') { foreach ($event_categories[$event->id] as $EVT) { //This is the css class name $eventArray['className'] .= ' ' . $EVT->category_identifier; } // set event type to the category id $eventArray['eventType'] = isset($primary_cat->category_name) && !empty($primary_cat->category_name) ? $primary_cat->category_name : ''; } else { //This is the css class name $eventArray['className'] .= isset($event->category_identifier) ? ' ' . $event->category_identifier : ''; // set event type to the category id $eventArray['eventType'] .= isset($event->category_name) ? ' ' . $event->category_name : ''; } } } //If set to true, events will be shown as all day events $eventArray['allDay'] = FALSE; //Array of the event details $events[] = $eventArray; //Reset category colors $eventArray['color'] = ''; $eventArray['textColor'] = ''; } //Debug: //Print the results of the code above //echo json_encode($events); //echo '<style type="text/css">'.$category_styles.'</style>'; }
function event_espresso_group_price_dropdown($event_id, $label = 1, $multi_reg = 0, $value = '') { global $wpdb, $org_options; do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, ''); /* * find out pricing type. * - If multiple price options, for each one * -- Create a row in a table with a name * -- qty dropdown * */ //Will make the name an array and put the time id as a key so we //know which event this belongs to $multi_name_adjust = $multi_reg == 1 ? "[{$event_id}]" : ''; $SQL = "SELECT ept.id, ept.event_cost, ept.surcharge, ept.surcharge_type, ept.price_type, edt.allow_multiple, edt.additional_limit "; $SQL .= "FROM " . EVENTS_PRICES_TABLE . " ept "; $SQL .= "JOIN " . EVENTS_DETAIL_TABLE . " edt ON ept.event_id = edt.id "; $SQL .= "WHERE event_id=%d ORDER BY ept.id ASC"; // filter SQL statement $SQL = apply_filters('filter_hook_espresso_group_price_dropdown_sql', $SQL); // get results $results = $wpdb->get_results($wpdb->prepare($SQL, $event_id)); if ($wpdb->num_rows > 0) { $attendee_limit = 1; //echo $label==1?'<label for="event_cost">' . __('Choose an Option: ','event_espresso') . '</label>':''; //echo '<input type="radio" name="price_option' . $multi_name_adjust . '" id="price_option-' . $event_id . '">'; ?> <table class="price_list"> <?php $available_spaces = get_number_of_attendees_reg_limit($event_id, 'number_available_spaces'); foreach ($results as $result) { //Setting this field for use on the registration form $_SESSION['espresso_session']['events_in_session'][$event_id]['price_id'][$result->id]['price_type'] = stripslashes_deep($result->price_type); // Addition for Early Registration discount if ($early_price_data = early_discount_amount($event_id, $result->event_cost)) { $result->event_cost = $early_price_data['event_price']; $message = __(' Early Pricing', 'event_espresso'); } $surcharge = ''; if ($result->surcharge > 0 && $result->event_cost > 0.0) { $surcharge = " + {$org_options['currency_symbol']}{$result->surcharge} " . $org_options['surcharge_text']; if ($result->surcharge_type == 'pct') { $surcharge = " + {$result->surcharge}% " . $org_options['surcharge_text']; } } ?> <tr> <td class="price_type"><?php echo $result->price_type; ?> </td> <td class="price"><?php if (!isset($message)) { $message = ''; } echo $org_options['currency_symbol'] . number_format($result->event_cost, 2) . $message . ' ' . $surcharge; ?> </td> <td class="selection"> <?php $attendee_limit = 1; $att_qty = empty($_SESSION['espresso_session']['events_in_session'][$event_id]['price_id'][$result->id]['attendee_quantity']) ? '' : $_SESSION['espresso_session']['events_in_session'][$event_id]['price_id'][$result->id]['attendee_quantity']; if ($result->allow_multiple == 'Y') { $attendee_limit = $result->additional_limit; if ($available_spaces != 'Unlimited') { $attendee_limit = $attendee_limit <= $available_spaces ? $attendee_limit : $available_spaces; } } event_espresso_multi_qty_dd($event_id, $result->id, $attendee_limit, $att_qty); ?> </td> </tr> <?php } ?> <tr> <td colspan="3" class="reg-allowed-limit"> <?php printf(__("You can register a maximum of %d attendees for this event.", 'event_espresso'), $attendee_limit); ?> </td> </tr> </table> <input type="hidden" id="max_attendees-<?php echo $event_id; ?> " class="max_attendees" value= "<?php echo $attendee_limit; ?> " /> <?php } else { if ($wpdb->num_rows == 0) { echo '<span class="free_event">' . __('Free Event', 'event_espresso') . '</span>'; echo '<input type="hidden" name="payment' . $multi_name_adjust . '" id="payment-' . $event_id . '" value="' . __('free event', 'event_espresso') . '">'; } } }
function event_espresso_shopping_cart() { global $wpdb, $org_options; //session_destroy(); //echo "<pre>", print_r( $_SESSION ), "</pre>"; $events_in_session = isset($_SESSION['espresso_session']['events_in_session']) ? $_SESSION['espresso_session']['events_in_session'] : event_espresso_clear_session(TRUE); if (event_espresso_invoke_cart_error($events_in_session)) { return false; } if (count($events_in_session) > 0) { foreach ($events_in_session as $event) { // echo $event['id']; if (is_numeric($event['id'])) { $events_IN[] = $event['id']; } } $events_IN = implode(',', $events_IN); $sql = "SELECT e.* FROM " . EVENTS_DETAIL_TABLE . " e "; $sql = apply_filters('filter_hook_espresso_shopping_cart_SQL_select', $sql); $sql .= " WHERE e.id in ({$events_IN}) "; $sql .= " AND e.event_status != 'D' "; $sql .= " ORDER BY e.start_date "; //echo '<h4>$sql : ' . $sql . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; $result = $wpdb->get_results($sql); ?> <form action='?page_id=<?php echo $org_options['event_page_id']; ?> ®event_action=load_checkout_page' method='post' id="event_espresso_shopping_cart"> <?php $counter = 1; //Counter that will keep track of the first events foreach ($result as $r) { //Check to see if the Members plugin is installed. if (function_exists('espresso_members_installed') && espresso_members_installed() == true && !is_user_logged_in()) { $member_options = get_option('events_member_settings'); if ($r->member_only == 'Y' || $member_options['member_only_all'] == 'Y') { event_espresso_user_login(); return; } } //If the event is still active, then show it. if (event_espresso_get_status($r->id) == 'ACTIVE') { $num_attendees = get_number_of_attendees_reg_limit($r->id, 'num_attendees'); //Get the number of attendees $available_spaces = get_number_of_attendees_reg_limit($r->id, 'available_spaces'); //Gets a count of the available spaces $number_available_spaces = get_number_of_attendees_reg_limit($r->id, 'number_available_spaces'); //Gets the number of available spaces //echo "<pre>$r->id, $num_attendees,$available_spaces,$number_available_spaces</pre>"; ?> <div class="multi_reg_cart_block event-display-boxes ui-widget" id ="multi_reg_cart_block-<?php echo $r->id; ?> "> <h3 class="event_title ui-widget-header ui-corner-top"><?php echo stripslashes_deep($r->event_name); ?> <span class="remove-cart-item"> <img class="ee_delete_item_from_cart" id="cart_link_<?php echo $r->id; ?> " alt="Remove this item from your cart" src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/remove.gif" /> </span> </h3> <div class="event-data-display ui-widget-content ui-corner-bottom"> <table id="cart-reg-details" class="event-display-tables"> <thead> <tr> <th><?php _e('Date', 'event_espresso'); ?> </th> <th><?php _e('Time', 'event_espresso'); ?> </th> </tr> </thead> <tbody> <tr> <td> <?php echo event_date_display($r->start_date, get_option('date_format')); ?> <?php /*_e( ' to ', 'event_espresso' ); ?> <?php echo event_date_display( $r->end_date, get_option( 'date_format' ) )*/ ?> </td> <td> <?php echo event_espresso_time_dropdown($r->id, 0, 1, $_SESSION['espresso_session']['events_in_session'][$r->id]['start_time_id']); ?> </td> </tr> <tr> <td colspan="2"> <?php echo event_espresso_group_price_dropdown($r->id, 0, 1, $_SESSION['espresso_session']['events_in_session'][$r->id]['price_id']); ?> </td> </tr> </tbody> </table> <input type="hidden" name="event_name[<?php echo $r->id; ?> ]" value="<?php echo $r->event_name; ?> " /> <input type="hidden" name="use_coupon[<?php echo $r->id; ?> ]" value="<?php echo $r->use_coupon_code; ?> " /> <input type="hidden" name="use_groupon[<?php echo $r->id; ?> ]" value="<?php echo $r->use_groupon_code; ?> " /> <?php do_action_ref_array('action_hook_espresso_add_to_multi_reg_cart_block', array($r)); ?> </div><!-- / .event-data-display --> </div><!-- / .event-display-boxes --> <?php $counter++; } } //echo $_SESSION['espresso_session']['groupon_used']; // printr( $_SESSION, '$_SESSION <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); ?> <div class="event-display-boxes ui-widget"> <div class="mer-event-submit ui-widget-content ui-corner-all"> <input type="hidden" name="event_name[<?php echo $r->id; ?> ]" value="<?php echo stripslashes_deep($r->event_name); ?> " /> <input type="hidden" name="regevent_action" value="load_checkout_page" /> <?php if (function_exists('event_espresso_coupon_payment_page') && isset($org_options['allow_mer_discounts']) && $org_options['allow_mer_discounts'] == 'Y') { //Discount code display ?> <div id="event_espresso_coupon_wrapper" class="clearfix event-data-display"> <label class="coupon-code" for="event_espresso_coupon_code"><?php _e('Enter Coupon Code ', 'event_espresso'); ?> </label> <input type="text" name="event_espresso_coupon_code" id ="event_espresso_coupon_code" value="<?php echo isset($_SESSION['espresso_session']['event_espresso_coupon_code']) ? $_SESSION['espresso_session']['event_espresso_coupon_code'] : ''; ?> " onkeydown="if(event.keyCode==13) {document.getElementById('event_espresso_refresh_total').focus(); return false;}" /> </div> <?php } ?> <?php if (function_exists('event_espresso_groupon_payment_page') && isset($org_options['allow_mer_vouchers']) && $org_options['allow_mer_vouchers'] == 'Y') { //Voucher code display ?> <div id="event_espresso_coupon_wrapper" class="clearfix event-data-display" > <label class="coupon-code" for="event_espresso_groupon_code"><?php _e('Enter Voucher Code ', 'event_espresso'); ?> </label> <input type="text" name="event_espresso_groupon_code" id ="event_espresso_groupon_code" value="<?php echo isset($_SESSION['espresso_session']['groupon_code']) ? $_SESSION['espresso_session']['groupon_code'] : ''; ?> " onkeydown="if(event.keyCode==13) {document.getElementById('event_espresso_refresh_total').focus(); return false;}" /> </div> <?php } ?> <div id="event_espresso_notifications" class="clearfix event-data-display" style=""></div> <div id="event_espresso_total_wrapper" class="clearfix event-data-display"> <?php do_action('action_hook_espresso_shopping_cart_before_total'); ?> <span class="event_total_price"> <?php _e('Total ', 'event_espresso') . $org_options['currency_symbol']; ?> <span id="event_total_price"><?php echo $_SESSION['espresso_session']['grand_total']; ?> </span> </span> <?php do_action('action_hook_espresso_shopping_cart_after_total'); ?> <p id="event_espresso_refresh_total"> <a id="event_espresso_refresh_total" style="cursor:pointer;"><?php _e('Refresh Total', 'event_espresso'); ?> </a> </p> </div> <p id="event_espresso_submit_cart"> <input type="submit" class="submit btn_event_form_submit ui-priority-primary ui-state-default ui-state-hover ui-state-focus ui-corner-all" name="Continue" id="event_espresso_continue_registration" value="<?php _e('Enter Attendee Information', 'event_espresso'); ?> »" /> </p> </div><!-- / .mer-event-submit --> </div><!-- / .event-display-boxes --> </form> <?php } }
function event_espresso_get_event_details($sql) { event_espresso_session_start(); if (!isset($_SESSION['event_espresso_sessionid'])) { $sessionid = mt_rand(100, 999) . time(); $_SESSION['event_espresso_sessionid'] = $sessionid; } global $wpdb, $org_options; //echo 'This page is located in ' . get_option( 'upload_path' ); $event_page_id = $org_options['event_page_id']; $currency_symbol = $org_options['currency_symbol']; $events = $wpdb->get_results($sql); $category_name = $wpdb->last_result[0]->category_name; $category_desc = $wpdb->last_result[0]->category_desc; $display_desc = $wpdb->last_result[0]->display_desc; if ($display_desc == 'Y') { echo '<p>' . stripslashes_deep($category_name) . '</p>'; echo '<p>' . wpautop($category_desc) . '</p>'; } foreach ($events as $event) { $event_id = $event->id; $event_name = $event->event_name; $event_identifier = $event->event_identifier; $active = $event->is_active; $registration_start = $event->registration_start; $registration_end = $event->registration_end; $start_date = $event->start_date; $reg_limit = $event->reg_limit; $event_address = $event->address; $member_only = $event->member_only; $externalURL = $event->externalURL; $registration_url = $externalURL != '' ? $externalURL : get_option('siteurl') . '/?page_id=' . $event_page_id . '®event_action=register&event_id=' . $event_id . '&name_of_event=' . stripslashes_deep($event_name); if (!is_user_logged_in() && get_option('events_members_active') == 'true' && $member_only == 'Y') { //Display a message if the user is not logged in. //_e('Member Only Event. Please ','event_espresso') . event_espresso_user_login_link() . '.'; } else { if ($start_date >= date('Y-m-d') && $registration_start <= date('Y-m-d') && $registration_end >= date('Y-m-d') || $event->event_status == 'O' && $registration_start <= date('Y-m-d')) { ?> <div id="div_event_data-<?php echo $event_id; ?> " class="event_data"> <h3 id="h3_event_title-<?php echo $event_id; ?> " class="event_title"><a id="a_event_title-<?php echo $event_id; ?> " class="a_event_title" href="<?php echo get_option('siteurl'); ?> /?page_id=<?php echo $event_page_id; ?> ®event_action=register&event_id=<?php echo $event_id; ?> &name_of_event=<?php echo stripslashes_deep($event_name); ?> "><?php echo stripslashes_deep($event_name); ?> </a></h3> <p id="p_event_price-<?php echo $event_id; ?> " class="event_price"> <?php echo __('Price: ', 'event_espresso') . event_espresso_get_price($event_id); ?> </p> <p id="p_event_date-<?php echo $event_id; ?> " class="event_date"><?php _e('Date:', 'event_espresso'); ?> <?php echo event_date_display($start_date); ?> </p> <p id="p_event_address-<?php echo $event_id; ?> " class="event_address"><?php _e('Address:', 'event_espresso'); ?> <?php echo $event_address; ?> </p> <p id="p_available_spaces-<?php echo $event_id; ?> " class="available_spaces"><?php _e('Available Spaces:', 'event_espresso'); ?> <?php echo get_number_of_attendees_reg_limit($event_id, 'available_spaces'); ?> </p> <p id="p_register_link-<?php echo $event_id; ?> " class="register_link"> <a id="a_register_link-<?php echo $event_id; ?> " class="a_register_link" href="<?php echo get_option('siteurl'); ?> /?page_id=<?php echo $event_page_id; ?> ®event_action=register&event_id=<?php echo $event_id; ?> &name_of_event=<?php echo stripslashes_deep($event_name); ?> "><?php _e('Register Online', 'event_espresso'); ?> </a> </p> </div> <?php } } } //Check to see how many database queries were performed //echo '<p>Database Queries: ' . get_num_queries() .'</p>'; }
function event_espresso_edit_list_widget() { global $wpdb, $org_options; if ($_POST['delete_event']) { if (is_array($_POST['checkbox'])) { while (list($key, $value) = each($_POST['checkbox'])) { $del_id = $key; event_espresso_delete_event($del_id); } } ?> <div id="message" class="updated fade"> <p><strong> <?php _e('Event(s) have been permanently deleted.', 'event_espresso'); ?> </strong></p> </div> <?php } ?> <form id="form1" name="form1" method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?> "> <table id="table" class="widefat fixed" width="100%"> <thead> <tr> <th class="manage-column column-title" id="title" scope="col" title="Click to Sort" style="width: 30%;"><?php _e('Name', 'event_espresso'); ?> </th> <th class="manage-column column-date" id="start" scope="col" title="Click to Sort" style="width: 30%;"><?php _e('Date', 'event_espresso'); ?> </th> <th class="manage-column column-date" id="status" scope="col" title="Click to Sort" style="width: 20%;"><?php _e('Status', 'event_espresso'); ?> </th> <th class="manage-column column-date" id="attendees" scope="col" title="Click to Sort" style="width: 15%;"><?php _e('Attendees', 'event_espresso'); ?> </th> </tr> </thead> <tbody> <?php /* Events */ //Get number of total events $wpdb->query("SELECT id FROM " . EVENTS_DETAIL_TABLE . " WHERE event_status != 'D'"); $total_events = $wpdb->num_rows; //Get total events today $wpdb->query("SELECT id FROM " . EVENTS_DETAIL_TABLE . " WHERE event_status != 'D' AND start_date = '" . $curdate . "' "); $total_events_today = $wpdb->num_rows; if ($total_events > 0) { $curdate = date("Y-m-d"); /*$pieces = explode('-',$curdate, 3); $this_year_r = $pieces[0]; $this_month_r = $pieces[1]; //echo $this_year_r; $days_this_month = date('t', strtotime($curdate));*/ $days_in_dasboard = $org_options['events_in_dasboard'] == '' ? '30' : stripslashes_deep($org_options['events_in_dasboard']); $sql = "SELECT e.id event_id, e.event_name, e.event_identifier, e.reg_limit, e.registration_start, "; $sql .= " e.start_date, e.is_active, e.recurrence_id, e.registration_startT FROM " . EVENTS_DETAIL_TABLE . " e "; $sql .= " WHERE event_status != 'D' "; if ($total_events_today > 0) { $sql .= " AND start_date = '" . $curdate . "' "; global $how_many_events; $how_many_events = __('todays\' events', 'event_espresso'); } else { $sql .= " AND ADDDATE('" . date('Y-m-d') . "', INTERVAL " . $days_in_dasboard . " DAY) >= start_date AND start_date >= '" . date('Y-m-d', strtotime($curdate)) . "' "; global $how_many_events; $how_many_events = __("the next {$days_in_dasboard} days of events", 'event_espresso'); } //$sql .= " WHERE event_status != 'D' AND start_date BETWEEN '".date('Y-m-d', strtotime($this_year_r. '-' .$this_month_r . '-01'))."' AND '".date('Y-m-d', strtotime($this_year_r . '-' .$this_month_r. '-' . $days_this_month))."' "; $sql .= " ORDER BY e.start_date ASC "; //echo $sql; $results = $wpdb->get_results($sql); foreach ($results as $result) { $event_id = $result->event_id; $event_name = stripslashes_deep($result->event_name); $event_identifier = stripslashes_deep($result->event_identifier); $reg_limit = $result->reg_limit; $registration_start = $result->registration_start; $start_date = $result->start_date; $end_date = $result->end_date; $is_active = $result->is_active; $status = array(); $status = event_espresso_get_is_active($event_id); $recurrence_id = $result->recurrence_id; $registration_startT = $result->registration_startT; ?> <tr> <td class="post-title page-title column-title"><strong><a class="row-title" href="admin.php?page=events&action=edit&event_id=<?php echo $event_id; ?> "><?php echo $event_name; ?> </a></strong> <div class="row-actions"><span><a href="#">View</a> | </span><span class='edit'><a href="admin.php?page=events&action=edit&event_id=<?php echo $event_id; ?> "><?php _e('Edit', 'event_espresso'); ?> </a> | </span><span class='delete'><a onclick="return confirmDelete();" href='admin.php?page=events&action=delete&event_id=<?php echo $event_id; ?> '><?php _e('Delete', 'event_espresso'); ?> </a></span> | <span><a href="admin.php?page=events&event_admin_reports=list_attendee_payments&event_id=<?php echo $event_id; ?> "><?php _e('Attendees', 'event_espresso'); ?> </a> | </span><span><a href="#"><?php _e('Export', 'event_espresso'); ?> </a></span></div></td> <td class="author column-author"><?php echo event_date_display($start_date, get_option('date_format')); ?> <br /> <?php echo event_espresso_get_time($event_id, 'start_time'); ?> </td> <td class="date column-date"><?php echo $status['display']; ?> </td> <td align="center" class="author column-attendees"><a href="admin.php?page=events&event_admin_reports=list_attendee_payments&event_id=<?php echo $event_id; ?> "><?php echo get_number_of_attendees_reg_limit($event_id, 'num_attendees'); ?> </a></td> </tr> <?php } } ?> </tbody> </table><p> </p> <div style="clear:both"></div> <script> jQuery(document).ready(function($) { var mytable = $('#table').dataTable( { "bStateSave": true, "sPaginationType": "full_numbers", "oLanguage": { "sSearch": "<strong><?php _e('Live Search Filter', 'event_espresso'); ?> :</strong>", "sZeroRecords": "<?php _e('No Records Found!', 'event_espresso'); ?> " }, "aoColumns": [ null, null, null, null ] } ); } ); </script> <div style="clear:both"></div> <?php }
echo $venue_title; ?> <br /> <?php echo stripslashes_deep($location); ?> <span class="google-map-link"><?php echo $google_map_link; ?> </span></span> </p> <?php } //Social media buttons do_action('espresso_social_display_buttons', $event_id); $num_attendees = get_number_of_attendees_reg_limit($event_id, 'num_attendees'); //Get the number of attendees. Please visit http://eventespresso.com/forums/?p=247 for available parameters for the get_number_of_attendees_reg_limit() function. if ($num_attendees >= $reg_limit) { ?> <!--<p id="available_spaces-<?php /* echo $event_id */ ?> "><span class="section-title"><?php /* _e('<strong>Available Spaces:</strong>', 'event_espresso') */ ?> </span><?php /* echo get_number_of_attendees_reg_limit($event_id, 'available_spaces', 'All Seats Reserved') */ ?> </p> --> <?php if ($overflow_event_id != '0' && $allow_overflow == 'Y') {
function espresso_attendees_data_sc($atts) { global $wpdb, $org_options; extract(shortcode_atts(array('event_id' => '0', 'type' => ''), $atts)); $event_id = "{$event_id}"; $type = "{$type}"; $data = get_number_of_attendees_reg_limit($event_id, $type); return $data; }
function event_espresso_shopping_cart() { global $wpdb, $org_options; //session_destroy(); //echo "<pre>", print_r( $_SESSION ), "</pre>"; $events_in_session = $_SESSION['espresso_session']['events_in_session']; if (event_espresso_invoke_cart_error($events_in_session)) { return false; } if (count($events_in_session) > 0) { foreach ($events_in_session as $event) { // echo $event['id']; if (is_numeric($event['id'])) { $events_IN[] = $event['id']; } } $events_IN = implode(',', $events_IN); $sql = "SELECT e.* FROM " . EVENTS_DETAIL_TABLE . " e "; $sql .= " WHERE e.id in ({$events_IN}) "; $sql .= " AND e.event_status != 'D' "; $sql .= " ORDER BY e.start_date "; $result = $wpdb->get_results($sql); ?> <form action='?page_id=<?php echo $org_options['event_page_id']; ?> ®event_action=load_checkout_page' method='post' id="event_espresso_shopping_cart"> <?php $counter = 1; //Counter that will keep track of the first events foreach ($result as $r) { $num_attendees = get_number_of_attendees_reg_limit($r->id, 'num_attendees'); //Get the number of attendees $available_spaces = get_number_of_attendees_reg_limit($r->id, 'available_spaces'); //Gets a count of the available spaces $number_available_spaces = get_number_of_attendees_reg_limit($r->id, 'number_available_spaces'); //Gets the number of available spaces //echo "<pre>$r->id, $num_attendees,$available_spaces,$number_available_spaces</pre>"; ?> <div class="multi_reg_cart_block event-display-boxes ui-widget" id ="multi_reg_cart_block-<?php echo $r->id; ?> "> <h3 class="event_title ui-widget-header ui-corner-top"><?php echo stripslashes_deep($r->event_name); ?> <span class="remove-cart-item"> <img class="ee_delete_item_from_cart" id="cart_link_<?php echo $r->id; ?> " alt="Remove this item from your cart" src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/remove.gif" /> </span> </h3> <div class="event-data-display ui-widget-content ui-corner-bottom"> <table id="cart-reg-details" class="event-display-tables"> <thead> <tr> <th><?php _e('Date', 'event_espresso'); ?> </th> <th><?php _e('Time', 'event_espresso'); ?> </th> </tr> </thead> <tbody> <tr> <td><?php echo event_date_display($r->start_date, get_option('date_format')); ?> <?php /*_e( ' to ', 'event_espresso' ); ?> <?php echo event_date_display( $r->end_date, get_option( 'date_format' ) )*/ ?> </td> <td><?php echo event_espresso_time_dropdown($r->id, 0, 1, $_SESSION['espresso_session']['events_in_session'][$r->id]['start_time_id']); ?> </td> </tr> <tr> <td colspan="2"><?php echo event_espresso_group_price_dropdown($r->id, 0, 1, $_SESSION['espresso_session']['events_in_session'][$r->id]['price_id']); ?> </td> </tr> </table> <?php //Coupons if (function_exists('event_espresso_coupon_registration_page')) { // echo event_espresso_coupon_registration_page( $r->use_coupon_code, $r->id, 1 ); } //End coupons display ?> <input type="hidden" name="event_name[<?php echo $r->id; ?> ]" value="<?php echo $r->event_name; ?> " /> </div><!-- / .event-data-display --> </div><!-- / .event-display-boxes --> <?php $counter++; } ?> <div class="event-display-boxes ui-widget"> <div class="mer-event-submit ui-widget-content ui-corner-all"> <input type="hidden" name="event_name[<?php echo $r->id; ?> ]" value="<?php echo stripslashes_deep($r->event_name); ?> " /> <input type="hidden" name="regevent_action" value="load_checkout_page" /> <?php //Coupon code display //Uncomment the following code at your own risk. Just beware that all coupon codes will work for everyting in the cart. ?> <?php /*?><div id="event_espresso_coupon_wrapper" class="clearfix event-data-display"> <label class="coupon-code" for="event_espresso_coupon_code"> <?php _e( 'Enter Coupon Code ', 'event_espresso' ); ?> </label> <input onkeydown="if(event.keyCode==13) {document.getElementById('event_espresso_refresh_total').focus(); return false;}" type="text" name="event_espresso_coupon_code" id ="event_espresso_coupon_code" value="<?php echo $_SESSION['espresso_session']['coupon_code']; ?>"/> </div><?php */ ?> <div id="event_espresso_total_wrapper" class="clearfix event-data-display"> <a href="#" id="event_espresso_refresh_total"><?php _e('Refresh Total', 'event_espresso'); ?> </a> <span class="event_total_price"> <?php _e('Total (' . $org_options['currency_symbol'] . '): <span id="event_total_price">' . $_SESSION['espresso_session']['grand_total'], 'event_espresso') . '</span>'; ?> </span> </div> <input type="submit" class="submit btn_event_form_submit ui-priority-primary ui-state-default ui-state-hover ui-state-focus ui-corner-all" name="Continue" id="event_espresso_continue_registration" value="<?php _e('Finish Registration', 'event_espresso'); ?> " /> </div><!-- / .mer-event-submit --> </div><!-- / .event-display-boxes --> </form> <?php } }
?> </h6> <?php //Show short descriptions if ($first_event_excerpt != '' && isset($org_options['display_short_description_in_event_list']) && $org_options['display_short_description_in_event_list'] == 'Y') { ?> <p><?php echo stripslashes_deep(wpautop($first_event_excerpt)); ?> </p> <?php } ?> <?php $num_attendees = get_number_of_attendees_reg_limit($first_event_instance['event_id'], 'num_attendees'); ?> <?php if ($num_attendees >= $events_group[0]['reg_limit']) { ?> <p><span class="error">Sold Out</span> <a href="<?php echo get_option('siteurl'); ?> /?page_id=<?php echo $first_event_instance['event_page_id']; ?> &e_reg=register&event_id=<?php echo $first_event_instance['overflow_event_id']; ?> &name_of_event=<?php
function event_espresso_get_event_details($sql) { //print_r( $_SESSION['event_espresso_sessionid']); //See if the session already exists global $wpdb, $org_options; //echo 'This page is located in ' . get_option( 'upload_path' ); $event_page_id = $org_options['event_page_id']; $currency_symbol = $org_options['currency_symbol']; $events = $wpdb->get_results($sql); $category_id = $wpdb->last_result[0]->id; $category_name = $wpdb->last_result[0]->category_name; $category_desc = html_entity_decode(wpautop($wpdb->last_result[0]->category_desc)); $display_desc = $wpdb->last_result[0]->display_desc; if ($display_desc == 'Y') { echo '<p id="events_category_name-' . $category_id . '" class="events_category_name">' . stripslashes_deep($category_name) . '</p>'; echo wpautop($category_desc); } foreach ($events as $event) { $event_id = $event->id; $event_name = $event->event_name; $event_identifier = $event->event_identifier; $active = $event->is_active; $registration_start = $event->registration_start; $registration_end = $event->registration_end; $start_date = $event->start_date; $end_date = $event->end_date; $reg_limit = $event->reg_limit; $event_address = $event->address; $member_only = $event->member_only; $externalURL = $event->externalURL; $allow_overflow = $event->allow_overflow; $overflow_event_id = $event->overflow_event_id; $registration_url = $externalURL != '' ? $externalURL : get_option('siteurl') . '/?page_id=' . $event_page_id . '®event_action=register&event_id=' . $event_id . '&name_of_event=' . stripslashes_deep($event_name); if (!is_user_logged_in() && get_option('events_members_active') == 'true' && $member_only == 'Y') { //Display a message if the user is not logged in. //_e('Member Only Event. Please ','event_espresso') . event_espresso_user_login_link() . '.'; } else { ?> <div id="event_data-<?php echo $event_id; ?> " class="event_data"> <h3 id="event_title-<?php echo $event_id; ?> " class="event_title"><a title="<?php echo stripslashes_deep($event_name); ?> " class="a_event_title" id="a_event_title-<?php echo $event_id; ?> " href="<?php echo get_option('siteurl'); ?> /?page_id=<?php echo $event_page_id; ?> ®event_action=register&event_id=<?php echo $event_id; ?> &name_of_event=<?php echo stripslashes_deep($event_name); ?> "><?php echo stripslashes_deep($event_name); ?> </a></h3> <p id="p_event_price-<?php echo $event_id; ?> "> <?php echo __('Price: ', 'event_espresso') . event_espresso_get_price($event_id); ?> </p> <p id="event_date-<?php echo $event_id; ?> "><?php _e('Start Date:', 'event_espresso'); ?> <?php echo event_date_display($start_date); ?> <br /> <?php _e('End Date:', 'event_espresso'); ?> <?php echo event_date_display($end_date); ?> </p> <p id="event_address-<?php echo $event_id; ?> "><?php _e('Address:', 'event_espresso'); ?> <?php echo $event_address; ?> </p> <?php /* * Display the amount of attendees and/or registration limit Available parameters for the get_number_of_attendees_reg_limit() function * @ $event_id - required * @ $type - * available_spaces = returns the number of available spaces * num_attendees = returns the number of attendees * reg_limit = returns the total number of spaces * num_incomplete = returns the number of incomplete (non paid) registrations * num_completed = returns the number of completed (paid) registrations * num_completed_slash_incomplete = returns the number of completed and incomplete registrations separated by a slash (eg. 3/1) * num_attendees_slash_reg_limit = returns the number of attendees and the registration limit separated by a slash (eg. 4/30) */ $num_attendees = get_number_of_attendees_reg_limit($event_id, 'num_attendees'); //Get the number of attendees if ($num_attendees >= $reg_limit) { ?> <p id="available_spaces-<?php echo $event_id; ?> "><?php _e('Available Spaces:', 'event_espresso'); ?> <?php echo get_number_of_attendees_reg_limit($event_id, 'available_spaces'); ?> </p> <p id="register_link-<?php echo $overflow_event_id; ?> "><a class="a_register_link" id="a_register_link-<?php echo $overflow_event_id; ?> " href="<?php echo get_option('siteurl'); ?> /?page_id=<?php echo $event_page_id; ?> ®event_action=register&event_id=<?php echo $overflow_event_id; ?> &name_of_event=<?php echo stripslashes_deep($event_name); ?> " title="<?php echo stripslashes_deep($event_name); ?> "><?php _e('Join Waiting List', 'event_espresso'); ?> </a></p> </div> <?php } else { ?> <p id="available_spaces-<?php echo $event_id; ?> "><?php _e('Available Spaces:', 'event_espresso'); ?> <?php echo get_number_of_attendees_reg_limit($event_id, 'available_spaces'); ?> </p> <p id="register_link-<?php echo $event_id; ?> "><a class="a_register_link" id="a_register_link-<?php echo $event_id; ?> " href="<?php echo get_option('siteurl'); ?> /?page_id=<?php echo $event_page_id; ?> ®event_action=register&event_id=<?php echo $event_id; ?> &name_of_event=<?php echo stripslashes_deep($event_name); ?> " title="<?php echo stripslashes_deep($event_name); ?> "><?php _e('Register Online', 'event_espresso'); ?> </a></p> <p><?php echo espresso_show_social_media($event_id, 'twitter'); ?> <?php echo espresso_show_social_media($event_id, 'facebook'); ?> </p> </div> <?php } } } //Check to see how many database queries were performed //echo '<p>Database Queries: ' . get_num_queries() .'</p>'; }
function edit_attendee_record() { do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, ''); global $wpdb, $org_options; $notifications['success'] = array(); $notifications['error'] = array(); $failed_nonce_msg = ' <div id="message" class="error"> <p> <strong>' . __('An Error Occurred. The request failed to pass a security check.', 'event_espresso') . '</strong><br/> <span style="font-size:.9em;">' . __('Please press the back button on your browser to return to the previous page.', 'event_espresso') . '</span> </p> </div>'; $attendee_num = 1; $is_additional_attendee = FALSE; // ************************************************************************** // **************************** EDIT ATTENDEE **************************** // ************************************************************************** if ($_REQUEST['form_action'] == 'edit_attendee') { $id = isset($_REQUEST['id']) ? absint($_REQUEST['id']) : ''; $registration_id = isset($_REQUEST['registration_id']) ? sanitize_text_field($_REQUEST['registration_id']) : ''; $multi_reg = FALSE; // check for multi reg, additional attendees, and verify reg id for primary attendee $SQL = "SELECT * FROM " . EVENTS_MULTI_EVENT_REGISTRATION_ID_GROUP_TABLE . " WHERE registration_id = %s"; $check = $wpdb->get_row($wpdb->prepare($SQL, $registration_id)); if ($check) { $registration_id = $check->primary_registration_id; $SQL = "SELECT distinct primary_registration_id, registration_id "; $SQL .= "FROM " . EVENTS_MULTI_EVENT_REGISTRATION_ID_GROUP_TABLE . " "; $SQL .= "WHERE primary_registration_id = %s"; $registration_ids = $wpdb->get_results($wpdb->prepare($SQL, $registration_id), ARRAY_A); $multi_reg = TRUE; } // find the primary attendee id so we know which form to present since the additional attendees will have a different form $SQL = "SELECT id FROM " . EVENTS_ATTENDEE_TABLE . " WHERE registration_id =%s AND is_primary = 1 "; if ($r = $wpdb->get_row($wpdb->prepare($SQL, $registration_id))) { $primary_attendee = !empty($r->id) ? $r->id : $id; $is_additional_attendee = $primary_attendee != $id ? TRUE : FALSE; } else { $primary_attendee = FALSE; } // ************************************************************************** // ************************** UPDATE PAYMENT ************************** // ************************************************************************** if (!empty($_REQUEST['attendee_payment']) && $_REQUEST['attendee_payment'] == 'update_price') { if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'edit_attendee_' . $registration_id . '_update_price_nonce')) { wp_die($failed_nonce_msg); } $upd_price = (double) number_format(abs(sanitize_text_field($_REQUEST['final_price'])), 2, '.', ''); $upd_qty = absint($_REQUEST['quantity']); $set_cols_and_values = array('final_price' => $upd_price, 'quantity' => $upd_qty); $set_format = array('%f', '%d'); $where_cols_and_values = array('id' => $id); $where_format = array('%d'); // run the update $upd_success = $wpdb->update(EVENTS_ATTENDEE_TABLE, $set_cols_and_values, $where_cols_and_values, $set_format, $where_format); // if there was an actual error if ($upd_success === FALSE) { $notifications['error'][] = __('An error occured. Attendee ticket price details could not be updated.', 'event_espresso'); } else { // now we need to gather all the ticket prices for all attendees for the entire registraion and calculate a new total cost $upd_total = 0; $SQL = "SELECT payment_status, amount_pd, final_price, quantity, is_primary FROM " . EVENTS_ATTENDEE_TABLE . " WHERE registration_id = %s"; if ($attendee_tickets = $wpdb->get_results($wpdb->prepare($SQL, $registration_id))) { // loop thru tickets foreach ($attendee_tickets as $attendee_ticket) { // calculate total for each attendee and add to total cost $upd_total += $attendee_ticket->final_price * $attendee_ticket->quantity; // grab amount paid by primary attendee if ($attendee_ticket->is_primary) { $amount_pd = (double) $attendee_ticket->amount_pd; $payment_status = $attendee_ticket->payment_status; } } } // format new total_cost $upd_total = (double) number_format($upd_total, 2, '.', ''); // compare new total_cost with amount_pd if ($upd_total == $amount_pd) { $upd_payment_status = __('Completed', 'event_espresso'); } elseif ($upd_total > $amount_pd) { $upd_payment_status = __('Pending', 'event_espresso'); } elseif ($upd_total < $amount_pd) { $upd_payment_status = __('Refund', 'event_espresso'); } // echo '<h4>$amount_pd : ' . $amount_pd . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; // echo '<h4>$payment_status : ' . $payment_status . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; // echo '<h4>$upd_total : ' . $upd_total . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; // echo '<h4>$upd_payment_status : ' . $upd_payment_status . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; // compare old payment status with new payment status and update if things have changed if ($upd_payment_status != $payment_status) { // update payment status for ALL attendees for the entire registration $set_cols_and_values = array('payment_status' => $upd_payment_status); $set_format = array('%s'); $where_cols_and_values = array('registration_id' => $registration_id); $where_format = array('%s'); // run the update $upd_success = $wpdb->update(EVENTS_ATTENDEE_TABLE, $set_cols_and_values, $where_cols_and_values, $set_format, $where_format); // if there was an actual error if ($upd_success === FALSE) { $notifications['error'][] = __('An error occured while attempting to update the payment status for attendeefrom this registration.', 'event_espresso'); } } // now update the primary registrant's total cost field' $set_cols_and_values = array('total_cost' => $upd_total); $set_format = array('%f'); $where_cols_and_values = array('id' => $id, 'is_primary' => TRUE); $where_format = array('%d', '%d'); // run the update $upd_success = $wpdb->update(EVENTS_ATTENDEE_TABLE, $set_cols_and_values, $where_cols_and_values, $set_format, $where_format); // if there was an actual error if ($upd_success === FALSE) { $notifications['error'][] = __('An error occured. The primary attendee ticket total could not be updated.', 'event_espresso'); } // let's base our success on the lack of errors $notifications['success'][] = empty($notifications['error']) ? __('All attendee ticket price details have been successfully updated.', 'event_espresso') : __('Some attendee ticket price details were successfully updated, but the following error(s) may have prevented others from being updated:', 'event_espresso'); } } // ************************************************************************** // ************************** DELETE ATTENDEE ************************** // ************************************************************************** if (!empty($_REQUEST['attendee_action']) && $_REQUEST['attendee_action'] == 'delete_attendee') { if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'edit_attendee_' . $registration_id . '_delete_attendee_nonce')) { wp_die($failed_nonce_msg); } $SQL = "DELETE FROM " . EVENTS_ATTENDEE_TABLE . " WHERE id =%d"; $del_results = $wpdb->query($wpdb->prepare($SQL, $id)); if ($del_results === FALSE) { $notifications['error'][] = __('An error occured. The attendee could not be deleted.', 'event_espresso'); } elseif ($del_results === 0) { $notifications['error'][] = __('The attendee record in the database could not be found and was therefore not deleted.', 'event_espresso'); } else { if (defined('ESPRESSO_SEATING_CHART')) { $SQL = "DELETE FROM " . EVENTS_SEATING_CHART_EVENT_SEAT_TABLE . " where attendee_id = %d"; if ($wpdb->query($wpdb->prepare($SQL, $id)) === FALSE) { $notifications['error'][] = __('An error occured. The attendee seating chart data could not be deleted.', 'event_espresso'); } } // get id's for all attendees from this registration $SQL = "SELECT id from " . EVENTS_ATTENDEE_TABLE . " WHERE registration_id = %s"; $attendees = $wpdb->query($wpdb->prepare($SQL, $registration_id)); if ($attendees === FALSE) { $notifications['error'][] = __('An error occured while attempting to retrieve additional attendee data from the database.', 'event_espresso'); } else { // update quantities for attendees $SQL = " UPDATE " . EVENTS_ATTENDEE_TABLE . " SET quantity = IF(quantity IS NULL ,NULL,IF(quantity > 0,IF(quantity-1>0,quantity-1,1),0)) "; $SQL .= "WHERE registration_id =%s"; if ($wpdb->update($SQL, $registration_id) === FALSE) { $notifications['error'][] = __('An error occured while attempting to update additional attendee ticket quantities.', 'event_espresso'); } event_espresso_cleanup_multi_event_registration_id_group_data(); } // let's base our success on the lack of errors $notifications['success'][] = empty($notifications['error']) ? __('All attendee details have been successfully deleted.', 'event_espresso') : __('One or more errors may have prevented some attendee details from being successfully deleted.', 'event_espresso'); } // ************************************************************************** // ************************** UPDATE ATTENDEE ************************** // ************************************************************************** } else { if (!empty($_REQUEST['attendee_action']) && $_REQUEST['attendee_action'] == 'update_attendee') { if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'edit_attendee_' . $registration_id . '_update_attendee_nonce')) { wp_die($failed_nonce_msg); } $event_id = isset($_POST['event_id']) ? $_POST['event_id'] : ''; $txn_type = isset($_POST['txn_type']) ? $_POST['txn_type'] : ''; $set_cols_and_values = array('fname' => isset($_POST['fname']) ? $_POST['fname'] : '', 'lname' => isset($_POST['lname']) ? $_POST['lname'] : '', 'address' => isset($_POST['address']) ? $_POST['address'] : '', 'address2' => isset($_POST['address2']) ? $_POST['address2'] : '', 'city' => isset($_POST['city']) ? $_POST['city'] : '', 'state' => isset($_POST['state']) ? $_POST['state'] : '', 'zip' => isset($_POST['zip']) ? $_POST['zip'] : '', 'phone' => isset($_POST['phone']) ? $_POST['phone'] : '', 'email' => isset($_POST['email']) ? $_POST['email'] : ''); $set_format = array('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s'); // Update the time ? if (isset($_POST['start_time_id'])) { $SQL = "SELECT ese.start_time, ese.end_time FROM " . EVENTS_START_END_TABLE . " ese WHERE ese.id=%d"; if ($times = $wpdb->get_results($wpdb->prepare($SQL, absint($_POST['start_time_id'])))) { foreach ($times as $time) { $start_time = $time->start_time; $end_time = $time->end_time; } $set_cols_and_values['event_time'] = $start_time; $set_cols_and_values['end_time'] = $end_time; array_push($set_format, '%s', '%s'); } } //printr( $_POST, '$_POST <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); $where_cols_and_values = array('id' => $id); $where_format = array('%d'); // run the update $upd_success = $wpdb->update(EVENTS_ATTENDEE_TABLE, $set_cols_and_values, $where_cols_and_values, $set_format, $where_format); // if there was an actual error if ($upd_success === FALSE) { $notifications['error'][] = __('An error occured. Attendee details could not be updated.', 'event_espresso'); } // Added for seating chart addon $booking_id = 0; if (defined('ESPRESSO_SEATING_CHART')) { if (seating_chart::check_event_has_seating_chart($event_id) !== false) { if (isset($_POST['seat_id'])) { $booking_id = seating_chart::parse_booking_info($_POST['seat_id']); if ($booking_id > 0) { seating_chart::confirm_a_seat($booking_id, $id); } } } } // Insert Additional Questions From Post Here $reg_id = $id; $SQL = "SELECT question_groups, event_meta FROM " . EVENTS_DETAIL_TABLE . " WHERE id = %d"; $questions = $wpdb->get_row($wpdb->prepare($SQL, $event_id)); $question_groups = unserialize($questions->question_groups); $event_meta = unserialize($questions->event_meta); if ($is_additional_attendee && isset($event_meta['add_attendee_question_groups']) && $event_meta['add_attendee_question_groups'] != NULL) { $question_groups = $event_meta['add_attendee_question_groups']; } $questions_in = ''; foreach ($question_groups as $g_id) { $questions_in .= $g_id . ','; } $questions_in = substr($questions_in, 0, -1); $group_name = ''; $counter = 0; //pull the list of questions that are relevant to this event $SQL = "SELECT q.*, q.id AS q_id, at.id AS a_id, at.*, qg.group_name, qg.show_group_description, qg.show_group_name "; $SQL .= "FROM " . EVENTS_QUESTION_TABLE . " q "; $SQL .= "LEFT JOIN " . EVENTS_ANSWER_TABLE . " at on q.id = at.question_id "; $SQL .= "JOIN " . EVENTS_QST_GROUP_REL_TABLE . " qgr on q.id = qgr.question_id "; $SQL .= "JOIN " . EVENTS_QST_GROUP_TABLE . " qg on qg.id = qgr.group_id "; $SQL .= "WHERE qgr.group_id in ( {$questions_in} ) "; $SQL .= "AND (at.attendee_id IS NULL OR at.attendee_id = '%d') "; $SQL .= "ORDER BY qg.id, q.id ASC"; $questions = $wpdb->get_results($wpdb->prepare($SQL, $id)); // printr( $questions, '$questions <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); $SQL = "SELECT id, question_id, answer FROM " . EVENTS_ANSWER_TABLE . " at WHERE at.attendee_id = %d"; $answers = $wpdb->get_results($wpdb->prepare($SQL, $id), OBJECT_K); foreach ($answers as $answer) { $answer_a[$answer->id] = $answer->question_id; } if ($questions) { foreach ($questions as $question) { //printr( $question, '$question <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); switch ($question->question_type) { case "TEXT": case "TEXTAREA": case "SINGLE": case "DROPDOWN": if ($question->system_name != '') { $post_val = isset($_POST[$question->system_name]) ? $_POST[$question->system_name] : ''; } else { $post_val = isset($_POST[$question->question_type . '_' . $question->a_id]) ? $_POST[$question->question_type . '_' . $question->a_id] : ''; } $post_val = sanitize_text_field(stripslashes($post_val)); break; case "MULTIPLE": $post_val = ''; for ($i = 0; $i < count($_POST[$question->question_type . '_' . $question->a_id]); $i++) { $post_val .= trim($_POST[$question->question_type . '_' . $question->a_id][$i]) . ","; } $post_val = sanitize_text_field(substr(stripslashes($post_val), 0, -1)); break; } // echo '<h4>$post_val : ' . $post_val . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; // echo '<h4>$question->id : ' . $question->q_id . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; // printr( $answer_a, '$answer_a <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); if (in_array($question->q_id, $answer_a)) { // existing answer $set_cols_and_values = array('answer' => html_entity_decode(trim($post_val), ENT_QUOTES, 'UTF-8')); //echo "<pre>".print_r($set_cols_and_values,true)."</pre>"; $set_format = array('%s'); $where_cols_and_values = array('attendee_id' => $id, 'question_id' => $question->q_id); $where_format = array('%d', '%d'); // run the update $upd_success = $wpdb->update(EVENTS_ANSWER_TABLE, $set_cols_and_values, $where_cols_and_values, $set_format, $where_format); //echo '<h4>last_query : ' . $wpdb->last_query . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; } else { // new answer $set_cols_and_values = array('registration_id' => $registration_id, 'attendee_id' => $id, 'question_id' => $question->q_id, 'answer' => html_entity_decode(trim($post_val), ENT_QUOTES, 'UTF-8')); $set_format = array('%s', '%d', '%d', '%s'); // run the insert $upd_success = $wpdb->insert(EVENTS_ANSWER_TABLE, $set_cols_and_values, $set_format); //echo '<h4>last_query : ' . $wpdb->last_query . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; } } } // let's base our success on the lack of errors $notifications['success'][] = empty($notifications['error']) ? __('All attendee details have been successfully updated.', 'event_espresso') : __('One or more errors may have prevented some attendee details from being successfully updated.', 'event_espresso'); } } // ************************************************************************** // ************************* RETRIEVE ATTENDEE ************************* // ************************************************************************** $counter = 0; $additional_attendees = NULL; $SQL = "SELECT att.*, evt.event_name, evt.question_groups, evt.event_meta, evt.additional_limit FROM " . EVENTS_ATTENDEE_TABLE . " att "; $SQL .= "JOIN " . EVENTS_DETAIL_TABLE . " evt ON att.event_id = evt.id "; // are we looking for an additional attendee ? if (isset($_REQUEST['attendee_num']) && $_REQUEST['attendee_num'] > 1 && isset($_REQUEST['id'])) { $SQL .= "WHERE att.id = " . sanitize_text_field($_REQUEST['id']); } else { // check for multi reg & additional attendees by first finding primary attendee $SQL2 = "SELECT primary_registration_id FROM " . EVENTS_MULTI_EVENT_REGISTRATION_ID_GROUP_TABLE . " WHERE registration_id = %s"; if ($primary_registration_id = $wpdb->get_var($wpdb->prepare($SQL2, sanitize_text_field($_REQUEST['registration_id'])))) { // now find all registrations $SQL3 = "SELECT registration_id FROM " . EVENTS_MULTI_EVENT_REGISTRATION_ID_GROUP_TABLE . " WHERE primary_registration_id = %s"; $reg_ids = $wpdb->get_col($wpdb->prepare($SQL3, $primary_registration_id)); $reg_ids = "'" . implode("','", $reg_ids) . "'"; } else { $reg_ids = "'" . sanitize_text_field($_REQUEST['registration_id']) . "'"; } $SQL .= " WHERE registration_id IN ( {$reg_ids} ) ORDER BY att.id"; } $attendees = $wpdb->get_results($wpdb->prepare($SQL, NULL)); foreach ($attendees as $attendee) { if ($counter == 0) { $id = $attendee->id; $registration_id = $attendee->registration_id; $lname = $attendee->lname; $fname = $attendee->fname; $address = $attendee->address; $address2 = $attendee->address2; $city = $attendee->city; $state = $attendee->state; $zip = $attendee->zip; $email = $attendee->email; $payment = $attendee->payment; $phone = $attendee->phone; $date = $attendee->date; $payment_status = $attendee->payment_status; $txn_type = $attendee->txn_type; $txn_id = $attendee->txn_id; $quantity = $attendee->quantity; $payment_date = $attendee->payment_date; $event_id = $attendee->event_id; $event_name = $attendee->event_name; $question_groups = unserialize($attendee->question_groups); $event_meta = unserialize($attendee->event_meta); $coupon_code = $attendee->coupon_code; $is_additional_attendee = $primary_attendee != $id ? true : false; $attendee_limit = $attendee->additional_limit; $amount_pd = $attendee->amount_pd; $total_cost = $attendee->total_cost; $orig_price = $attendee->orig_price; $final_price = $attendee->final_price; $start_date = $attendee->start_date; $event_time = $attendee->event_time; // Added for seating chart addon $booking_info = ""; if (defined('ESPRESSO_SEATING_CHART')) { $seating_chart_id = seating_chart::check_event_has_seating_chart($event_id); if ($seating_chart_id !== false) { $seat = $wpdb->get_row("select scs.* , sces.id as booking_id from " . EVENTS_SEATING_CHART_SEAT_TABLE . " scs inner join " . EVENTS_SEATING_CHART_EVENT_SEAT_TABLE . " sces on scs.id = sces.seat_id where sces.attendee_id = '" . $id . "' "); if ($seat !== NULL) { $booking_info = $seat->custom_tag . " #booking id: " . $seat->booking_id; } } } $event_date = event_date_display($start_date . ' ' . $event_time, get_option('date_format') . ' g:i a'); if ($is_additional_attendee && isset($event_meta['add_attendee_question_groups']) && $event_meta['add_attendee_question_groups'] != NULL) { $question_groups = $event_meta['add_attendee_question_groups']; } $counter++; } else { $additional_attendees[$attendee->id] = array('full_name' => $attendee->fname . ' ' . $attendee->lname, 'email' => $attendee->email, 'phone' => $attendee->phone); } } // display success messages if (!empty($notifications['success'])) { $success_msg = implode($notifications['success'], '<br />'); ?> <div id="message" class="updated fade"> <p> <strong><?php echo $success_msg; ?> </strong> </p> </div> <?php } // display error messages if (!empty($notifications['error'])) { $error_msg = implode($notifications['error'], '<br />'); ?> <div id="message" class="error"> <p> <strong><?php echo $error_msg; ?> </strong> </p> </div> <?php } ?> <div> <p> <a href="admin.php?page=events&event_id=<?php echo $event_id; ?> &event_admin_reports=list_attendee_payments"> <strong>« <?php _e('Back to Attendees List', 'event_espresso'); ?> </strong> </a> </p> </div> <div class="metabox-holder"> <div class="postbox"> <h3> <?php _e('Registration Id <a href="admin.php?page=events&event_admin_reports=edit_attendee_record&event_id=' . $event_id . '®istration_id=' . $registration_id . '&form_action=edit_attendee">#' . $registration_id . '</a> | ID #' . $id . ' | Name: ' . $fname . ' ' . $lname . ' | Registered For:', 'event_espresso'); ?> <a href="admin.php?page=events&event_admin_reports=list_attendee_payments&event_id=<?php echo $event_id; ?> "><?php echo stripslashes_deep($event_name); ?> </a> - <?php echo $event_date; ?> </h3> <div class="inside"> <table width="100%"> <tr> <td width="50%" valign="top"> <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?> " class="espresso_form"> <h4 class="qrtr-margin"> <?php _e('Registration Information', 'event_espresso'); ?> <?php echo $is_additional_attendee == false ? '[ <span class="green_text">' . __('Primary Attendee Record', 'event_espresso') . '</span> ]' : '[ <a href="admin.php?page=events&event_admin_reports=edit_attendee_record&event_id=' . $event_id . '®istration_id=' . $registration_id . '&form_action=edit_attendee">View/Edit Primary Attendee</a> ]'; ?> </h4> <fieldset> <ul> <li> <?php $time_id = 0; $SQL = "SELECT id FROM " . EVENTS_START_END_TABLE . " WHERE event_id=%d AND start_time =%s"; if ($event_time = $wpdb->get_row($wpdb->prepare($SQL, $event_id, $event_time))) { $time_id = $event_time->id; } echo event_espresso_time_dropdown($event_id, $label = 1, $multi_reg = 0, $time_id); ?> </li> <li> <?php //Added for seating chart addon. Creates a field to select a seat from a popup. 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, $booking_info); ?> </li> <li> <?php if (count($question_groups) > 0) { $questions_in = ''; foreach ($question_groups as $g_id) { $questions_in .= $g_id . ','; } $questions_in = substr($questions_in, 0, -1); $group_name = ''; $counter = 0; $FILTER = ''; if (isset($event_meta['additional_attendee_reg_info']) && $event_meta['additional_attendee_reg_info'] == '2' && isset($_REQUEST['attendee_num']) && $_REQUEST['attendee_num'] > 1) { $FILTER .= " AND qg.system_group = 1 "; } //pull the list of questions that are relevant to this event $SQL = "SELECT q.*, at.*, qg.group_name, qg.show_group_description, qg.show_group_name "; $SQL .= "FROM " . EVENTS_QUESTION_TABLE . " q "; $SQL .= "LEFT JOIN " . EVENTS_ANSWER_TABLE . " at on q.id = at.question_id "; $SQL .= "JOIN " . EVENTS_QST_GROUP_REL_TABLE . " qgr on q.id = qgr.question_id "; $SQL .= "JOIN " . EVENTS_QST_GROUP_TABLE . " qg on qg.id = qgr.group_id "; $SQL .= "WHERE qgr.group_id in ( {$questions_in} ) "; $SQL .= "AND ( at.attendee_id IS NULL OR at.attendee_id = %d ) "; $SQL .= $FILTER . " "; $SQL .= "ORDER BY qg.id, q.id ASC"; $questions = $wpdb->get_results($wpdb->prepare($SQL, $id)); $num_rows = $wpdb->num_rows; if ($num_rows > 0) { //Output the questions $question_displayed = array(); foreach ($questions as $question) { $counter++; if (!in_array($question->id, $question_displayed)) { $question_displayed[] = $question->id; //echo '<p>'; echo event_form_build_edit($question, $question->answer, $show_admin_only = true); //echo "</p>"; #echo $counter == $num_rows ? '</fieldset>' : ''; } } } //end questions display } ?> </li> <input type="hidden" name="id" value="<?php echo $id; ?> " /> <input type="hidden" name="registration_id" value="<?php echo $registration_id; ?> " /> <input type="hidden" name="event_id" value="<?php echo $event_id; ?> " /> <input type="hidden" name="display_action" value="view_list" /> <input type="hidden" name="form_action" value="edit_attendee" /> <input type="hidden" name="attendee_action" value="update_attendee" /> <?php wp_nonce_field('edit_attendee_' . $registration_id . '_update_attendee_nonce'); ?> <li> <input type="submit" name="Submit" class="button-primary action" value="<?php _e('Update Record', 'event_espresso'); ?> " /> </li> </ul> </fieldset> </form></td> <td width="50%" valign="top"> <?php if (count($additional_attendees) > 0) { ?> <h4> <?php _e('Additional Attendees', 'event_espresso'); ?> </h4> <ol> <?php foreach ($additional_attendees as $att => $row) { $attendee_num++; ?> <li> <?php // create edit link $edit_att_url_params = array('event_admin_reports' => 'edit_attendee_record', 'form_action' => 'edit_attendee', 'registration_id' => $registration_id, 'id' => $att, 'attendee_num' => $attendee_num, 'event_id' => $event_id); // add url params $edit_attendee_link = add_query_arg($edit_att_url_params, 'admin.php?page=events'); ?> <a href="<?php echo $edit_attendee_link; ?> " title="<?php _e('Edit Attendee', 'event_espresso'); ?> "> <strong><?php echo $row['full_name']; ?> </strong> (<?php echo $row['email']; ?> ) </a> | <?php // create delete link $delete_att_url_params = array('event_admin_reports' => 'edit_attendee_record', 'form_action' => 'edit_attendee', 'attendee_action' => 'delete_attendee', 'registration_id' => $registration_id, 'id' => $att, 'attendee_num' => $attendee_num, 'event_id' => $event_id); // add url params $delete_attendee_link = add_query_arg($delete_att_url_params, 'admin.php?page=events'); // add nonce $edit_attendee_link = wp_nonce_url($delete_attendee_link, 'edit_attendee_' . $registration_id . '_delete_attendee_nonce'); ?> <a href="<?php echo $delete_attendee_link; ?> " title="<?php _e('Delete Attendee', 'event_espresso'); ?> " onclick="return confirmDelete();"> <?php _e('Delete', 'event_espresso'); ?> </a> </li> <?php } ?> </ol> <?php } ?> <br/> <h4 class="qrtr-margin"><?php _e('Ticket Prices', 'event_espresso'); ?> </h4> <form method="POST" action="<?php echo $_SERVER['REQUEST_URI']; ?> &status=saved" class="espresso_form"> <fieldset> <ul> <li> <strong class="att-tckt-prc-lbl"><?php _e('Payment Status:', 'event_espresso'); ?> </strong> <?php echo $payment_status; ?> <?php echo event_espresso_paid_status_icon($payment_status); ?> [ <a href="admin.php?page=events&attendee_pay=paynow&form_action=payment&registration_id=<?php echo $registration_id; ?> &event_admin_reports=enter_attendee_payments&event_id=<?php echo $event_id; ?> " title="<?php _e('Edit Payment', 'event_espresso'); ?> "> <?php _e('View/Edit Payment', 'event_espresso'); ?> </a> ] </li> <li> <strong class="att-tckt-prc-lbl"><?php _e('Transaction ID:', 'event_espresso'); ?> </strong> <?php echo !empty($txn_id) ? $txn_id : 'N/A'; ?> </li> <li> <strong class="att-tckt-prc-lbl"><?php _e('Date Paid:', 'event_espresso'); ?> </strong> <?php echo !empty($payment_date) ? event_date_display($payment_date) : 'N/A'; ?> </li> <li> <strong class="att-tckt-prc-lbl"> <?php _e('Total Amount Owing:', 'event_espresso'); ?> </strong> <?php echo $org_options['currency_symbol']; echo $total_cost; ?> </li> <li> <strong class="att-tckt-prc-lbl"><?php _e('Total Amount Paid to Date:', 'event_espresso'); ?> </strong> <?php echo $org_options['currency_symbol'] . $amount_pd; //echo espresso_attendee_price(array('attendee_id' => $id, 'reg_total' => true)); ?> </li> <li> <h6 class="qrtr-margin"><strong><?php _e('Attendee Ticket Fees:', 'event_espresso'); ?> </strong></h6> <div <?php if (isset($_REQUEST['show_payment']) && $_REQUEST['show_payment'] == 'true') { echo ' class="yellow_inform"'; } ?> > <table border="0"> <tr> <td align="left" valign="top"> <label><?php _e('Amount:', 'event_espresso'); ?> ( <?php echo $org_options['currency_symbol']; ?> )</label> </td> <td align="center" valign="top"> <label><?php _e('# Tickets:', 'event_espresso'); ?> </label> </td> <td align="right" valign="top"> <label class="algn-rght"><?php _e('Total:', 'event_espresso'); ?> </label> </td> </tr> <tr> <td align="left" valign="top"> <input name="final_price" class="small-text algn-rght" type="text" value ="<?php echo $final_price; ?> " /> </td> <td align="center" valign="top"> <?php // number of tickets currently purchased $quantity = !empty($quantity) ? $quantity : 1; // availalbe spaces left for event $available_spaces = get_number_of_attendees_reg_limit($event_id, 'number_available_spaces'); if ($available_spaces != 'Unlimited') { // first add our purchased tickets ($quantity) back into available spaces // ( becuase a sold out show incluldes these tickets here, so admin should be allowed to play with these numbers - think about it ) $available_spaces += $quantity; $attendee_limit = $attendee_limit <= $available_spaces ? $attendee_limit : $available_spaces; } // final check to make sure that attendee limit has to at LEAST be the number of tickets this attendee has already purchased // otherwise the ticket quantity selector may display less than what this attendee has already purchased $attendee_limit = $attendee_limit < $quantity ? $quantity : $attendee_limit; ?> <select name="quantity" class="price_id"> <?php for ($i = 0; $i <= $attendee_limit; $i++) { $selected = $i == $quantity ? ' selected="selected" ' : ''; ?> <option <?php echo $selected; ?> value="<?php echo $i; ?> "><?php echo $i; ?> </option> <?php } ?> </select> <!--<input name="quantity" type="text" value ="<?php echo !empty($quantity) ? $quantity : 1; ?> " />--> </td> <td align="right" valign="top"> <?php $ticket_total = (double) ($final_price * $quantity) > 0 ? number_format($final_price * $quantity, 2, '.', '') : 0.0; ?> <input class="small-text algn-rght" type="text" name="total_owing" disabled="true" value ="<?php echo $ticket_total; ?> " /> </td> </tr> </table> </div> </li> <li> <strong class="att-tckt-prc-lbl"><?php _e('Original Ticket Price:', 'event_espresso'); ?> </strong> <?php echo $org_options['currency_symbol'] . ' ' . $orig_price; ?> / <?php _e('ticket', 'event_espresso'); ?> </li> <li> <br/> <input type="submit" name="submit_ticket_prices" class="button-primary action" value="Update Price" /> </li> </ul> </fieldset> <input type="hidden" name="id" value="<?php echo $id; ?> " /> <input type="hidden" name="registration_id" value="<?php echo $registration_id; ?> " /> <input type="hidden" name="form_action" value="edit_attendee" /> <input type="hidden" name="event_id" value="<?php echo $event_id; ?> " /> <input type="hidden" name="attendee_payment" value="update_price" /> <?php wp_nonce_field('edit_attendee_' . $registration_id . '_update_price_nonce'); ?> </form> </td> </tr> </table> </div> </div> </div> <?php } }
function register_attendees($single_event_id = NULL, $event_id_sc = 0, $reg_form_only = false) { //Declare the $data object $data = (object) array('event' => NULL); do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, ''); //Run code for the seating chart addon if (function_exists('espresso_seating_version')) { do_action('ee_seating_chart_css'); do_action('ee_seating_chart_js'); do_action('ee_seating_chart_flush_expired_seats'); } global $wpdb, $org_options; if (isset($_REQUEST['ee']) && $_REQUEST['ee'] != '') { $_REQUEST['event_id'] = $_REQUEST['ee']; } $event_id = $event_id_sc != '0' ? $event_id_sc : $_REQUEST['event_id']; if (!empty($_REQUEST['event_id_time'])) { $pieces = explode('|', $_REQUEST['event_id_time'], 3); $event_id = $pieces[0]; $start_time = $pieces[1]; $time_id = $pieces[2]; $time_selected = true; } //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 = isset($org_options['currency_format']) ? $org_options['currency_format'] : ''; $message = $org_options['message']; //Build event queries $sql = "SELECT e.*, ese.start_time, ese.end_time "; if (isset($org_options['use_venue_manager']) && $org_options['use_venue_manager'] == 'Y') { $sql .= ", v.name venue_name, v.address venue_address, v.address2 venue_address2, v.city venue_city, v.state venue_state, v.zip venue_zip, v.country venue_country, v.meta venue_meta "; } $sql .= " FROM " . EVENTS_DETAIL_TABLE . " e "; $sql .= " LEFT JOIN " . EVENTS_START_END_TABLE . " ese ON ese.event_id = e.id "; if (isset($org_options['use_venue_manager']) && $org_options['use_venue_manager'] == 'Y') { $sql .= " LEFT JOIN " . EVENTS_VENUE_REL_TABLE . " r ON r.event_id = e.id LEFT JOIN " . EVENTS_VENUE_TABLE . " v ON v.id = r.venue_id "; } $sql .= " WHERE e.is_active='Y' "; $sql .= " AND e.event_status != 'D' "; //Get the ID of a single event if ($single_event_id != NULL) { //If a single event needs to be displayed, get its ID $sql .= " AND event_identifier = '" . $single_event_id . "' "; } else { $sql .= " AND e.id = '" . $event_id . "' LIMIT 0,1"; } //Support for diarise if (!empty($_REQUEST['post_event_id'])) { $sql = "SELECT e.* FROM " . EVENTS_DETAIL_TABLE . ' e'; $sql .= " LEFT JOIN " . EVENTS_START_END_TABLE . " ese ON ese.event_id = e.id "; $sql .= " WHERE post_id = '" . $_REQUEST['post_event_id'] . "' "; $sql .= " LIMIT 0,1"; } $data->event = $wpdb->get_row($wpdb->prepare($sql, NULL), OBJECT); $num_rows = $wpdb->num_rows; //Build the registration page if ($num_rows > 0) { //These are the variables that can be used throughout the registration page //foreach ($events as $event) { global $this_event_id; $event_id = $data->event->id; $this_event_id = $event_id; $event_name = stripslashes_deep($data->event->event_name); $event_desc = stripslashes_deep($data->event->event_desc); $display_desc = $data->event->display_desc; if ($reg_form_only == true) { $display_desc = "N"; } $display_reg_form = $data->event->display_reg_form; $event_address = $data->event->address; $event_address2 = $data->event->address2; $event_city = $data->event->city; $event_state = $data->event->state; $event_zip = $data->event->zip; $event_country = $data->event->country; $event_description = stripslashes_deep($data->event->event_desc); $event_identifier = $data->event->event_identifier; $event_cost = isset($data->event->event_cost) ? $data->event->event_cost : "0.00"; $member_only = $data->event->member_only; $reg_limit = $data->event->reg_limit; $allow_multiple = $data->event->allow_multiple; $start_date = $data->event->start_date; $end_date = $data->event->end_date; $allow_overflow = $data->event->allow_overflow; $overflow_event_id = $data->event->overflow_event_id; //Venue details $venue_title = $data->event->venue_title; $venue_url = $data->event->venue_url; $venue_image = $data->event->venue_image; $venue_phone = $data->event->venue_phone; $venue_address = ''; $venue_address2 = ''; $venue_city = ''; $venue_state = ''; $venue_zip = ''; $venue_country = ''; global $event_meta; $event_meta = unserialize($data->event->event_meta); //Venue information if ($org_options['use_venue_manager'] == 'Y') { $event_address = $data->event->venue_address; $event_address2 = $data->event->venue_address2; $event_city = $data->event->venue_city; $event_state = $data->event->venue_state; $event_zip = $data->event->venue_zip; $event_country = $data->event->venue_country; //Leaving these variables intact, just in case people wnat to use them $venue_title = $data->event->venue_name; $venue_address = $data->event->venue_address; $venue_address2 = $data->event->venue_address2; $venue_city = $data->event->venue_city; $venue_state = $data->event->venue_state; $venue_zip = $data->event->venue_zip; $venue_country = $data->event->venue_country; global $venue_meta; $add_venue_meta = array('venue_title' => $data->event->venue_name, 'venue_address' => $data->event->venue_address, 'venue_address2' => $data->event->venue_address2, 'venue_city' => $data->event->venue_city, 'venue_state' => $data->event->venue_state, 'venue_country' => $data->event->venue_country); $venue_meta = isset($data->event->venue_meta) && $data->event->venue_meta != '' && (isset($add_venue_meta) && $add_venue_meta != '') ? array_merge(unserialize($data->event->venue_meta), $add_venue_meta) : ''; //print_r($venue_meta); } $virtual_url = stripslashes_deep($data->event->virtual_url); $virtual_phone = stripslashes_deep($data->event->virtual_phone); //Address formatting $location = (!empty($event_address) ? $event_address : '') . (!empty($event_address2) ? '<br />' . $event_address2 : '') . (!empty($event_city) ? '<br />' . $event_city : '') . (!empty($event_state) ? ', ' . $event_state : '') . (!empty($event_zip) ? '<br />' . $event_zip : '') . (!empty($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')); $question_groups = unserialize($data->event->question_groups); $reg_start_date = $data->event->registration_start; $reg_end_date = $data->event->registration_end; $today = date("Y-m-d"); if (isset($data->event->timezone_string) && $data->event->timezone_string != '') { $timezone_string = $data->event->timezone_string; } else { $timezone_string = get_option('timezone_string'); if (!isset($timezone_string) || $timezone_string == '') { $timezone_string = 'America/New_York'; } } $t = time(); $today = date_at_timezone("Y-m-d H:i A", $timezone_string, $t); //echo event_date_display($today, get_option('date_format'). ' ' .get_option('time_format')) . ' ' . $timezone_string; //echo espresso_ddtimezone_simple(); $reg_limit = $data->event->reg_limit; $additional_limit = $data->event->additional_limit; //If the coupon code system is intalled then use it $use_coupon_code = $data->event->use_coupon_code; //If the groupon code addon is installed, then use it $use_groupon_code = $data->event->use_groupon_code; //Set a default value for additional limit if ($additional_limit == '') { $additional_limit = '5'; } $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 //echo $number_available_spaces; global $all_meta; $all_meta = array('event_id' => $event_id, '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, 'event_country' => $event_country, 'venue_title' => $venue_title, 'venue_address' => $venue_address, 'venue_address2' => $venue_address2, 'venue_city' => $venue_city, 'venue_state' => $venue_state, 'venue_country' => $venue_country, 'location' => $location, 'is_active' => $data->event->is_active, 'event_status' => $data->event->event_status, 'contact_email' => empty($data->event->alt_email) ? $org_options['contact_email'] : $data->event->alt_email, 'start_time' => empty($data->event->start_time) ? '' : $data->event->start_time, 'end_time' => empty($data->event->end_time) ? '' : $data->event->end_time, 'registration_startT' => $data->event->registration_startT, 'registration_start' => $data->event->registration_start, 'registration_endT' => $data->event->registration_endT, 'registration_end' => $data->event->registration_end, 'start_date' => event_espresso_no_format_date($start_date, get_option('date_format')), 'end_date' => event_date_display($end_date, get_option('date_format')), 'google_map_link' => $google_map_link); //print_r($all_meta); //This function gets the status of the event. $is_active = array(); $is_active = event_espresso_get_is_active(0, $all_meta); //echo '<p>'.print_r(event_espresso_get_is_active($event_id, $all_meta)).'</p>';; if ($org_options['use_captcha'] == 'Y' && empty($_REQUEST['edit_details'])) { ?> <script type="text/javascript"> var RecaptchaOptions = { theme : '<?php echo $org_options['recaptcha_theme'] == '' ? 'red' : $org_options['recaptcha_theme']; ?> ', lang : '<?php echo $org_options['recaptcha_language'] == '' ? 'en' : $org_options['recaptcha_language']; ?> ' }; </script> <?php } //This is the start of the registration form. This is where you can start editing your display. //(Shows the regsitration form if enough spaces exist) if ($num_attendees >= $reg_limit) { ?> <div class="espresso_event_full event-display-boxes" id="espresso_event_full-<?php echo $event_id; ?> "> <h3 class="event_title"><?php echo stripslashes_deep($event_name); ?> </h3> <div class="event-messages"> <p class="event_full"><strong><?php _e('We are sorry but this event has reached the maximum number of attendees!', 'event_espresso'); ?> </strong></p> <p class="event_full"><strong><?php _e('Please check back in the event someone cancels.', 'event_espresso'); ?> </strong></p> <p class="num_attendees"><?php _e('Current Number of Attendees:', 'event_espresso'); ?> <?php echo $num_attendees; ?> </p> </div> <?php $num_attendees = get_number_of_attendees_reg_limit($event_id, 'num_attendees'); //Get the number of attendees. Please visit http://eventespresso.com/forums/?p=247 for available parameters for the get_number_of_attendees_reg_limit() function. if ($num_attendees >= $reg_limit && ($allow_overflow == 'Y' && $overflow_event_id != 0)) { ?> <p id="register_link-<?php echo $overflow_event_id; ?> " class="register-link-footer"><a class="a_register_link ui-button ui-button-big ui-priority-primary ui-state-default ui-state-hover ui-state-focus ui-corner-all" id="a_register_link-<?php echo $overflow_event_id; ?> " href="<?php echo espresso_reg_url($overflow_event_id); ?> " title="<?php echo stripslashes_deep($event_name); ?> "><?php _e('Join Waiting List', 'event_espresso'); ?> </a></p> <?php } ?> </div> <?php } else { $member_options = get_option('events_member_settings'); //echo "<pre>".print_r($member_options,true)."</pre>"; //If enough spaces exist then show the form //Check to see if the Members plugin is installed. if (function_exists('espresso_members_installed') && espresso_members_installed() == true && !is_user_logged_in() && ($member_only == 'Y' || $member_options['member_only_all'] == 'Y')) { event_espresso_user_login(); } else { //Serve up the registration form //As of version 3.0.17 the registration details have been moved to registration_form.php require 'registration_page_display.php'; } } //End if ($num_attendees >= $reg_limit) (Shows the regsitration form if enough spaces exist) } else { //If there are no results from the query, display this message echo '<h3>' . __('This event has expired or is no longer available.', 'event_espresso') . '</h3>'; } echo espresso_registration_footer(); //Check to see how many database queries were performed //echo '<p>Database Queries: ' . get_num_queries() .'</p>'; }
<p class="espesso_event_full"> <?php _e('Sorry, there are not enough spaces available to complete your registration.', 'event_espresso'); ?> </p> <p class="espesso_event_full"> <?php _e('Quantity in your Party:', 'event_espresso'); ?> <?php echo $quantity; ?> </p> <p class="espesso_event_full"><?php _e('Spaces Available:', 'event_espresso'); ?> <?php echo get_number_of_attendees_reg_limit($event_id, 'avail_spaces_slash_reg_limit'); ?> </p> <?php return; } //Uncomment to check the number of available spaces //echo get_number_of_attendees_reg_limit($event_id, 'number_available_spaces'); //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"; } } //End if ($payment_status == ("Incomplete") )
function event_process_payments() { $org_options = get_option('events_organization_settings'); global $wpdb; if ($_POST['perm_delete_event']) { if (is_array($_POST['checkbox'])) { while (list($key, $value) = each($_POST['checkbox'])) { $del_id = $key; event_espresso_empty_event_trash($del_id); //$sql = "DELETE FROM " . EVENTS_ATTENDEE_TABLE . " WHERE registration_id = '$del_id'"; //$wpdb->query( $sql ); } } ?> <div id="message" class="updated fade"> <p><strong> <?php _e('Event(s) have been permanently deleted.', 'event_espresso'); ?> </strong></p> </div> <?php } ?> <h3><?php _e('Select an event to view attendee details and payments', 'event_espresso'); ?> </h3> <div style="float:right; margin:10px 20px;"> <ul> <li><button style="margin-left:20px" class="button-primary" onclick="window.location='<?php echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&id=" . $event_id . "&export=report&action=payment&all_events=true"; ?> '" > <?php _e('Export All Event Attendees to Excel', 'event_espresso'); ?> </button> </li> </ul> </div> <div id="tablewrapper"> <div id="tableheader"> <div class="search"> <select id="columns" onchange="sorter.search('query')"></select> <input type="text" id="query" onkeyup="sorter.search('query')" /> </div> <span class="details"> <div><?php _e('Records', 'event_espresso'); ?> <span id="startrecord"></span> - <span id="endrecord"></span> <?php _e('of', 'event_espresso'); ?> <span id="totalrecords"></span> </div> <div><a href="javascript:sorter.reset()"><?php _e('Reset', 'event_espresso'); ?> </a></div> </span> </div> <form id="form1" name="form1" method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?> "> <table id="table" class="tinytable"> <thead> <tr> <th><h3><?php _e('Delete', 'event_espresso'); ?> </h3></th> <th><h3><?php _e('Event ID', 'event_espresso'); ?> </h3></th> <th><h3><?php _e('Event Name', 'event_espresso'); ?> </h3></th> <th><h3><?php _e('Start Date', 'event_espresso'); ?> </h3></th> <th><h3><?php _e('Status', 'event_espresso'); ?> </h3></th> <th><h3><?php _e('# Attendees', 'event_espresso'); ?> </h3></th> <th><h3><?php _e('Action', 'event_espresso'); ?> </h3></th> </tr> </thead> <tbody> <?php $event_results = $wpdb->get_results("SELECT * FROM " . EVENTS_DETAIL_TABLE . " ORDER BY date(start_date) " . $limit); if ($wpdb->num_rows > 0) { foreach ($event_results as $event) { $event_id = $event->id; $event_name = $event->event_name; $event_desc = $event->event_desc; $event_description = $event->event_desc; $event_identifier = $event->event_identifier; $event_cost = $event->event_cost; $active = $event->is_active; $event_status = $event->event_status; $status = array(); $status = event_espresso_get_is_active($event_id); $start_date = $event->start_date; $end_date = $event->end_date; $reg_limit = $event->reg_limit; ?> <tr> <td> <?php echo $event_status == 'D' ? '<input name="checkbox[' . $event_id . ']" type="checkbox" title="Permanently delete ' . $event_name . '" />' : ''; ?> </td> <td><?php echo $event_id; ?> </td> <td><a href="admin.php?page=events&event_id=<?php echo $event_id; ?> &event_admin_reports=list_attendee_payments" title="<?php _e('View Attendees', 'event_espresso'); ?> "><?php echo stripslashes($event_name); ?> </a></td> <td><?php echo event_date_display($start_date); ?> </td> <td><?php echo $status['display']; ?> </td> <td><?php echo get_number_of_attendees_reg_limit($event_id, 'num_attendees_slash_reg_limit'); ?> </td> <td><a href="admin.php?page=events&event_id=<?php echo $event_id; ?> &event_admin_reports=list_attendee_payments" title="<?php _e('View Attendees', 'event_espresso'); ?> "><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/group.png" width="16" height="16" alt="<?php _e('View Attendees', 'event_espresso'); ?> " /></a> | <a href="admin.php?page=events&action=edit&event_id=<?php echo $event_id; ?> " title="<?php _e('Edit Event', 'event_espresso'); ?> "><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/calendar_edit.png" width="16" height="16" alt="<?php _e('Edit Event', 'event_espresso'); ?> " /></a> | <a href="#" onclick="window.location='<?php echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&id=" . $event_id . "&export=report&action=payment&type=excel"; ?> '" title="<?php _e('Export to Excel', 'event_espresso'); ?> "><img alt="<?php _e('Export to Excel', 'event_espresso'); ?> " src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/excel_icon.png" width="16" height="16" /></a> | <a href="#" onclick="window.location='<?php echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&id=" . $event_id . "&export=report&action=payment&type=csv"; ?> '" title="<?php _e('Export to CSV', 'event_espresso'); ?> "><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/csv_icon_sm.gif" width="15" height="16" alt="<?php _e('Export to CSV', 'event_espresso'); ?> " /></a> | <a href="admin.php?page=events&event_admin_reports=event_newsletter&event_id=<?php echo $event_id; ?> " title="<?php _e('Email Event Attendees', 'event_espresso'); ?> "><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/email_go.png" width="16" height="16" alt="<?php _e('Email Event Attendees', 'event_espresso'); ?> " /></a></td> </tr> <?php } } else { ?> <tr> <td><?php _e('No Record Found!', 'event_espresso'); ?> </td> </tr> <?php } ?> </tbody> </table> <input type="checkbox" name="sAll" onclick="selectAll(this)" /> <strong> <?php _e('Check All', 'event_espresso'); ?> </strong> <input name="perm_delete_event" type="submit" class="button-secondary" id="perm_delete_event" value="<?php _e('Permanently Delete Events(s)', 'event_espresso'); ?> " style="margin-left:100px;" onclick="return confirmDelete();" /> </form> <div id="tablefooter"> <div id="tablenav"> <div> <img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/first.gif" width="16" height="16" alt="First Page" onclick="sorter.move(-1,true)" /> <img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/previous.gif" width="16" height="16" alt="First Page" onclick="sorter.move(-1)" /> <img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/next.gif" width="16" height="16" alt="First Page" onclick="sorter.move(1)" /> <img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/last.gif" width="16" height="16" alt="Last Page" onclick="sorter.move(1,true)" /> </div> <div> <select id="pagedropdown"></select> </div> <div> <a href="javascript:sorter.showall()"><?php _e('View All', 'event_espresso'); ?> </a> </div> </div> <div id="tablelocation"> <div> <select onchange="sorter.size(this.value)"> <option value="5">5</option> <option value="10" selected="selected">10</option> <option value="20">20</option> <option value="50">50</option> <option value="100">100</option> </select> <span><?php _e('Entries Per Page', 'event_espresso'); ?> </span> </div> <div class="page"><?php _e('Page', 'event_espresso'); ?> <span id="currentpage"></span> <?php _e('of', 'event_espresso'); ?> <span id="totalpages"></span> </div> </div> </div> </div> <script type="text/javascript"> var sorter = new TINY.table.sorter('sorter','table',{ headclass:'head', ascclass:'asc', descclass:'desc', evenclass:'evenrow', oddclass:'oddrow', evenselclass:'evenselected', oddselclass:'oddselected', paginate:true, size:30, colddid:'columns', currentid:'currentpage', totalid:'totalpages', startingrecid:'startrecord', endingrecid:'endrecord', totalrecid:'totalrecords', hoverid:'selectedrow', pageddid:'pagedropdown', navid:'tablenav', sortcolumn:1, sortdir:1, //sum:[2], //avg:[2,7,8,9], //columns:[{index:7, format:'%', decimals:1},{index:2, format:'$', decimals:0}], init:true }); </script> <?php }
function event_espresso_get_event_list_table($sql) { event_espresso_session_start(); if (!isset($_SESSION['event_espresso_sessionid'])) { $sessionid = mt_rand(100, 999) . time(); $_SESSION['event_espresso_sessionid'] = $sessionid; } //print_r( $_SESSION['event_espresso_sessionid']); //See if the session already exists global $wpdb; //echo 'This page is located in ' . get_option( 'upload_path' ); $org_options = get_option('events_organization_settings'); $event_page_id = $org_options['event_page_id']; $currency_symbol = $org_options['currency_symbol']; $events = $wpdb->get_results($sql); $category_name = $wpdb->last_result[0]->category_name; $category_desc = $wpdb->last_result[0]->category_desc; $display_desc = $wpdb->last_result[0]->display_desc; if ($display_desc == 'Y') { echo '<p>' . htmlspecialchars_decode($category_name) . '</p>'; echo '<p>' . htmlspecialchars_decode($category_desc) . '</p>'; } //If the members addon is installed, get the users information if available if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . "members/member_functions.php")) { if (get_option('events_members_active') == 'true') { require_once EVENT_ESPRESSO_MEMBERS_DIR . "member_functions.php"; //Load Members functions } } if (!is_user_logged_in() && get_option('events_members_active') == 'true' && $member_only == 'Y') { //Display a message if the user is not logged in. //_e('Member Only Event. Please ','event_espresso') . event_espresso_user_login_link() . '.'; } else { ?> <div class="pagination"> Viewing all member only reservation times for the next 10 days. </div> <table class="forum"> <tr> <th id="th-group"><?php _e('Event Date', 'event_espresso'); ?> </th> <th id="th-group"><?php _e('Start Time', 'event_espresso'); ?> </th> <th id="th-group"><?php _e('Description', 'event_espresso'); ?> </th> <th id="th-group"><?php _e('Open Spots', 'event_espresso'); ?> </th> <th id="th-group"><?php _e('Register Link', 'event_espresso'); ?> </th> <th id="th-group"><?php _e('Boat Captain?', 'event_espresso'); ?> </th> </tr> <?php foreach ($events as $event) { $event_id = $event->id; $event_name = $event->event_name; $event_desc = $event->event_desc; $event_identifier = $event->event_identifier; $active = $event->is_active; $start_date = $event->start_date; $start_time = $event->start_time; $reg_limit = $event->reg_limit; $event_address = $event->address; $member_only = $event->member_only; $event_desc = strip_tags(html_entity_decode($event_desc)); $live_button = '<a id="a_register_link-' . $event_id . '" href="' . get_option('siteurl') . '/?page_id=' . $event_page_id . '®event_action=register&event_id=' . $event_id . '&name_of_event=' . stripslashes($event_name) . '">Reserve Spot</a>'; $open_spots = get_number_of_attendees_reg_limit($event_id, 'available_spaces'); if ($open_spots < 1) { $live_button = 'Closed'; } ?> <tr class=""> <td class="td-group"> <?php echo event_date_display($start_date); ?> </td> <td class="td-group"> <?php echo $start_time; ?> </td> <td class="td-group"> <?php echo $event_desc; ?> </td> <td class="td-group"> <?php echo $open_spots; ?> </td> <td class="td-group"> <?php echo $live_button; ?> </td> <td class="td-group"> No Captain yet </td> </tr> <?php } //close foreach ?> </table> <?php // close is_user_logged_in } }
function edit_event($event_id = 0) { global $wpdb, $org_options, $espresso_premium; ob_start(); $SQL = "SELECT e.*, ev.id as venue_id\n\t FROM " . EVENTS_DETAIL_TABLE . " e\n\t LEFT JOIN " . EVENTS_VENUE_REL_TABLE . " vr ON e.id = vr.event_id\n\t LEFT JOIN " . EVENTS_VENUE_TABLE . " ev ON vr.venue_id = ev.id\n\t WHERE e.id = %d"; $events = $wpdb->get_results($wpdb->prepare($SQL, $event_id)); if (!is_array($events) || count($events) <= 0) { event_espresso_edit_list(); #echo "<div class='updated fade below-h2'><p>"; #_e("Event is not available any more!","eventespresso"); #echo "</p></div>"; return 1; } foreach ($events as $event) { $event_id = $event->id; $event_name = htmlentities(stripslashes($event->event_name), ENT_QUOTES, 'UTF-8'); $event_desc = htmlentities(stripslashes($event->event_desc), ENT_QUOTES, 'UTF-8'); $display_desc = $event->display_desc; $display_reg_form = $event->display_reg_form; $member_only = $event->member_only; $phone = stripslashes_deep($event->phone); $externalURL = stripslashes_deep($event->externalURL); //Early discounts $early_disc = stripslashes_deep($event->early_disc); $early_disc_date = stripslashes_deep($event->early_disc_date); $early_disc_percentage = stripslashes_deep($event->early_disc_percentage); $post_id = $event->post_id; $post_type = $event->post_type; $event_identifier = stripslashes_deep($event->event_identifier); $registration_start = $event->registration_start; $registration_end = $event->registration_end; $registration_startT = $event->registration_startT; $resitration_endT = $event->registration_endT; $timezone_string = $event->timezone_string; $start_date = $event->start_date; $end_date = $event->end_date; $tax_percentage = $event->tax_percentage; $tax_mode = $event->tax_mode; $start_time = isset($event->start_time) ? $event->start_time : ''; $end_time = isset($event->end_time) ? $event->end_time : ''; $reg_limit = $event->reg_limit; $additional_limit = $event->additional_limit; $allow_overflow = $event->allow_overflow; $overflow_event_id = $event->overflow_event_id; $allow_multiple = $event->allow_multiple; $event_cost = unserialize(isset($event->event_cost) ? $event->event_cost : ''); $is_active = $event->is_active; $status = array(); $status = event_espresso_get_is_active($event_id); $event_status = $event->event_status; $conf_mail = stripslashes_deep($event->conf_mail); $send_mail = stripslashes_deep($event->send_mail); $use_coupon_code = $event->use_coupon_code; $alt_email = $event->alt_email; $address = stripslashes_deep($event->address); $address2 = stripslashes_deep($event->address2); $city = stripslashes_deep($event->city); $state = stripslashes_deep($event->state); $zip = stripslashes_deep($event->zip); $country = stripslashes_deep($event->country); $venue_id = stripslashes_deep($event->venue_id); $venue_title = stripslashes_deep($event->venue_title); $venue_url = stripslashes_deep($event->venue_url); $venue_phone = stripslashes_deep($event->venue_phone); $venue_image = stripslashes_deep($event->venue_image); $email_id = $event->email_id; $ticket_id = $event->ticket_id; $wp_user = $event->wp_user; $date_submitted = $event->submitted != '0000-00-00 00:00:00' ? empty($event->submitted) ? '' : event_date_display($event->submitted, get_option('date_format')) : 'N/A'; $google_map_link = espresso_google_map_link(array('address' => $address, 'city' => $city, 'state' => $state, 'zip' => $zip, 'country' => $country)); //Virtual location $virtual_url = stripslashes_deep($event->virtual_url); $virtual_phone = stripslashes_deep($event->virtual_phone); $question_groups = unserialize($event->question_groups); global $event_meta; $event_meta = unserialize($event->event_meta); $recurrence_id = $event->recurrence_id; $visible_on = $event->visible_on; $require_pre_approval = $event->require_pre_approval; if (function_exists('event_espresso_edit_event_groupon')) { $use_groupon_code = $event->use_groupon_code; } } $values = array(array('id' => 'Y', 'text' => __('Yes', 'event_espresso')), array('id' => 'N', 'text' => __('No', 'event_espresso'))); //If user is an event manager, then show only their events if (function_exists('espresso_is_my_event') && espresso_is_my_event($event_id) != true) { echo '<h2>' . __('Sorry, you do not have permission to edit this event.', 'event_espresso') . '</h2>'; return; } ?> <!--Update event display--> <div id="submitdiv" class="postbox"> <div class="handlediv" title="Click to toggle"><br /> </div> <h3 class='hndle'> <span> <?php _e('Quick Overview', 'event_espresso'); ?> </span> </h3> <div class="inside"> <div class="submitbox" id="submitpost"> <div id="minor-publishing"> <div id="minor-publishing-actions" class="clearfix"> <div id="preview-action"> <a class="preview button" href="<?php echo espresso_reg_url($event_id); ?> " target="_blank" id="event-preview" tabindex="5"> <?php _e('View Event', 'event_espresso'); ?> </a> <input type="hidden" name="event-preview" id="event-preview" value="" /> </div> <div id="copy-action"> <a class="preview button" href="admin.php?page=events&action=copy_event&event_id=<?php echo $event_id; ?> " id="post-copy" tabindex="4" onclick="return confirm('<?php _e('Are you sure you want to copy ' . $event_name . '?', 'event_espresso'); ?> ')"> <?php _e('Duplicate Event', 'event_espresso'); ?> </a> <input type="hidden" name="event-copy" id="event-copy" value="" /> </div> </div> <!-- /minor-publishing-actions --> <div id="misc-publishing-actions"> <div class="misc-pub-section curtime" id="visibility"> <span id="timestamp"> <?php _e('Start Date', 'event_espresso'); ?> <b> <?php echo event_date_display($start_date); ?> <?php echo event_date_display($start_time, get_option('time_format')); ?> </b> </span> </div> <div class="misc-pub-section"> <label for="post_status"> <?php _e('Current Status:', 'event_espresso'); ?> </label> <span id="post-status-display"> <?php echo $status['display']; ?> </span> </div> <div class="misc-pub-section" id="visibility"> <img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/group.png" width="16" height="16" alt="<?php _e('View Attendees', 'event_espresso'); ?> " /> <?php echo !empty($number_attendees) ? __('Attendees', 'event_espresso') : '<a href="admin.php?page=events&event_admin_reports=list_attendee_payments&event_id=' . $event_id . '">' . __('Attendees', 'event_espresso') . '</a>'; ?> : <?php echo get_number_of_attendees_reg_limit($event_id, 'num_attendees_slash_reg_limit'); ?> </div> <div class="misc-pub-section <?php echo function_exists('espresso_is_admin') && espresso_is_admin() == true && $espresso_premium == true ? '' : 'misc-pub-section-last'; ?> " id="visibility2"> <a href="admin.php?page=events&event_admin_reports=event_newsletter&event_id=<?php echo $event_id; ?> " title="<?php _e('Email Event Attendees', 'event_espresso'); ?> "><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/email_go.png" width="16" height="16" alt="<?php _e('Newsletter', 'event_espresso'); ?> " /></a> <a href="admin.php?page=events&event_admin_reports=event_newsletter&event_id=<?php echo $event_id; ?> " title="<?php _e('Email Event Attendees', 'event_espresso'); ?> "> <?php _e('Email Event Attendees', 'event_espresso'); ?> </a></div> <?php if (function_exists('espresso_is_admin') && espresso_is_admin() == true && $espresso_premium == true) { $user_name = espresso_user_meta($wp_user, 'user_firstname') != '' ? espresso_user_meta($wp_user, 'user_firstname') . ' ' . espresso_user_meta($wp_user, 'user_lastname') . ' (<a href="user-edit.php?user_id=' . $wp_user . '">' . espresso_user_meta($wp_user, 'user_nicename') . '</a>)' : espresso_user_meta($wp_user, 'display_name') . ' (<a href="user-edit.php?user_id=' . $wp_user . '">' . espresso_user_meta($wp_user, 'user_nicename') . '</a>)'; $user_company = espresso_user_meta($wp_user, 'company') != '' ? espresso_user_meta($wp_user, 'company') : ''; $user_organization = espresso_user_meta($wp_user, 'organization') != '' ? espresso_user_meta($wp_user, 'organization') : ''; $user_co_org = $user_company != '' ? $user_company : $user_organization; echo '<div class="misc-pub-section misc-pub-section-last" id="visibility3">'; echo '<ul>'; echo '<li><strong>' . __('Submitted By:', 'event_espresso') . '</strong> ' . $user_name . '</li>'; echo '<li><strong>' . __('Email:', 'event_espresso') . '</strong> ' . espresso_user_meta($wp_user, 'user_email') . '</li>'; echo $user_co_org != '' ? '<li><strong>' . __('Organization:', 'event_espresso') . '</strong> ' . espresso_user_meta($wp_user, 'company') . '</li>' : ''; echo '<li><strong>' . __('Date Submitted:', 'event_espresso') . '</strong> ' . $date_submitted . '</li>'; echo '</ul>'; echo '</div>'; } ?> </div> <!-- /misc-publishing-actions --> </div> <!-- /minor-publishing --> <div id="major-publishing-actions" class="clearfix"> <?php if ($recurrence_id > 0) { ?> <div id="delete-action"> <a class="submitdelete deletion" href="admin.php?page=events&action=delete_recurrence_series&recurrence_id=<?php echo $recurrence_id; ?> " onclick="return confirm('<?php _e('Are you sure you want to delete ' . $event_name . '?', 'event_espresso'); ?> ')"> <?php _e('Delete all events in this series', 'event_espresso'); ?> </a> </div> <?php } else { ?> <div id="delete-action"> <a class="submitdelete deletion" href="admin.php?page=events&action=delete&event_id=<?php echo $event_id; ?> " onclick="return confirm('<?php _e('Are you sure you want to delete ' . $event_name . '?', 'event_espresso'); ?> ')"> <?php _e('Delete Event', 'event_espresso'); ?> </a> </div> <?php } ?> <div id="publishing-action"> <input class="button-primary" type="submit" name="Submit" value="<?php _e('Update Event', 'event_espresso'); ?> " id="save_event_setting" /> </div> <!-- /publishing-action --> </div> <!-- /major-publishing-actions --> </div> <!-- /submitpost --> </div> <!-- /inside --> </div> <!-- /submitdiv --> <?php if ($espresso_premium == true) { do_action('action_hook_espresso_edit_event_right_column_top', $event_id); } $advanced_options = ''; if (file_exists(EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/event-management/advanced_settings.php')) { require_once EVENT_ESPRESSO_PLUGINFULLPATH . "includes/admin-files/event-management/advanced_settings.php"; } else { //Display Lite version options $status = array(array('id' => 'A', 'text' => __('Active', 'event_espresso')), array('id' => 'D', 'text' => __('Deleted', 'event_espresso'))); $advanced_options = '<p><strong>' . __('Advanced Options:', 'event_espresso') . '</strong></p>' . '<p><label>' . __('Is this an active event? ', 'event_espresso') . '</label>' . __(select_input('is_active', $values, $is_active)) . '</p>' . '<p><label>' . __('Display description? ', 'event_espresso') . '</label>' . select_input('display_desc', $values, $display_desc) . '</p>' . '<p><label>' . __('Display registration form? ', 'event_espresso') . '</label>' . select_input('display_reg_form', $values, $display_reg_form) . '</p>'; } //Display Lite version options - End espresso_postbox('event-status', 'Event Options', '<p><label for"reg-limit">' . __('Attendee Limit', 'event_espresso') . ': </label><input name="reg_limit" id="reg-limit" size="10" type="text" value="' . $reg_limit . '" /><br />' . '<span>(' . __('leave blank for unlimited', 'event_espresso') . ')</span></p>' . '<p><label>' . __('Allow group registrations?', 'event_espresso') . '</label> ' . select_input('allow_multiple', $values, $allow_multiple) . '</p>' . '<p><label for="addit-limit">' . __('Max Group Registrants', 'event_espresso') . ':</label> <input type="text" id="addit-limit" name="additional_limit" value="' . $additional_limit . '" size="4" />' . '</p>' . $advanced_options); if (function_exists('espresso_ticket_dd') && $espresso_premium == true) { ?> <div id="event-category" class="postbox"> <div class="handlediv" title="Click to toggle"><br> </div> <h3 class="hndle"> <span> <?php _e('Custom Tickets', 'event_espresso'); ?> </span> </h3> <div class="inside"> <?php echo espresso_ticket_dd($ticket_id); ?> </div> </div> <?php } if ($espresso_premium == true) { ?> <div id="featured-image-options" class="postbox"> <div class="handlediv" title="Click to toggle"><br /> </div> <h3 class="hndle"> <span> <?php _e('Featured Image', 'event_espresso'); ?> </span> </h3> <div class="inside"> <div id="featured-image"> <?php if (!empty($event_meta['event_thumbnail_url'])) { $event_thumb = $event_meta['event_thumbnail_url']; } else { $event_thumb = ''; } ?> <label for="upload_image"> <?php _e('Add Featured Image', 'event_espresso'); ?> </label> <input id="upload_image" type="hidden" size="36" name="upload_image" value="<?php echo $event_thumb; ?> " /> <input id="upload_image_button" type="button" value="<?php _e('Upload Image', 'event_espresso'); ?> " /> <?php if ($event_thumb) { ?> <p class="event-featured-thumb"><img style="width: 100%;" src="<?php echo $event_thumb; ?> " alt="" /></p> <a id='remove-image' href='#' title='<?php _e('Remove Image', 'event_espresso'); ?> ' onclick='return false;'><?php _e('Remove Image', 'event_espresso'); ?> </a> <?php } ?> </div> </div> </div> <?php } /* * Added for seating chart addon */ if (defined('ESPRESSO_SEATING_CHART')) { $seating_chart_id = 0; $seating_chart_event = $wpdb->get_row("select * from " . EVENTS_SEATING_CHART_EVENT_TABLE . " where event_id = {$event_id}"); if ($seating_chart_event !== NULL) { $seating_chart_id = $seating_chart_event->seating_chart_id; } ?> <div style="display: block;" id="seating_chart-options" class="postbox"> <div class="handlediv" title="Click to toggle"><br /> </div> <h3 class="hndle"><span> <?php _e('Seating chart', 'event_espresso'); ?> </span></h3> <div class="inside"> <p> <select name="seating_chart_id" id="seating_chart_id" style="float:none;"> <option value="0" <?php if ($seating_chart_id == 0) { echo 'selected="selected"'; } ?> ><?php _e('None', 'event_espresso'); ?> </option> <?php $seating_charts = $wpdb->get_results("select * from " . EVENTS_SEATING_CHART_TABLE . " order by name"); foreach ($seating_charts as $seating_chart) { ?> <option value="<?php echo $seating_chart->id; ?> " <?php if ($seating_chart_id == $seating_chart->id) { echo 'selected="selected"'; } ?> ><?php echo $seating_chart->name; ?> </option> <?php } ?> </select> <?php do_action('espresso_seating_chart_select', $event_id); ?> <?php do_action('ee_seating_chart_js'); ?> <?php do_action('ee_seating_chart_css'); ?> <?php do_action('ee_seating_chart_flush_expired_seats'); ?> </p> </div> </div> <?php } /* * End */ ###### Modification by wp-developers to introduce attendee pre-approval requirement ########## if (isset($org_options['use_attendee_pre_approval']) && $org_options['use_attendee_pre_approval'] == 'Y' && $espresso_premium == true) { ?> <div id="attendee-pre-approval-options" class="postbox"> <div class="handlediv" title="Click to toggle"><br /> </div> <h3 class="hndle"> <span> <?php _e('Attendee pre-approval required?', 'event_espresso'); ?> </span> </h3> <div class="inside"> <p class="pre-approve"> <?php $pre_approval_values = array(array('id' => '1', 'text' => __('Yes', 'event_espresso')), array('id' => '0', 'text' => __('No', 'event_espresso'))); echo select_input("require_pre_approval", $pre_approval_values, $require_pre_approval); ?> </p> </div> </div> <?php } ########## END ################################# if (defined('EVENT_ESPRESSO_MEMBERS_DIR') && $espresso_premium == true) { ?> <div id="member-options" class="postbox"> <div class="handlediv" title="Click to toggle"><br> </div> <h3 class="hndle"> <span> <?php _e('Member Options', 'event_espresso'); ?> </span> </h3> <div class="inside"> <p><?php echo event_espresso_member_only($member_only); ?> </p> </div> </div> <!-- /member-options --> <?php } if (defined('EVENTS_MAILCHIMP_ATTENDEE_REL_TABLE') && $espresso_premium == true) { MailChimpView::event_list_selection(); } ?> <div id="event-categories" class="postbox"> <div class="handlediv" title="Click to toggle"><br> </div> <h3 class="hndle"> <span> <?php _e('Event Category', 'event_espresso'); ?> </span> </h3> <div class="inside"> <?php echo event_espresso_get_categories($event_id); ?> </div> </div> <!-- /event-category --> <?php if (file_exists(EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/event-management/promotions_box.php')) { require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/event-management/promotions_box.php'; } ?> <!-- /event-promotions --> <?php echo espresso_event_question_groups($question_groups, $event_meta['add_attendee_question_groups'], $event); ?> <!-- /event-questions --> <?php do_action('action_hook_espresso_staff_cb', $event_id, $recurrence_id); if (defined('EVENTS_GROUPON_CODES_TABLE') && $espresso_premium == true) { ?> <div id="groupon-options" class="postbox"> <div class="handlediv" title="Click to toggle"><br> </div> <h3 class="hndle"> <span> <?php _e('Groupon Options', 'event_espresso'); ?> </span> </h3> <div class="inside"> <p><?php echo event_espresso_edit_event_groupon($use_groupon_code); ?> </p> </div> </div> <!-- /groupon-options --> <?php } if ($espresso_premium == true) { do_action('action_hook_espresso_edit_event_right_column_bottom', $event_id); } $sidebar_content = ob_get_clean(); ob_start(); ?> <div id="titlediv"> <strong> <?php _e('Event Title', 'event_espresso'); ?> </strong> <div id="titlewrap"> <label class="screen-reader-text" for="title"> <?php _e('Event Title', 'event_espresso'); ?> </label> <input type="text" name="event" size="30" tabindex="1" value="<?php echo $event_name; ?> " id="title" autocomplete="off" /> </div> <!-- /titlewrap --> <div class="inside"> <div id="edit-slug-box"> <strong> <?php _e('Unique Event Identifier:', 'event_espresso'); ?> </strong> <input disabled="disabled" type="text" size="30" tabindex="2" name="event_identifier" id="event_identifier" value ="<?php echo $event_identifier; ?> " /> <?php echo '<a href="#" class="button" onclick="prompt('Event Shortcode:', \'[SINGLEEVENT single_event_id="\' + jQuery(\'#event_identifier\').val() + \'"]\'); return false;">' . __('Shortcode') . '</a>'; ?> <?php echo '<a href="#" class="button" onclick="prompt('Short URL:', \'' . espresso_reg_url($event_id) . '\'); return false;">' . __('Short URL') . '</a>'; ?> <?php echo '<a href="#" class="button" onclick="prompt('Full URL:', \'' . home_url() . '/?page_id=' . $org_options['event_page_id'] . '&regevent_action=register&event_id=' . $event_id . '\'); return false;">' . __('Full URL') . '</a>'; ?> </div> <!-- /edit-slug-box --> </div> <!-- /.inside --> </div> <!-- /titlediv --> <div id="descriptiondivrich" class="postarea"> <strong> <?php _e('Event Description', 'event_espresso'); ?> </strong> <?php if (function_exists('wp_editor')) { $args = array("textarea_rows" => 5, "textarea_name" => "event_desc", "editor_class" => "my_editor_custom"); wp_editor(espresso_admin_format_content($event_desc), "event_desc", $args); } else { /* This is the editor used by WordPress. It is very very hard to find documentation for this thing, so I pasted everything I could find below. param: string $content Textarea content. param: string $id Optional, default is 'content'. HTML ID attribute value. param: string $prev_id Optional, default is 'title'. HTML ID name for switching back and forth between visual editors. param: bool $media_buttons Optional, default is true. Whether to display media buttons. param: int $tab_index Optional, default is 2. Tabindex for textarea element. */ //the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2) //the_editor(espresso_admin_format_content($event_desc), $id = 'event_desc'/* , $prev_id = 'title', $media_buttons = true, $tab_index = 3 */); the_editor(espresso_admin_format_content($event_desc), $id = 'event_desc'); } ?> <table id="post-status-info" cellspacing="0"> <tbody> <tr> <td id="wp-word-count"></td> <td class="autosave-info"><span id="autosave"> </span></td> </tr> </tbody> </table> </div> <!-- /postdivrich --> <?php $main_post_content = ob_get_clean(); ob_start(); ?> <div id="normal-sortables" class="meta-box-sortables ui-sortable"> <div style="display: block;" id="event-date-time" class="postbox"> <div class="handlediv" title="Click to toggle"><br> </div> <h3 class="hndle"> <span> <?php _e('Event Date/Times', 'event_espresso'); ?> </span> </h3> <div class="inside"> <table width="100%" border="0" cellpadding="5"> <tr valign="top"> <td class="a"><fieldset id="add-reg-dates"> <legend> <?php _e('Registration Dates', 'event_espresso'); ?> </legend> <p> <label for="registration_start"> <?php echo __('Registration Start:', 'event_espresso'); ?> </label> <input type="text" class="datepicker" size="15" id="registration_start" name="registration_start" value="<?php echo $registration_start; ?> " /> </p> <p> <label for="registration_end"><?php echo __('Registration End:', 'event_espresso'); ?> </label> <input type="text" class="datepicker" size="15" id="registration_end" name="registration_end" value="<?php echo $registration_end; ?> " /> </p> </fieldset> <fieldset> <legend> <?php _e('Event Dates', 'event_espresso'); ?> </legend> <p> <label for="start_date"><?php echo __('Event Start Date', 'event_espresso'); ?> </label> <input type="text" class="datepicker" size="15" id="start_date" name="start_date" value="<?php echo $start_date; ?> " /> </p> <p> <label for="end_date"><?php echo __('Event End Date', 'event_espresso'); ?> </label> <input type="text" class="datepicker" size="15" id="end_date" name="end_date" value="<?php echo $end_date; ?> " /> </p> </fieldset> <?php if (isset($org_options['use_event_timezones']) && $org_options['use_event_timezones'] == 'Y' && $espresso_premium == true) { ?> <fieldset id="event-timezone"> <p> <label> <?php _e('Event Timezone', 'event_espresso'); ?> :</label> <?php echo eventespresso_ddtimezone($event_id); ?> </p> </fieldset> <?php } ?> </td> <?php // ADD TIME REGISTRATION ?> <td class="b"><fieldset id="add-register-times"> <legend> <?php _e('Registration Times', 'event_espresso'); ?> </legend> <?php echo event_espresso_timereg_editor($event_id); ?> </fieldset> <fieldset id="add-event-times"> <legend> <?php _e('Event Times', 'event_espresso'); ?> </legend> <?php echo event_espresso_time_editor($event_id); ?> </fieldset> <?php if ((!isset($org_options['use_event_timezones']) || $org_options['use_event_timezones'] != 'Y') && $espresso_premium == true) { ?> <p><span class="run-in"> <?php _e('Current Time', 'event_espresso'); ?> :</span> <span class="current-date"> <?php echo date(get_option('date_format')) . ' ' . date(get_option('time_format')); ?> </span> <a class="change-date-time" href="options-general.php" target="_blank"> <?php _e('Change timezone and date format settings?', 'event_espresso'); ?> </a></p> <?php } ?> </td> </tr> </table> </div> </div> <?php /** * Load the recurring events form if the add-on has been installed. * */ if (defined('EVENT_ESPRESSO_RECURRENCE_TABLE') && $espresso_premium == true) { require_once EVENT_ESPRESSO_RECURRENCE_FULL_PATH . "functions/re_view_functions.php"; //For now, only the recurring events will show the form if ($recurrence_id > 0) { event_espresso_re_form($recurrence_id); } } ?> <div id="event-pricing" class="postbox"> <?php defined('EVENT_ESPRESSO_MEMBERS_DIR') ? $members_active = 'class="members-active"' : ($members_active = ''); ?> <div class="handlediv" title="Click to toggle"><br> </div> <h3 class="hndle"> <span> <?php _e('Event Pricing', 'event_espresso'); ?> </span> </h3> <div class="inside"> <table <?php echo $members_active; ?> width="100%" border="0" cellpadding="5"> <tr valign="top"> <td id="standard-pricing" class="a"><?php event_espresso_multi_price_update($event_id); //Standard pricing ?> </td> <?php //If the members addon is installed, define member only event settings if (defined('EVENT_ESPRESSO_MEMBERS_DIR') && $espresso_premium == true) { ?> <td id="member-pricing" class="b"><?php echo event_espresso_member_only_pricing($event_id); //Show the the member only pricing options. ?> </td> <?php } ?> </tr> </table> </div> </div> <h2> <?php _e('Advanced Options', 'event_espresso'); ?> </h2> <?php if ($espresso_premium == true) { do_action('action_hook_espresso_edit_event_left_column_advanced_options_top', $event_id); } ?> <div id="event-location" class="postbox"> <div class="handlediv" title="Click to toggle"><br /> </div> <h3 class="hndle"> <span> <?php _e('Additional Event/Venue Information', 'event_espresso'); ?> </span> </h3> <div class="inside"> <table width="100%" border="0" cellpadding="5"> <tr valign="top"> <?php if (function_exists('espresso_venue_dd') && $org_options['use_venue_manager'] == 'Y' && $espresso_premium == true) { $ven_type = 'class="use-ven-manager"'; ?> <td <?php echo $ven_type; ?> ><fieldset id="venue-manager"> <legend><?php echo __('Venue Information', 'event_espresso'); ?> </legend> <?php if (!espresso_venue_dd()) { ?> <p class="info"><b> <?php _e('You have not created any venues yet.', 'event_espresso'); ?> </b></p> <p><a href="admin.php?page=event_venues"><?php echo __('Add venues to the Venue Manager', 'event_espresso'); ?> </a></p> <?php } else { ?> <?php echo espresso_venue_dd($venue_id); ?> <?php } ?> </fieldset></td> <?php } else { $ven_type = 'class="manual-venue"'; ?> <td <?php echo $ven_type; ?> ><fieldset> <legend> <?php _e('Physical Location', 'event_espresso'); ?> </legend> <p> <label for="phys-addr"> <?php _e('Address:', 'event_espresso'); ?> </label> <input size="20" id="phys-addr" tabindex="100" type="text" value="<?php echo $address; ?> " name="address" /> </p> <p> <label for="phys-addr-2"> <?php _e('Address 2:', 'event_espresso'); ?> </label> <input size="20" id="phys-addr-2" tabindex="101" type="text" value="<?php echo $address2; ?> " name="address2" /> </p> <p> <label for="phys-city"> <?php _e('City:', 'event_espresso'); ?> </label> <input size="20" id="phys-city" tabindex="102" type="text" value="<?php echo $city; ?> " name="city" /> </p> <p> <label for="phys-state"> <?php _e('State:', 'event_espresso'); ?> </label> <input size="20" id="phys-state" tabindex="103" type="text" value="<?php echo $state; ?> " name="state" /> </p> <p> <label for="zip-postal"> <?php _e('Zip/Postal Code:', 'event_espresso'); ?> </label> <input size="20" id="zip-postal" tabindex="104" type="text" value="<?php echo $zip; ?> " name="zip" /> </p> <p> <label for="phys-country"> <?php _e('Country:', 'event_espresso'); ?> </label> <input size="20" id="phys-country" tabindex="105" type="text" value="<?php echo $country; ?> " name="country" /> </p> <p> <?php _e('Google Map Link (for email):', 'event_espresso'); ?> <br /> <?php echo $google_map_link; ?> </p> </fieldset></td> <td <?php echo $ven_type; ?> > <fieldset> <legend> <?php _e('Venue Information', 'event_espresso'); ?> </legend> <p> <label for="ven-title"> <?php _e('Title:', 'event_espresso'); ?> </label> <input size="20"id="ven-title" tabindex="106" type="text" value="<?php echo $venue_title; ?> " name="venue_title" /> </p> <p> <label for="ven-website"> <?php _e('Website:', 'event_espresso'); ?> </label> <input size="20" id="ven-website" tabindex="107" type="text" value="<?php echo $venue_url; ?> " name="venue_url" /> </p> <p> <label for="ven-phone"> <?php _e('Phone:', 'event_espresso'); ?> </label> <input size="20" id="ven-phone" tabindex="108" type="text" value="<?php echo $venue_phone; ?> " name="venue_phone" /> </p> <p> <label for="ven-image"> <?php _e('Image:', 'event_espresso'); ?> </label> <input size="20" id="ven-image" tabindex="110" type="text" value="<?php echo $venue_image; ?> " name="venue_image" /> </p> <?php } ?> </td> <td <?php echo $ven_type; ?> ><fieldset id="virt-location"> <legend> <?php _e('Virtual Location', 'event_espresso'); ?> </legend> <p> <label for="virt-phone"> <?php _e('Phone:', 'event_espresso'); ?> </label> <input size="20" id="virt-phone" type="text" tabindex="111" value="<?php echo $phone; ?> " name="phone" /> </p> <p> <label for="url-event"> <?php _e('URL of Event:', 'event_espresso'); ?> </label> <textarea id="url-event" cols="30" rows="4" tabindex="112" name="virtual_url"><?php echo $virtual_url; ?> </textarea> </p> <p> <label for="call-in-num"> <?php _e('Call in Number:', 'event_espresso'); ?> </label> <input id="call-in-num" size="20" tabindex="113" type="text" value="<?php echo $virtual_phone; ?> " name="virtual_phone" /> </p> </fieldset></td> </tr> </table> </div> </div> <!-- /event-location--> <?php if ($espresso_premium == true) { ?> <div id="event-meta" class="postbox"> <div class="handlediv" title="Click to toggle"><br> </div> <h3 class="hndle"> <span> <?php _e('Event Meta', 'event_espresso'); ?> </span> </h3> <div class="inside"> <?php event_espresso_meta_edit($event_meta); ?> </div> </div> <?php } ?> <!-- /event-meta--> <div id="confirmation-email" class="postbox"> <div class="handlediv" title="Click to toggle"><br /> </div> <h3 class="hndle"> <span> <?php _e('Email Confirmation:', 'event_espresso'); ?> </span> </h3> <div class="inside"> <div id="emaildescriptiondivrich" class="postarea"> <div class="email-conf-opts"> <p><?php echo __('Send custom confirmation emails for this event?', 'event_espresso') . ' ' . select_input('send_mail', $values, $send_mail); ?> <?php echo '<a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=custom_email_info"><img src="' . EVENT_ESPRESSO_PLUGINFULLURL . '/images/question-frame.png" width="16" height="16" /></a>'; ?> </p> <?php if ($espresso_premium == true) { ?> <p> <?php _e('Use a ', 'event_espresso'); ?> <a href="admin.php?page=event_emails" target="_blank"> <?php _e('pre-existing email', 'event_espresso'); ?> </a>? <?php echo espresso_db_dropdown('id', 'email_name', EVENTS_EMAIL_TABLE, 'email_name', $email_id, 'desc') . ' <a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=email_manager_info"><img src="' . EVENT_ESPRESSO_PLUGINFULLURL . '/images/question-frame.png" width="16" height="16" /></a>'; ?> </p> <br /> <em>OR</em> <?php } ?> <p> <?php _e('Create a custom email:', 'event_espresso'); ?> <?php echo '<a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=event_custom_emails"><img src="' . EVENT_ESPRESSO_PLUGINFULLURL . '/images/question-frame.png" width="16" height="16" /></a>'; ?> </p> </div> <div class="postbox"> <?php //echo '<p>version_compare ='.(version_compare($wp_version, $wp_min_version) >= 0).'</p>'; if (function_exists('wp_editor')) { $args = array("textarea_rows" => 5, "textarea_name" => "conf_mail", "editor_class" => "my_editor_custom"); wp_editor(espresso_admin_format_content($conf_mail), "conf_mail", $args); } else { echo '<textarea name="conf_mail" class="theEditor" id="conf_mail">' . espresso_admin_format_content($conf_mail) . '</textarea>'; espresso_tiny_mce(); } ?> <?php /* ?> <textarea name="conf_mail" class="theEditor" id="conf_mail"><?php echo espresso_admin_format_content($conf_mail); ?></textarea><?php */ ?> <table id="email-confirmation-form" cellspacing="0"> <tr> <td class="aer-word-count"></td> <td class="autosave-info"><span><a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=custom_email_info"> <?php _e('View Custom Email Tags', 'event_espresso'); ?> </a> | <a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=custom_email_example"> <?php _e('Email Example', 'event_espresso'); ?> </a></span></td> </tr> </table> </div> </div> </div> </div> <!-- /confirmation-email--> <?php if (file_exists(EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/event-management/edit_event_post.php')) { require_once EVENT_ESPRESSO_PLUGINFULLPATH . "includes/admin-files/event-management/edit_event_post.php"; } ?> </div> <!-- /normal-sortables--> <?php $center_metabox_content = ob_get_clean(); espresso_choose_layout($main_post_content, $sidebar_content, $center_metabox_content); include_once 'create_events_help.php'; ?> <?php wp_nonce_field('espresso_verify_update_event_nonce', 'nonce_verify_update_event'); //Security check using nonce ?> <input type="hidden" name="edit_action" value="update"> <input type="hidden" name="date_submitted" value="<?php echo $date_submitted; ?> "> <input type="hidden" name="recurrence_id" value="<?php echo $recurrence_id; ?> "> <input type="hidden" name="action" value="edit"> <input type="hidden" name="event_id" value="<?php echo $event_id; ?> "> <script type="text/javascript" charset="utf-8"> //<![CDATA[ jQuery(document).ready(function() { postboxes.add_postbox_toggles('events'); jQuery(".datepicker" ).datepicker({ changeMonth: true, changeYear: true, dateFormat: "yy-mm-dd", showButtonPanel: true }); //Image upload var header_clicked = false; jQuery('#upload_image_button').click(function() { formfield = jQuery('#upload_image').attr('name'); tb_show('', 'media-upload.php?type=image&TB_iframe=1'); jQuery('p.event-featured-thumb').addClass('old'); header_clicked = true; return false; }); window.original_send_to_editor = window.send_to_editor; window.send_to_editor = function(html) { if(header_clicked) { imgurl = jQuery('img',html).attr('src'); jQuery('#' + formfield).val(imgurl); jQuery('#featured-image').append("<p id='image-display'><img class='show-selected-image' src='"+imgurl+"' alt='' /></p>"); header_clicked = false; tb_remove(); } else { window.original_send_to_editor(html); } } // process the remove link in the metabox jQuery('#remove-image').click(function(){ var answer = confirm("<?php _e("Do you really want to delete this image? Please remember to update your event to complete the removal.", 'event_espresso'); ?> "); if (answer){ jQuery("#upload_image").val(''); jQuery("p.event-featured-thumb").remove(); jQuery("p#image-display").remove(); jQuery('#remove-image').remove(); jQuery("#show_thumb_in_lists, #show_on_calendar, #show_thumb_in_regpage").val(false); } return false; }); }); //]]> </script> <?php }
function event_espresso_group_price_dropdown($event_id, $label = 1, $multi_reg = 0, $value = '') { global $wpdb, $org_options; /* * find out pricing type. * - If multiple price options, for each one * -- Create a row in a table with a name * -- qty dropdown * */ //Will make the name an array and put the time id as a key so we //know which event this belongs to $multi_name_adjust = $multi_reg == 1 ? "[{$event_id}]" : ''; $results = $wpdb->get_results("SELECT ept.id, ept.event_cost, ept.surcharge, ept.surcharge_type, ept.price_type, edt.allow_multiple, edt.additional_limit\n FROM " . EVENTS_PRICES_TABLE . " ept\n JOIN " . EVENTS_DETAIL_TABLE . " edt\n ON ept.event_id = edt.id\n WHERE event_id='" . $event_id . "' ORDER BY ept.id ASC"); if ($wpdb->num_rows > 0) { $attendee_limit = 1; //echo $label==1?'<label for="event_cost">' . __('Choose an Option: ','event_espresso') . '</label>':''; //echo '<input type="radio" name="price_option' . $multi_name_adjust . '" id="price_option-' . $event_id . '">'; ?> <table class="price_list"> <?php $available_spaces = get_number_of_attendees_reg_limit($event_id, 'number_available_spaces'); foreach ($results as $result) { //Setting this field for use on the registration form $_SESSION['espresso_session']['events_in_session'][$event_id]['price_id'][$result->id]['price_type'] = $result->price_type; // Addition for Early Registration discount if (early_discount_amount($event_id, $result->event_cost) != false) { $early_price_data = array(); $early_price_data = early_discount_amount($event_id, $result->event_cost); $result->event_cost = $early_price_data['event_price']; $message = __(' Early Pricing', 'event_espresso'); } $surcharge = ''; if ($result->surcharge > 0 && $result->event_cost > 0.0) { $surcharge = " + {$org_options['currency_symbol']}{$result->surcharge} " . __('Surcharge', 'event_espresso'); if ($result->surcharge_type == 'pct') { $surcharge = " + {$result->surcharge}% " . __('Surcharge', 'event_espresso'); } } //echo '<option value="' . number_format($result->event_cost,2) . '|' . $result->price_type . '|' . $result->surcharge . '">' . $result->price_type . ' (' . $org_options['currency_symbol'] . number_format($result->event_cost,2) . $message . ') '. $surcharge . ' </option>'; ?> <tr> <td class="price_type"> <?php echo $result->price_type; ?> </td> <td class="price"> <?php if (!isset($message)) { $message = ''; } echo $org_options['currency_symbol'] . number_format($result->event_cost, 2) . $message . ' ' . $surcharge; ?> </td> <td class="selection"> <?php if ($result->allow_multiple == 'Y') { $attendee_limit = $result->additional_limit + 1; if ($available_spaces != 'Unlimited') { $attendee_limit = $attendee_limit <= $available_spaces ? $attendee_limit : $available_spaces; } event_espresso_multi_qty_dd($event_id, $result->id, $attendee_limit, empty($_SESSION['espresso_session']['events_in_session'][$event_id]['price_id'][$result->id]['attendee_quantity']) ? '' : $_SESSION['espresso_session']['events_in_session'][$event_id]['price_id'][$result->id]['attendee_quantity']); } else { $checked = $wpdb->num_rows == 1 || array_key_exists($result->id, $_SESSION['espresso_session']['events_in_session'][$event_id]['price_id']) && isset($_SESSION['espresso_session']['events_in_session'][$event_id]['price_id'][$result->id]['attendee_quantity']) ? ' checked="checked"' : ''; ?> <input type="radio" class="price_id" name="price_id[<?php echo $event_id; ?> ]" <?php echo $checked; ?> value="<?php echo $result->id; ?> " /> <?php } ?> </td> </tr> <?php } ?> <tr> <td colspan="3" class="reg-allowed-limit"><?php printf(__("You can register a maximum of %d attendees for this event.", 'event_espresso'), $attendee_limit); ?> </td> </tr> </table> <input type="hidden" id="max_attendees-<?php echo $event_id; ?> " class="max_attendees" value= "<?php echo $attendee_limit; ?> " /> <?php } else { if ($wpdb->num_rows == 0) { echo '<span class="free_event">' . __('Free Event', 'event_espresso') . '</span>'; echo '<input type="hidden" name="payment' . $multi_name_adjust . '" id="payment-' . $event_id . '" value="' . __('free event', 'event_espresso') . '">'; } } }