Exemplo n.º 1
0
    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>';
    }
        _e('Please <a href="contact" title="contact us">contact us</a> if you would like to know if spaces are still available.', 'event_espresso');
        ?>
</strong></p>
				<?php 
        break;
    case 'REGISTRATION_NOT_OPEN':
        //only show the event description.
        // if todays date is after $reg_end_date
        // if todays date is prior to $reg_start_date
        ?>
				<p class="event_full"><strong><?php 
        _e('We are sorry but this event is not yet open for registration.', 'event_espresso');
        ?>
</strong></p>
				<p class="event_full"><strong><?php 
        _e('You will be able to register starting ' . event_espresso_no_format_date($reg_start_date, 'F d, Y'), 'event_espresso');
        ?>
</strong></p>
				<?php 
        break;
    default:
        /** This section shows the registration form if it is an active event * */
        if (is_array($add_attendee_question_groups) && count($add_attendee_question_groups) > 0 && $meta['attendee_number'] > 1) {
            $question_groups = $add_attendee_question_groups;
            $meta['additional_attendee_reg_info'] = 9;
            //this will override the deprecated way of doing the additional attendee questions
            $increase_attende_num = true;
        }
        //echo "additional_attendee_reg_info = ".$meta['additional_attendee_reg_info'];
        //echo "Attendee # ".$meta['attendee_number'];
        $attendee_number = $meta['attendee_number'];
Exemplo n.º 3
0
function event_list_attendees()
{
    global $wpdb, $org_options, $ticketing_installed, $espresso_premium;
    define('EVT_ADMIN_URL', admin_url('admin.php?page=events'));
    $EVT_ID = isset($_REQUEST['event_id']) && $_REQUEST['event_id'] != '' ? absint($_REQUEST['event_id']) : FALSE;
    if ($EVT_ID) {
        echo '<h1>' . espresso_event_list_attendee_title($EVT_ID) . '</h1>';
    }
    $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', time());
    if (isset($_POST['delete_customer']) && !empty($_POST['delete_customer'])) {
        if (is_array($_POST['checkbox'])) {
            while (list($att_id, $value) = each($_POST['checkbox'])) {
                $SQL = "DELETE FROM " . EVENTS_ATTENDEE_TABLE . " WHERE id = '%d'";
                $wpdb->query($wpdb->prepare($SQL, $att_id));
                $SQL = "DELETE FROM " . EVENTS_ATTENDEE_META_TABLE . " WHERE attendee_id = '%d'";
                $wpdb->query($wpdb->prepare($SQL, $att_id));
                $SQL = "DELETE FROM " . EVENTS_ANSWER_TABLE . " WHERE attendee_id = '%d'";
                $wpdb->query($wpdb->prepare($SQL, $att_id));
            }
        }
        ?>
		<div id="message" class="updated fade">
			<p>
				<strong><?php 
        _e('Customer(s) have been successfully deleted from the event.', 'event_espresso');
        ?>
</strong>
			</p>
		</div>
		<?php 
    }
    //	MARKING USERS AS ATTENDED (OR NOT)
    if ((!empty($_POST['attended_customer']) || !empty($_POST['unattended_customer'])) && $ticketing_installed == TRUE) {
        if (is_array($_POST['checkbox'])) {
            while (list($att_id, $value) = each($_POST['checkbox'])) {
                // on / off value for attended status checkbox
                $checker = $value == "on" && $_POST['attended_customer'] ? 1 : 0;
                $SQL = "SELECT checked_in_quantity FROM " . EVENTS_ATTENDEE_TABLE . " WHERE id = %d ";
                $ticket_scanned = $wpdb->get_var($wpdb->prepare($SQL, $att_id));
                if ($ticket_scanned >= 1) {
                    ?>
					<div id="message" class="error fade">
						<p>
							<strong><?php 
                    _e('Scanned tickets cannot be redeemed/un-redeemed here.', 'event_espresso');
                    ?>
</strong>
						</p>
					</div>
					<?php 
                } else {
                    if ($wpdb->update(EVENTS_ATTENDEE_TABLE, array('checked_in' => $checker), array('id' => $att_id), array('%d'), array('%d'))) {
                        ?>
					<div id="message" class="updated fade">
					  <p><strong>
						<?php 
                        _e('Customer(s) attendance data successfully updated for this event.', 'event_espresso');
                        ?>
						</strong></p>
					</div>
					<?php 
                    }
                }
            }
        }
    }
    require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/event-management/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 {
        ?>
		<p>
			<strong><?php 
        _e('Advanced filters are available in the premium versions.', 'event_espresso');
        ?>
</strong> 
			<a href="http://eventespresso.com/download/" target="_blank">
				<?php 
        _e('Upgrade Now!', 'event_espresso');
        ?>
			</a>
		</p>
		<?php 
    }
    $sql_clause = " WHERE ";
    $sql_a = "(";
    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 = implode(",", $group);
        $sql_a .= "SELECT a.*, e.id event_id, e.event_name, checked_in FROM " . EVENTS_ATTENDEE_TABLE . " a ";
        $sql_a .= " LEFT JOIN " . EVENTS_DETAIL_TABLE . " e ON e.id=a.event_id ";
        if ($_REQUEST['category_id'] != '') {
            $sql_a .= " JOIN " . EVENTS_CATEGORY_REL_TABLE . " r ON r.event_id = e.id ";
            $sql_a .= " JOIN " . EVENTS_CATEGORY_TABLE . " c ON  c.id = r.cat_id ";
        }
        if ($group != '') {
            $sql_a .= " JOIN " . EVENTS_VENUE_REL_TABLE . " r ON r.event_id = e.id ";
            $sql_a .= " JOIN " . EVENTS_LOCALE_REL_TABLE . " l ON  l.venue_id = r.venue_id ";
        }
        $sql_a .= $_REQUEST['category_id'] != '' ? " AND c.id = '" . $_REQUEST['category_id'] . "' " : '';
        $sql_clause = " WHERE ";
        if ($_REQUEST['payment_status'] != '') {
            $sql_a .= " {$sql_clause} a.payment_status = '" . $_REQUEST['payment_status'] . "' ";
            $sql_clause = " AND ";
        }
        if ($_POST['month_range'] != '') {
            $pieces = explode('-', $_REQUEST['month_range'], 3);
            $year_r = $pieces[0];
            $month_r = $pieces[1];
            $sql_a .= " {$sql_clause} a.date BETWEEN '" . event_espresso_no_format_date($year_r . '-' . $month_r . '-01', $format = 'Y-m-d') . "' AND '" . event_espresso_no_format_date($year_r . '-' . $month_r . '-31', $format = 'Y-m-d') . "' ";
            $sql_clause = " AND ";
        }
        if ($EVT_ID) {
            $sql_a .= " {$sql_clause} a.event_id = '" . $EVT_ID . "' ";
            $sql_clause = " AND ";
        }
        if ($_REQUEST['today_a'] == 'true') {
            //$sql_a .= " $sql_clause a.date = '" . event_espresso_no_format_date($curdate,$format = 'Y-m-d') ."' ";
            $sql_a .= " {$sql_clause} a.date BETWEEN '" . $curdate . ' 00:00:00' . "' AND '" . $curdate . ' 23:59:59' . "' ";
            $sql_clause = " AND ";
        }
        if ($_REQUEST['this_month_a'] == 'true') {
            $sql_a .= " {$sql_clause} a.date BETWEEN '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-01', $format = 'Y-m-d') . "' AND '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-' . $days_this_month, $format = 'Y-m-d') . "' ";
            $sql_clause = " AND ";
        }
        $sql_a .= $group != '' ? $sql_clause . "  l.locale_id IN (" . $group . ") " : '';
        $sql_a .= " AND e.event_status != 'D' ";
        $sql_a .= ") UNION (";
    }
    $sql_a .= "SELECT a.*, e.id event_id, e.event_name, checked_in FROM " . EVENTS_ATTENDEE_TABLE . " a ";
    $sql_a .= " LEFT JOIN " . EVENTS_DETAIL_TABLE . " e ON e.id=a.event_id ";
    if (!empty($_REQUEST['category_id'])) {
        $sql_a .= " JOIN " . EVENTS_CATEGORY_REL_TABLE . " r ON r.event_id = e.id ";
        $sql_a .= " JOIN " . EVENTS_CATEGORY_TABLE . " c ON  c.id = r.cat_id ";
    }
    $sql_a .= !empty($_REQUEST['category_id']) ? " AND c.id = '" . $_REQUEST['category_id'] . "' " : '';
    $sql_clause = " WHERE ";
    if (!empty($_REQUEST['payment_status'])) {
        $sql_a .= " {$sql_clause} a.payment_status = '" . $_REQUEST['payment_status'] . "' ";
        $sql_clause = " AND ";
    }
    if (!empty($_POST['month_range'])) {
        $pieces = explode('-', $_REQUEST['month_range'], 3);
        $year_r = $pieces[0];
        $month_r = $pieces[1];
        $sql_a .= " {$sql_clause} a.date BETWEEN '" . event_espresso_no_format_date($year_r . '-' . $month_r . '-01', $format = 'Y-m-d') . "' AND '" . event_espresso_no_format_date($year_r . '-' . $month_r . '-31', $format = 'Y-m-d') . "' ";
        $sql_clause = " AND ";
    }
    if ($EVT_ID) {
        $sql_a .= " {$sql_clause} a.event_id = '" . $EVT_ID . "' ";
        $sql_clause = " AND ";
    }
    if (!empty($_REQUEST['today_a'])) {
        //$sql_a .= " $sql_clause a.date = '" . event_espresso_no_format_date($curdate,$format = 'Y-m-d') ."' ";
        $sql_a .= " {$sql_clause} a.date BETWEEN '" . $curdate . ' 00:00:00' . "' AND '" . $curdate . ' 23:59:59' . "' ";
        $sql_clause = " AND ";
    }
    if (!empty($_REQUEST['this_month_a'])) {
        $sql_a .= " {$sql_clause} a.date BETWEEN '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-01', $format = 'Y-m-d') . "' AND '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-' . $days_this_month, $format = 'Y-m-d') . "' ";
        $sql_clause = " AND ";
    }
    if (function_exists('espresso_member_data') && (espresso_member_data('role') == 'espresso_event_manager' || espresso_member_data('role') == 'espresso_group_admin')) {
        $sql_a .= $sql_clause . " e.wp_user = '******'id') . "' ";
    }
    $sql_a .= " {$sql_clause} e.event_status != 'D' ";
    $sql_a .= ") ORDER BY date DESC, id ASC ";
    $sql_a .= $records_to_show;
    $attendees = $wpdb->get_results($sql_a);
    $total_attendees = $wpdb->num_rows;
    $quantity = 0;
    $att_table_form_url = add_query_arg(array('event_admin_reports' => 'list_attendee_payments', 'event_id' => $EVT_ID), EVT_ADMIN_URL);
    ?>
<form id="attendee-admin-list-page-select-frm" name="attendee_admin_list_page_select_frm" method="post" action="<?php 
    echo $att_table_form_url;
    ?>
">
	<div id="attendee-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 
    //_e('a max total of', 'event_espresso');
    ?>
		<?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;
        ?>
&nbsp;&nbsp;</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('event_admin_reports' => 'list_attendee_payments', 'event_id' => $EVT_ID, 'max_rows' => $max_rows, 'start_rec' => $prev_rows), EVT_ADMIN_URL);
        ?>
		<a id="attendee-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_attendees >= $max_rows && $max_rows < 100000) {
        $next_rows = $start_rec + $max_rows + 1;
        $next_rows_url = add_query_arg(array('event_admin_reports' => 'list_attendee_payments', 'event_id' => $EVT_ID, 'max_rows' => $max_rows, 'start_rec' => $next_rows), EVT_ADMIN_URL);
        ?>
		<a id="attendee-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="<?php 
    echo $att_table_form_url;
    ?>
">
	<table id="table" class="widefat fixed" width="100%">
		<thead>
			<tr>
				<th class="manage-column column-cb check-column" id="cb" scope="col" style="width:3%;min-width:35px !important;">
					<input type="checkbox">
				</th>
				<th class="manage-column column-att-id" id="att-id" scope="col" title="Click to Sort"style="width:3%;max-width:35px !important;"> 
					<span><?php 
    _e('ID', 'event_espresso');
    ?>
</span> <span class="sorting-indicator"></span> 
				</th>
				<th class="manage-column column-name" id="name" scope="col" title="Click to Sort"style="width: 10%;"> 
					<span><?php 
    _e('Attendee Name', 'event_espresso');
    ?>
</span> <span class="sorting-indicator"></span> 
				</th>
				<th class="manage-column column-registrationid" id="registrationid" scope="col" title="Click to Sort" style="width: 10%;">
				 	<span><?php 
    _e('Reg ID', 'event_espresso');
    ?>
</span> <span class="sorting-indicator"></span> 
				</th>
				<th class="manage-column column-date" id="registration" scope="col" title="Click to Sort" style="width: 10%;"> 
					<span><?php 
    _e('Registered', 'event_espresso');
    ?>
</span> <span class="sorting-indicator"></span> 
				</th>
				<th class="manage-column column-title" id="event-title" scope="col" title="Click to Sort" style="width: 10%;"> 
					<span><?php 
    _e('Event Title', 'event_espresso');
    ?>
</span> <span class="sorting-indicator"></span> 
				</th>
				<th class="manage-column column-title" id="event-time" scope="col" title="Click to Sort" style="width: 8%;"> 
					<span><?php 
    _e('Event Time', 'event_espresso');
    ?>
</span> <span class="sorting-indicator"></span> 
				</th>
				<?php 
    if ($ticketing_installed == true) {
        ?>
				<th class="manage-column column-title" id="attended" scope="col" title="Click to Sort" style="width: 8%;">
				 	<span><?php 
        _e('Attended', 'event_espresso');
        ?>
</span> <span class="sorting-indicator"></span> 
				</th>
				<?php 
    }
    ?>
				<th class="manage-column column-title" id="ticket-option" scope="col" title="Click to Sort" style="width: 13%;">
				 	<span><?php 
    _e('Option', 'event_espresso');
    ?>
</span> <span class="sorting-indicator"></span> 
				</th>
				<th align="center" class="manage-column column-date" id="amount" style="width: 5%;" title="Click to Sort" scope="col">
				 	<span><?php 
    _e('Payment', 'event_espresso');
    ?>
</span> <span class="sorting-indicator"></span> 
				</th>
				<th class="manage-column column-date" id="payment_type" scope="col" title="Click to Sort" style="width: 8%;">
				 	<span><?php 
    _e('Type', 'event_espresso');
    ?>
</span> <span class="sorting-indicator"></span> 
				</th>
				<th class="manage-column column-date" id="coupon" scope="col" title="Click to Sort" style="width: 10%;"> 
					<span><?php 
    _e('Coupon', 'event_espresso');
    ?>
</span> <span class="sorting-indicator"></span> 
				</th>
				<th class="manage-column column-date" id="txn_id" scope="col" title="Click to Sort" style="width: 10%;"> 
					<span><?php 
    _e('Transaction ID', 'event_espresso');
    ?>
</span> <span class="sorting-indicator"></span> 
				</th>
				<th class="manage-column column-date" id="action" scope="col" title="" >
					<?php 
    _e('Actions', 'event_espresso');
    ?>
				</th>
			</tr>
		</thead>
		<tbody>	
<?php 
    if ($total_attendees > 0) {
        foreach ($attendees as $attendee) {
            $id = $attendee->id;
            $registration_id = $attendee->registration_id;
            $lname = htmlspecialchars(stripslashes($attendee->lname), ENT_QUOTES, 'UTF-8');
            $fname = htmlspecialchars(stripslashes($attendee->fname), ENT_QUOTES, 'UTF-8');
            $address = htmlspecialchars(stripslashes($attendee->address), ENT_QUOTES, 'UTF-8');
            $city = htmlspecialchars(stripslashes($attendee->city), ENT_QUOTES, 'UTF-8');
            $state = htmlspecialchars(stripslashes($attendee->state), ENT_QUOTES, 'UTF-8');
            $zip = $attendee->zip;
            $email = '<span style="visibility:hidden">' . $attendee->email . '</span>';
            $phone = $attendee->phone;
            $quantity = $attendee->quantity > 1 ? '<br />(' . __('Total Attendees', 'event_espresso') . ': ' . $attendee->quantity . ')' : '';
            $attended = $attendee->checked_in;
            $ticket_scanned = $attendee->checked_in_quantity;
            $amount_pd = $attendee->amount_pd;
            $payment_status = $attendee->payment_status;
            $payment_date = $attendee->payment_date;
            $date = $attendee->date;
            $event_id = $attendee->event_id;
            $coupon_code = $attendee->coupon_code;
            $txn_id = $attendee->txn_id;
            $txn_type = $attendee->txn_type;
            $price_option = $attendee->price_option;
            $event_time = $attendee->event_time;
            $event_name = $attendee->event_name;
            $event_date = $attendee->start_date;
            ?>
			<tr>
			
				<td class="check-column" style="padding:7px 0 22px 7px; vertical-align:top;">
					<input name="checkbox[<?php 
            echo $id;
            ?>
]" type="checkbox"  title="Delete <?php 
            echo $fname;
            echo $lname;
            ?>
">
				</td>
				
	            <td nowrap="nowrap">
					<?php 
            echo $attendee->id;
            ?>
				</td>
				
	            <td class="row-title"  nowrap="nowrap">
					<a href="admin.php?page=events&amp;event_admin_reports=edit_attendee_record&amp;event_id=<?php 
            echo $event_id;
            ?>
&amp;registration_id=<?php 
            echo $registration_id;
            ?>
&amp;form_action=edit_attendee&amp;id=<?php 
            echo $id;
            ?>
" title="<?php 
            echo 'ID#:' . $id . ' [ REG#: ' . $registration_id . ' ] Email: ' . $attendee->email;
            ?>
">
						<?php 
            echo $fname;
            ?>
 <?php 
            echo $lname;
            ?>
 <?php 
            echo $email;
            ?>
	              </a>
				 </td>
				
	            <td nowrap="nowrap">
					<?php 
            echo $registration_id;
            ?>
				</td>
				
	            <td class="date column-date">
					<?php 
            echo event_date_display($date, get_option('date_format') . ' g:i a');
            ?>
				</td>
				
	            <td nowrap="nowrap">
					<a href="admin.php?page=events&amp;event_admin_reports=list_attendee_payments&amp;event_id=<?php 
            echo $event_id;
            ?>
" title="<?php 
            _e('View attendees for this event', 'event_espresso');
            ?>
">
						<?php 
            echo stripslashes_deep($event_name);
            ?>
					</a>
				</td>
				
	            <td nowrap="nowrap">
					<?php 
            echo event_date_display($event_time, get_option('time_format'));
            ?>
				</td>
				
	            <?php 
            if ($ticketing_installed == true) {
                ?>
	            <td nowrap="nowrap">
					<p style="padding-left:15px">
						<?php 
                echo $attended == 1 || $ticket_scanned >= 1 ? event_espresso_paid_status_icon('Checkedin') : event_espresso_paid_status_icon('NotCheckedin');
                ?>
					</p>
				</td>
	            <?php 
            }
            ?>
				
	            <td nowrap="nowrap">
					<?php 
            echo $price_option;
            ?>
				</td>
				
	            <td class="date column">
					<a href="admin.php?page=events&amp;attendee_pay=paynow&amp;form_action=payment&amp;registration_id=<?php 
            echo $registration_id;
            ?>
&amp;event_admin_reports=enter_attendee_payments&amp;event_id=<?php 
            echo $event_id;
            ?>
" title="<?php 
            _e('Edit Payment', 'event_espresso');
            ?>
 ID: <?php 
            echo $registration_id;
            ?>
">
	              		<p style="padding-left:17px"><?php 
            event_espresso_paid_status_icon($payment_status);
            ?>
</p>
	              	</a> 
				</td>
				
				<td class="">
					<?php 
            echo espresso_payment_type($txn_type);
            ?>
				</td>
				
	            <td class="">
					<?php 
            echo $coupon_code;
            ?>
				</td>
				
	            <td class="">
					<?php 
            echo $txn_id;
            ?>
				</td>
				
	            <td class="" >
	            
	            	<a href="admin.php?page=events&amp;attendee_pay=paynow&amp;form_action=payment&amp;registration_id=<?php 
            echo $registration_id;
            ?>
&amp;event_admin_reports=enter_attendee_payments&amp;event_id=<?php 
            echo $event_id;
            ?>
" title="<?php 
            _e('Edit Payment', 'event_espresso');
            ?>
 ID: <?php 
            echo $registration_id;
            ?>
">
						<img src="<?php 
            echo EVENT_ESPRESSO_PLUGINFULLURL;
            ?>
images/icons/money.png" width="16" height="16" alt="<?php 
            _e('Edit Payment', 'event_espresso');
            ?>
" />
					</a>
	            
	            	<a href="admin.php?page=events&amp;event_admin_reports=edit_attendee_record&amp;registration_id=<?php 
            echo $registration_id;
            ?>
&amp;event_id=<?php 
            echo $event_id;
            ?>
&amp;form_action=edit_attendee" title="<?php 
            _e('Edit Attendee', 'event_espresso');
            ?>
">
						<img src="<?php 
            echo EVENT_ESPRESSO_PLUGINFULLURL;
            ?>
images/icons/user_edit.png" width="16" height="16" alt="<?php 
            _e('Edit Attendee', 'event_espresso');
            ?>
" />
					</a>
	            
	            	<a href="admin.php?page=events&amp;event_admin_reports=resend_email&amp;registration_id=<?php 
            echo $registration_id;
            ?>
&amp;event_id=<?php 
            echo $event_id;
            ?>
&amp;form_action=resend_email" title="<?php 
            _e('Resend Registration Details', 'event_espresso');
            ?>
">
						<img src="<?php 
            echo EVENT_ESPRESSO_PLUGINFULLURL;
            ?>
images/icons/email_link.png" width="16" height="16" alt="<?php 
            _e('Resend Registration Details', 'event_espresso');
            ?>
" />
					</a>
					
	            	<?php 
            if ($espresso_premium == true) {
                ?>
	            	<a href="<?php 
                echo home_url();
                ?>
/?download_invoice=true&amp;admin=true&amp;registration_id=<?php 
                echo $registration_id;
                ?>
" target="_blank"  title="<?php 
                _e('Download Invoice', 'event_espresso');
                ?>
">
						<img src="<?php 
                echo EVENT_ESPRESSO_PLUGINFULLURL;
                ?>
images/icons/page_white_acrobat.png" width="16" height="16" alt="<?php 
                _e('Download Invoice', 'event_espresso');
                ?>
" />
					</a>
					<?php 
            }
            ?>
				
					<?php 
            if ($ticketing_installed == true && function_exists('espresso_ticket_url')) {
                ?>
					<a href="<?php 
                echo espresso_ticket_url($id, $registration_id);
                ?>
" target="_blank"  title="<?php 
                _e('View/Download Ticket', 'event_espresso');
                ?>
">
						<img src="<?php 
                echo EVENT_ESPRESSO_PLUGINFULLURL;
                ?>
images/icons/ticket-arrow-icon.png" width="16" height="16" alt="<?php 
                _e('Download Ticket', 'event_espresso');
                ?>
" />
					</a>
					<?php 
            }
            if ($org_options["use_attendee_pre_approval"] == "Y") {
                ?>
		  				<br/>
		  				<a href="admin.php?page=events&amp;attendee_pay=paynow&amp;form_action=payment&amp;registration_id=<?php 
                echo $registration_id;
                ?>
&amp;event_admin_reports=enter_attendee_payments&amp;event_id=<?php 
                echo $event_id;
                ?>
" title="<?php 
                _e('Edit Payment', 'event_espresso');
                ?>
 ID: <?php 
                echo $registration_id;
                ?>
">
		  				<?php 
                if (is_attendee_approved($event_id, $id)) {
                    ?>
		  					<strong><?php 
                    _e('Approved', 'event_espresso');
                    ?>
</strong><br/>
		  				<?php 
                } else {
                    ?>
		  					<span style="color:#FF0000"><strong><?php 
                    _e('Awaiting approval', 'event_espresso');
                    ?>
</strong></span>
		  				<?php 
                }
                ?>
		  				</a>
	  				<?php 
            }
            ?>
					
				</td>
				
			</tr>
<?php 
        }
    }
    ?>
		</tbody>
	</table>
	
  	<div style="clear:both; margin-bottom:30px;">
	
    	<input name="delete_customer" type="submit" class="button-secondary" id="delete_customer" value="<?php 
    _e('Delete Attendee(s)', 'event_espresso');
    ?>
" style="margin:10px 0 0 0;" onclick="return confirmDelete();" />
		
	    <?php 
    if ($ticketing_installed == true) {
        ?>
	    <input name="attended_customer" type="submit" class="button-secondary" id="attended_customer" value="<?php 
        _e('Mark as Attended', 'event_espresso');
        ?>
" style="margin:10px 0 0 10px;" />
	    <input name="unattended_customer" type="submit" class="button-secondary" id="attended_customer" value="<?php 
        _e('Unmark as Attended', 'event_espresso');
        ?>
" style="margin:10px 0 0 10px;" />
	    <?php 
    }
    ?>
		
	    <a style="margin-left:5px" class="button-secondary" href="admin.php?page=events&amp;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 class="button-secondary" style="margin-left:5px" href="#" onclick="window.location='<?php 
    echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&amp;export=report&action=payment&amp;type=excel&amp;";
    echo $EVT_ID ? "event_id=" . $EVT_ID : "all_events=true";
    ?>
'" title="<?php 
    _e('Export to Excel', 'event_espresso');
    ?>
">
	    	<?php 
    _e('Export to Excel', 'event_espresso');
    ?>
	    </a> 
		
		<?php 
    if ($EVT_ID) {
        ?>
		<a style="margin-left:5px"  class="button-secondary"  href="admin.php?page=events&amp;event_admin_reports=add_new_attendee&amp;event_id=<?php 
        echo $EVT_ID;
        ?>
">
			<?php 
        _e('Add Attendee', 'event_espresso');
        ?>
		</a>
		<?php 
    }
    ?>
 
		
		<?php 
    if ($EVT_ID) {
        ?>
		<a style="margin-left:5px" class="button-primary" href="admin.php?page=events&amp;action=edit&amp;event_id=<?php 
        echo $EVT_ID;
        ?>
">
			<?php 
        _e('Edit 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">
	<dt>
		<?php 
    event_espresso_paid_status_icon('Completed');
    ?>
 - <?php 
    _e('Completed', 'event_espresso');
    ?>
	</dt>
	<dt>
		<?php 
    event_espresso_paid_status_icon('Incomplete');
    ?>
 - <?php 
    _e('Incomplete', 'event_espresso');
    ?>
	</dt>
    <dt>
		<?php 
    event_espresso_paid_status_icon('Pending');
    ?>
 - <?php 
    _e('Pending', 'event_espresso');
    ?>
	</dt>
	<dt>
		<img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
images/icons/money.png" width="16" height="16" alt="<?php 
    _e('Payment Details', 'event_espresso');
    ?>
" /> - <?php 
    _e('Payment Details', 'event_espresso');
    ?>
	</dt>
</dl>

 <dl style="float:left; margin-left:10px; width:200px">
	<dt>
		<img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
images/icons/email_link.png" width="16" height="16" alt="<?php 
    _e('Resend Details', 'event_espresso');
    ?>
" /> - <?php 
    _e('Resend Email', 'event_espresso');
    ?>
	</dt>
	<dt>
		<img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
images/icons/page_white_acrobat.png" width="16" height="16" alt="<?php 
    _e('Download Invoice', 'event_espresso');
    ?>
" /> - <?php 
    _e('Download Invoice', 'event_espresso');
    ?>
	</dt>
	<dt>
		<img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
images/icons/user_edit.png" width="16" height="16" alt="<?php 
    _e(' Attendee Details', 'event_espresso');
    ?>
" /> - <?php 
    _e('Attendee Details', 'event_espresso');
    ?>
	</dt>
</dl>
<?php 
    $hide = $EVT_ID ? '1,5' : '1,3';
    $hide .= $ticketing_installed ? ',11,12' : ',10,11';
    ?>
<script>
	jQuery(document).ready(function($) {
		/* show the table data */
		var mytable = $('#table').dataTable( {
			"sDom": 'Clfrtip',
			"bAutoWidth": false,
			"bStateSave": true,
			"sPaginationType": "full_numbers",
			"oLanguage": {    "sSearch": "<strong><?php 
    _e('Live Search Filter', 'event_espresso');
    ?>
:</strong> (eg, email, txn id, event, etc.)",
			"sZeroRecords": "<?php 
    _e('No Records Found!', 'event_espresso');
    ?>
" },
			"aoColumns": [
				{ "bSortable": false },
				null,
				<?php 
    echo $ticketing_installed == true ? 'null,' : '';
    ?>
				null,
				null,
				null,
				null,
				null,
				null,
				null,
				null,
				null,
				null,
				{ "bSortable": false }
			],
			"aoColumnDefs": [
				{ "bVisible": false, "aTargets": [<?php 
    echo $hide;
    ?>
] }
			],
			"oColVis": {
				"aiExclude": [0,2],
				"buttonText": "Filter: Show / Hide Columns",
				"bRestore": true
			},
		});
	});
</script>
<?php 
}
Exemplo n.º 4
0
function espresso_attendees_by_month_dropdown($current_value = '')
{
    global $wpdb;
    $strQuery = "select id, date from " . EVENTS_ATTENDEE_TABLE . " group by YEAR(date), MONTH(date) ";
    //$rsrcResult = mysql_query($strQuery);
    $data = $wpdb->get_results($strQuery, ARRAY_A);
    //print_r($data);
    if ($wpdb->num_rows > 0) {
        echo '<select name="month_range">';
        echo '<option value="">' . __('Select a Month/Year', 'event_espresso') . '</option>';
        /*         * * loop over the results ** */
        foreach ($data as $row) {
            /*             * * create the options ** */
            echo '<option value="' . event_espresso_no_format_date($row["date"], $format = 'Y-m-d') . '"';
            if (event_espresso_no_format_date($row["date"], $format = 'Y-m-d') == $current_value) {
                echo ' selected';
            }
            echo '>' . event_espresso_no_format_date($row["date"], $format = 'F  Y') . '</option>' . "\n";
        }
        echo "</select>";
    } else {
        _e('No Results', 'event_espresso');
    }
}
    if (function_exists('event_espresso_groupon_payment_page')) {
        $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_name' => '<p class="section-title">' . stripslashes_deep($event_name) . '</span>', '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' => '<span class="section-title">' . $venue_title . '</span>', 'venue_address' => $venue_address, 'venue_address2' => $venue_address2, 'venue_city' => $venue_city, 'venue_state' => $venue_state, 'venue_country' => $venue_country, 'is_active' => $data->event->is_active, 'event_status' => $data->event->event_status, 'start_time' => $data->event->start_time, 'start_time' => empty($data->event->start_time) ? '' : $data->event->start_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, 'event_address' => empty($data->event->event_address) ? '' : $data->event->event_address, 'start_date' => '<span class="section-title">' . event_espresso_no_format_date($start_date, get_option('date_format')) . '</span>', 'end_date' => '<span class="section-title">' . event_date_display($end_date, get_option('date_format')) . '</span>', 'google_map_link' => $google_map_link);
    $registration_url = $externalURL != '' ? $externalURL : espresso_reg_url($event_id);
    //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);
}
/**
 * this is the original database stuff
 */
/*
	$sql  = "SELECT * FROM " .EVENTS_DETAIL_TABLE. " WHERE event_status != 'D' AND id = " . $event_id;

	if ($wpdb->get_results($sql)){
			$events = $wpdb->get_results($sql);
			foreach ($events as $event){ //These are the variables that can be used throughout the regsitration page
        // if todays date is after $reg_end_date
        // if todays date is prior to $reg_start_date
        ?>
				<div class="event-registration-pending event-messages">
					<p class="event_full">
						<strong>
							<?php 
        _e('We are sorry but this event is not yet open for registration.', 'event_espresso');
        ?>
						</strong>
					</p>
					<p class="event_full">
						<strong>
							<?php 
        _e('You will be able to register starting ', 'event_espresso');
        echo event_espresso_no_format_date($reg_start_date, 'F d, Y');
        ?>
						</strong>
					</p>
				</div>
				<?php 
        break;
    default:
        //This will display the registration form
        ?>
				<form method="post" action="<?php 
        echo home_url();
        ?>
/?page_id=<?php 
        echo $event_page_id;
        ?>
Exemplo n.º 7
0
function espresso_total_attendees_this_month()
{
    //Get total attendees this month
    global $wpdb;
    //Dates
    $curdate = date("Y-m-d");
    $pieces = explode('-', $curdate, 3);
    $this_year_r = $pieces[0];
    $this_month_r = $pieces[1];
    $days_this_month = date('t', strtotime($curdate));
    $asql3 = "(";
    if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_group_admin') {
        $group = get_user_meta(espresso_member_data('id'), "espresso_group", true);
        $asql3 .= "SELECT SUM(a.quantity) quantity FROM " . EVENTS_ATTENDEE_TABLE . " a ";
        $asql3 .= " LEFT JOIN " . EVENTS_DETAIL_TABLE . " e ON e.id=a.event_id ";
        if (!empty($group)) {
            $asql3 .= " JOIN " . EVENTS_VENUE_REL_TABLE . " r ON r.event_id = e.id ";
            $asql3 .= " JOIN " . EVENTS_LOCALE_REL_TABLE . " l ON  l.venue_id = r.venue_id ";
        }
        $asql3 .= " WHERE date BETWEEN '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-01', $format = 'Y-m-d') . "' AND '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-' . $days_this_month, $format = 'Y-m-d') . "' ";
        $asql3 .= !empty($group) ? " AND l.locale_id IN (" . implode(",", $group) . ") " : '';
        $asql3 .= " AND a.quantity >= 1 ";
        //AND (a.payment_status='Completed' OR a.payment_status='Pending') ";
        $asql3 .= " AND e.event_status != 'D' ";
        $asql3 .= ") UNION (";
    }
    $asql3 .= "SELECT SUM(a.quantity) quantity FROM " . EVENTS_ATTENDEE_TABLE . " a ";
    $asql3 .= " LEFT JOIN " . EVENTS_DETAIL_TABLE . " e ON e.id=a.event_id ";
    $asql3 .= " WHERE a.date BETWEEN '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-01', $format = 'Y-m-d') . "' AND '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-' . $days_this_month, $format = 'Y-m-d') . "' ";
    if (function_exists('espresso_member_data') && (espresso_member_data('role') == 'espresso_event_manager' || espresso_member_data('role') == 'espresso_group_admin')) {
        $asql3 .= " AND e.wp_user = '******'id') . "' ";
    }
    $asql3 .= " AND a.quantity >= 1 ";
    //AND (a.payment_status='Completed' OR a.payment_status='Pending') ";
    $asql3 .= " AND e.event_status != 'D' ";
    $asql3 .= ")";
    //echo $asql3;
    $total_a_this_month = 0;
    $wpdb->query($asql3);
    if ($wpdb->num_rows > 0 && $wpdb->last_result[0]->quantity != NULL) {
        $total_a_this_month = $wpdb->last_result[0]->quantity + (isset($wpdb->last_result[1]->quantity) ? $wpdb->last_result[1]->quantity : 0);
    }
    return $total_a_this_month;
}
Exemplo n.º 8
0
    function espresso_reg_form_sc($atts)
    {
        global $wpdb, $org_options;
        global $load_espresso_scripts;
        $load_espresso_scripts = true;
        //This tells the plugin to load the required scripts
        extract(shortcode_atts(array('event_id' => '0'), $atts));
        $event_id = "{$event_id}";
        //The following variables are used to get information about your organization
        $event_page_id = $org_options['event_page_id'];
        $Organization = stripslashes_deep($org_options['organization']);
        $Organization_street1 = $org_options['organization_street1'];
        $Organization_street2 = $org_options['organization_street2'];
        $Organization_city = $org_options['organization_city'];
        $Organization_state = $org_options['organization_state'];
        $Organization_zip = $org_options['organization_zip'];
        $contact = $org_options['contact_email'];
        $registrar = $org_options['contact_email'];
        $currency_format = $org_options['currency_format'];
        $message = $org_options['message'];
        $use_captcha = $org_options['use_captcha'];
        $paypal_id = $org_options['paypal_id'];
        $sql = "SELECT * FROM " . EVENTS_DETAIL_TABLE;
        $sql .= " WHERE is_active='Y' ";
        $sql .= " AND event_status != 'D' ";
        $sql .= " AND id = '" . $event_id . "' LIMIT 0,1";
        if ($wpdb->get_results($sql)) {
            $events = $wpdb->get_results($sql);
            //These are the variables that can be used throughout the regsitration page
            foreach ($events as $event) {
                $event_id = $event->id;
                $event_name = stripslashes_deep($event->event_name);
                $event_desc = stripslashes_deep($event->event_desc);
                $display_desc = $event->display_desc;
                $display_reg_form = $event->display_reg_form;
                $event_address = $event->address;
                $event_address2 = $event->address2;
                $event_city = $event->city;
                $event_state = $event->state;
                $event_zip = $event->zip;
                $event_country = $event->country;
                $event_description = stripslashes_deep($event->event_desc);
                $event_identifier = $event->event_identifier;
                $event_cost = $event->event_cost;
                $member_only = $event->member_only;
                $reg_limit = $event->reg_limit;
                $allow_multiple = $event->allow_multiple;
                $start_date = $event->start_date;
                $end_date = $event->end_date;
                $allow_overflow = $event->allow_overflow;
                $overflow_event_id = $event->overflow_event_id;
                $virtual_url = stripslashes_deep($event->virtual_url);
                $virtual_phone = stripslashes_deep($event->virtual_phone);
                //Address formatting
                $location = ($event_address != '' ? $event_address : '') . ($event_address2 != '' ? '<br />' . $event_address2 : '') . ($event_city != '' ? '<br />' . $event_city : '') . ($event_state != '' ? ', ' . $event_state : '') . ($event_zip != '' ? '<br />' . $event_zip : '') . ($event_country != '' ? '<br />' . $event_country : '');
                //Google map link creation
                $google_map_link = espresso_google_map_link(array('address' => $event_address, 'city' => $event_city, 'state' => $event_state, 'zip' => $event_zip, 'country' => $event_country, 'text' => 'Map and Directions', 'type' => 'text'));
                $reg_start_date = $event->registration_start;
                $reg_end_date = $event->registration_end;
                $today = date("Y-m-d");
                $reg_limit = $event->reg_limit;
                $additional_limit = $event->additional_limit;
                $question_groups = unserialize($event->question_groups);
                global $all_meta;
                $all_meta = array('event_name' => stripslashes_deep($event_name), 'event_desc' => stripslashes_deep($event_desc), 'event_address' => $event_address, 'event_address2' => $event_address2, 'event_city' => $event_city, 'event_state' => $event_state, 'event_zip' => $event_zip, 'is_active' => $event->is_active, 'event_status' => $event->event_status, 'start_time' => $event->start_time, 'registration_startT' => $event->registration_startT, 'registration_start' => $event->registration_start, 'registration_endT' => $event->registration_endT, 'registration_end' => $event->registration_end, 'is_active' => $is_active, 'event_country' => $event_country, 'start_date' => event_date_display($start_date, get_option('date_format')), 'end_date' => event_date_display($end_date, get_option('date_format')), 'time' => $event->start_time, 'google_map_link' => $google_map_link, 'price' => $event->event_cost, 'event_cost' => $event->event_cost);
                //This function gets the status of the event.
                $is_active = array();
                $is_active = event_espresso_get_is_active(0, $all_meta);
                //If the coupon code system is intalled then use it
                if (function_exists('event_espresso_coupon_registration_page')) {
                    $use_coupon_code = $event->use_coupon_code;
                }
                //If the groupon code addon is installed, then use it
                if (function_exists('event_espresso_groupon_payment_page')) {
                    $use_groupon_code = $event->use_groupon_code;
                }
                //Set a default value for additional limit
                if ($additional_limit == '') {
                    $additional_limit = '5';
                }
            }
            //End foreach ($events as $event)
        }
        //This is the registration form.
        //This is a template file for displaying a registration form for an event on a page.
        //There should be a copy of this file in your wp-content/uploads/espresso/ folder.
        ?>
		<div id="event_espresso_registration_form">
			<form method="post" action="<?php 
        echo home_url();
        ?>
/?page_id=<?php 
        echo $event_page_id;
        ?>
" id="registration_form">
				<?php 
        //print_r( event_espresso_get_is_active($event_id));
        switch ($is_active['status']) {
            case 'EXPIRED':
                //only show the event description.
                _e('<h3 class="expired_event">This event has passed.</h3>', 'event_espresso');
                break;
            case 'REGISTRATION_CLOSED':
                //only show the event description.
                // if todays date is after $reg_end_date
                ?>
						<p class="event_full"><strong><?php 
                _e('We are sorry but registration for this event is now closed.', 'event_espresso');
                ?>
</strong></p>
						<p class="event_full"><strong><?php 
                _e('Please <a href="contact" title="contact us">contact us</a> if you would like to know if spaces are still available.', 'event_espresso');
                ?>
</strong></p>
						<?php 
                break;
            case 'REGISTRATION_NOT_OPEN':
                //only show the event description.
                // if todays date is after $reg_end_date
                // if todays date is prior to $reg_start_date
                ?>
						<p class="event_full"><strong><?php 
                _e('We are sorry but this event is not yet open for registration.', 'event_espresso');
                ?>
</strong></p>
						<p class="event_full"><strong><?php 
                _e('You will be able to register starting ', 'event_espresso');
                echo event_espresso_no_format_date($reg_start_date, 'F d, Y');
                ?>
</strong></p>
							<?php 
                break;
            default:
                //If the event is in an active or ongoing status, then show the registration form.
                //echo $is_active['status'];//Show event status
                if ($display_reg_form == 'Y') {
                    ?>
							<p class="event_time">
					<?php 
                    //This block of code is used to display the times of an event in either a dropdown or text format.
                    if ($time_selected == true) {
                        //If the customer is coming from a page where the time was preselected.
                        echo event_espresso_display_selected_time($time_id);
                        //Optional parameters start, end, default
                    } else {
                        if ($time_selected == false) {
                            echo event_espresso_time_dropdown($event_id);
                        }
                    }
                    //End time selected
                    ?>
							</p>

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


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

								<input class="btn_event_form_submit" id="event_form_field-<?php 
                    echo $event_id;
                    ?>
" type="submit" name="Submit" value="<?php 
                    _e('Submit', 'event_espresso');
                    ?>
">
							</p>
					<?php 
                }
                break;
        }
        //End Switch statement to check the status of the event
        ?>
			</form>
		</div><?php 
    }
function event_list_attendees()
{
    global $wpdb, $org_options, $ticketing_installed;
    //Dates
    $curdate = date("Y-m-d");
    $pieces = explode('-', $curdate, 3);
    $this_year_r = $pieces[0];
    $this_month_r = $pieces[1];
    $days_this_month = date('t', strtotime($curdate));
    if (!empty($_POST['delete_customer'])) {
        if (is_array($_POST['checkbox'])) {
            while (list($key, $value) = each($_POST['checkbox'])) {
                $del_id = $key;
                $sql = "DELETE FROM " . EVENTS_ATTENDEE_TABLE . " WHERE id = '{$del_id}'";
                $wpdb->query($sql);
            }
        }
        ?>

<div id="message" class="updated fade">
  <p><strong>
    <?php 
        _e('Customer(s) have been successfully deleted from the event.', 'event_espresso');
        ?>
    </strong></p>
</div>
<?php 
    }
    //	MARKING USERS AS ATTENDED (OR NOT)
    if ((!empty($_POST['attended_customer']) || !empty($_POST['unattended_customer'])) && $ticketing_installed == true) {
        if (is_array($_POST['checkbox'])) {
            while (list($key, $value) = each($_POST['checkbox'])) {
                $del_id = $key;
                //echo $del_id . " / " . $value . "<br />\n";
                if ($value == "on" && $_POST['attended_customer']) {
                    $checker = 1;
                } else {
                    $checker = 0;
                }
                $wpdb->get_results("SELECT checked_in_quantity FROM " . EVENTS_ATTENDEE_TABLE . " WHERE id = '{$del_id}' LIMIT 0,1 ");
                $ticket_scanned = $wpdb->last_result[0]->checked_in_quantity;
                if ($ticket_scanned >= 1) {
                    ?>
					<div id="message" class="error fade">
					  <p><strong>
						<?php 
                    _e('Scanned tickets cannot be redeemed/un-redeemed here.', 'event_espresso');
                    ?>
						</strong></p>
					</div>
					<?php 
                } else {
                    $sql = "UPDATE " . EVENTS_ATTENDEE_TABLE . " SET checked_in = {$checker} WHERE id = '{$del_id}'";
                    $wpdb->query($sql);
                    //echo $sql;
                    ?>
					<div id="message" class="updated fade">
					  <p><strong>
						<?php 
                    _e('Customer(s) attendance data successfully updated for this event.', 'event_espresso');
                    ?>
						</strong></p>
					</div>
					<?php 
                }
            }
        }
    }
    require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/event-management/queries.php';
    $total_events = espresso_total_events();
    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 available in the premium versions.', 'event_espresso') . '</strong> <a href="http://eventespresso.com/download/" target="_blank">' . __('Upgrade Now!', 'event_espresso') . '</a></p>';
    }
    if (isset($_REQUEST['event_id']) && $_REQUEST['event_id'] != '') {
        echo '<h3>' . espresso_event_list_attendee_title($_REQUEST['event_id']) . '</h3>';
    }
    ?>
<style type="text/css">
        .dataTables_paginate {margin-top:10px;}
        .sorting_asc .sorting_desc {}
        th.sorting_asc span.sorting-indicator {display:block; margin-left:3px; background-position: 0 0;}
        th.sorting_desc span.sorting-indicator {display:block; margin-left:3px; background-position: -7px 0;}
        #table thead tr th span {cursor:pointer; float:left;}
        #table thead tr th span:hover {color:#D54E21;}
        #table_filter input {width:250px; background:#fff;}

        /*fixing this */
        .view_btn:hover, .edit_btn:hover, .complete_btn:hover, .shortcode_btn:hover, .excel_exp_btn:hover, .csv_exp_btn:hover, .newsletter_btn:hover  {height: 18px; margin: 2px 3px 0 0;}
    </style>
<?php 
    /*if (!empty($_REQUEST['event_id'])) { ?>
    
            <h3 style="margin-bottom:15px;"><?php _e('Attendee Report for Event ID:', 'event_espresso'); ?> <?php espresso_event_list_attendee_title($_REQUEST['event_id']); ?></h3>
    
        <?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-cb check-column" id="cb" scope="col" style="width: 4%;"><input type="checkbox"></th>
        <th class="manage-column column-title" id="name" scope="col" title="Click to Sort"style="width: 10%;"> <span>
          <?php 
    _e('Attendee Name', 'event_espresso');
    ?>
          <span> <span class="sorting-indicator"></span> </th>
        <th class="manage-column column-date" id="registrationid" scope="col" title="Click to Sort" style="width: 10%;"> <span>
          <?php 
    _e('Reg ID', 'event_espresso');
    ?>
          </span> <span class="sorting-indicator"></span> </th>
        <th class="manage-column column-date" id="registration" scope="col" title="Click to Sort" style="width: 10%;"> <span>
          <?php 
    _e('Registered', 'event_espresso');
    ?>
          </span> <span class="sorting-indicator"></span> </th>
        <th class="manage-column column-title" id="event" scope="col" title="Click to Sort" style="width: 10%;"> <span>
          <?php 
    _e('Event Title', 'event_espresso');
    ?>
          </span> <span class="sorting-indicator"></span> </th>
        <th class="manage-column column-title" id="event" scope="col" title="Click to Sort" style="width: 8%;"> <span>
          <?php 
    _e('Event Time', 'event_espresso');
    ?>
          </span> <span class="sorting-indicator"></span> </th>
        <?php 
    if ($ticketing_installed == true) {
        ?>
        <th class="manage-column column-title" id="attended" scope="col" title="Click to Sort" style="width: 8%;"> <span>
          <?php 
        _e('Attended', 'event_espresso');
        ?>
          </span> <span class="sorting-indicator"></span> </th>
        <?php 
    }
    ?>
        <th class="manage-column column-title" id="event" scope="col" title="Click to Sort" style="width: 8%;"> <span>
          <?php 
    _e('Option', 'event_espresso');
    ?>
          </span> <span class="sorting-indicator"></span> </th>
        <th align="center" class="manage-column column-date" id="amount" style="width: 10%;" title="Click to Sort" scope="col"> <span>
          <?php 
    _e('Payment', 'event_espresso');
    ?>
          </span> <span class="sorting-indicator"></span> </th>
        <th class="manage-column column-date" id="payment_type" scope="col" title="Click to Sort" style="width: 10%;"> <span>
          <?php 
    _e('Type', 'event_espresso');
    ?>
          </span> <span class="sorting-indicator"></span> </th>
        <th class="manage-column column-date" id="coupon" scope="col" title="Click to Sort" style="width: 12%;"> <span>
          <?php 
    _e('Coupon', 'event_espresso');
    ?>
          </span> <span class="sorting-indicator"></span> </th>
        <th class="manage-column column-date" id="txn_id" scope="col" title="Click to Sort" style="width: 15%;"> <span>
          <?php 
    _e('Transaction ID', 'event_espresso');
    ?>
          </span> <span class="sorting-indicator"></span> </th>
        <th class="manage-column column-date" id="action" scope="col" title="Click to Sort"style="width: 8%;"><?php 
    _e('Action', 'event_espresso');
    ?>
</th>
      </tr>
    </thead>
    <tbody>
      <?php 
    $temp_reg_id = '';
    //will temporarily hold the registration id for checking with the next row
    $attendees_group = '';
    //will hold the names of the group members
    $counter = 0;
    //used for keeping track of the last row.  If counter = num_rows, print
    $go = false;
    //triggers the output when true.  Set when the next reg id != temp_reg_id
    $sql_clause = " WHERE ";
    $sql_a = "(";
    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 = unserialize($group);
        $group = implode(",", $group);
        $sql_a .= "SELECT a.*, e.id event_id, e.event_name, checked_in FROM " . EVENTS_ATTENDEE_TABLE . " a ";
        $sql_a .= " LEFT JOIN " . EVENTS_DETAIL_TABLE . " e ON e.id=a.event_id ";
        if ($_REQUEST['category_id'] != '') {
            $sql_a .= " JOIN " . EVENTS_CATEGORY_REL_TABLE . " r ON r.event_id = e.id ";
            $sql_a .= " JOIN " . EVENTS_CATEGORY_TABLE . " c ON  c.id = r.cat_id ";
        }
        if ($group != '') {
            $sql_a .= " JOIN " . EVENTS_VENUE_REL_TABLE . " r ON r.event_id = e.id ";
            $sql_a .= " JOIN " . EVENTS_LOCALE_REL_TABLE . " l ON  l.venue_id = r.venue_id ";
        }
        $sql_a .= $_REQUEST['category_id'] != '' ? " AND c.id = '" . $_REQUEST['category_id'] . "' " : '';
        $sql_clause = " WHERE ";
        if ($_REQUEST['payment_status'] != '') {
            $sql_a .= " {$sql_clause} a.payment_status = '" . $_REQUEST['payment_status'] . "' ";
            $sql_clause = " AND ";
        }
        if ($_POST['month_range'] != '') {
            $pieces = explode('-', $_REQUEST['month_range'], 3);
            $year_r = $pieces[0];
            $month_r = $pieces[1];
            $sql_a .= " {$sql_clause} a.date BETWEEN '" . event_espresso_no_format_date($year_r . '-' . $month_r . '-01', $format = 'Y-m-d') . "' AND '" . event_espresso_no_format_date($year_r . '-' . $month_r . '-31', $format = 'Y-m-d') . "' ";
            $sql_clause = " AND ";
        }
        if ($_REQUEST['event_id'] != '') {
            $sql_a .= " {$sql_clause} a.event_id = '" . $_REQUEST['event_id'] . "' ";
            $sql_clause = " AND ";
        }
        if ($_REQUEST['today_a'] == 'true') {
            //$sql_a .= " $sql_clause a.date = '" . event_espresso_no_format_date($curdate,$format = 'Y-m-d') ."' ";
            $sql_a .= " {$sql_clause} a.date BETWEEN '" . $curdate . ' 00:00:00' . "' AND '" . $curdate . ' 23:59:59' . "' ";
            $sql_clause = " AND ";
        }
        if ($_REQUEST['this_month_a'] == 'true') {
            $sql_a .= " {$sql_clause} a.date BETWEEN '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-01', $format = 'Y-m-d') . "' AND '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-' . $days_this_month, $format = 'Y-m-d') . "' ";
            $sql_clause = " AND ";
        }
        $sql_a .= $group != '' ? $sql_clause . "  l.locale_id IN (" . $group . ") " : '';
        $sql_a .= " AND e.event_status != 'D' ";
        $sql_a .= ") UNION (";
    }
    $sql_a .= "SELECT a.*, e.id event_id, e.event_name, checked_in FROM " . EVENTS_ATTENDEE_TABLE . " a ";
    $sql_a .= " LEFT JOIN " . EVENTS_DETAIL_TABLE . " e ON e.id=a.event_id ";
    if (!empty($_REQUEST['category_id'])) {
        $sql_a .= " JOIN " . EVENTS_CATEGORY_REL_TABLE . " r ON r.event_id = e.id ";
        $sql_a .= " JOIN " . EVENTS_CATEGORY_TABLE . " c ON  c.id = r.cat_id ";
    }
    $sql_a .= !empty($_REQUEST['category_id']) ? " AND c.id = '" . $_REQUEST['category_id'] . "' " : '';
    $sql_clause = " WHERE ";
    if (!empty($_REQUEST['payment_status'])) {
        $sql_a .= " {$sql_clause} a.payment_status = '" . $_REQUEST['payment_status'] . "' ";
        $sql_clause = " AND ";
    }
    if (!empty($_POST['month_range'])) {
        $pieces = explode('-', $_REQUEST['month_range'], 3);
        $year_r = $pieces[0];
        $month_r = $pieces[1];
        $sql_a .= " {$sql_clause} a.date BETWEEN '" . event_espresso_no_format_date($year_r . '-' . $month_r . '-01', $format = 'Y-m-d') . "' AND '" . event_espresso_no_format_date($year_r . '-' . $month_r . '-31', $format = 'Y-m-d') . "' ";
        $sql_clause = " AND ";
    }
    if (!empty($_REQUEST['event_id'])) {
        $sql_a .= " {$sql_clause} a.event_id = '" . $_REQUEST['event_id'] . "' ";
        $sql_clause = " AND ";
    }
    if (!empty($_REQUEST['today_a'])) {
        //$sql_a .= " $sql_clause a.date = '" . event_espresso_no_format_date($curdate,$format = 'Y-m-d') ."' ";
        $sql_a .= " {$sql_clause} a.date BETWEEN '" . $curdate . ' 00:00:00' . "' AND '" . $curdate . ' 23:59:59' . "' ";
        $sql_clause = " AND ";
    }
    if (!empty($_REQUEST['this_month_a'])) {
        $sql_a .= " {$sql_clause} a.date BETWEEN '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-01', $format = 'Y-m-d') . "' AND '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-' . $days_this_month, $format = 'Y-m-d') . "' ";
        $sql_clause = " AND ";
    }
    if (function_exists('espresso_member_data') && (espresso_member_data('role') == 'espresso_event_manager' || espresso_member_data('role') == 'espresso_group_admin')) {
        $sql_a .= $sql_clause . " e.wp_user = '******'id') . "' ";
    }
    $sql_a .= " {$sql_clause} e.event_status != 'D' ";
    $sql_a .= ") ORDER BY date DESC, id ASC ";
    $attendees = $wpdb->get_results($sql_a);
    //echo $sql_a;
    $total_attendees = $wpdb->num_rows;
    $quantity = 0;
    $attendees_group = '';
    if ($total_attendees > 0) {
        foreach ($attendees as $attendee) {
            /**
            		09-07-11 Edit Seth
            		Removing the grouping functionality to make attendees easier to manage
            	**/
            #if (isset($attendees[$i])){
            //if (isset($attendees[$i])){
            //$attendee = $attendees[$i];
            //echo 'Reg. Id: '.$registration_id.'<br />';
            $registration_id = $attendee->registration_id;
            $lname = $attendee->lname;
            $fname = $attendee->fname;
            $address = $attendee->address;
            $city = $attendee->city;
            $state = $attendee->state;
            $zip = $attendee->zip;
            $email = '<span style="visibility:hidden">' . $attendee->email . '</span>';
            $phone = $attendee->phone;
            $quantity = $attendee->quantity > 1 ? '<br />(' . __('Total Attendees', 'event_espresso') . ': ' . $attendee->quantity . ')' : '';
            //if ($temp_reg_id == '') {
            $id = $attendee->id;
            //$temp_reg_id = $registration_id;
            //echo 'Temp Reg. Id: '.$registration_id.'<br />';
            $attended = $attendee->checked_in;
            $ticket_scanned = $attendee->checked_in_quantity;
            $amount_pd = $attendee->amount_pd;
            $payment_status = $attendee->payment_status;
            $payment_date = $attendee->payment_date;
            $date = $attendee->date;
            $event_id = $attendee->event_id;
            $coupon_code = $attendee->coupon_code;
            $txn_id = $attendee->txn_id;
            $txn_type = $attendee->txn_type;
            $price_option = $attendee->price_option;
            $event_time = $attendee->event_time;
            $event_name = $attendee->event_name;
            $event_date = $attendee->start_date;
            ?>
                  <tr>
                    <td class="check-column" style="padding:7px 0 22px 7px; vertical-align:top;"><input name="checkbox[<?php 
            echo $id;
            ?>
]" type="checkbox"  title="Delete <?php 
            echo $fname;
            echo $lname;
            ?>
"></td>
                    <td class="row-title"  nowrap="nowrap"><a href="admin.php?page=events&amp;event_admin_reports=edit_attendee_record&amp;event_id=<?php 
            echo $event_id;
            ?>
&amp;registration_id=<?php 
            echo $registration_id;
            ?>
&amp;form_action=edit_attendee&amp;id=<?php 
            echo $id;
            ?>
" title="<?php 
            echo 'ID#:' . $id . ' [ REG#: ' . $registration_id . ' ]';
            ?>
"><?php 
            echo $fname;
            ?>
 <?php 
            echo $lname;
            ?>
                      <?php 
            /*?><ul>
                 <?php echo $attendees_group ?>
              </ul><?php */
            ?>
                      </a></td>
                    <td nowrap="nowrap"><?php 
            echo $registration_id;
            ?>
</td>
                    <td class="date column-date"><?php 
            echo event_date_display($date, get_option('date_format') . ' g:i a');
            ?>
</td>
                    <td nowrap="nowrap"><a href="admin.php?page=events&amp;event_admin_reports=list_attendee_payments&amp;event_id=<?php 
            echo $event_id;
            ?>
" title="<?php 
            _e('View attendees for this event', 'event_espresso');
            ?>
"><?php 
            echo stripslashes_deep($event_name);
            ?>
</a></td>
                    <td nowrap="nowrap"><?php 
            echo event_date_display($event_time, get_option('time_format'));
            ?>
</td>
                    <?php 
            if ($ticketing_installed == true) {
                ?>
                    <td nowrap="nowrap"><p style="padding-left:15px"><?php 
                echo $attended == 1 || $ticket_scanned >= 1 ? event_espresso_paid_status_icon('Checkedin') : event_espresso_paid_status_icon('NotCheckedin');
                ?>
</p></td>
                    <?php 
            }
            ?>
                    <td nowrap="nowrap"><?php 
            echo $price_option;
            ?>
</td>
                    <td class="date column"><a href="admin.php?page=events&amp;attendee_pay=paynow&amp;form_action=payment&amp;registration_id=<?php 
            echo $registration_id;
            ?>
&amp;event_admin_reports=enter_attendee_payments&amp;event_id=<?php 
            echo $event_id;
            ?>
" title="<?php 
            _e('Edit Payment', 'event_espresso');
            ?>
 ID: <?php 
            echo $registration_id;
            ?>
">
                      <p style="padding-left:17px"><?php 
            event_espresso_paid_status_icon($payment_status);
            ?>
</p>
                      </a> <?php 
            /*?><a href="admin.php?page=events&amp;attendee_pay=paynow&amp;form_action=payment&amp;registration_id=<?php echo $temp_reg_id ?>&amp;event_admin_reports=enter_attendee_payments&amp;event_id=<?php echo $event_id ?>" title="<?php _e('Edit Payment', 'event_espresso'); ?> ID: <?php echo $temp_reg_id ?>"><?php //echo $org_options['currency_symbol'] ?><?php //echo $total_amount_pd ?></a><?php */
            ?>
</td>
                    <td class="date column-date"><?php 
            echo espresso_payment_type($txn_type);
            ?>
</td>
                    <td class="date column-date"><?php 
            echo $coupon_code;
            ?>
</td>
                    <td class="date column-date"><?php 
            echo $txn_id;
            ?>
</td>
                    <td class="date column-date" >
                    
                    <a href="admin.php?page=events&amp;attendee_pay=paynow&amp;form_action=payment&amp;registration_id=<?php 
            echo $registration_id;
            ?>
&amp;event_admin_reports=enter_attendee_payments&amp;event_id=<?php 
            echo $event_id;
            ?>
" title="<?php 
            _e('Edit Payment', 'event_espresso');
            ?>
 ID: <?php 
            echo $registration_id;
            ?>
"><img src="<?php 
            echo EVENT_ESPRESSO_PLUGINFULLURL;
            ?>
images/icons/money.png" width="16" height="16" alt="<?php 
            _e('Edit Payment', 'event_espresso');
            ?>
" /></a>
                    
                    <a href="admin.php?page=events&amp;event_admin_reports=edit_attendee_record&amp;registration_id=<?php 
            echo $registration_id;
            ?>
&amp;event_id=<?php 
            echo $event_id;
            ?>
&amp;form_action=edit_attendee" title="<?php 
            _e('Edit Attendee', 'event_espresso');
            ?>
"><img src="<?php 
            echo EVENT_ESPRESSO_PLUGINFULLURL;
            ?>
images/icons/user_edit.png" width="16" height="16" alt="<?php 
            _e('Edit Attendee', 'event_espresso');
            ?>
" /></a>
                    
                    <a href="admin.php?page=events&amp;event_admin_reports=resend_email&amp;registration_id=<?php 
            echo $registration_id;
            ?>
&amp;event_id=<?php 
            echo $event_id;
            ?>
&amp;form_action=resend_email" title="<?php 
            _e('Resend Registration Details', 'event_espresso');
            ?>
"><img src="<?php 
            echo EVENT_ESPRESSO_PLUGINFULLURL;
            ?>
images/icons/email_link.png" width="16" height="16" alt="<?php 
            _e('Resend Registration Details', 'event_espresso');
            ?>
" /></a>
                    
                    <a href="<?php 
            echo home_url();
            ?>
/?download_invoice=true&amp;admin=true&amp;registration_id=<?php 
            echo $registration_id;
            ?>
" target="_blank"  title="<?php 
            _e('Download Invoice', 'event_espresso');
            ?>
"><img src="<?php 
            echo EVENT_ESPRESSO_PLUGINFULLURL;
            ?>
images/icons/page_white_acrobat.png" width="16" height="16" alt="<?php 
            _e('Download Invoice', 'event_espresso');
            ?>
" /></a>
          <?php 
            if ($org_options["use_attendee_pre_approval"] == "Y") {
                ?>
          <br/>
          <a href="admin.php?page=events&amp;attendee_pay=paynow&amp;form_action=payment&amp;registration_id=<?php 
                echo $registration_id;
                ?>
&amp;event_admin_reports=enter_attendee_payments&amp;event_id=<?php 
                echo $event_id;
                ?>
" title="<?php 
                _e('Edit Payment', 'event_espresso');
                ?>
 ID: <?php 
                echo $registration_id;
                ?>
">
          <?php 
                if (is_attendee_approved($event_id, $id)) {
                    ?>
          <strong>
          <?php 
                    _e('Approved', 'event_espresso');
                    ?>
          </strong><br/>
          <?php 
                } else {
                    ?>
          <span style="color:#FF0000"><strong>
          <?php 
                    _e('Awaiting approval', 'event_espresso');
                    ?>
          </strong></span>
          <?php 
                }
                ?>
          </a>
          <?php 
            }
            ?>
</td>
      </tr>
      <?php 
            $temp_reg_id = $registration_id;
            $registration_id = '';
        }
    }
    ?>
    </tbody>
  </table>
  <div style="clear:both; margin-bottom:30px;">
    <input name="delete_customer" type="submit" class="button-secondary" id="delete_customer" value="<?php 
    _e('Delete Attendee(s)', 'event_espresso');
    ?>
" style="margin:10px 0 0 0;" onclick="return confirmDelete();" />
    <?php 
    if ($ticketing_installed == true) {
        ?>
    <input name="attended_customer" type="submit" class="button-secondary" id="attended_customer" value="<?php 
        _e('Mark as Attended', 'event_espresso');
        ?>
" style="margin:10px 0 0 10px;" />
    <input name="unattended_customer" type="submit" class="button-secondary" id="attended_customer" value="<?php 
        _e('Unmark as Attended', 'event_espresso');
        ?>
" style="margin:10px 0 0 10px;" />
    <?php 
    }
    ?>
    <a style="margin-left:5px" class="button-primary" href="admin.php?page=events&amp;action=csv_import">
    <?php 
    _e('Import CSV', 'event_espresso');
    ?>
    </a> <a class="button-primary" style="margin-left:5px" href="#" onclick="window.location='<?php 
    echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&amp;event_id=" . $_REQUEST['event_id'] . "&amp;export=report&action=payment&amp;type=excel";
    echo $_REQUEST['event_id'] == '' ? '&amp;all_events=true' : '';
    ?>
'" title="<?php 
    _e('Export to Excel', 'event_espresso');
    ?>
">
    <?php 
    _e('Export to Excel', 'event_espresso');
    ?>
    </a> <?php 
    echo isset($_REQUEST['event_id']) ? '<a style="margin-left:5px"  class="button-primary"  href="admin.php?page=events&amp;event_admin_reports=add_new_attendee&amp;event_id=' . $_REQUEST['event_id'] . '">' . __('Add Attendee', 'event_espresso') . '</a>' : '';
    ?>
 <?php 
    echo isset($_REQUEST['event_id']) ? '<a style="margin-left:5px" class="button-primary" href="admin.php?page=events&amp;action=edit&amp;event_id=' . $_REQUEST['event_id'] . '">' . __('Edit Event', 'event_espresso') . '</a>' : '';
    ?>
 </div>
</form>
 <h4 style="clear:both"><?php 
    _e('Legend', 'event_espresso');
    ?>
</h4>
<dl style="float:left; margin-left:10px; width:200px">
  <dt><?php 
    event_espresso_paid_status_icon('Completed');
    ?>
 - <?php 
    _e('Completed', 'event_espresso');
    ?>
</dt>
  <dt><?php 
    event_espresso_paid_status_icon('Incomplete');
    ?>
 - <?php 
    _e('Incomplete', 'event_espresso');
    ?>
</dt>
    <dt><?php 
    event_espresso_paid_status_icon('Pending');
    ?>
 - <?php 
    _e('Pending', 'event_espresso');
    ?>
</dt>

  <dt><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
images/icons/money.png" width="16" height="16" alt="<?php 
    _e('Payment Details', 'event_espresso');
    ?>
" /> - <?php 
    _e('Payment Details', 'event_espresso');
    ?>
</dt>

  
  </dl>
  <dl style="float:left; margin-left:10px; width:200px">
  <dt><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
images/icons/email_link.png" width="16" height="16" alt="<?php 
    _e('Resend Details', 'event_espresso');
    ?>
" /> - <?php 
    _e('Resend Email', 'event_espresso');
    ?>
</dt>
  <dt><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
images/icons/page_white_acrobat.png" width="16" height="16" alt="<?php 
    _e('Download Invoice', 'event_espresso');
    ?>
" /> - <?php 
    _e('Download Invoice', 'event_espresso');
    ?>
</dt>
  <dt><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
images/icons/user_edit.png" width="16" height="16" alt="<?php 
    _e(' Attendee Details', 'event_espresso');
    ?>
" /> - <?php 
    _e('Attendee Details', 'event_espresso');
    ?>
</dt>
</dl>
<script>
		jQuery(document).ready(function($) {
			/* show the table data */
			var mytable = $('#table').dataTable( {
				"sDom": 'Clfrtip',
				"bAutoWidth": false,
				"bStateSave": true,
				"sPaginationType": "full_numbers",
				"oLanguage": {    "sSearch": "<strong><?php 
    _e('Live Search Filter', 'event_espresso');
    ?>
:</strong> (eg, email, txn id, event, etc.)",
				"sZeroRecords": "<?php 
    _e('No Records Found!', 'event_espresso');
    ?>
" },
				"aoColumns": [
					{ "bSortable": false },
					null,
					<?php 
    echo $ticketing_installed == true ? 'null,' : '';
    ?>
					null,
					null,
					null,
					null,
					null,
					null,
					null,
					null,
					null,
					{ "bSortable": false }
				],
				"aoColumnDefs": [
					{ "bVisible": false, "aTargets": [  <?php 
    if (isset($_REQUEST['event_id'])) {
        echo '4,';
    } else {
        echo '2,';
    }
    ?>
 <?php 
    echo $ticketing_installed == true ? '10,11' : '9,10';
    ?>
 ] }
				],
				"oColVis": {
					"aiExclude": [ 0, 1],
					"buttonText": "Filter: Show / Hide Columns",
					"bRestore": true
				},
			});
		});
	</script>
<?php 
}