Пример #1
0
function event_newsletter($event_id = 0)
{
    //print_r($_POST);
    if (isset($_POST['action']) && $_POST['action'] == 'send_newsletter') {
        espresso_event_reminder($event_id, $_POST['email_subject'], $_POST['email_text'], $_POST['email_name']);
    }
    //echo $event_id;
    global $wpdb, $org_options;
    wp_tiny_mce(false, array("editor_selector" => "theEditor"));
    $events = $wpdb->get_results("SELECT * FROM " . EVENTS_DETAIL_TABLE . " WHERE id = '" . $event_id . "'");
    foreach ($events as $event) {
        $event_id = $event->id;
        $event_name = stripslashes_deep($event->event_name);
        $event_description = stripslashes_deep($event->event_desc);
        $start_date = $event->start_date;
        $end_date = $event->end_date;
        #$start_time = $event->start_time;
        #$end_time = $event->end_time;
        $conf_mail = stripslashes_deep($event->conf_mail);
    }
    ?>
  <div id="poststuff" class="metabox-holder has-right-sidebar">
  <?php 
    event_espresso_display_right_column();
    ?>
  <div id="post-body">
<div id="post-body-content">
 <div class="metabox-holder">
			<div class="postbox">
<h3><?php 
    _e('Send an Email to the Attendees of', 'event_espresso');
    ?>
 <a href="admin.php?page=events&amp;action=edit&amp;event_id=<?php 
    echo $event_id;
    ?>
"><?php 
    echo '"' . $event_name . '"';
    ?>
</a></h3>
 <div class="inside">
  <form method="post" action="<?php 
    echo $_SERVER['REQUEST_URI'];
    ?>
">
  <input type="hidden" name="action" value="send_newsletter"><p><strong><?php 
    _e('Use a <a href="admin.php?page=event_emails">pre-existing email</a>? ', 'event_espresso');
    ?>
</strong> <?php 
    echo espresso_db_dropdown('id', 'email_name', EVENTS_EMAIL_TABLE, 'email_name', 'desc') . ' <a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=email_manager_info"><img src="' . EVENT_ESPRESSO_PLUGINFULLURL . '/images/question-frame.png" width="16" height="16" /></a>';
    ?>
 </p>
  <p><strong><?php 
    _e('OR', 'event_espresso');
    ?>
</strong></p>
   <ul>
    <li><label for="email_subject"><?php 
    _e('Email Subject Line', 'event_espresso');
    ?>
</label> <input type="text" name="email_subject" size="25"></li>
   <li><label for="email_text"><?php 
    _e('Email Text', 'event_espresso');
    ?>
</label><br />
   <!-- <textarea class="theEditor" id="email_text" name="email_text"></textarea> -->
   <?php 
    wp_editor('', 'email_text');
    ?>
      <br />
<a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=custom_email_info"><?php 
    _e('View Custom Email Tags', 'event_espresso');
    ?>
</a>  | <a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=custom_email_example"> <?php 
    _e('Email Example', 'event_espresso');
    ?>
</a>
   </li>
   <li>
    <p>
            <input class="button-primary" type="submit" name="Submit" value="<?php 
    _e('Send Email to Attendees');
    ?>
" id="add_new_email" />
            </p>
    </li>
   </ul>
     </form>
    
     </div>
	</div>
    <p><a href="admin.php?page=events&amp;action=edit&amp;event_id=<?php 
    echo $event_id;
    ?>
"><?php 
    _e('<< Back to', 'event_espresso');
    ?>
 <?php 
    echo $event_name;
    ?>
</a></p>
</div>
</div>
</div>
</div>
<div id="email_manager_info" style="display:none">
<h2><?php 
    _e('Pre-existing Emails', 'event_espresso');
    ?>
</h2>
      <p><?php 
    _e('This will override the custom email below if selected.', 'event_espresso');
    ?>
</p>
</div>
<?php 
    echo event_espresso_custom_email_info();
}
Пример #2
0
function organization_config_mnu()
{
    global $org_options, $espresso_premium, $espresso_check_for_updates;
    if (isset($_POST['update_org'])) {
        $org_options['organization'] = isset($_POST['org_name']) && !empty($_POST['org_name']) ? stripslashes_deep($_POST['org_name']) : '';
        $org_options['organization_street1'] = isset($_POST['org_street1']) && !empty($_POST['org_street1']) ? $_POST['org_street1'] : '';
        $org_options['organization_street2'] = isset($_POST['org_street2']) && !empty($_POST['org_street2']) ? $_POST['org_street2'] : '';
        $org_options['organization_city'] = isset($_POST['org_city']) && !empty($_POST['org_city']) ? $_POST['org_city'] : '';
        $org_options['organization_state'] = isset($_POST['org_state']) && !empty($_POST['org_state']) ? $_POST['org_state'] : '';
        $org_options['organization_zip'] = isset($_POST['org_zip']) && !empty($_POST['org_zip']) ? $_POST['org_zip'] : '';
        $org_options['organization_country'] = isset($_POST['org_country']) && !empty($_POST['org_country']) ? $_POST['org_country'] : '';
        $org_options['contact_email'] = isset($_POST['email']) && !empty($_POST['email']) ? $_POST['email'] : '';
        $org_options['expire_on_registration_end'] = isset($_POST['expire_on_registration_end']) && !empty($_POST['expire_on_registration_end']) ? $_POST['expire_on_registration_end'] : '';
        $org_options['event_page_id'] = isset($_POST['event_page_id']) && !empty($_POST['event_page_id']) ? $_POST['event_page_id'] : '';
        $org_options['return_url'] = isset($_POST['return_url']) && !empty($_POST['return_url']) ? $_POST['return_url'] : '';
        $org_options['cancel_return'] = isset($_POST['cancel_return']) && !empty($_POST['cancel_return']) ? $_POST['cancel_return'] : '';
        $org_options['notify_url'] = isset($_POST['notify_url']) && !empty($_POST['notify_url']) ? $_POST['notify_url'] : '';
        $org_options['events_in_dasboard'] = isset($_POST['events_in_dasboard']) && !empty($_POST['events_in_dasboard']) ? $_POST['events_in_dasboard'] : '';
        $org_options['default_mail'] = isset($_POST['default_mail']) && !empty($_POST['default_mail']) ? $_POST['default_mail'] : '';
        $org_options['payment_subject'] = isset($_POST['payment_subject']) && !empty($_POST['payment_subject']) ? $_POST['payment_subject'] : '';
        $org_options['payment_message'] = isset($_POST['payment_message']) && !empty($_POST['payment_message']) ? esc_html($_POST['payment_message']) : '';
        $org_options['message'] = isset($_POST['success_message']) && !empty($_POST['success_message']) ? esc_html($_POST['success_message']) : '';
        $org_options['email_before_payment'] = isset($_POST['email_before_payment']) && !empty($_POST['email_before_payment']) ? $_POST['email_before_payment'] : '';
        $org_options['email_fancy_headers'] = isset($_POST['email_fancy_headers']) && !empty($_POST['email_fancy_headers']) ? $_POST['email_fancy_headers'] : '';
        $org_options['use_captcha'] = isset($_POST['use_captcha']) && !empty($_POST['use_captcha']) ? $_POST['use_captcha'] : '';
        $org_options['recaptcha_publickey'] = isset($_POST['recaptcha_publickey']) && !empty($_POST['recaptcha_publickey']) ? $_POST['recaptcha_publickey'] : '';
        $org_options['recaptcha_privatekey'] = isset($_POST['recaptcha_privatekey']) && !empty($_POST['recaptcha_privatekey']) ? $_POST['recaptcha_privatekey'] : '';
        $org_options['recaptcha_theme'] = isset($_POST['recaptcha_theme']) && !empty($_POST['recaptcha_theme']) ? $_POST['recaptcha_theme'] : '';
        $org_options['recaptcha_width'] = isset($_POST['recaptcha_width']) && !empty($_POST['recaptcha_width']) ? $_POST['recaptcha_width'] : '';
        $org_options['recaptcha_language'] = isset($_POST['recaptcha_language']) && !empty($_POST['recaptcha_language']) ? $_POST['recaptcha_language'] : '';
        $org_options['espresso_dashboard_widget'] = isset($_POST['espresso_dashboard_widget']) && !empty($_POST['espresso_dashboard_widget']) ? $_POST['espresso_dashboard_widget'] : '';
        $org_options['time_reg_limit'] = isset($_POST['time_reg_limit']) && !empty($_POST['time_reg_limit']) ? $_POST['time_reg_limit'] : '';
        $org_options['skip_confirmation_page'] = isset($_POST['skip_confirmation_page']) ? $_POST['skip_confirmation_page'] : 'N';
        $org_options['allow_mer_discounts'] = isset($_POST['allow_mer_discounts']) ? $_POST['allow_mer_discounts'] : 'N';
        $org_options['allow_mer_vouchers'] = isset($_POST['allow_mer_vouchers']) ? $_POST['allow_mer_vouchers'] : 'N';
        $org_options['use_attendee_pre_approval'] = isset($_POST['use_attendee_pre_approval']) && !empty($_POST['use_attendee_pre_approval']) ? $_POST['use_attendee_pre_approval'] : '';
        if (!empty($_POST['event_ssl_active'])) {
            $org_options['event_ssl_active'] = isset($_POST['event_ssl_active']) && !empty($_POST['event_ssl_active']) ? $_POST['event_ssl_active'] : '';
        }
        $org_options['show_pending_payment_options'] = isset($_POST['show_pending_payment_options']) && !empty($_POST['show_pending_payment_options']) ? $_POST['show_pending_payment_options'] : '';
        $org_options['use_venue_manager'] = isset($_POST['use_venue_manager']) && !empty($_POST['use_venue_manager']) ? $_POST['use_venue_manager'] : '';
        $org_options['use_personnel_manager'] = isset($_POST['use_personnel_manager']) && !empty($_POST['use_personnel_manager']) ? $_POST['use_personnel_manager'] : '';
        $org_options['use_event_timezones'] = isset($_POST['use_event_timezones']) && !empty($_POST['use_event_timezones']) ? $_POST['use_event_timezones'] : '';
        $org_options['full_logging'] = isset($_POST['full_logging']) && !empty($_POST['full_logging']) ? $_POST['full_logging'] : '';
        $org_options['surcharge'] = isset($_POST['surcharge']) && !empty($_POST['surcharge']) ? $_POST['surcharge'] : '';
        $org_options['surcharge_type'] = isset($_POST['surcharge_type']) && !empty($_POST['surcharge_type']) ? $_POST['surcharge_type'] : '';
        $org_options['surcharge_text'] = isset($_POST['surcharge_text']) && !empty($_POST['surcharge_text']) ? $_POST['surcharge_text'] : '';
        $org_options['show_reg_footer'] = isset($_POST['show_reg_footer']) && !empty($_POST['show_reg_footer']) ? $_POST['show_reg_footer'] : '';
        $org_options['affiliate_id'] = isset($_POST['affiliate_id']) && !empty($_POST['affiliate_id']) ? $_POST['affiliate_id'] : '';
        $org_options['site_license_key'] = isset($_POST['site_license_key']) && !empty($_POST['site_license_key']) ? $_POST['site_license_key'] : '';
        $org_options['default_payment_status'] = isset($_POST['default_payment_status']) && !empty($_POST['default_payment_status']) ? $_POST['default_payment_status'] : '';
        $org_options['default_logo_url'] = isset($_REQUEST['upload_image']) && !empty($_REQUEST['upload_image']) ? $_REQUEST['upload_image'] : '';
        $currency_format = getCountryFullData($org_options['organization_country']);
        switch ($currency_format['iso_code_3']) {
            case 'USA':
                $org_options['currency_symbol'] = '$';
                // US Dollar
                break;
            case 'CHE':
                $org_options['currency_symbol'] = 'Fr.';
                // Swiss Franc
                break;
            case 'AUS':
                $org_options['currency_symbol'] = 'A$';
                // Australian Dollar
                break;
            case 'GBR':
                $org_options['currency_symbol'] = '&pound;';
                // British Pound
                break;
            case 'NOR':
                $org_options['currency_symbol'] = 'kr';
                // Norwegian Krone
                break;
            case 'BRA':
                $org_options['currency_symbol'] = 'R$';
                // Brazillian Real
                break;
            case 'CAN':
                $org_options['currency_symbol'] = 'C$';
                // Canadian Dollar
                break;
            case 'JPN':
                $org_options['currency_symbol'] = '&yen;';
                // Japanese Yen
                break;
            case 'SWE':
                $org_options['currency_symbol'] = 'kr';
                // Swedish Krona
                break;
            case 'DNK':
                $org_options['currency_symbol'] = 'kr';
                // Danish Krone
                break;
            case 'ZAF':
                $org_options['currency_symbol'] = 'R';
                // South African Rand
                break;
            case 'IND':
                $org_options['currency_symbol'] = 'Rs';
                // Indian Rupee
                break;
            case 'TUR':
                $org_options['currency_symbol'] = 'TL';
                // Turkish Lira
                break;
            case 'NZL':
                $org_options['currency_symbol'] = 'NZ$';
                // New Zealand Dollar
                break;
            case 'HKG':
                $org_options['currency_symbol'] = 'HK$';
                // Hong Kong Dollar
                break;
            case 'SGP':
                $org_options['currency_symbol'] = 'S$';
                // Singapore Dollar
                break;
            case 'POL':
                $org_options['currency_symbol'] = 'zl';
                // Polish Zloty (hex code: z&#x0142;)
                break;
            case 'HUN':
                $org_options['currency_symbol'] = 'Ft';
                // Hungarian Forint
                break;
            case 'CZE':
                $org_options['currency_symbol'] = 'Kc';
                // Czech Koruna (hex code: K&#x10D;)
                break;
            case 'ISR':
                $org_options['currency_symbol'] = 'ILS';
                // Israeli Shekel (hex code: &#8362;)
                break;
            case 'MEX':
                $org_options['currency_symbol'] = 'Mex$';
                // Mexican Peso
                break;
            case 'MYS':
                $org_options['currency_symbol'] = 'RM';
                // Malaysian Ringgit
                break;
            case 'PHL':
                $org_options['currency_symbol'] = 'PhP';
                // Phillipine Peso (hex code: &#x20b1;)
                break;
            case 'TWN':
                $org_options['currency_symbol'] = 'NT$';
                // New Taiwan Dollar
                break;
            case 'THA':
                $org_options['currency_symbol'] = 'THB';
                // Thai Baht (hex code: &#xe3f;)
                break;
            case 'AUT' || 'BEL' || 'CYP' || 'EST' || 'FIN' || 'FRA' || 'DEU' || 'GRC' || 'IRL' || 'ITA' || 'LUX' || 'MLT' || 'NLD' || 'PRT' || 'SVK' || 'SVN' || 'ESP' || 'AND' || 'MCO' || 'SMR' || 'VAT' | 'MYT' || 'MNE' || 'XKV' || 'SPM':
                $org_options['currency_symbol'] = 'EUR';
                // use the Euro for all eurozone countries
                break;
            default:
                $org_options['currency_symbol'] = '$';
                break;
        }
        /* if (getCountryZoneId($org_options['organization_country']) == '2') {
        	  $org_options['currency_symbol'] = 'Euro: '; //Creates the symbol for the Euro
        	  } */
        update_option('events_organization_settings', $org_options);
        echo '<div id="message" class="updated fade"><p><strong>' . __('Organization details saved.', 'event_espresso') . '</strong></p></div>';
    }
    $org_options = get_option('events_organization_settings');
    $values = array(array('id' => 'Y', 'text' => __('Yes', 'event_espresso')), array('id' => 'N', 'text' => __('No', 'event_espresso')));
    ?>
	<div class="wrap columns-2">
		<div id="icon-options-event" class="icon32"> </div>
		<h2>
			<?php 
    _e('General Settings', 'event_espresso');
    ?>
		</h2>
		<?php 
    ob_start();
    ?>
		<div class="meta-box-sortables ui-sortable">
			<form class="espresso_form" method="post" action="<?php 
    echo $_SERVER['REQUEST_URI'];
    ?>
">
				<ul id="event_espresso-sortables">
					<li>
						<div class="metabox-holder">
							<div class="postbox">
								<div title="Click to toggle" class="handlediv"><br />
								</div>
								<h3 class="hndle">
									<?php 
    _e('Organization Settings', 'event_espresso');
    ?>
								</h3>
								<div class="inside">
									<div class="padding">
									<h4>
											<?php 
    _e('Company Logo', 'event_espresso');
    ?>
										</h4>
											<ul>
												<li><label for="upload_image">
															<?php 
    _e('Add a Default Logo', 'event_espresso');
    ?>
															<a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=espresso_default_logo_info"><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
/images/question-frame.png" width="16" height="16" /></a></label>
															<div id="default-logo-image">
															<?php 
    $org_options['default_logo_url'] = isset($org_options['default_logo_url']) ? $org_options['default_logo_url'] : '';
    ?>
															<input id="upload_image" type="hidden" size="36" name="upload_image" value="<?php 
    echo $org_options['default_logo_url'];
    ?>
" />
															<input id="upload_image_button" type="button" value="Upload Image" />
															<?php 
    if ($org_options['default_logo_url'] != '') {
        ?>
																<p class="default-logo-thumb"><img src="<?php 
        echo $org_options['default_logo_url'];
        ?>
" alt="" /><br />
																<a id="remove-image" href="#" title="Remove this image" onclick="return false;"><?php 
        _e('Remove Image', 'event_espresso');
        ?>
</a></p>
															<?php 
    }
    ?>
														</div>
														<div id="espresso_default_logo_info" class="pop-help" style="display:none">
															<h2>
																<?php 
    _e('Default Logo', 'event_espresso');
    ?>
															</h2>
															<p><?php 
    echo __('The default logo will be used in your custom invoice, ticketing, certificates, and payment templates.', 'event_espresso');
    ?>
</p>
														</div>
														</li>
														<li><h4><?php 
    _e('Contact Information', 'event_espresso');
    ?>
</h4></li>									
											<li>
												<label for="org_name">
													<?php 
    _e('Organization Name:', 'event_espresso');
    ?>
												</label>
												<input type="text" name="org_name" size="45" value="<?php 
    echo stripslashes_deep($org_options['organization']);
    ?>
" />
											</li>
											<li>
												<label for="org_street1">
													<?php 
    _e('Organization Street 1:', 'event_espresso');
    ?>
												</label>
												<input type="text" name="org_street1" size="45" value="<?php 
    echo $org_options['organization_street1'];
    ?>
" />
											</li>
											<li>
												<label for="org_street2">
													<?php 
    _e('Organization Street 2:', 'event_espresso');
    ?>
												</label>
												<input type="text" name="org_street2" size="45" value="<?php 
    echo $org_options['organization_street2'];
    ?>
" />
											</li>
											<li>
												<label for="org_city">
													<?php 
    _e('Organization City:', 'event_espresso');
    ?>
												</label>
												<input type="text" name="org_city" size="45" value="<?php 
    echo $org_options['organization_city'];
    ?>
" />
											</li>
											<li>
												<label for="org_state">
													<?php 
    _e('Organization State:', 'event_espresso');
    ?>
												</label>
												<input type="text" name="org_state" size="45" value="<?php 
    echo $org_options['organization_state'];
    ?>
" />
											</li>
											<li>
												<label for="org_zip">
													<?php 
    _e('Organization Zip/Postal Code:', 'event_espresso');
    ?>
												</label>
												<input type="text" name="org_zip" size="10" value="<?php 
    echo $org_options['organization_zip'];
    ?>
" />
											</li>
											<li>
												<label for="org_country">
													<?php 
    _e('Organization Country:', 'event_espresso');
    ?>
												</label>
												<?php 
    printCountriesSelector("org_country", $org_options['organization_country']);
    ?>
 (<?php 
    echo $org_options['currency_symbol'];
    ?>
)</li>
											<li>
												<label for="email">
													<?php 
    _e('Primary contact email:', 'event_espresso');
    ?>
												</label>
												<input type="text" name="email" size="45" value="<?php 
    echo $org_options['contact_email'];
    ?>
" />
											</li>
											<li>
												<h4>
													<?php 
    _e('Time and Date Settings', 'event_espresso');
    ?>
												</h4>
											</li >
											<li class="time-date">
												<p> <span class="run-in">
														<?php 
    _e('Current Time: ', 'event_espresso');
    ?>
													</span><span class="current-date"> <?php 
    echo date(get_option('date_format') . ' ' . get_option('time_format'));
    ?>
 </span><a class="change-date-time" href="options-general.php" target="_blank">
														<?php 
    _e('Change timezone and date format settings?', 'event_espresso');
    ?>
													</a> </p>
												<p> <span class="important">
														<?php 
    _e('Note:', 'event_espresso');
    ?>
													</span>
													<?php 
    _e('You must set the time zone for your city, or the city closest to you. UTC time will not work.', 'event_espresso');
    ?>
													<a href="http://ee-updates.s3.amazonaws.com/images/time-zone-settings-example.jpg" class="thickbox">View an example?</a> </p>
											</li>
											
										</ul>
										
										<p>
											<input class="button-primary" type="submit" name="Submit" value="<?php 
    _e('Save Options', 'event_espresso');
    ?>
" id="save_organization_saetting_1" />
										</p>
									</div>
								</div>
							</div>
						</div>
					</li>
					<li>
						<div class="metabox-holder">
							<div class="postbox">
								<div title="Click to toggle" class="handlediv"><br />
								</div>
								<h3 class="hndle">
									<?php 
    _e('Page Settings', 'event_espresso');
    ?>
								</h3>
								<div class="inside">
									<div class="padding"> <a name="page_settings" id="page_settings"></a>
										<?php 
    if (empty($org_options['event_page_id']) || empty($org_options['return_url']) || empty($org_options['notify_url']) || empty($org_options['cancel_return'])) {
        espresso_create_default_pages();
    }
    //Check to see if we are using the deprecated SSL option. If we are, recommend updating to WordPress HTTPS (SSL).
    if (!empty($org_options['event_ssl_active']) && $espresso_premium == true && $org_options['event_ssl_active'] == 'Y') {
        echo '<div id="ssl-reg" style="background-color: #ffffe0; border: #e6db55 1px solid; padding:4px;">';
        echo '<p><strong>' . __('Attention!', 'event_espresso') . '</strong><br />' . __('The Secure Payment System has been removed.', 'event_espresso') . '</p>';
        echo '<p>' . __('If your site uses SSL to handle secure transactions. Please install the <a href="http://ee-updates.s3.amazonaws.com/espresso-https.1.0.zip" title="Download Now">Event Espresso SSL/HTTPS</a> plugin now.', 'event_espresso') . ' ' . __('<a href="http://eventespresso.com/forums/2011/09/use-wordpress-https-for-ssl-encryption-on-your-event-espresso-site/" target="_blank">More information here</a>.', 'event_espresso') . '</p>';
        $ssl_values = array(array('id' => 'N', 'text' => __('Yes', 'event_espresso')), array('id' => 'Y', 'text' => __('No', 'event_espresso')));
        ?>
											<label for="event_ssl_active">
												<?php 
        _e('Turn off this message?', 'event_espresso');
        ?>
											</label>
											<br />
											<?php 
        echo select_input('event_ssl_active', $ssl_values, $org_options['event_ssl_active']);
        echo '</div>';
    }
    ?>
										<p>
											<?php 
    _e('The following shortcodes and page settings are required for Event Espresso to function properly. These shortcodes should not be replaced with any other shortcodes. Please view <a href="admin.php?page=support#shortcodes">this page</a> for a list of optional shortcodes.', 'event_espresso');
    ?>
										</p>
										<p>
											<label for="event_page_id">
												<?php 
    _e('Main registration page:', 'event_espresso');
    ?>
											</label>
											<select name="event_page_id">
												<option value="0">
													<?php 
    _e('Main page', 'event_espresso');
    ?>
												</option>
												<?php 
    parent_dropdown($default = $org_options['event_page_id']);
    ?>
											</select>
											<a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=registration_page_info"><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
/images/question-frame.png" width="16" height="16" /></a><br />
											<span class="messages"><?php 
    echo sprintf(__("This page should contain the %s shortcode. <br />This page can be hidden from navigation if desired, <br />but should always contain the %s shortcode.", 'event_espresso'), '<span class="highlight">[ESPRESSO_EVENTS]</span>', '[ESPRESSO_EVENTS]');
    ?>
)</span></p>
										<?php 
    ###### Popup help box #######
    ?>
										<div id="registration_page_info" class="pop-help" style="display:none">
											<h2>
												<?php 
    _e('Main Events Page', 'event_espresso');
    ?>
											</h2>
											<p><?php 
    echo sprintf(__('This is the page that displays your events and doubles as your registration page. It is very important that this page always contains the %s shortcode.', 'event_espresso'), '<strong>[ESPRESSO_EVENTS]</strong>');
    ?>
</p>
											<p><?php 
    echo sprintf(__("This page should ALWAYS contain the %s shortcode.", 'event_espresso'), '<strong>[ESPRESSO_EVENTS]</strong>');
    ?>
</p>
										</div>
										<?php 
    ###### close popup help box ######
    ?>
										<p>
											<label for="return_url">
												<?php 
    _e('Auto Return URL (Thank You and Return Payment page):', 'event_espresso');
    ?>
											</label>
											<select name="return_url">
												<option value="0">
													<?php 
    _e('Main page', 'event_espresso');
    ?>
												</option>
												<?php 
    parent_dropdown($default = $org_options['return_url']);
    ?>
											</select>
											<a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=return_url_info" target="_blank"><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
/images/question-frame.png" width="16" height="16" /></a><br />
											<span class="messages">(<?php 
    echo sprintf(__("This page should contain the %s shortcode.<br />This page should hidden from your navigation,<br />but still viewable to the public (not password protected.)", 'event_espresso'), '<span class="highlight">[ESPRESSO_PAYMENTS]</span>');
    ?>
 </span></p>
										<?php 
    ##### Popup help box #####
    ?>
										<div id="return_url_info" class="pop-help" style="display:none">
											<h2>
												<?php 
    _e('Auto Return URL', 'event_espresso');
    ?>
											</h2>
											<p>
												<?php 
    _e('The URL to which the payer\'s browser is redirected after completing the payment; for example, a URL on your site that displays a "Thank you for your payment" page.', 'event_espresso');
    ?>
											</p>
											<p><?php 
    echo sprintf(__("This page should contain the %s shortcode.", 'event_espresso'), '<strong>[ESPRESSO_PAYMENTS]</strong>');
    ?>
</p>
											<p><em class="important"><b>
														<?php 
    _e('ATTENTION:', 'event_espresso');
    ?>
													</b><br />
													<?php 
    _e('This page should be hidden from from your navigation menu. Exclude pages by using the "Exclude Pages" plugin from http://wordpress.org/extend/plugins/exclude-pages/ or using the "exclude" parameter in your "wp_list_pages" template tag. Please refer to http://codex.wordpress.org/Template_Tags/wp_list_pages for more inforamation about excluding pages.', 'event_espresso');
    ?>
												</em> </p>
										</div>
										<?php 
    ##### close popup help #####
    ?>
										<p>
											<label for="cancel_return">
												<?php 
    _e('Cancel Return URL (used for cancelled payments):', 'event_espresso');
    ?>
											</label>
											<select name="cancel_return">
												<option value="0">
													<?php 
    _e('Main page', 'event_espresso');
    ?>
												</option>
												<?php 
    parent_dropdown($default = $org_options['cancel_return']);
    ?>
											</select>
											<a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=cancel_return_info"><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
/images/question-frame.png" width="16" height="16" /></a><br />
											<span class="messages">(
												<?php 
    echo sprintf(__("This should be a page on your website that contains a cancelled message %s and the %s shortcode. This page should hidden %s from your navigation, but still viewable to the public (not password protected.)", 'event_espresso'), '<br />', '<span class="highlight">[ESPRESSO_CANCELLED]</span>', '<br />');
    ?>
												)</span></p>
										<?php 
    ##### popup help box #####
    ?>
										<div id="cancel_return_info" class="pop-help" style="display:none">
											<h2>
												<?php 
    _e('Cancel Return URL', 'event_espresso');
    ?>
											</h2>
											<p>
												<?php 
    _e('A URL to which the payer\'s browser is redirected if payment is cancelled; for example, a URL on your website that displays a "Payment Canceled" page.', 'event_espresso');
    ?>
											</p>
											<p>
												<?php 
    echo sprintf(__("This should be a page on your website that contains a cancelled message and the %s shortcode.", 'event_espresso'), '<strong>[ESPRESSO_CANCELLED]</strong>');
    ?>
											</p>
											<p><em class="important"><b>
														<?php 
    _e('ATTENTION:', 'event_espresso');
    ?>
													</b><br />
													<?php 
    _e('This page should be hidden from from your navigation menu. Exclude pages by using the "Exclude Pages" plugin from http://wordpress.org/extend/plugins/exclude-pages/ or using the "exclude" parameter in your "wp_list_pages" template tag. Please refer to http://codex.wordpress.org/Template_Tags/wp_list_pages for more inforamation about excluding pages.', 'event_espresso');
    ?>
												</em></p>
										</div>
										<?php 
    ##### close popup help box #####
    ?>
										<p>
											<label for="notify_url">
												<?php 
    _e('Notify URL (used to process payments):', 'event_espresso');
    ?>
											</label>
											<select name="notify_url">
												<option value="0">
													<?php 
    _e('Main page', 'event_espresso');
    ?>
												</option>
												<?php 
    parent_dropdown($default = $org_options['notify_url']);
    ?>
											</select>
											<a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=notify_url_info"><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
/images/question-frame.png" width="16" height="16" /></a><br />
											<span class="messages">(<?php 
    echo sprintf(__("This page should contain the %s shortcode.<br />This page should hidden from your navigation, <br />but still viewable to the public (not password protected.)", 'event_espresso'), '<span class="highlight">[ESPRESSO_TXN_PAGE]</span>');
    ?>
</span></p>
										<?php 
    ##### popup help box #####
    ?>
										<div id="notify_url_info" class="pop-help" style="display:none">
											<h2>
												<?php 
    _e('Notify URL', 'event_espresso');
    ?>
											</h2>
											<p>
												<?php 
    _e('The URL to which PayPal posts information about the transaction, in the form of Instant Payment Notification messages.', 'event_espresso');
    ?>
											</p>
											<p> <?php 
    echo sprintf(__('This page should contain the %s shortcode.', 'event_espresso'), '<strong>[ESPRESSO_TXN_PAGE]</strong>');
    ?>
 </p>
											<p><em class="important"><b>
														<?php 
    _e('ATTENTION:', 'event_espresso');
    ?>
													</b><br />
													<?php 
    _e('This page should be hidden from from your navigation menu. Exclude pages by using the "Exclude Pages" plugin from http://wordpress.org/extend/plugins/exclude-pages/ or using the "exclude" parameter in your "wp_list_pages" template tag. Please refer to http://codex.wordpress.org/Template_Tags/wp_list_pages for more inforamation about excluding pages.', 'event_espresso');
    ?>
												</em> </p>
										</div>
										<p>
											<input class="button-primary" type="submit" name="Submit" value="<?php 
    _e('Save Options', 'event_espresso');
    ?>
" id="save_organization_saetting_2" />
										</p>
									</div>
								</div>
							</div>
						</div>
					</li>
					<li>
						<div class="metabox-holder">
							<div class="postbox">
								<div title="Click to toggle" class="handlediv"><br />
								</div>
								<h3 class="hndle">
									<?php 
    _e('Email Settings', 'event_espresso');
    ?>
								</h3>
								<div class="inside">
									<div class="padding"><a name="email-settings" id="email-settings"></a>
										<?php 
    $values = array(array('id' => 'Y', 'text' => __('Yes', 'event_espresso')), array('id' => 'N', 'text' => __('No', 'event_espresso')));
    ?>
										<p>
											<?php 
    _e('Send payment confirmation emails?', 'event_espresso');
    echo select_input('default_mail', $values, $org_options['default_mail']);
    ?>
										</p>
										<p>
											<?php 
    _e('Send registration confirmation emails before payment is received?', 'event_espresso');
    echo select_input('email_before_payment', $values, $org_options['email_before_payment']);
    ?>
										</p>
										<p>
	<?php 
    _e('Use fancy email headers?', 'event_espresso');
    echo select_input('email_fancy_headers', $values, $org_options['email_fancy_headers']);
    ?>
											<a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=fancyemailheaders"><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
/images/question-frame.png" width="16" height="16" /></a>
										</p>
												<?php 
    ###### Popup help box #######
    ?>
										<div id="fancyemailheaders" class="pop-help" style="display:none">
											<h2>
	<?php 
    _e('Fancy Email Headers', 'event_espresso');
    ?>
											</h2>
											<p><?php 
    echo sprintf(__("This option enables the use of the email header format %s From: name %s %s Reply-to: name %s %s.", 'event_espresso'), '<br />', '&lt;email@address.com&gt;', '<br />', '&lt;email@address.com&gt;', '<br />');
    ?>
</p>
											<p><?php 
    _e("You should only use this if you know it will not cause email delivery problems. Some servers will not send emails that use this format.", 'event_espresso');
    ?>
</p>
										</div>
										<h4>
												<?php 
    _e('Payment Confirmation Email:', 'event_espresso');
    ?>
										</h4>
										<p>
											<label for="payment_subject">
	<?php 
    _e('Email Subject:', 'event_espresso');
    ?>
											</label>
											<input id="payment_subject" name="payment_subject" size="50" type="text" value="<?php 
    echo stripslashes_deep($org_options['payment_subject']);
    ?>
" />
										</p>

										<div id="payment-conf-email" class="postbox">
											<?php 
    if (function_exists('wp_editor')) {
        $args = array("textarea_rows" => 5, "textarea_name" => "payment_message", "editor_class" => "my_editor_custom");
        wp_editor(espresso_admin_format_content($org_options['payment_message']), "payment_message", $args);
    } else {
        echo '<textarea class="theEditor std-textarea" id="payment_message" name="payment_message">' . espresso_admin_format_content($org_options['payment_message']) . '</textarea>';
    }
    ?>
	<?php 
    /* ?><textarea class="theEditor std-textarea" id="payment_message" name="payment_message"><?php echo espresso_admin_format_content($org_options['payment_message']); ?></textarea><?php */
    ?>
											<table id="payment-confirmation-form" cellspacing="0">
												<tbody>
													<tr>
														<td class="aer-word-count"></td>
														<td class="autosave-info"><span><a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=custom_email_info">
	<?php 
    _e('View Custom Email Tags', 'event_espresso');
    ?>
																</a></span></td>
													</tr>
												</tbody>
											</table>
										</div>
										<h4>
											<?php 
    _e('Default Registration Confirmation Email:', 'event_espresso');
    ?>
										</h4>

										<div id="reg-conf-email" class="postbox">
											<?php 
    if (function_exists('wp_editor')) {
        $args = array("textarea_rows" => 5, "textarea_name" => "success_message", "editor_class" => "my_editor_custom");
        wp_editor(espresso_admin_format_content($org_options['message']), "success_message", $args);
    } else {
        echo '<textarea class="theEditor std-textarea" id="success_message" name="success_message">' . espresso_admin_format_content($org_options['message']) . '</textarea>';
    }
    ?>
	<?php 
    /* ?><textarea class="theEditor std-textarea"  id="reg-conf-email-mce" name="success_message"><?php echo espresso_admin_format_content($org_options['message']); ?></textarea><?php */
    ?>
											<table id="email-confirmation-form" cellspacing="0">
												<tbody>
													<tr>
														<td class="aer-word-count"></td>
														<td class="autosave-info"><span><a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=custom_email_info">
	<?php 
    _e('View Custom Email Tags', 'event_espresso');
    ?>
																</a> | <a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=custom_email_example">
	<?php 
    _e('Example', 'event_espresso');
    ?>
																</a></span></td>
													</tr>
												</tbody>
											</table>
										</div>
										<p>
											<input class="button-primary" type="submit" name="Submit" value="<?php 
    _e('Save Options', 'event_espresso');
    ?>
" id="save_organization_saetting_5" />
										</p>
									</div>
								</div>
							</div>
						</div>
						<div style="clear:both;"></div>
					</li>
					<li>
						<h2>
					<?php 
    _e('Advanced Features', 'event_espresso');
    ?>
						</h2>
						<hr />
					</li>
					<?php 
    if (file_exists(EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/recaptcha_form.php') || file_exists(EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/optional_event_settings.php')) {
        if (file_exists(EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/optional_event_settings.php')) {
            echo '<li>';
            require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/optional_event_settings.php';
            echo '</li>';
        }
        if (file_exists(EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/recaptcha_form.php')) {
            echo '<li>';
            require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/recaptcha_form.php';
            echo '</li>';
        }
    } else {
        ?>
						<li>
							<div class="metabox-holder">
								<div class="postbox">
									<div title="Click to toggle" class="handlediv"><br />
									</div>
									<h3 class="hndle">
		<?php 
        _e('Optional Event Settings', 'event_espresso');
        ?>
									</h3>
									<div class="inside">
										<div class="padding">
											<p><?php 
        echo __('Please purchase a', 'event_espresso');
        ?>
 <a href="http://eventespresso.com/download/" target="_blank"><?php 
        echo __('support license', 'event_espresso');
        ?>
</a> <?php 
        echo __('to gain access to these features.', 'event_espresso');
        ?>
</p>
											<p>
													<?php 
        _e('Additional features include:', 'event_espresso');
        ?>
											</p>
											<ol>
												<li>
													<?php 
        _e('Upcoming events widget in the admin dashboard', 'event_espresso');
        ?>
												</li>
												<li>
													<?php 
        _e('Registration limits on time slots', 'event_espresso');
        ?>
												</li>
												<li>
													<?php 
        _e('Ability to display short descriptions in the event listings', 'event_espresso');
        ?>
												</li>
												<li>
													<?php 
        _e('Custom post types for events', 'event_espresso');
        ?>
												</li>
												<li>
													<?php 
        _e('Attendee pre-approval feature', 'event_espresso');
        ?>
												</li>
												<li>
													<?php 
        _e('Event Venue/Staff Manager', 'event_espresso');
        ?>
												</li>
												<li>
		<?php 
        _e('Graphical Reports', 'event_espresso');
        ?>
												</li>
											</ol>
										</div>
									</div>
								</div>
							</div>
						</li>
						<li>
							<div class="metabox-holder">
								<div class="postbox">
									<div title="Click to toggle" class="handlediv"><br />
									</div>
									<h3 class="hndle">
		<?php 
        _e('reCAPTCHA Settings', 'event_espresso');
        ?>
									</h3>
									<div class="inside">
										<div class="padding">
											<p><?php 
        echo __('Please purchase a', 'event_espresso');
        ?>
 <a href="http://eventespresso.com/download/" target="_blank"><?php 
        echo __('support license', 'event_espresso');
        ?>
</a> <?php 
        echo __('to gain access to this feature.', 'event_espresso');
        ?>
</p>
											<p> <?php 
        echo sprintf(__('reCAPTCHA helps prevent automated abuse of your site (such as comment spam or bogus registrations) by using a %s to ensure that only humans perform certain actions.', 'event_espresso'), '<a href="http://recaptcha.net/captcha.html">CAPTCHA</a>');
        ?>
 </p>
										</div>
									</div>
								</div>
							</div>
						</li>
						<?php 
    }
    if ($espresso_check_for_updates == true && $espresso_premium == true) {
        ?>

						<li><a name="license_key" id="license_key"></a>
							<div class="metabox-holder">
								<div class="postbox">
									<div title="Click to toggle" class="handlediv"><br />
									</div>
									<h3 class="hndle">
		<?php 
        _e('Support License', 'event_espresso');
        ?>
									</h3>
									<div class="inside">
										<div class="padding">
											<ul>
												<li>
													<label for="site_license_key">
		<?php 
        _e('Site License Key:', 'event_espresso');
        ?>
													</label>
													<input type="text" name="site_license_key" size="45" value="<?php 
        echo isset($org_options['site_license_key']) ? stripslashes_deep($org_options['site_license_key']) : '';
        ?>
" />
												</li>

											</ul>
											<p>
												<input class="button-primary" type="submit" name="Submit" value="<?php 
        _e('Save Options', 'event_espresso');
        ?>
" id="save_organization_saetting_5" />
											</p>
										</div>
									</div>
								</div>
							</div>
						</li>
	<?php 
    }
    ?>
				</ul>
				<input type="hidden" name="update_org" value="update" />
			</form>
		</div>
		<?php 
    $post_content = ob_get_clean();
    espresso_choose_layout($post_content, event_espresso_display_right_column());
    ?>
	</div>
	<script type="text/javascript" charset="utf-8">
		//<![CDATA[
		jQuery(document).ready(function() {
			postboxes.add_postbox_toggles('event_espresso');

			//Logo uploader
			var header_clicked = false;
			jQuery('#upload_image_button').click(function() {
				formfield = jQuery('#upload_image').attr('name');
				tb_show('', 'media-upload.php?type=image&amp;TB_iframe=1');
				jQuery('p.default-logo-thumb').addClass('old');
				header_clicked = true;
				return false;
			});
			window.original_send_to_editor = window.send_to_editor;

			window.send_to_editor = function(html) {
				if(header_clicked) {
					//Remove old image
					jQuery("#upload_image").val('');
					jQuery("p.default-logo-thumb").remove();
					jQuery("p#image-display").remove();
					jQuery('#remove-image').remove();
					
					//Add new image
					imgurl = jQuery('img',html).attr('src');
					jQuery('#' + formfield).val(imgurl);
					jQuery('#default-logo-image').append("<p id='image-display'><img src='"+imgurl+"' alt='' /></p>");
					header_clicked = false;
					tb_remove();
				} else {
					window.original_send_to_editor(html);
				}
			}
			
			// process the remove link in the metabox
			jQuery('#remove-image').click(function(){
				var answer = confirm('<?php 
    _e('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso');
    ?>
');
				if (answer){
					jQuery("#upload_image").val('');
					jQuery("p.default-logo-thumb").remove();
					jQuery("p#image-display").remove();
					jQuery('#remove-image').remove();
				}
				return false;
			});

		});
		//]]>
	</script>
	<?php 
    echo event_espresso_custom_email_info();
    if (!function_exists('wp_editor')) {
        espresso_tiny_mce();
    }
}
Пример #3
0
function event_espresso_edit_list()
{
    global $wpdb, $org_options;
    define('EVT_ADMIN_URL', admin_url('admin.php?page=events'));
    $max_rows = isset($_REQUEST['max_rows']) & !empty($_REQUEST['max_rows']) ? absint($_REQUEST['max_rows']) : 50;
    $start_rec = isset($_REQUEST['start_rec']) && !empty($_REQUEST['start_rec']) ? absint($_REQUEST['start_rec']) : 0;
    $records_to_show = " LIMIT {$max_rows} OFFSET {$start_rec} ";
    //Dates
    $curdate = date('Y-m-d');
    $this_year_r = date('Y');
    $this_month_r = date('m');
    $days_this_month = date('t', strtotime($curdate));
    $month_range = isset($_REQUEST['month_range']) && !empty($_REQUEST['month_range']) ? sanitize_text_field($_REQUEST['month_range']) : FALSE;
    $category_id = isset($_REQUEST['category_id']) && !empty($_REQUEST['category_id']) ? sanitize_text_field($_REQUEST['category_id']) : FALSE;
    $today_filter = isset($_REQUEST['today']) && $_REQUEST['today'] == 'true' ? TRUE : FALSE;
    $this_month_filter = isset($_REQUEST['this_month']) && $_REQUEST['this_month'] == 'true' ? TRUE : FALSE;
    $event_status = isset($_POST['event_status']) && !empty($_POST['event_status']) ? sanitize_text_field($_REQUEST['event_status']) : FALSE;
    if (isset($_POST['delete_event'])) {
        if (is_array($_POST['checkbox'])) {
            while (list($key, $value) = each($_POST['checkbox'])) {
                $del_id = $key;
                event_espresso_delete_event($del_id);
            }
        }
        ?>
		<div id="message" class="updated fade">
			<p><strong>
					<?php 
        _e('Event(s) have been permanently deleted.', 'event_espresso');
        ?>
				</strong></p>
		</div>
		<?php 
    }
    if (isset($_POST['perm_delete_event'])) {
        if (is_array($_POST['checkbox'])) {
            while (list($key, $value) = each($_POST['checkbox'])) {
                $del_id = $key;
                event_espresso_empty_event_trash($del_id);
            }
        }
        ?>

		<div id="message" class="updated fade">
			<p><strong>
					<?php 
        _e('Event(s) have been permanently deleted.', 'event_espresso');
        ?>
				</strong></p>
		</div>
		<?php 
    }
    $recurrence_icon = '';
    if (defined('EVENT_ESPRESSO_RECURRENCE_MODULE_ACTIVE')) {
        $recurrence_icon = '<img src="' . EVENT_ESPRESSO_PLUGINFULLURL . 'images/arrow_rotate_clockwise.png" alt="Recurring Event" title="Recurring Event" class="re_fr" />';
    }
    require_once 'queries.php';
    if (file_exists(EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/admin_reports_filters.php')) {
        require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/admin_reports_filters.php';
    } else {
        echo '<p><strong>' . __('Advanced filters are now available in the premium versions.', 'event_espresso') . '</strong> <a href="http://eventespresso.com/download/" target="_blank">' . __('Upgrade Now!', 'event_espresso') . '</a></p>';
        //$total_events = espresso_total_events();
    }
    if ($month_range !== FALSE) {
        $pieces = explode('-', $month_range, 3);
        $year_r = $pieces[0];
        $month_r = $pieces[1];
    }
    $group = '';
    $sql = '';
    //Check if the venue manager is turned on
    $use_venue_manager = isset($org_options['use_venue_manager']) && $org_options['use_venue_manager'] == 'Y' ? TRUE : FALSE;
    $is_regional_manager = FALSE;
    //This checks to see if the user is a regional manager and creates a union to join the events that are in the users region based on the venue/locale combination
    if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_group_admin') {
        $is_regional_manager = TRUE;
        $group = get_user_meta(espresso_member_data('id'), "espresso_group", TRUE);
        if ($group != '0' && !empty($group)) {
            $sql = "(SELECT e.id event_id, e.event_name, e.event_identifier, e.reg_limit, e.registration_start, ";
            $sql .= " e.start_date, e.is_active, e.recurrence_id, e.registration_startT, e.wp_user ";
            //Get the venue information
            if ($use_venue_manager) {
                $sql .= ", v.name AS venue_title, v.address AS venue_address, v.address2 AS venue_address2, v.city AS venue_city, v.state AS venue_state, v.zip AS venue_zip, v.country AS venue_country ";
            } else {
                $sql .= ", e.venue_title, e.phone, e.address, e.address2, e.city, e.state, e.zip, e.country ";
            }
            //Get the locale fields
            if ($use_venue_manager) {
                $sql .= ", lc.name AS locale_name, e.wp_user ";
            }
            $sql .= " FROM " . EVENTS_DETAIL_TABLE . " e ";
            //Join the categories
            if ($today_filter) {
                $sql .= " JOIN " . EVENTS_CATEGORY_REL_TABLE . " cr ON cr.event_id = e.id ";
                $sql .= " JOIN " . EVENTS_CATEGORY_TABLE . " c ON  c.id = cr.cat_id ";
            }
            //Join the venues and locales
            if (!empty($group) && $use_venue_manager) {
                $sql .= " LEFT JOIN " . EVENTS_VENUE_REL_TABLE . " vr ON vr.event_id = e.id ";
                $sql .= " LEFT JOIN " . EVENTS_VENUE_TABLE . " v ON v.id = vr.venue_id ";
                $sql .= " LEFT JOIN " . EVENTS_LOCALE_REL_TABLE . " l ON  l.venue_id = vr.venue_id ";
                $sql .= " LEFT JOIN " . EVENTS_LOCALE_TABLE . " lc ON lc.id = l.locale_id ";
            }
            //Event status filter
            $sql .= $event_status !== FALSE && $event_status != 'IA' ? " WHERE e.event_status = '" . $event_status . "' " : " WHERE e.event_status != 'D' ";
            //Category filter
            $sql .= $category_id !== FALSE ? " AND c.id = '" . $category_id . "' " : '';
            //Find events in the locale
            $sql .= !empty($group) && $use_venue_manager == true ? " AND l.locale_id IN (" . implode(",", $group) . ") " : '';
            //Month filter
            if ($month_range !== FALSE) {
                $sql .= " AND e.start_date BETWEEN '" . date('Y-m-d', strtotime($year_r . '-' . $month_r . '-01')) . "' AND '" . date('Y-m-d', strtotime($year_r . '-' . $month_r . '-31')) . "' ";
            }
            //Todays events filter
            if ($today_filter) {
                $sql .= " AND e.start_date = '" . $curdate . "' ";
            }
            //This months events filter
            if ($this_month_filter) {
                $sql .= " AND e.start_date BETWEEN '" . date('Y-m-d', strtotime($this_year_r . '-' . $this_month_r . '-01')) . "' AND '" . date('Y-m-d', strtotime($this_year_r . '-' . $this_month_r . '-' . $days_this_month)) . "' ";
            }
            $sql .= ") UNION ";
        }
    }
    //This is the standard query to retrieve the events
    $sql .= "(SELECT e.id event_id, e.event_name, e.event_identifier, e.reg_limit, e.registration_start, ";
    $sql .= " e.start_date, e.is_active, e.recurrence_id, e.registration_startT, e.wp_user ";
    //Get the venue information
    if ($use_venue_manager) {
        //If using the venue manager, we need to get those fields
        $sql .= ", v.name AS venue_title, v.address AS venue_address, v.address2 AS venue_address2, v.city AS venue_city, v.state AS venue_state, v.zip AS venue_zip, v.country AS venue_country ";
    } else {
        //Otherwise we need to get the address fields from the individual events
        $sql .= ", e.venue_title, e.phone, e.address, e.address2, e.city, e.state, e.zip, e.country ";
    }
    //get the locale fields
    if ($is_regional_manager && $use_venue_manager) {
        $sql .= ", lc.name AS locale_name, e.wp_user ";
    }
    $sql .= " FROM " . EVENTS_DETAIL_TABLE . " e ";
    //Join the categories
    if ($category_id != FALSE) {
        $sql .= " JOIN " . EVENTS_CATEGORY_REL_TABLE . " cr ON cr.event_id = e.id ";
        $sql .= " JOIN " . EVENTS_CATEGORY_TABLE . " c ON  c.id = cr.cat_id ";
    }
    //Join the venues
    if ($use_venue_manager == true) {
        $sql .= " LEFT JOIN " . EVENTS_VENUE_REL_TABLE . " vr ON vr.event_id = e.id ";
        $sql .= " LEFT JOIN " . EVENTS_VENUE_TABLE . " v ON v.id = vr.venue_id ";
    }
    //Join the locales
    if (isset($is_regional_manager) && $is_regional_manager == true && $use_venue_manager == true) {
        $sql .= " LEFT JOIN " . EVENTS_LOCALE_REL_TABLE . " l ON  l.venue_id = vr.venue_id ";
        $sql .= " LEFT JOIN " . EVENTS_LOCALE_TABLE . " lc ON lc.id = l.locale_id ";
    }
    //Event status filter
    $sql .= isset($_POST['event_status']) && ($_POST['event_status'] != '' && $_POST['event_status'] != 'IA') ? " WHERE e.event_status = '" . $_POST['event_status'] . "' " : " WHERE e.event_status != 'D' ";
    //Category filter
    $sql .= $category_id !== FALSE ? " AND c.id = '" . $category_id . "' " : '';
    //Month filter
    if ($_POST['month_range'] != '') {
        $sql .= " AND e.start_date BETWEEN '" . date('Y-m-d', strtotime($year_r . '-' . $month_r . '-01')) . "' AND '" . date('Y-m-d', strtotime($year_r . '-' . $month_r . '-31')) . "' ";
    }
    //Todays events filter
    if (isset($_REQUEST['today']) && $_REQUEST['today'] == 'true') {
        $sql .= " AND e.start_date = '" . $curdate . "' ";
    }
    //This months events filter
    if (isset($_REQUEST['this_month']) && $_REQUEST['this_month'] == 'true') {
        $sql .= " AND e.start_date BETWEEN '" . date('Y-m-d', strtotime($this_year_r . '-' . $this_month_r . '-01')) . "' AND '" . date('Y-m-d', strtotime($this_year_r . '-' . $this_month_r . '-' . $days_this_month)) . "' ";
    }
    //If user is an event manager, then show only their events
    if (function_exists('espresso_member_data') && (espresso_member_data('role') == 'espresso_event_manager' || espresso_member_data('role') == 'espresso_group_admin')) {
        $sql .= " AND e.wp_user = '******'id') . "' ";
    }
    $sql .= ") ORDER BY start_date DESC ";
    $sql .= $records_to_show;
    $events = $wpdb->get_results($sql);
    $total_events = $wpdb->num_rows;
    ?>

	<form id="event-admin-list-page-select-frm" name="event_admin_list_page_select_frm" method="post" action="<?php 
    echo EVT_ADMIN_URL;
    ?>
">
		<div id="event-admin-list-page-select-dv" class="admin-list-page-select-dv">
			<input name="navig" value="<?php 
    _e('Retrieve', 'event_espresso');
    ?>
" type="submit" class="button-secondary">
			<?php 
    $rows = array(50 => 50, 100 => 100, 250 => 250, 500 => 500, 100000 => 'all');
    ?>
			<select name="max_rows" size="1">
				<?php 
    foreach ($rows as $key => $value) {
        ?>
				<?php 
        $selected = $key == $max_rows ? ' selected="selected"' : '';
        ?>
				<option value="<?php 
        echo $key;
        ?>
"<?php 
        echo $selected;
        ?>
><?php 
        echo $value;
        ?>
&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('max_rows' => $max_rows, 'start_rec' => $prev_rows), EVT_ADMIN_URL);
        ?>
			<a id="event-admin-load-prev-rows-btn" href="<?php 
        echo $prev_rows_url;
        ?>
" title="load prev rows" class="button-secondary">
				<?php 
        echo __('Previous', 'event_espresso') . ' ' . $max_rows . ' ' . __('rows', 'event_espresso');
        ?>
			</a>
			<?php 
    }
    ?>
			<?php 
    if ($total_events >= $max_rows && $max_rows < 100000) {
        $next_rows = $start_rec + $max_rows + 1;
        $next_rows_url = add_query_arg(array('max_rows' => $max_rows, 'start_rec' => $next_rows), EVT_ADMIN_URL);
        ?>
			<a id="event-admin-load-next-rows-btn" href="<?php 
        echo $next_rows_url;
        ?>
" title="load next rows" class="button-secondary">
			<?php 
        echo __('Next', 'event_espresso') . ' ' . $max_rows . ' ' . __('rows', 'event_espresso');
        ?>
			</a> 
			<?php 
    }
    ?>
		</div>
	</form>

	<form id="form1" name="form1" method="post" action="admin.php?page=events<?php 
    //echo $_SERVER["REQUEST_URI"]
    ?>
">
		<table id="table" class="widefat event-list" width="100%">
			<thead>
				<tr>
					<th class="manage-column column-cb check-column" id="cb" scope="col" style="width:28px;"><input type="checkbox"></th>

					<th class="manage-column column-comments num" id="id" style="padding-top:7px; width:3%;" scope="col" title="Click to Sort">
						<span><?php 
    _e('ID', 'event_espresso');
    ?>
</span>
						<span class="sorting-indicator"></span>
					</th>

					<th class="manage-column column-title" id="name" scope="col" title="Click to Sort" style="width:26%;">
						<span><?php 
    _e('Name', 'event_espresso');
    ?>
</span>
						<span class="sorting-indicator"></span>
					</th>

					<th class="manage-column column-title" id="name" scope="col" title="Click to Sort" style="width:12%;">
						<span><?php 
    _e('Venue', 'event_espresso');
    ?>
</span>
						<span class="sorting-indicator"></span>
					</th>

					<th class="manage-column column-author" id="start" scope="col" title="Click to Sort" style="width:12%;">
						<span><?php 
    _e('Start Date', 'event_espresso');
    ?>
</span>
						<span class="sorting-indicator"></span>
					</th>

					<th class="manage-column column-author" id="start" scope="col" title="Click to Sort" style="width:10%;">
						<span><?php 
    _e('Start Time', 'event_espresso');
    ?>
</span>
						<span class="sorting-indicator"></span>
					</th>

					<th class="manage-column column-date" id="dow" scope="col" title="Click to Sort" style="width:6%;";>
							<span><?php 
    _e('DoW', 'event_espresso');
    ?>
</span>
						<span class="sorting-indicator"></span>
					</th>

					<th class="manage-column column-date" id="begins" scope="col" title="Click to Sort" style="width:12%;">
						<span><?php 
    _e('Reg Begins', 'event_espresso');
    ?>
</span>
						<span class="sorting-indicator"></span>
					</th>

					<th class="manage-column column-date" id="status" scope="col" title="Click to Sort" style="width:10%;">
						<span><?php 
    _e('Status', 'event_espresso');
    ?>
</span>
						<span class="sorting-indicator"></span>
					</th>
					<?php 
    if (function_exists('espresso_is_admin') && espresso_is_admin() == true && $espresso_premium == true) {
        ?>
						<th class="manage-column column-date" id="status" scope="col" title="Click to Sort" style="width:10%;">
							<span><?php 
        _e('Creator', 'event_espresso');
        ?>
</span>
							<span class="sorting-indicator"></span>
						</th>
					<?php 
    }
    ?>
					<th class="manage-column column-date" id="attendees" scope="col" title="Click to Sort" style="width:9%;">
						<span><?php 
    _e('Attendees', 'event_espresso');
    ?>
</span>
						<span class="sorting-indicator"></span>
					</th>
					<th class="manage-column column-author" id="actions" scope="col" style="width:25%;">
						<?php 
    _e('Actions', 'event_espresso');
    ?>
					</th>

				</tr>
			</thead>

			<tbody>
				<?php 
    if ($total_events > 0) {
        foreach ($events as $event) {
            //print_r ($event);
            $event_id = $event->event_id;
            $event_name = stripslashes_deep($event->event_name);
            $event_identifier = stripslashes_deep($event->event_identifier);
            $reg_limit = isset($event->reg_limit) ? $event->reg_limit : '';
            $registration_start = isset($event->registration_start) ? $event->registration_start : '';
            $start_date = isset($event->start_date) ? $event->start_date : '';
            $end_date = isset($event->end_date) ? $event->end_date : '';
            $is_active = isset($event->is_active) ? $event->is_active : '';
            $status = array();
            $status = event_espresso_get_is_active($event_id);
            $recurrence_id = isset($event->recurrence_id) ? $event->recurrence_id : '';
            $registration_startT = isset($event->registration_startT) ? $event->registration_startT : '';
            $event_address = isset($event->address) ? $event->address : '';
            $event_address2 = isset($event->address2) ? $event->address2 : '';
            $event_city = isset($event->city) ? $event->city : '';
            $event_state = isset($event->state) ? $event->state : '';
            $event_zip = isset($event->zip) ? $event->zip : '';
            $event_country = isset($event->country) ? $event->country : '';
            //added new
            $venue_title = isset($event->venue_title) ? $event->venue_title : '';
            $venue_locale = isset($event->locale_name) ? $event->locale_name : '';
            $wp_user = isset($event->wp_user) ? $event->wp_user : '';
            $location = (!empty($event_address) ? $event_address : '') . (!empty($event_address2) ? '<br />' . $event_address2 : '') . (!empty($event_city) ? '<br />' . $event_city : '') . (!empty($event_state) ? ', ' . $event_state : '') . (!empty($event_zip) ? '<br />' . $event_zip : '') . (!empty($event_country) ? '<br />' . $event_country : '');
            $dow = date("D", strtotime($start_date));
            ob_start();
            ?>
						<tr>
							<td class="check-column" style="padding:7px 0 22px 7px; vertical-align:top;"><!--Delete Events-->
								<?php 
            echo '<input name="checkbox[' . $event_id . ']" type="checkbox"  title="Delete Event ' . $event_name . '" />';
            ?>
</td>

							<td class="column-comments" style="padding-top:3px;"><?php 
            echo $event_id;
            ?>
</td>

							<td class="post-title page-title"><strong><a class="row-title" href="admin.php?page=events&action=edit&event_id=<?php 
            echo $event_id;
            ?>
"><?php 
            echo $event_name;
            ?>
</a> <?php 
            echo $recurrence_id > 0 ? $recurrence_icon : '';
            ?>
 </strong>
								<div class="row-actions"><span><a href="<?php 
            echo espresso_reg_url($event_id);
            ?>
" target="_blank"><?php 
            _e('View', 'event_espresso');
            ?>
</a> | </span><span class='edit'><a href="admin.php?page=events&amp;action=edit&amp;event_id=<?php 
            echo $event_id;
            ?>
"><?php 
            _e('Edit', 'event_espresso');
            ?>
</a> | </span><span class='delete'><a onclick="return confirmDelete();" href='admin.php?page=events&amp;action=delete&amp;event_id=<?php 
            echo $event_id;
            ?>
'><?php 
            _e('Delete', 'event_espresso');
            ?>
</a></span> | <span><a href="admin.php?page=events&amp;event_admin_reports=list_attendee_payments&amp;event_id=<?php 
            echo $event_id;
            ?>
"><?php 
            _e('Attendees', 'event_espresso');
            ?>
</a> | </span><span><a href="#" onclick="window.location='<?php 
            echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&amp;event_id=" . $event_id . "&amp;export=report&action=payment&amp;type=excel";
            ?>
'" title="<?php 
            _e('Export to Excel', 'event_espresso');
            ?>
"><?php 
            _e('Export', 'event_espresso');
            ?>
</a></span></div></td>

							<td class="author"><?php 
            echo $venue_title != '' ? $venue_title : '';
            echo $venue_locale != '' ? '<br />[' . $venue_locale . ']' : '';
            ?>
</td>

							<td class="author"><?php 
            echo event_date_display($start_date, get_option('date_format'));
            ?>
</td>

							<td class="author"><?php 
            echo event_espresso_get_time($event_id, 'start_time');
            ?>
</td>

							<td class="date"><?php 
            echo $dow;
            ?>
</td>

							<td class="date"><?php 
            echo event_date_display($registration_start, get_option('date_format'));
            ?>
 <br />
								<?php 
            echo $registration_startT;
            ?>
</td>

							<td class="date"><?php 
            echo $status['display'];
            ?>
</td>

							<?php 
            if (function_exists('espresso_is_admin') && espresso_is_admin() == true && $espresso_premium == true) {
                $user_company = espresso_user_meta($wp_user, 'company') != '' ? espresso_user_meta($wp_user, 'company') : '';
                $user_organization = espresso_user_meta($wp_user, 'organization') != '' ? espresso_user_meta($wp_user, 'organization') : '';
                $user_co_org = $user_company != '' ? $user_company : $user_organization;
                ?>
								<td class="date"><?php 
                echo espresso_user_meta($wp_user, 'user_firstname') != '' ? espresso_user_meta($wp_user, 'user_firstname') . ' ' . espresso_user_meta($wp_user, 'user_lastname') . ' (<a href="user-edit.php?user_id=' . $wp_user . '">' . espresso_user_meta($wp_user, 'user_nicename') . '</a>)' : espresso_user_meta($wp_user, 'display_name') . ' (<a href="user-edit.php?user_id=' . $wp_user . '">' . espresso_user_meta($wp_user, 'user_nicename') . '</a>)';
                ?>
									<?php 
                echo $user_co_org != '' ? '<br />[' . espresso_user_meta($wp_user, 'company') . ']' : '';
                ?>
								</td>
							<?php 
            }
            ?>

							<td class="author"><a href="admin.php?page=events&amp;event_admin_reports=list_attendee_payments&amp;event_id=<?php 
            echo $event_id;
            ?>
"><?php 
            echo get_number_of_attendees_reg_limit($event_id, 'num_attendees_slash_reg_limit');
            ?>
</a></td>
							<td class="date"><div style="width:180px;"><a href="<?php 
            echo espresso_reg_url($event_id);
            ?>
" title="<?php 
            _e('View Event', 'event_espresso');
            ?>
" target="_blank"><div class="view_btn"></div></a>

									<a href="admin.php?page=events&amp;action=edit&amp;event_id=<?php 
            echo $event_id;
            ?>
" title="<?php 
            _e('Edit Event', 'event_espresso');
            ?>
"><div class="edit_btn"></div></a>

									<a href="admin.php?page=events&amp;event_id=<?php 
            echo $event_id;
            ?>
&amp;event_admin_reports=list_attendee_payments" title="<?php 
            _e('View Attendees', 'event_espresso');
            ?>
"><div class="complete_btn"></div></a>
									<a href="admin.php?page=events&event_admin_reports=charts&event_id=<?php 
            echo $event_id;
            ?>
" title="<?php 
            _e('View Report', 'event_espresso');
            ?>
"><div class="reports_btn"></div></a>


									<a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=unique_id_info_<?php 
            echo $event_id;
            ?>
" title="<?php 
            _e('Get Short URL/Shortcode', 'event_espresso');
            ?>
"><div class="shortcode_btn"></div></a>

									<a href="#" onclick="window.location='<?php 
            echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&amp;event_id=" . $event_id . "&amp;export=report&action=payment&amp;type=excel";
            ?>
'" title="<?php 
            _e('Export to Excel', 'event_espresso');
            ?>
"><div class="excel_exp_btn"></div></a>

									<a href="#" onclick="window.location='<?php 
            echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&event_id=" . $event_id . "&export=report&action=payment&type=csv";
            ?>
'" title="<?php 
            _e('Export to CSV', 'event_espresso');
            ?>
"><div class="csv_exp_btn"></div></a>

									<a href="admin.php?page=events&amp;event_admin_reports=event_newsletter&amp;event_id=<?php 
            echo $event_id;
            ?>
" title="<?php 
            _e('Email Attendees', 'event_espresso');
            ?>
"><div class="newsletter_btn"></div></a></div>

								<div id="unique_id_info_<?php 
            echo $event_id;
            ?>
" style="display:none">
									<?php 
            _e('<h2>Short URL/Shortcode</h2><p>This is the short URL to this event:</p><p><span  class="updated fade">' . espresso_reg_url($event_id) . '</span></p><p>This will show the registration form for this event just about anywhere. Copy and paste the following shortcode into any page or post.</p><p><span  class="updated fade">[SINGLEEVENT single_event_id="' . $event_identifier . '"]</span></p> <p class="red_text"> Do not use in place of the main events page that is set in the Organization Settings page.', 'event_espresso');
            ?>
								</div></td>
						</tr>
						<?php 
            //echo $_REQUEST['event_status'];
            if (!empty($_REQUEST['event_status'])) {
                $content = ob_get_contents();
                ob_end_clean();
                switch ($_REQUEST['event_status']) {
                    case 'A':
                        switch (event_espresso_get_status($event_id, empty($event_meta) ? '' : $event_meta)) {
                            case 'NOT_ACTIVE':
                                //Don't show the event if any of the above are true
                                break;
                            default:
                                echo $content;
                                break;
                        }
                        break;
                    case 'IA':
                        switch (event_espresso_get_status($event_id)) {
                            case 'NOT_ACTIVE':
                                echo $content;
                                break;
                            default:
                                //Don't show the event if any of the above are true
                                break;
                        }
                        break;
                    default:
                        echo $content;
                        break;
                }
            }
        }
        //End foreach ($events as $event){
    }
    ?>

			</tbody>
		</table>
		<div style="clear:both; margin-bottom:30px;">
			<input type="checkbox" name="sAll" onclick="selectAll(this)" />
			<strong>
				<?php 
    _e('Check All', 'event_espresso');
    ?>
			</strong><?php 
    if (isset($_POST['event_status']) && $_POST['event_status'] == 'D') {
        ?>
				<input name="perm_delete_event" type="submit" class="button-secondary" id="perm_delete_event" value="<?php 
        _e('Permanently Delete Events(s)', 'event_espresso');
        ?>
" style="margin:10px 0 0 10px;" onclick="return confirmDelete();" />
			<?php 
    } else {
        ?>
				<input name="delete_event" type="submit" class="button-secondary" id="delete_event" value="<?php 
        _e('Delete Events(s)', 'event_espresso');
        ?>
" style="margin:10px 0 0 10px;" onclick="return confirmDelete();" />

				<a  style="margin-left:5px"class="button-secondary" href="admin.php?page=events&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 style="margin-left:5px" class="button-secondary" href="#" onclick="window.location='<?php 
        echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&amp;id=" . $event_id . "&amp;export=report&action=payment&amp;type=excel&all_events=true";
        ?>
'" title="<?php 
        _e('Export to Excel', 'event_espresso');
        ?>
"><?php 
        _e('Export All Attendee Data', 'event_espresso');
        ?>
</a>
				<a class="button-secondary" href="#" onclick="window.location='<?php 
        echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&amp;id=" . $event_id . "&amp;export=report&action=event&amp;type=excel&all_events=true";
        ?>
'" title="<?php 
        _e('Export to Excel', 'event_espresso');
        ?>
"><?php 
        _e('Export All Event Data', 'event_espresso');
        ?>
</a>
				<a style="margin-left:5px" class="button-primary" href="admin.php?page=events&amp;action=add_new_event"><?php 
        _e('Add New Event', 'event_espresso');
        ?>
</a>
			<?php 
    }
    ?>
  </div>
	</form>
	<h4 style="clear:both"><?php 
    _e('Legend', 'event_espresso');
    ?>
</h4>
	<dl style="float:left; margin-left:10px; width:200px">
		<?php 
    echo defined('EVENT_ESPRESSO_RECURRENCE_MODULE_ACTIVE') ? '<dt><img src="' . EVENT_ESPRESSO_PLUGINFULLURL . 'images/arrow_rotate_clockwise.png" alt="Recurring Event" title="Recurring Event"  /> - ' . __('Recurring Event', 'event_espresso') . '</dt>' : '';
    ?>
		<dt><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
images/icons/magnifier.png" width="16" height="16" alt="<?php 
    _e('View Event', 'event_espresso');
    ?>
" /> - <?php 
    _e('View Event', 'event_espresso');
    ?>
</dt>

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

		<dt><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
images/icons/group.png" width="16" height="16" alt="<?php 
    _e('Event Attendees', 'event_espresso');
    ?>
" /> - <?php 
    _e('Event Attendees', 'event_espresso');
    ?>
</dt>
		<dt><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
images/icons/chart_bar.png" width="16" height="16" alt="<?php 
    _e('Send Event Email', 'event_espresso');
    ?>
" /> - <?php 
    _e('View Report', 'event_espresso');
    ?>
</dt>


	</dl>

	<dl style="float:left; margin-left:10px;">
		<dt><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
images/icons/tag.png" width="16" height="16" alt="<?php 
    _e('Short Code', 'event_espresso');
    ?>
" /> - <?php 
    _e('Short Code', 'event_espresso');
    ?>
</dt>
		<dt><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
images/icons/excel_icon.png" width="16" height="16" alt="<?php 
    _e('Excel Spreadsheet', 'event_espresso');
    ?>
" /> - <?php 
    _e('Excel Export', 'event_espresso');
    ?>
</dt>

		<dt><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
images/icons/csv_icon_sm.gif" width="16" height="16" alt="<?php 
    _e('CSV Spreadsheet', 'event_espresso');
    ?>
" /> - <?php 
    _e('CSV Export', 'event_espresso');
    ?>
</dt>

		<dt><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
images/icons/email_go.png" width="16" height="16" alt="<?php 
    _e('View Report', 'event_espresso');
    ?>
" /> - <?php 
    _e('Event Newsletter', 'event_espresso');
    ?>
</dt>
	</dl>

	<script>
		jQuery(document).ready(function($) {
			/* show the table data */
			var mytable = $('#table').dataTable( {
				"sDom": 'Clfrtip',
				"aoColumns": [
					{ "bSortable": false },
					null,
					null,
					null,
					null,
					null,
					null,
					null,
					null,
	<?php 
    echo function_exists('espresso_is_admin') && espresso_is_admin() == true ? 'null,' : '';
    ?>
					null,
					{ "bSortable": false }
				],
				"aoColumnDefs": [
					{ "bVisible": false, "aTargets": [ <?php 
    echo $org_options['use_venue_manager'] == 'Y' ? '' : '3,';
    ?>
 6 ] }
				],
				"oColVis": {
					"aiExclude": [ 0, 1, 2 ],
					"buttonText": "Filter: Show / Hide Columns",
					"bRestore": true
				},
				"bAutoWidth": false,
				"bStateSave": true,
				"sPaginationType": "full_numbers",
				"oLanguage": {	"sSearch": "<strong><?php 
    _e('Live Search Filter', 'event_espresso');
    ?>
:</strong>",
					"sZeroRecords": "<?php 
    _e('No Records Found!', 'event_espresso');
    ?>
" }

			});
		});
	</script>

	<div id="coupon_code_info" style="display:none">
		<h2><?php 
    _e('Coupon/Promo Code', 'event_espresso');
    ?>
</h2><p><?php 
    _e('This is used to apply discounts to events.', 'event_espresso');
    ?>
</p><p><?php 
    _e('A coupon or promo code could can be anything you want. For example: Say you have an event that costs', 'event_espresso');
    ?>
 <?php 
    echo $org_options['currency_symbol'];
    ?>
200. <?php 
    _e('If you supplied a promo like "PROMO50" and entered 50.00 into the "Discount w/Promo Code" field your event will be discounted', 'event_espresso');
    ?>
  <?php 
    echo $org_options['currency_symbol'];
    ?>
50.00, <?php 
    _e('Bringing the cost of the event to', 'event_espresso');
    ?>
 <?php 
    echo $org_options['currency_symbol'];
    ?>
150.</p>
	</div>
	<div id="unique_id_info" style="display:none">
		<h2><?php 
    _e('Event Identifier', 'event_espresso');
    ?>
</h2><p><?php 
    _e('This should be a unique identifier for the event. Example: "Event1" (without qoutes.)</p><p>The unique ID can also be used in individual pages using the', 'event_espresso');
    ?>
 [SINGLEEVENT single_event_id="<?php 
    _e('Unique Event ID', 'event_espresso');
    ?>
"] <?php 
    _e('shortcode', 'event_espresso');
    ?>
.</p>
	</div>
	<?php 
    echo event_espresso_custom_email_info();
}
function event_espresso_edit_list()
{
    global $wpdb, $org_options;
    require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/event-management/queries.php';
    if (!defined('EVT_ADMIN_URL')) {
        define('EVT_ADMIN_URL', admin_url('admin.php?page=events'));
    }
    // DELETE EVENT
    if (isset($_POST['delete_event'])) {
        if (is_array($_POST['checkbox'])) {
            while (list($key, $value) = each($_POST['checkbox'])) {
                $del_id = $key;
                event_espresso_delete_event($del_id);
            }
        }
        ?>
		<div id="message" class="updated fade">
			<p><strong>
					<?php 
        _e('Event(s) have been permanently deleted.', 'event_espresso');
        ?>
				</strong></p>
		</div>
		<?php 
    }
    // REALLY REALLY DELETE EVENT THIS TIME !!!
    if (isset($_POST['perm_delete_event'])) {
        if (is_array($_POST['checkbox'])) {
            while (list($key, $value) = each($_POST['checkbox'])) {
                $del_id = $key;
                event_espresso_empty_event_trash($del_id);
            }
        }
        ?>
		<div id="message" class="updated fade">
			<p><strong>
					<?php 
        _e('Event(s) have been permanently deleted.', 'event_espresso');
        ?>
				</strong></p>
		</div>
		<?php 
    }
    // dejavu ?
    $recurrence_icon = '';
    if (defined('EVENT_ESPRESSO_RECURRENCE_MODULE_ACTIVE')) {
        $recurrence_icon = '<img src="' . EVENT_ESPRESSO_PLUGINFULLURL . 'images/arrow_rotate_clockwise.png" alt="Recurring Event" title="Recurring Event" class="re_fr" />';
    }
    // get SQL for query
    $SQL = espresso_generate_events_page_list_table_sql();
    $events = $wpdb->get_results($SQL, OBJECT_K);
    $total_events = $wpdb->num_rows;
    //echo '<h4>' . $wpdb->last_query . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
    //printr( $events, '$events  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
    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';
        espresso_display_admin_reports_filters($total_events);
    } else {
        ?>
		<p>
			<strong><?php 
        _e('Advanced filters are available in the premium versions.', 'event_espresso');
        ?>
</strong> 
			<a href="http://eventespresso.com/pricing/?utm_source=ee_plugin_admin&utm_medium=link&utm_content=Advanced+filters+are+available+in+the+premium+versions<?php 
        echo '+ee_version_' . EVENT_ESPRESSO_VERSION;
        ?>
&utm_campaign=event_overview_tab" target="_blank">
				<?php 
        _e('Upgrade Now!', 'event_espresso');
        ?>
			</a>
		</p>
		<?php 
    }
    ?>
	<form id="form1" name="form1" method="post" action="admin.php?page=events<?php 
    //echo $_SERVER["REQUEST_URI"]
    ?>
">
		<table id="table" class="widefat event-list" width="100%">
			<thead>
				<tr>
					<th class="manage-column column-cb check-column" id="cb" scope="col" style="width:28px;"><input type="checkbox"></th>

					<th class="manage-column column-comments num" id="id" style="padding-top:7px; width:3%;" scope="col" title="Click to Sort">
						<span><?php 
    _e('ID', 'event_espresso');
    ?>
</span>
						<span class="sorting-indicator"></span>
					</th>

					<th class="manage-column column-title" id="name" scope="col" title="Click to Sort" style="width:26%;">
						<span><?php 
    _e('Name', 'event_espresso');
    ?>
</span>
						<span class="sorting-indicator"></span>
					</th>

					<th class="manage-column column-title" id="name" scope="col" title="Click to Sort" style="width:12%;">
						<span><?php 
    _e('Venue', 'event_espresso');
    ?>
</span>
						<span class="sorting-indicator"></span>
					</th>

					<th class="manage-column column-date" id="dow" scope="col" title="Click to Sort" style="width:4%;";>
						<span><?php 
    _e('DoW', 'event_espresso');
    ?>
</span>
						<span class="sorting-indicator"></span>
					</th>

					<th class="manage-column column-author" id="start" scope="col" title="Click to Sort" style="width:12%;">
						<span><?php 
    _e('Start Date', 'event_espresso');
    ?>
</span>
						<span class="sorting-indicator"></span>
					</th>

					<th class="manage-column column-author" id="start" scope="col" title="Click to Sort" style="width:7%;">
						<span><?php 
    _e('Start Time', 'event_espresso');
    ?>
</span>
						<span class="sorting-indicator"></span>
					</th>

					<th class="manage-column column-date" id="begins" scope="col" title="Click to Sort" style="width:16%;">
						<span><?php 
    _e('Reg Begins', 'event_espresso');
    ?>
</span>
						<span class="sorting-indicator"></span>
					</th>

					<th class="manage-column column-date" id="status" scope="col" title="Click to Sort" style="width:8%;">
						<span><?php 
    _e('Status', 'event_espresso');
    ?>
</span>
						<span class="sorting-indicator"></span>
					</th>
					<?php 
    if (function_exists('espresso_is_admin') && espresso_is_admin() == true && $espresso_premium == true) {
        ?>
						<th class="manage-column column-date" id="status" scope="col" title="Click to Sort" style="width:10%;">
							<span><?php 
        _e('Creator', 'event_espresso');
        ?>
</span>
							<span class="sorting-indicator"></span>
						</th>
	<?php 
    }
    ?>
					<th class="manage-column column-date" id="attendees" scope="col" title="Click to Sort" style="width:7%;">
						<span><?php 
    _e('Attendees', 'event_espresso');
    ?>
</span>
						<span class="sorting-indicator"></span>
					</th>
					<th class="manage-column column-author" id="actions" scope="col" style="width:25%;">
	<?php 
    _e('Actions', 'event_espresso');
    ?>
					</th>

				</tr>
			</thead>

			<tbody>
				<?php 
    if ($total_events > 0) {
        // instead of doing queries for each event while looping through them, we're going to grab a list of event IDs and consolidate our queries outside the loop
        $event_ids = implode(',', array_keys($events));
        // first let's grab attendee counts in one BIG query instead of individual queries for each event
        $SQL = "SELECT event_id, SUM(quantity) AS quantity FROM " . EVENTS_ATTENDEE_TABLE . " ";
        $SQL .= "WHERE (payment_status='Completed' OR payment_status='Pending' OR payment_status='Refund') ";
        $SQL .= "GROUP BY event_id HAVING event_id IN ( {$event_ids} )";
        $attendees = $wpdb->get_results($SQL, OBJECT_K);
        //					echo '<h4>' . $wpdb->last_query . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
        //					printr( $attendees, '$attendees  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
        // now let's grab start times for each event
        $SQL = "SELECT event_id, start_time FROM " . EVENTS_START_END_TABLE . " ";
        $SQL .= "WHERE event_id IN ( {$event_ids} ) ";
        $SQL .= 'ORDER BY start_time ASC';
        $start_times = $wpdb->get_results($SQL, OBJECT_K);
        //					echo '<h4>' . $wpdb->last_query . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
        //					printr( $start_times, '$start_times  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
        foreach ($events as $event) {
            //printr( $event, '$event  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
            $event_id = $event->event_id;
            $event_name = stripslashes_deep($event->event_name);
            $event_identifier = stripslashes_deep($event->event_identifier);
            $reg_limit = isset($event->reg_limit) ? $event->reg_limit : '';
            $start_date = isset($event->start_date) ? $event->start_date : '';
            $start_time = isset($start_times[$event_id]) ? $start_times[$event_id]->start_time : '';
            $end_date = isset($event->end_date) ? $event->end_date : '';
            $is_active = isset($event->is_active) ? $event->is_active : '';
            $status = array();
            $recurrence_id = isset($event->recurrence_id) ? $event->recurrence_id : '';
            $registration_start = isset($event->registration_start) ? $event->registration_start : '';
            $registration_startT = isset($event->registration_startT) ? $event->registration_startT : '';
            $event_address = isset($event->address) ? $event->address : '';
            $event_address2 = isset($event->address2) ? $event->address2 : '';
            $event_city = isset($event->city) ? $event->city : '';
            $event_state = isset($event->state) ? $event->state : '';
            $event_zip = isset($event->zip) ? $event->zip : '';
            $event_country = isset($event->country) ? $event->country : '';
            //added new
            $venue_title = isset($event->venue_title) ? stripslashes_deep($event->venue_title) : '';
            $venue_locale = isset($event->locale_name) ? $event->locale_name : '';
            $wp_user = isset($event->wp_user) ? $event->wp_user : '';
            $event_meta = array();
            $event_meta['is_active'] = $is_active;
            $event_meta['event_status'] = $event->event_status;
            $event_meta['start_time'] = $start_time;
            $event_meta['start_date'] = $start_date;
            $event_meta['registration_start'] = $registration_start;
            $event_meta['registration_startT'] = $registration_startT;
            $registration_end = $event_meta['registration_end'] = $event->registration_end;
            $registration_endT = $event_meta['registration_endT'] = $event->registration_endT;
            $status = event_espresso_get_is_active($event_id, $event_meta);
            //Get number of attendees
            $num_attendees = isset($attendees[$event_id]) ? $attendees[$event_id]->quantity : 0;
            $location = (!empty($event_address) ? $event_address : '') . (!empty($event_address2) ? '<br />' . $event_address2 : '') . (!empty($event_city) ? '<br />' . $event_city : '') . (!empty($event_state) ? ', ' . $event_state : '') . (!empty($event_zip) ? '<br />' . $event_zip : '') . (!empty($event_country) ? '<br />' . $event_country : '');
            $dow = date("D", strtotime($start_date));
            ob_start();
            ?>
						<tr>
							<td class="check-column" style="padding:7px 0 22px 7px; vertical-align:top;"><!--Delete Events-->
			<?php 
            echo '<input name="checkbox[' . $event_id . ']" type="checkbox"  title="Delete Event ' . $event_name . '" />';
            ?>
</td>

							<td class="column-comments" style="padding-top:3px;"><?php 
            echo $event_id;
            ?>
</td>

							<td class="post-title page-title">
								<strong><a class="row-title" href="admin.php?page=events&action=edit&event_id=<?php 
            echo $event_id;
            ?>
"><?php 
            echo $event_name;
            ?>
</a> <?php 
            echo $recurrence_id > 0 ? $recurrence_icon : '';
            ?>
 </strong>
								<div class="row-actions"><span><a href="<?php 
            echo espresso_reg_url($event_id);
            ?>
" target="_blank"><?php 
            _e('View', 'event_espresso');
            ?>
</a> | </span><span class='edit'><a href="admin.php?page=events&amp;action=edit&amp;event_id=<?php 
            echo $event_id;
            ?>
"><?php 
            _e('Edit', 'event_espresso');
            ?>
</a> | </span><span class='delete'><a onclick="return confirmDelete();" href='admin.php?page=events&amp;action=delete&amp;event_id=<?php 
            echo $event_id;
            ?>
'><?php 
            _e('Delete', 'event_espresso');
            ?>
</a></span> | <span><a href="admin.php?page=events&amp;event_admin_reports=list_attendee_payments&amp;event_id=<?php 
            echo $event_id;
            ?>
"><?php 
            _e('Attendees', 'event_espresso');
            ?>
</a> | </span><span><a href="#" onclick="window.location='<?php 
            echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&amp;event_id=" . $event_id . "&amp;export=report&action=payment&amp;type=excel";
            ?>
'" title="<?php 
            _e('Export to Excel', 'event_espresso');
            ?>
"><?php 
            _e('Export', 'event_espresso');
            ?>
</a></span></div>
							</td>

							<td class="author">
								<?php 
            echo $venue_title != '' ? $venue_title : '';
            echo $venue_locale != '' ? '<br />[' . $venue_locale . ']' : '';
            ?>
						
							</td>

							<td class="date"><?php 
            echo $dow;
            ?>
</td>

							<td class="author"><?php 
            echo event_date_display($start_date, get_option('date_format'));
            ?>
</td>

							<td class="author"><?php 
            echo date(get_option('time_format'), strtotime($start_time));
            ?>
</td>

							<td class="date"><?php 
            echo event_date_display($registration_start, get_option('date_format'));
            ?>
 @ <?php 
            echo date(get_option('time_format'), strtotime($registration_startT));
            ?>
</td>

							<td class="date"><?php 
            echo $status['display'];
            ?>
</td>

							<?php 
            if (function_exists('espresso_is_admin') && espresso_is_admin() == true && $espresso_premium == true) {
                $user_company = espresso_user_meta($wp_user, 'company') != '' ? espresso_user_meta($wp_user, 'company') : '';
                $user_organization = espresso_user_meta($wp_user, 'organization') != '' ? espresso_user_meta($wp_user, 'organization') : '';
                $user_co_org = $user_company != '' ? $user_company : $user_organization;
                ?>
								<td class="date"><?php 
                echo espresso_user_meta($wp_user, 'user_firstname') != '' ? espresso_user_meta($wp_user, 'user_firstname') . ' ' . espresso_user_meta($wp_user, 'user_lastname') . ' (<a href="user-edit.php?user_id=' . $wp_user . '">' . espresso_user_meta($wp_user, 'user_nicename') . '</a>)' : espresso_user_meta($wp_user, 'display_name') . ' (<a href="user-edit.php?user_id=' . $wp_user . '">' . espresso_user_meta($wp_user, 'user_nicename') . '</a>)';
                ?>
				<?php 
                echo $user_co_org != '' ? '<br />[' . espresso_user_meta($wp_user, 'company') . ']' : '';
                ?>
								</td>
			<?php 
            }
            ?>

							<td class="author">
								<?php 
            $attendees_url = add_query_arg(array('event_admin_reports' => 'list_attendee_payments', 'event_id' => $event_id, 'event_status' => $event->event_status), EVT_ADMIN_URL);
            ?>
								<a href="<?php 
            echo $attendees_url;
            ?>
"><?php 
            echo $num_attendees . '/' . $reg_limit;
            ?>
</a>
							</td>
							
							<td class="date">
								<div style="width:180px;">
								
									<a href="<?php 
            echo espresso_reg_url($event_id);
            ?>
" title="<?php 
            _e('View Event', 'event_espresso');
            ?>
" target="_blank">
										<div class="view_btn"></div>
									</a>

									<a href="admin.php?page=events&amp;action=edit&amp;event_id=<?php 
            echo $event_id;
            ?>
" title="<?php 
            _e('Edit Event', 'event_espresso');
            ?>
">
										<div class="edit_btn"></div>
									</a>

									<a href="admin.php?page=events&amp;event_id=<?php 
            echo $event_id;
            ?>
&amp;event_admin_reports=list_attendee_payments" title="<?php 
            _e('View Attendees', 'event_espresso');
            ?>
">
										<div class="complete_btn"></div>
									</a>
									
									<a href="admin.php?page=events&event_admin_reports=charts&event_id=<?php 
            echo $event_id;
            ?>
" title="<?php 
            _e('View Report', 'event_espresso');
            ?>
">
										<div class="reports_btn"></div>
									</a>


									<a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=unique_id_info_<?php 
            echo $event_id;
            ?>
" title="<?php 
            _e('Get Short URL/Shortcode', 'event_espresso');
            ?>
">
										<div class="shortcode_btn"></div>
									</a>

									<a href="#" onclick="window.location='<?php 
            echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&amp;event_id=" . $event_id . "&amp;export=report&action=payment&amp;type=excel";
            ?>
'" title="<?php 
            _e('Export to Excel', 'event_espresso');
            ?>
">
										<div class="excel_exp_btn"></div>
									</a>

									<a href="#" onclick="window.location='<?php 
            echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&event_id=" . $event_id . "&export=report&action=payment&type=csv";
            ?>
'" title="<?php 
            _e('Export to CSV', 'event_espresso');
            ?>
">
										<div class="csv_exp_btn"></div>
									</a>

									<a href="admin.php?page=events&amp;event_admin_reports=event_newsletter&amp;event_id=<?php 
            echo $event_id;
            ?>
" title="<?php 
            _e('Email Attendees', 'event_espresso');
            ?>
">
										<div class="newsletter_btn"></div>
									</a>
									
								</div>

								<div id="unique_id_info_<?php 
            echo $event_id;
            ?>
" style="display:none">
						<?php 
            _e('<h2>Short URL/Shortcode</h2><p>This is the short URL to this event:</p><p><span  class="updated fade">' . espresso_reg_url($event_id) . '</span></p><p>This will show the registration form for this event just about anywhere. Copy and paste the following shortcode into any page or post.</p><p><span  class="updated fade">[SINGLEEVENT single_event_id="' . $event_identifier . '"]</span></p> <p class="red_text"> Do not use in place of the main events page that is set in the Organization Settings page.', 'event_espresso');
            ?>
								</div>
								
							</td>
						</tr>
						<?php 
            $content = ob_get_contents();
            ob_end_clean();
            echo $content;
        }
        //End foreach ($events as $event){
    }
    ?>

			</tbody>
		</table>
		<div style="clear:both; margin-bottom:30px;">
			<input type="checkbox" name="sAll" onclick="selectAll(this)" />
			<strong>
	<?php 
    _e('Check All', 'event_espresso');
    ?>
			</strong><?php 
    if (isset($_REQUEST['event_status']) && $_REQUEST['event_status'] == 'D') {
        ?>
				<input name="perm_delete_event" type="submit" class="button-secondary" id="perm_delete_event" value="<?php 
        _e('Permanently Delete Events(s)', 'event_espresso');
        ?>
" style="margin:10px 0 0 10px;" onclick="return confirmDelete();" />
			<?php 
    } else {
        ?>
				<input name="delete_event" type="submit" class="button-secondary" id="delete_event" value="<?php 
        _e('Delete Events(s)', 'event_espresso');
        ?>
" style="margin:10px 0 0 10px;" onclick="return confirmDelete();" />

				<a  style="margin-left:5px"class="button-secondary" href="admin.php?page=events&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 style="margin-left:5px" class="button-secondary" href="#" onclick="window.location='<?php 
        echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&amp;export=report&action=payment&amp;type=excel&all_events=true";
        ?>
'" title="<?php 
        _e('Export to Excel', 'event_espresso');
        ?>
"><?php 
        _e('Export All Attendee Data', 'event_espresso');
        ?>
</a>
				<a class="button-secondary" href="#" onclick="window.location='<?php 
        echo get_bloginfo('wpurl') . "/wp-admin/admin.php?event_espresso&amp;export=report&action=event&amp;type=excel&all_events=true";
        ?>
'" title="<?php 
        _e('Export to Excel', 'event_espresso');
        ?>
"><?php 
        _e('Export All Event Data', 'event_espresso');
        ?>
</a>
				<a style="margin-left:5px" class="button-primary" href="admin.php?page=events&amp;action=add_new_event"><?php 
        _e('Add New Event', 'event_espresso');
        ?>
</a>
		<?php 
    }
    ?>
  </div>
	</form>
	<h4 style="clear:both"><?php 
    _e('Legend', 'event_espresso');
    ?>
</h4>
	<dl style="float:left; margin-left:10px; width:200px">
	<?php 
    echo defined('EVENT_ESPRESSO_RECURRENCE_MODULE_ACTIVE') ? '<dt><img src="' . EVENT_ESPRESSO_PLUGINFULLURL . 'images/arrow_rotate_clockwise.png" alt="Recurring Event" title="Recurring Event"  /> - ' . __('Recurring Event', 'event_espresso') . '</dt>' : '';
    ?>
		<dt><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
images/icons/magnifier.png" width="16" height="16" alt="<?php 
    _e('View Event', 'event_espresso');
    ?>
" /> - <?php 
    _e('View Event', 'event_espresso');
    ?>
</dt>

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

		<dt><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
images/icons/group.png" width="16" height="16" alt="<?php 
    _e('Event Attendees', 'event_espresso');
    ?>
" /> - <?php 
    _e('Event Attendees', 'event_espresso');
    ?>
</dt>
		<dt><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
images/icons/chart_bar.png" width="16" height="16" alt="<?php 
    _e('Send Event Email', 'event_espresso');
    ?>
" /> - <?php 
    _e('View Report', 'event_espresso');
    ?>
</dt>


	</dl>

	<dl style="float:left; margin-left:10px;">
		<dt><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
images/icons/tag.png" width="16" height="16" alt="<?php 
    _e('Short Code', 'event_espresso');
    ?>
" /> - <?php 
    _e('Short Code', 'event_espresso');
    ?>
</dt>
		<dt><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
images/icons/excel_icon.png" width="16" height="16" alt="<?php 
    _e('Excel Spreadsheet', 'event_espresso');
    ?>
" /> - <?php 
    _e('Excel Export', 'event_espresso');
    ?>
</dt>

		<dt><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
images/icons/csv_icon_sm.gif" width="16" height="16" alt="<?php 
    _e('CSV Spreadsheet', 'event_espresso');
    ?>
" /> - <?php 
    _e('CSV Export', 'event_espresso');
    ?>
</dt>

		<dt><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
images/icons/email_go.png" width="16" height="16" alt="<?php 
    _e('View Report', 'event_espresso');
    ?>
" /> - <?php 
    _e('Event Newsletter', 'event_espresso');
    ?>
</dt>
	</dl>

	<script>
		jQuery(document).ready(function($) {
			// show the table data 
			var mytable = $('#table').dataTable( {
				"sDom": 'Clfrtip',
				"aoColumns": [
					{ "bSortable": false },
					null,
					null,
					null,
					null,
					null,
					null,
					null,
					null,
	<?php 
    echo function_exists('espresso_is_admin') && espresso_is_admin() == true ? 'null,' : '';
    ?>
					null,
					{ "bSortable": false }
				],
				"aoColumnDefs": [
					{ "bVisible": false, "aTargets": [ <?php 
    echo $org_options['use_venue_manager'] == 'Y' ? '' : '3,';
    ?>
 4 ] }
				],
				"oColVis": {
					"aiExclude": [ 0, 1, 2 ],
					"buttonText": "Filter: Show / Hide Columns",
					"bRestore": true
				},
				"bAutoWidth": false,
				"bStateSave": true,
				"sPaginationType": "full_numbers",
				"oLanguage": {	"sSearch": "<strong><?php 
    _e('Live Search Filter', 'event_espresso');
    ?>
:</strong>",
					"sZeroRecords": "<?php 
    _e('No Records Found!', 'event_espresso');
    ?>
" }

			});
		});
	</script>

	<div id="coupon_code_info" style="display:none">
		<h2><?php 
    _e('Coupon/Promo Code', 'event_espresso');
    ?>
</h2><p><?php 
    _e('This is used to apply discounts to events.', 'event_espresso');
    ?>
</p><p><?php 
    _e('A coupon or promo code could can be anything you want. For example: Say you have an event that costs', 'event_espresso');
    ?>
 <?php 
    echo $org_options['currency_symbol'];
    ?>
200. <?php 
    _e('If you supplied a promo like "PROMO50" and entered 50.00 into the "Discount w/Promo Code" field your event will be discounted', 'event_espresso');
    ?>
  <?php 
    echo $org_options['currency_symbol'];
    ?>
50.00, <?php 
    _e('Bringing the cost of the event to', 'event_espresso');
    ?>
 <?php 
    echo $org_options['currency_symbol'];
    ?>
150. </p>
			<p><?php 
    _e("Note: Promo Codes which are marked to 'apply to all events', although not explicitly enumerated, can also be used for this event, provided it allows promo codes.", "event_espresso");
    ?>
</p>
	</div>
	<div id="unique_id_info" style="display:none">
		<h2><?php 
    _e('Event Identifier', 'event_espresso');
    ?>
</h2><p><?php 
    _e('This should be a unique identifier for the event. Example: "Event1" (without quotes.)</p><p>The unique ID can also be used in individual pages using the', 'event_espresso');
    ?>
 [SINGLEEVENT single_event_id="<?php 
    _e('Unique Event ID', 'event_espresso');
    ?>
"] <?php 
    _e('shortcode', 'event_espresso');
    ?>
.</p>
	</div>
	<?php 
    echo event_espresso_custom_email_info();
}
Пример #5
0
function event_espresso_manage_events()
{
    global $wpdb, $org_options;
    ?>
	<div id="configure_organization_form" class="wrap meta-box-sortables ui-sortable">
		<div id="event_reg_theme" class="wrap">
			<div id="icon-options-event" class="icon32"></div>
			<h2>
				<?php 
    if ($_REQUEST['page'] == 'events' && isset($_REQUEST['event_admin_reports'])) {
        switch ($_REQUEST['event_admin_reports']) {
            case 'charts':
                _e('Attendee Reports', 'event_espresso');
                break;
            case 'event_list_attendees':
            case 'resend_email':
            case 'list_attendee_payments':
                _e('Attendee Reports', 'event_espresso');
                if (!empty($_REQUEST['event_id']) && $_REQUEST['event_admin_reports'] != 'add_new_attendee') {
                    echo '<a href="admin.php?page=events&amp;event_admin_reports=add_new_attendee&amp;event_id=' . $_REQUEST['event_id'] . '" class="button add-new-h2" style="margin-left: 20px;">' . __('Add New Attendee', 'event_espresso') . '</a>';
                }
                break;
            case 'edit_attendee_record':
                _e('Edit Attendee Data', 'event_espresso');
                break;
            case 'enter_attendee_payments':
                _e('Edit Attendee Payment Record', 'event_espresso');
                break;
            case 'add_new_attendee':
                _e('Add New Attendee', 'event_espresso');
                break;
            case 'event_newsletter':
                _e('Email Event Attendees', 'event_espresso');
                break;
        }
    } else {
        _e('Event Overview', 'event_espresso');
        if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'edit' || $_REQUEST['action'] == 'add_new_event')) {
        } else {
            echo '<a href="admin.php?page=events&amp;action=add_new_event" class="button add-new-h2" style="margin-left: 20px;">' . __('Add New Event', 'event_espresso') . '</a>';
        }
    }
    ?>
			</h2>
			<?php 
    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'copy_event') {
        require_once "copy_event.php";
        copy_event();
    }
    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
        event_espresso_delete_event();
    }
    //Delete recurrence series of events
    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete_recurrence_series') {
        $r = $wpdb->get_results("SELECT id FROM " . EVENTS_DETAIL_TABLE . " ed WHERE recurrence_id = " . $_REQUEST['recurrence_id']);
        if ($wpdb->num_rows > 0) {
            foreach ($r as $row) {
                event_espresso_delete_event($row->id);
            }
        }
    }
    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'csv_import') {
        require_once 'csv_import.php';
        csv_import();
    }
    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'add') {
        require_once "insert_event.php";
        add_event_to_db();
    }
    //Update the event
    if (isset($_REQUEST['edit_action']) && $_REQUEST['edit_action'] == 'update') {
        require_once "update_event.php";
        update_event();
    }
    //If we need to add or edit a new event then we show the add or edit forms
    if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'add_new_event' || $_REQUEST['action'] == 'edit')) {
        ?>
				<form id="espresso_event_editor" name="form" method="post" action="<?php 
        echo $_SERVER["REQUEST_URI"];
        ?>
">
					<?php 
        if ($_REQUEST['action'] == 'edit') {
            //show the edit form
            require_once "edit_event.php";
            edit_event($_REQUEST['event_id']);
        } else {
            //Show the add new event form
            require_once "add_new_event.php";
            add_new_event();
        }
        ?>
					<br class="clear" />
				</form>
				<!-- /event_reg_theme -->
				<?php 
    } else {
        //If we are not adding or editing an event then show the list of events
        if (isset($_REQUEST['event_admin_reports'])) {
            switch ($_REQUEST['event_admin_reports']) {
                case 'charts':
                    require_once EVENT_ESPRESSO_INCLUDES_DIR . "admin-reports/event_list_attendees.php";
                    require_once EVENT_ESPRESSO_INCLUDES_DIR . "admin-reports/charts.php";
                    espresso_charts();
                    break;
                case 'list_attendee_payments':
                    require_once EVENT_ESPRESSO_INCLUDES_DIR . "admin-reports/event_list_attendees.php";
                    event_list_attendees();
                    break;
                case 'event_list_attendees':
                    require_once EVENT_ESPRESSO_INCLUDES_DIR . "admin-reports/event_list_attendees.php";
                    event_list_attendees();
                    break;
                case 'edit_attendee_record':
                    require_once EVENT_ESPRESSO_INCLUDES_DIR . "admin-reports/event_list_attendees.php";
                    require_once EVENT_ESPRESSO_INCLUDES_DIR . "admin-reports/edit_attendee_record.php";
                    edit_attendee_record();
                    break;
                case 'enter_attendee_payments':
                    require_once EVENT_ESPRESSO_INCLUDES_DIR . "admin-reports/event_list_attendees.php";
                    require_once EVENT_ESPRESSO_INCLUDES_DIR . "admin-reports/enter_attendee_payments.php";
                    enter_attendee_payments();
                    break;
                case 'add_new_attendee':
                    require_once EVENT_ESPRESSO_INCLUDES_DIR . "admin-reports/event_list_attendees.php";
                    require_once EVENT_ESPRESSO_INCLUDES_DIR . "admin-reports/add_new_attendee.php";
                    add_new_attendee($_REQUEST['event_id']);
                    break;
                case 'event_newsletter':
                    if (file_exists(EVENT_ESPRESSO_INCLUDES_DIR . "admin-files/event_newsletter.php")) {
                        require_once EVENT_ESPRESSO_INCLUDES_DIR . "admin-files/event_newsletter.php";
                        event_newsletter($_REQUEST['event_id']);
                    } else {
                        require_once "event_newsletter.php";
                    }
                    break;
                case 'resend_email':
                    require_once EVENT_ESPRESSO_INCLUDES_DIR . "/admin-reports/event_list_attendees.php";
                    echo '<div id="message" class="updated fade"><p><strong>Resending email to attendee.</strong></p></div>';
                    event_espresso_email_confirmations(array('registration_id' => $_REQUEST['registration_id'], 'send_admin_email' => 'false', 'send_attendee_email' => 'true'));
                    event_list_attendees();
                    break;
                default:
                    event_espresso_edit_list();
                    break;
            }
        } else {
            event_espresso_edit_list();
        }
    }
    //Do not remove anything below this line. These are the color box popups.
    ?>
</div>
	</div>
	<div id="email_manager_info" style="display:none">
		<h2><?php 
    _e('Pre-existing Emails', 'event_espresso');
    ?>
</h2>
		<p><?php 
    _e('These emails will override the custom email if a pre-existing email is selected. You must select "Yes" in the "Send custom confirmation emails for this event?" above.', 'event_espresso');
    ?>
</p>
	</div>
	<div id="coupon_code_info" style="display:none">
		<h2><?php 
    _e('Coupon/Promo Code', 'event_espresso');
    ?>
</h2><p><?php 
    _e('This is used to apply discounts to events.', 'event_espresso');
    ?>
</p><p><?php 
    _e('A coupon or promo code could can be anything you want. For example: Say you have an event that costs', 'event_espresso');
    ?>
 <?php 
    echo $org_options['currency_symbol'];
    ?>
200. <?php 
    _e('If you supplied a promo like "PROMO50" and entered 50.00 into the "Discount w/Promo Code" field your event will be discounted', 'event_espresso');
    ?>
  <?php 
    echo $org_options['currency_symbol'];
    ?>
50.00, <?php 
    _e('Bringing the cost of the event to', 'event_espresso');
    ?>
 <?php 
    echo $org_options['currency_symbol'];
    ?>
150. </p>
			<p><?php 
    _e("Note: Promo Codes which are marked to 'apply to all events', although not explicitly enumerated, can also be used for this event, provided it allows promo codes.", "event_espresso");
    ?>
</p>
	</div>
	<div id="unique_id_info" style="display:none">
		<h2><?php 
    _e('Event Identifier', 'event_espresso');
    ?>
</h2><p><?php 
    _e('This should be a unique identifier for the event. Example: "Event1" (without quotes.)</p><p>The unique ID can also be used in individual pages using the', 'event_espresso');
    ?>
 [SINGLEEVENT single_event_id="<?php 
    _e('Unique Event ID', 'event_espresso');
    ?>
"] <?php 
    _e('shortcode', 'event_espresso');
    ?>
.</p>
	</div>
	<div id="secondary_info" style="display:none">
		<h2><?php 
    _e('Waitlist Events', 'event_espresso');
    ?>
</h2>
		<p><?php 
    _e('These types of events can be used as a overflow or waiting list events.', 'event_espresso');
    ?>
</p>
		<p><?php 
    _e('If an event is set up as an "Waitlist Event," it can be set to not appear in your event listings template. You may need to customize your event_listing.php file to make this work. For more information, please', 'event_espresso');
    ?>
 <a href="http://eventespresso.com/forums/?p=512" target="_blank"><?php 
    _e('visit the forums', 'event_espresso');
    ?>
</a>.</p>
	</div>
	<div id="external_URL_info" style="display:none">
		<h2><?php 
    _e('Off-site Registration Page', 'event_espresso');
    ?>
</h2>
		<p><?php 
    _e('If an off-site registration page is entered, it will override your registration page and send attendees to the URL that is entered.', 'event_espresso');
    ?>
</p>
	</div>
	<div id="alt_email_info" style="display:none">
		<h2><?php 
    _e('Alternate Email Address', 'event_espresso');
    ?>
</h2>
		<p><?php 
    _e('If an alternate email address is entered. Admin email notifications wil be sent to this address instead.', 'event_espresso');
    ?>
</p>
	</div>
	<div id="status_types_info" style="display:none;">
		<h2><?php 
    _e('Event Status Types', 'event_espresso');
    ?>
</h2>
		<ul>
			<li><strong><?php 
    _e('Public', 'event_espresso');
    ?>
</strong><br /><?php 
    _e('This type if event will appear in the event listings. It is a live event (not deleted, ongoing or secondary.)', 'event_espresso');
    ?>
</li>
			<li><strong><?php 
    _e('Waitlist', 'event_espresso');
    ?>
</strong><br /><?php 
    _e('This type of event can be hidden and used as a waiting list for a primary event. Template customizations may be required. For more information, please', 'event_espresso');
    ?>
 <a href="http://eventespresso.com/forums/?p=512" target="_blank"><?php 
    _e('visit the forums', 'event_espresso');
    ?>
</a></li>
			<li><strong><?php 
    _e('Ongoing', 'event_espresso');
    ?>
</strong><br /><?php 
    _e('This type of an event can be set to appear in your event listings and display a registration page. Template customizations are required. For more information, please', 'event_espresso');
    ?>
 <a href="http://eventespresso.com/forums/?p=518" target="_blank"><?php 
    _e('visit the forums', 'event_espresso');
    ?>
</a></li>
			<li><strong><?php 
    _e('Deleted', 'event_espresso');
    ?>
</strong><br /><?php 
    _e('This is event type will not appear in the event listings and will not dispaly a registrations page. Deleted events can still be accessed in the', 'event_espresso');
    ?>
 <a href="admin.php?page=events"><?php 
    _e('Attendee Reports', 'event_espresso');
    ?>
</a> <?php 
    _e('page', 'event_espresso');
    ?>
.</li>
		</ul>
	</div>
	<?php 
    echo event_espresso_custom_email_info();
}
function enter_attendee_payments()
{
    global $wpdb, $org_options;
    $event_id = $_REQUEST['event_id'];
    $today = date("d-m-Y");
    //Added by Imon
    $multi_reg = false;
    $registration_id = $_REQUEST['registration_id'];
    $registration_ids = array();
    $check = $wpdb->get_row("select * from " . EVENTS_MULTI_EVENT_REGISTRATION_ID_GROUP_TABLE . " where registration_id = '{$registration_id}' ");
    if ($check !== NULL) {
        $registration_id = $check->primary_registration_id;
        $registration_ids = $wpdb->get_results("select * from " . EVENTS_MULTI_EVENT_REGISTRATION_ID_GROUP_TABLE . " where primary_registration_id = '{$registration_id}' ", ARRAY_A);
        $multi_reg = true;
    }
    switch ($_REQUEST['form_action']) {
        //Add payment info
        case 'payment':
            if (isset($_REQUEST['attendee_action']) && $_REQUEST['attendee_action'] == 'post_payment') {
                //Added by Imon
                $primary_row = $wpdb->get_row("select id from " . EVENTS_ATTENDEE_TABLE . " where registration_id = '{$registration_id}' order by id limit 0,1 ");
                $primary_attendee_id = $primary_row->id;
                // GET the primary attendee id because amount paid info is kept with the primary attendee
                $payment_status = isset($_REQUEST['payment_status']) ? $_REQUEST['payment_status'] : '';
                $txn_type = isset($_REQUEST['txn_type']) ? $_REQUEST['txn_type'] : '';
                $txn_id = isset($_REQUEST['txn_id']) ? $_REQUEST['txn_id'] : '';
                //$quantity = isset($_REQUEST[ 'quantity' ]) ? $_REQUEST[ 'quantity' ]:'';
                $amount_pd = isset($_REQUEST['amount_pd']) ? $_REQUEST['amount_pd'] : '';
                $payment_date = isset($_REQUEST['payment_date']) ? $_REQUEST['payment_date'] : '';
                $coupon_code = isset($_REQUEST['coupon_code']) ? $_REQUEST['coupon_code'] : '';
                //Added/updated by Imon
                //Update payment status information for primary attendee
                $sql = "UPDATE " . EVENTS_ATTENDEE_TABLE . " SET payment_status = '{$payment_status}', txn_type = '{$txn_type}', txn_id = '{$txn_id}', amount_pd = '{$amount_pd}', payment_date ='{$payment_date}',  coupon_code ='{$coupon_code}' WHERE registration_id ='" . $registration_id . "' and id = {$primary_attendee_id} ";
                $wpdb->query($sql);
                if (count($registration_ids) > 0) {
                    foreach ($registration_ids as $reg_id) {
                        // Update payment status information for all attendees
                        $sql = "UPDATE " . EVENTS_ATTENDEE_TABLE . " SET payment_status = '{$payment_status}', txn_type = '{$txn_type}', txn_id = '{$txn_id}', payment_date ='{$payment_date}', coupon_code ='{$coupon_code}' WHERE registration_id ='" . $reg_id['registration_id'] . "' ";
                        $wpdb->query($sql);
                    }
                } else {
                    // Update payment status information for all attendees
                    $sql = "UPDATE " . EVENTS_ATTENDEE_TABLE . " SET payment_status = '{$payment_status}', txn_type = '{$txn_type}', txn_id = '{$txn_id}', payment_date ='{$payment_date}', coupon_code ='{$coupon_code}' WHERE registration_id ='" . $registration_id . "' ";
                    $wpdb->query($sql);
                }
                //Send Payment Recieved Email
                if ($_REQUEST['send_payment_rec'] == "send_message") {
                    /*
                     * @todo Do we send an email to each attendee in a group or just the main?
                     */
                    //event_espresso_send_payment_notification( $id );
                    //Added by Imon
                    if (count($registration_ids) > 0) {
                        foreach ($registration_ids as $reg_id) {
                            event_espresso_send_payment_notification(array('registration_id' => $reg_id['registration_id']));
                        }
                    } else {
                        event_espresso_send_payment_notification(array('registration_id' => $registration_id));
                    }
                }
            }
            break;
            //Send Invoice
        //Send Invoice
        case 'send_invoice':
            //Added by Imon
            if ($org_options["use_attendee_pre_approval"] == "Y") {
                $pre_approve = $_REQUEST['pre_approve'];
                if (count($registration_ids) > 0) {
                    foreach ($registration_ids as $reg_id) {
                        $sql = "UPDATE " . EVENTS_ATTENDEE_TABLE . " SET pre_approve = '{$pre_approve}' WHERE registration_id ='" . $reg_id['registration_id'] . "'";
                        $wpdb->query($sql);
                    }
                } else {
                    $sql = "UPDATE " . EVENTS_ATTENDEE_TABLE . " SET pre_approve = '{$pre_approve}' WHERE registration_id ='" . $registration_id . "'";
                    $wpdb->query($sql);
                }
            } else {
                $pre_approve = 0;
            }
            if ($pre_approve == "0") {
                if (count($registration_ids) > 0) {
                    foreach ($registration_ids as $reg_id) {
                        event_espresso_send_invoice($reg_id['registration_id'], $_REQUEST['invoice_subject'], $_REQUEST['invoice_message']);
                    }
                } else {
                    event_espresso_send_invoice($registration_id, $_REQUEST['invoice_subject'], $_REQUEST['invoice_message']);
                }
                echo '<div id="message" class="updated fade"><p><strong>' . __('Invoice Sent', 'event_espresso') . '</strong></p></div>';
            }
            break;
    }
    //Show the forms.
    // $id = $registration_id ;
    $attendees = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . EVENTS_ATTENDEE_TABLE . " WHERE registration_id ='%s' ORDER BY ID LIMIT 1", $registration_id));
    foreach ($attendees as $attendee) {
        $id = $attendee->id;
        //$registration_id = $attendee->registration_id;//Removed by Imon
        $lname = $attendee->lname;
        $fname = $attendee->fname;
        $address = $attendee->address;
        $city = $attendee->city;
        $state = $attendee->state;
        $zip = $attendee->zip;
        $email = $attendee->email;
        $phone = $attendee->phone;
        $date = $attendee->date;
        $payment_status = $attendee->payment_status;
        $txn_type = $attendee->txn_type;
        $txn_id = $attendee->txn_id;
        $amount_pd = $attendee->amount_pd;
        $quantity = $attendee->quantity;
        $payment_date = $attendee->payment_date;
        $event_id = $attendee->event_id;
        $coupon_code = $attendee->coupon_code;
        $pre_approve = $attendee->pre_approve;
        $start_date = $attendee->start_date;
        $event_time = $attendee->event_time;
    }
    $events = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . EVENTS_DETAIL_TABLE . " WHERE id='%d'", $event_id));
    foreach ($events as $event) {
        $event_id = $event->id;
        $event_name = $event->event_name;
        $event_desc = $event->event_desc;
        $event_description = $event->event_desc;
        $event_identifier = $event->event_identifier;
        $cost = isset($event->event_cost) ? $event->event_cost : 0;
        $active = $event->is_active;
    }
    $event_date = event_date_display($start_date . ' ' . $event_time, get_option('date_format') . ' g:i a');
    $total_paid = espresso_attendee_price(array('registration_id' => $_REQUEST['registration_id'], 'session_total' => true));
    if (isset($_REQUEST['status']) && $_REQUEST['status'] == 'saved') {
        ?>

        <div id="message" class="updated fade">
          <p><strong>
            <?php 
        _e('Payment details saved for', 'event_espresso');
        ?>
            <?php 
        echo $fname;
        ?>
 <?php 
        echo $lname;
        ?>
.
            <?php 
        if (isset($_REQUEST['send_payment_rec']) && $_REQUEST['send_payment_rec'] == "send_message") {
            ?>
            <?php 
            _e('Payment notification has been sent.', 'event_espresso');
            ?>
            <?php 
        }
        ?>
            </strong></p>
        </div>
<?php 
    }
    ?>
<div class="metabox-holder">
<div class="postbox">
<?php 
    if (!$multi_reg) {
        ?>
      <h3>
      <?php 
        _e('Name:', 'event_espresso');
        ?>
        <?php 
        echo $fname;
        ?>
 <?php 
        echo $lname;
        ?>
 |
        <?php 
        _e('ID:', 'event_espresso');
        ?>
 <?php 
        echo $id;
        ?>
 |

        <?php 
        _e('Registered For:', 'event_espresso');
        ?>
         <a href="admin.php?page=events&event_admin_reports=list_attendee_payments&event_id=<?php 
        echo $event_id;
        ?>
"><?php 
        echo stripslashes_deep($event_name);
        ?>
</a> - <?php 
        echo $event_date;
        ?>
</h3>
<?php 
    } else {
        ?>
  <h3>
    <?php 
        echo __('Multiple Registration Payment for ', 'event_espresso');
        ?>
 <a href="admin.php?page=events&event_admin_reports=list_attendee_payments&event_id=<?php 
        echo $event_id;
        ?>
"><?php 
        echo stripslashes_deep($event_name);
        ?>
</a> - <?php 
        echo $event_date;
        ?>
  </h3>
  <?php 
    }
    ?>
  <div class="inside">
    <table width="100%" border="0">
      <tr>
        <td><strong>
          <?php 
    _e('Payment Details', 'event_espresso');
    ?>
          </strong></td>
        <td><strong>
          <?php 
    _e('Invoice/Payment Reminder', 'event_espresso');
    ?>
          </strong></td>
      </tr>
      <tr>
        <td valign="top">
        <?php 
    if (count($registration_ids) > 0) {
        echo '<p><strong>' . __('Registration Ids:', 'event_espresso') . '</strong></p>';
        echo '<ul>';
        foreach ($registration_ids as $reg_id) {
            //TODO:Display cost per registration id. At the moment it is not possible to display price per registration id because discount is calculated for total amount [IMON]
            echo '<li># ' . $reg_id['registration_id'] . ' [ <a href="admin.php?page=events&event_admin_reports=edit_attendee_record&event_id=' . $event_id . '&registration_id=' . $reg_id['registration_id'] . '&form_action=edit_attendee">' . __('View/Edit Registration', 'event_espresso') . '</a> ]</li>';
        }
    } else {
        echo '<p><strong>' . __('Registration Id:', 'event_espresso') . '</strong></p>';
        //TODO:Display cost per registration id. At the moment it is not possible to display price per registration id because discount is calculated for total amount [IMON]
        echo '<p># ' . $registration_id . ' [ <a href="admin.php?page=events&event_admin_reports=edit_attendee_record&event_id=' . $event_id . '&registration_id=' . $registration_id . '&form_action=edit_attendee">' . __('View/Edit Registration', 'event_espresso') . '</a> ]</p>';
    }
    echo '</ul><hr style="width:90%; margin:20px 0;" align="left" />';
    ?>
        <form method="POST" action="<?php 
    echo $_SERVER['REQUEST_URI'];
    ?>
&status=saved" class="espresso_form">
            <fieldset>
              <ul>
                <li>
                <label for="payment_status">
                  <?php 
    _e('Payment Status:', 'event_espresso');
    ?>
                </label>
<?php 
    $values = array(array('id' => '', 'text' => __('None', 'event_espresso')), array('id' => 'Completed', 'text' => __('Completed', 'event_espresso')), array('id' => 'Pending', 'text' => __('Pending', 'event_espresso')), array('id' => 'Payment Declined', 'text' => __('Payment Declined', 'event_espresso')), array('id' => 'Incomplete', 'text' => __('Incomplete', 'event_espresso')));
    echo select_input('payment_status', $values, $payment_status);
    ?>
                </li>
                <li>
                  <label for="txn_type">
                    <?php 
    _e('Transaction Type:', 'event_espresso');
    ?>
                  </label>
                  <?php 
    $txn_values = array(array('id' => '', 'text' => __('N/A', 'event_espresso')), array('id' => 'web_accept', 'text' => espresso_payment_type('web_accept')), array('id' => 'CC', 'text' => __('Credit Card', 'event_espresso')), array('id' => 'INV', 'text' => espresso_payment_type('INV')), array('id' => 'OFFLINE', 'text' => espresso_payment_type('OFFLINE')));
    echo select_input('txn_type', $txn_values, $txn_type);
    ?>
                </li>
                <li>
                  <label>
                    <?php 
    _e('Transaction ID:', 'event_espresso');
    ?>
                  </label>
                  <input type="text" name="txn_id" size="45" value ="<?php 
    echo $txn_id;
    ?>
" />
                </li>
                <li>
                  <label>
                    <?php 
    _e('Amount:', 'event_espresso');
    ?>
                  </label>
                  <?php 
    //TODO:Need to check this after pricing module is done [IMON]
    echo $org_options['currency_symbol'];
    ?>
                    <input style="width:100px;" readonly="true" type="text" name="amount_pd" size="20" value ="<?php 
    echo $total_paid;
    ?>
" /> <?php 
    echo ' [ <a href="admin.php?page=events&event_admin_reports=edit_attendee_record&event_id=' . $event_id . '&registration_id=' . $registration_id . '&form_action=edit_attendee&show_payment=true">' . __('Edit Payment', 'event_espresso') . '</a> ] ';
    ?>
                </li>
                <li>
                  <label>
                    <?php 
    _e('Coupon Code:', 'event_espresso');
    ?>
                    </label>
                  <input type="text" name="coupon_code" size="45" value ="<?php 
    echo $coupon_code;
    ?>
" />
                </li>
                <?php 
    /*?><li>
        <label>
          <?php _e( 'How Many People:', 'event_espresso' ); ?>
        </label>
        <input type="text" name="quantity" size="45" value ="<?php echo espresso_count_attendees_for_registration($id); ?>" />
      </li><?php */
    ?>
                <li>
					<label><?php 
    _e('Date Paid:', 'event_espresso');
    ?>
</label>
					<input type="text" name="payment_date" size="45" value ="<?php 
    echo !empty($payment_date) ? event_date_display($payment_date) : event_date_display($today);
    ?>
" />
                </li>
                <li>
                  <label>
                    <?php 
    _e('Do you want to send a payment recieved notice to registrant?', 'event_espresso');
    ?>
                  </label>
                  <input type="radio" name="send_payment_rec" value="send_message">
                  <?php 
    _e('Yes', 'event_espresso');
    ?>
                  <input type="radio" name="send_payment_rec" checked value="N">
                  <?php 
    _e('No', 'event_espresso');
    ?>
                </li>
                <input type="hidden" name="id" value="<?php 
    echo $id;
    ?>
">
                <input type="hidden" name="registration_id" value="<?php 
    echo $registration_id;
    ?>
">
                <input type="hidden" name="form_action" value="payment">
                <input type="hidden" name="attendee_pay" value="paynow">
                <input type="hidden" name="event_id" value="<?php 
    echo $event_id;
    ?>
">
                <input type="hidden" name="attendee_action" value="post_payment">
                <li>
                  <input type="submit" name="Submit" value="Update Payment">
                </li>
              </ul>
            </fieldset>
          </form></td>
        <td valign="top"><form method='post' action="<?php 
    echo $_SERVER['REQUEST_URI'];
    ?>
&status=invoiced">
            <input type="hidden" name="id" value="<?php 
    echo $id;
    ?>
">
            <input type="hidden" name="form_action" value="send_invoice">
            <input type="hidden" name="event_id" value="<?php 
    echo $event_id;
    ?>
">
            <ul>
              <li>
                <?php 
    _e('Use a ', 'event_espresso');
    ?>
                <a href="admin.php?page=event_emails" target="_blank">
                <?php 
    _e('pre-existing email', 'event_espresso');
    ?>
                </a>? <?php 
    echo espresso_db_dropdown('id', 'email_name', EVENTS_EMAIL_TABLE, 'email_name', '', 'desc') . ' <a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=email_manager_info"><img src="' . EVENT_ESPRESSO_PLUGINFULLURL . '/images/question-frame.png" width="16" height="16" /></a>';
    ?>
 </li>
              <li>
                <?php 
    _e('OR', 'event_espresso');
    ?>
              </li>
              <li>
                <?php 
    _e('Create a custom email:', 'event_espresso');
    ?>
              </li>
              <li>
                <?php 
    _e('Invoice Subject', 'event_espresso');
    ?>
                :
                <input type="text" name="invoice_subject" size="45" value="<?php 
    _e('Payment Reminder for [event]', 'event_espresso');
    ?>
" />
              </li>
              <li>
                <p>
                  <?php 
    _e('Message:', 'event_espresso');
    ?>
                </p>
               
				<div class="postbox">
									 <?php 
    $email_content = __('Dear [fname] [lname], <p>Our records show that we have not received your payment of [cost] for [event_link].</p> <p>Please visit [payment_url] to view your payment options.</p><p>[invoice_link]</p><p>Sincerely,<br />' . ($Organization = $org_options['organization'] . '</p>'), 'event_espresso');
    if (function_exists('wp_editor')) {
        $args = array("textarea_rows" => 5, "textarea_name" => "invoice_message", "editor_class" => "my_editor_custom");
        wp_editor(espresso_admin_format_content($email_content), "invoice_message", $args);
    } else {
        echo '<textarea name="invoice_message" class="theEditor" id="invoice_message">' . espresso_admin_format_content($email_content) . '</textarea>';
        espresso_tiny_mce();
    }
    ?>
										<table id="email-confirmation-form" cellspacing="0">
											<tbody>
												<tr>
													<td class="aer-word-count"></td>
													<td class="autosave-info"><span>&nbsp;</span></td>
												</tr>
											</tbody>
										</table>
										<p><a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=custom_email_info">
														<?php 
    _e('View Custom Email Tags', 'event_espresso');
    ?>
</a> | <a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=custom_email_example">
														<?php 
    _e('Email Example', 'event_espresso');
    ?>
</a></p>
									</div>
									
              </li>
              <?php 
    if ($org_options["use_attendee_pre_approval"] == "Y") {
        $pre_approve = is_attendee_approved($event_id, $id) == true ? 1 : 0;
        ?>
              <li>
                <?php 
        _e("Attendee approved?", "event_espresso");
        ?>
                :
                <?php 
        $pre_approval_values = array(array('id' => '0', 'text' => __('Yes', 'event_espresso')), array('id' => '1', 'text' => __('No', 'event_espresso')));
        echo select_input("pre_approve", $pre_approval_values, $pre_approve);
        ?>
                <br />
                <?php 
        _e("(If not approved then invoice will not be sent.)", "event_espresso");
        ?>
              </li>
              <?php 
    }
    ?>
              <li>
                <input type="submit" name="Submit" value="Send Invoice">
              </li>
            </ul>
          </form></td>
      </tr>
    </table>
    <p> <strong> <a href="admin.php?page=events&event_id=<?php 
    echo $event_id;
    ?>
&event_admin_reports=list_attendee_payments"> &lt;&lt;
      <?php 
    _e('Back to List', 'event_espresso');
    ?>
      </a> </strong> </p>
  </div>
</div>
<?php 
    //This show what tags can be added to a custom email.
    event_espresso_custom_email_info();
    //event_list_attendees();
}
function enter_attendee_payments()
{
    global $wpdb, $org_options;
    require_once EVENT_ESPRESSO_PLUGINFULLPATH . "includes/functions/attendee_functions.php";
    $notifications['success'] = array();
    $notifications['error'] = array();
    $failed_nonce_msg = '
<div id="message" class="error">
	<p>
		<strong>' . __('An Error Occurred. The request failed to pass a security check.', 'event_espresso') . '</strong><br/>
		<span style="font-size:.9em;">' . __('Please press the back button on your browser to return to the previous page.', 'event_espresso') . '</span>
	</p>
</div>';
    $multi_reg = FALSE;
    $event_id = isset($_POST['event_id']) ? absint($_POST['event_id']) : isset($_REQUEST['event_id']) ? absint($_REQUEST['event_id']) : '';
    $registration_id = isset($_POST['registration_id']) ? sanitize_text_field($_POST['registration_id']) : isset($_REQUEST['registration_id']) ? sanitize_text_field($_REQUEST['registration_id']) : FALSE;
    $registration_ids = array();
    //echo '<h4>$registration_id : ' . $registration_id . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
    $SQL = "SELECT * FROM " . EVENTS_MULTI_EVENT_REGISTRATION_ID_GROUP_TABLE . " WHERE registration_id =%s LIMIT 1";
    if ($check = $wpdb->get_row($wpdb->prepare($SQL, $registration_id))) {
        //printr( $check, '$check  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
        $registration_id = $check->primary_registration_id;
        $SQL = "SELECT * FROM " . EVENTS_MULTI_EVENT_REGISTRATION_ID_GROUP_TABLE . " WHERE primary_registration_id =%s";
        $registration_ids = $wpdb->get_results($wpdb->prepare($SQL, $registration_id), ARRAY_A);
        $registration_ids = $registration_ids !== FALSE ? $registration_ids : array();
        $multi_reg = TRUE;
    }
    //echo '<h4>$registration_id : ' . $registration_id . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
    //printr( $registration_ids, '$registration_ids  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
    switch ($_REQUEST['form_action']) {
        //Add payment info
        case 'payment':
            if (isset($_POST['attendee_action']) && $_POST['attendee_action'] == 'post_payment') {
                if (!wp_verify_nonce($_POST['_wpnonce'], 'payment_' . $registration_id . '_post_payment_nonce')) {
                    wp_die($failed_nonce_msg);
                }
                $attendees_to_email = array();
                // get the primary attendee id because amount paid info is kept with the primary attendee
                $SQL = "SELECT id, payment_status FROM " . EVENTS_ATTENDEE_TABLE . " WHERE registration_id =%s AND is_primary = 1 ORDER BY id LIMIT 0,1 ";
                $primary_att = $wpdb->get_row($wpdb->prepare($SQL, $registration_id));
                if (!$primary_att) {
                    $notifications['error'][] = __('An error occured. The primary attendee details could not be retrieved from the database.', 'event_espresso');
                } else {
                    $txn_type = isset($_POST['txn_type']) ? $_POST['txn_type'] : apply_filters('filter_hook_event_espresso_enter_attendee_payments_remove_require_txn_type', FALSE);
                    $txn_id = isset($_POST['txn_id']) ? $_POST['txn_id'] : apply_filters('filter_hook_event_espresso_enter_attendee_payments_remove_require_txn_id', FALSE);
                    $payment_date = isset($_POST['payment_date']) ? date_i18n(get_option('date_format'), strtotime($_POST['payment_date'])) : FALSE;
                    $coupon_code = isset($_POST['coupon_code']) ? $_POST['coupon_code'] : '';
                    $total_owing = isset($_POST['total_owing']) ? (double) number_format(sanitize_text_field($_POST['total_owing']), 2, '.', '') : 0.0;
                    $amount_pd = isset($_POST['amount_pd']) ? (double) number_format(sanitize_text_field($_POST['amount_pd']), 2, '.', '') : 0.0;
                    $new_payment = isset($_POST['new_payment']) && $_POST['new_payment'] != '' ? (double) number_format(sanitize_text_field($_POST['new_payment']), 2, '.', '') : 0.0;
                    $upd_payment_status = isset($_POST['payment_status']) ? $_POST['payment_status'] : 'Pending';
                    // if making a payment, we are going to require the txn type and txn id
                    if ($new_payment != 0.0) {
                        $fail = FALSE;
                        if (!$txn_type) {
                            $notifications['error'][] = __('You must enter a Transaction Type when making a payment.', 'event_espresso');
                            $fail = TRUE;
                        }
                        if (!$txn_id) {
                            $notifications['error'][] = __('You must enter a Transaction ID when making a payment.', 'event_espresso');
                            $fail = TRUE;
                        }
                        if ($fail) {
                            break;
                        }
                        $upd_total = $amount_pd + $new_payment;
                    } else {
                        $upd_total = $amount_pd;
                    }
                    // compare new total_cost with amount_pd
                    if ($new_payment != 'Cancelled') {
                        if ($new_payment == $total_owing) {
                            $upd_payment_status = 'Completed';
                        } elseif ($new_payment < $total_owing) {
                            $upd_payment_status = isset($_POST['payment_status']) && $_POST['payment_status'] == 'Incomplete' ? 'Incomplete' : 'Pending';
                        } elseif ($new_payment > $total_owing) {
                            $upd_payment_status = 'Refund';
                        }
                    }
                    //Update payment status information for primary attendee
                    $set_cols_and_values = array('payment_status' => $upd_payment_status, 'txn_type' => $txn_type, 'txn_id' => $txn_id, 'payment_date' => $payment_date, 'coupon_code' => $coupon_code, 'amount_pd' => $upd_total);
                    $set_format = array('%s', '%s', '%s', '%s', '%s', '%f');
                    $where_cols_and_values = array('id' => $primary_att->id);
                    $where_format = array('%d');
                    // run the update
                    $upd_success = $wpdb->update(EVENTS_ATTENDEE_TABLE, $set_cols_and_values, $where_cols_and_values, $set_format, $where_format);
                    // if there was an actual error
                    if ($upd_success === FALSE) {
                        $notifications['error'][] = __('An error occured. The attendee payment details could not be updated.', 'event_espresso');
                    } else {
                        $attendee_data = array('attendee_id' => $primary_att->id, 'payment_status' => $upd_payment_status, 'registration_id' => $registration_id, 'total_cost' => $upd_total, 'txn_type' => __('Manual Website Payment', 'event_espresso'), 'txn_id' => $txn_id);
                        do_action('action_hook_espresso_update_attendee_payment_status', $attendee_data);
                        if (count($registration_ids) > 0) {
                            foreach ($registration_ids as $reg_id) {
                                // Update payment status information for all attendees
                                // remove amount_pd from update data, since that only applies to the primary attendee
                                unset($set_cols_and_values['amount_pd']);
                                $set_format = array('%s', '%s', '%s', '%s', '%s');
                                $where_cols_and_values = array('registration_id' => $reg_id['registration_id']);
                                $where_format = array('%s');
                                // run the update
                                $upd_success = $wpdb->update(EVENTS_ATTENDEE_TABLE, $set_cols_and_values, $where_cols_and_values, $set_format, $where_format);
                                // if there was an actual error
                                if ($upd_success === FALSE) {
                                    $notifications['error'][] = __('An error occured. The payment details for the additional attendees could not be updated.', 'event_espresso');
                                }
                                $attendees_to_email[] = array('registration_id' => $reg_id['registration_id']);
                            }
                        } else {
                            // Update payment status information for all attendees
                            // remove amount_pd from update data, since that only applies to the primary attendee
                            unset($set_cols_and_values['amount_pd']);
                            $set_format = array('%s', '%s', '%s', '%s', '%s');
                            $where_cols_and_values = array('registration_id' => $registration_id);
                            $where_format = array('%s');
                            // run the update
                            $upd_success = $wpdb->update(EVENTS_ATTENDEE_TABLE, $set_cols_and_values, $where_cols_and_values, $set_format, $where_format);
                            // if there was an actual error
                            if ($upd_success === FALSE) {
                                $notifications['error'][] = __('An error occured. The payment details for the additional attendees could not be updated.', 'event_espresso');
                            }
                        }
                        //Send Payment Recieved Email
                        $send_payment_rec = isset($_POST['send_payment_rec']) ? $_POST['send_payment_rec'] : FALSE;
                        if ($send_payment_rec == "send_message") {
                            //event_espresso_send_payment_notification( $id );
                            if (count($attendees_to_email) > 0) {
                                //printr( $attendees_to_email, '$attendees_to_email  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); wp_die();
                                foreach ($attendees_to_email as $attendee_to_email) {
                                    $result = event_espresso_send_payment_notification($attendee_to_email);
                                    if (!empty($result)) {
                                        $notifications['error'][] = $result;
                                    }
                                }
                            } else {
                                $result = event_espresso_send_payment_notification(array('registration_id' => $registration_id));
                                if (!empty($result)) {
                                    $notifications['error'][] = $result;
                                }
                            }
                        }
                    }
                    // let's base our success on the lack of errors
                    $notifications['success'][] = empty($notifications['error']) ? __('All attendee payment details have been successfully updated.', 'event_espresso') : __('Some attendee payment details were successfully updated, but the following error(s) may have prevented others from being updated:', 'event_espresso');
                }
            }
            break;
            //Send Invoice
        //Send Invoice
        case 'send_invoice':
            if (!wp_verify_nonce($_POST['_wpnonce'], 'send_invoice_' . $registration_id . '_nonce')) {
                wp_die($failed_nonce_msg);
            }
            if ($org_options["use_attendee_pre_approval"] == "Y") {
                $pre_approve = $_POST['pre_approve'];
                if (count($registration_ids) > 0) {
                    foreach ($registration_ids as $reg_id) {
                        $SQL = "UPDATE " . EVENTS_ATTENDEE_TABLE . " SET pre_approve = %s WHERE registration_id = %s";
                        $wpdb->query($wpdb->prepare($SQL, $pre_approve, $reg_id['registration_id']));
                    }
                } else {
                    $SQL = "UPDATE " . EVENTS_ATTENDEE_TABLE . " SET pre_approve = %s WHERE registration_id = %s";
                    $wpdb->query($wpdb->prepare($SQL, $pre_approve, $registration_id));
                }
            } else {
                $pre_approve = 0;
            }
            if ($pre_approve == "0") {
                if (count($registration_ids) > 0) {
                    $reg_attendees = array();
                    foreach ($registration_ids as $reg_id) {
                        $SQL = 'SELECT * FROM ' . EVENTS_ATTENDEE_TABLE . ' WHERE registration_id =%s';
                        $more_reg_attendees = $wpdb->get_results($wpdb->prepare($SQL, $reg_id['registration_id']), 'OBJECT_K');
                        foreach ($more_reg_attendees as $another_reg_attendee) {
                            $reg_attendees[$another_reg_attendee->email] = $another_reg_attendee;
                        }
                    }
                    foreach ($reg_attendees as $reg_attendee) {
                        event_espresso_send_invoice($reg_attendee->registration_id, $_POST['invoice_subject'], $_POST['invoice_message']);
                    }
                } else {
                    event_espresso_send_invoice($registration_id, $_POST['invoice_subject'], $_POST['invoice_message']);
                }
                $notifications['success'][] = __('Invoice Sent.', 'event_espresso');
            }
            break;
    }
    $SQL = "SELECT * FROM " . EVENTS_ATTENDEE_TABLE . " WHERE registration_id ='%s' ORDER BY id LIMIT 1";
    $attendee = $wpdb->get_row($wpdb->prepare($SQL, $registration_id));
    if ($attendee === FALSE) {
        echo '<div id="message" class="error"><p><strong>' . __('An error occured. The requested attendee data could not be found.', 'event_espresso') . '</strong></p></div>';
        exit;
    }
    $id = $attendee->id;
    $lname = $attendee->lname;
    $fname = $attendee->fname;
    $address = $attendee->address;
    $city = $attendee->city;
    $state = $attendee->state;
    $zip = $attendee->zip;
    $email = $attendee->email;
    $phone = $attendee->phone;
    $date = $attendee->date;
    $payment_status = $attendee->payment_status;
    $txn_type = $attendee->txn_type;
    $txn_id = $attendee->txn_id;
    $quantity = $attendee->quantity;
    $payment_date = $attendee->payment_date;
    $event_id = $attendee->event_id;
    $coupon_code = $attendee->coupon_code;
    $pre_approve = $attendee->pre_approve;
    $start_date = $attendee->start_date;
    $event_time = $attendee->event_time;
    $amount_pd = $attendee->amount_pd;
    $total_cost = $attendee->total_cost;
    $orig_price = $attendee->orig_price;
    $final_price = $attendee->final_price;
    $SQL = "SELECT * FROM " . EVENTS_DETAIL_TABLE . " WHERE id='%d'";
    $event = $wpdb->get_row($wpdb->prepare($SQL, $event_id));
    if ($event === FALSE) {
        echo '<div id="message" class="error"><p><strong>' . __('An error occured. The event data for this registration could not be found.', 'event_espresso') . '</strong></p></div>';
        exit;
    }
    $event_id = $event->id;
    $event_name = $event->event_name;
    $event_desc = $event->event_desc;
    $event_description = $event->event_desc;
    $event_identifier = $event->event_identifier;
    $cost = isset($event->event_cost) ? $event->event_cost : 0;
    $active = $event->is_active;
    $event_date = event_date_display($start_date . ' ' . $event_time, get_option('date_format') . ' g:i a');
    //	$total_paid = espresso_attendee_price(array('registration_id'=>$_REQUEST['registration_id'], 'session_total'=>true));
    // display success messages
    if (!empty($notifications['success'])) {
        $success_msg = implode($notifications['success'], '<br />');
        ?>
			
<div id="message" class="updated fade">
<p>
	<strong><?php 
        echo $success_msg;
        ?>
</strong>
</p>
</div>

	<?php 
    }
    // display error messages
    if (!empty($notifications['error'])) {
        $error_msg = implode($notifications['error'], '<br />');
        ?>
			
<div id="message" class="error">
<p>
	<strong><?php 
        echo $error_msg;
        ?>
</strong>
</p>
</div>

	<?php 
    }
    ?>

<div>
	<p>				
		<a href="admin.php?page=events&event_id=<?php 
    echo $event_id;
    ?>
&event_admin_reports=list_attendee_payments">
			 <strong><span class="laquo big-text">&laquo;&nbsp;</span><?php 
    _e('Back to Attendees List', 'event_espresso');
    ?>
</strong>
		</a>				
	</p>
</div>		
		
<div class="metabox-holder">
	<div class="postbox">
		<?php 
    // create attendee list link
    $list_att_url_params = array('event_admin_reports' => 'list_attendee_payments', 'event_id' => $event_id);
    // add url params
    $list_attendee_link = add_query_arg($list_att_url_params, 'admin.php?page=events');
    ?>
		<?php 
    if (!$multi_reg) {
        ?>
		<h3>
			<?php 
        _e('Name:', 'event_espresso');
        ?>
			<b><?php 
        echo $fname;
        ?>
 <?php 
        echo $lname;
        ?>
</b>&nbsp;&nbsp;|&nbsp;&nbsp;
			<?php 
        _e('ID:', 'event_espresso');
        ?>
			<?php 
        echo $id;
        ?>
&nbsp;&nbsp;|&nbsp;&nbsp;
			<?php 
        _e('Registered For:', 'event_espresso');
        ?>
			<a href="<?php 
        echo $list_attendee_link;
        ?>
"><?php 
        echo stripslashes_deep($event_name);
        ?>
</a> - <?php 
        echo $event_date;
        ?>
		</h3>
			
		<?php 
    } else {
        ?>
		
		<h3>
			<?php 
        echo __('Multiple Registration Payment for ', 'event_espresso');
        ?>
 <a href="<?php 
        echo $list_attendee_link;
        ?>
"><?php 
        echo stripslashes_deep($event_name);
        ?>
</a> - <?php 
        echo $event_date;
        ?>
		</h3>
		
		<?php 
    }
    ?>
		
		<div class="inside">
			<table width="100%" border="0">
				<tr>
					<td>
						<h4 class="qrtr-margin"><strong><?php 
    _e('Payment Details', 'event_espresso');
    ?>
</strong></h4>
					</td>
					<td>
						<h4 class="qrtr-margin"><strong><?php 
    _e('Invoice/Payment Reminder', 'event_espresso');
    ?>
</strong></h4>
					</td>
				</tr>
				<tr>
					<td valign="top">
						<?php 
    // create edit attendee link
    $edit_att_url_params = array('event_admin_reports' => 'edit_attendee_record', 'form_action' => 'edit_attendee', 'registration_id' => $registration_id, 'event_id' => $event_id);
    // add url params
    $edit_attendee_link = add_query_arg($edit_att_url_params, 'admin.php?page=events');
    ?>
						
						<?php 
    if (count($registration_ids) > 0) {
        ?>
				
						<p>
							<strong><?php 
        _e('Registration Ids:', 'event_espresso');
        ?>
</strong>
						</p>
						<ul>
							<?php 
        foreach ($registration_ids as $reg_id) {
            ?>
					
		                		<li>
								#&nbsp;<?php 
            echo $reg_id['registration_id'];
            ?>
&nbsp;&nbsp;
								<a href="<?php 
            echo $edit_attendee_link;
            ?>
"><?php 
            _e('View / Edit Registration', 'event_espresso');
            ?>
</a>
							</li>				
							<?php 
        }
        ?>
						</ul>
						
						<?php 
    } else {
        ?>
				
						<p>
							<strong><?php 
        _e('Registration Id:', 'event_espresso');
        ?>
</strong>
						</p>
						<p>
							#&nbsp;<?php 
        echo $registration_id;
        ?>
&nbsp;&nbsp;<a href="<?php 
        echo $edit_attendee_link;
        ?>
"><?php 
        _e('View/Edit Registration', 'event_espresso');
        ?>
</a>
						</p>
						
						<?php 
    }
    ?>
				
						<hr style="width:90%; margin:20px 0;" align="left" />

						<form method="POST" action="<?php 
    echo $_SERVER['REQUEST_URI'];
    ?>
" class="espresso_form">
							<fieldset>
								<ul>
									<li>
										<label>
											<?php 
    _e('Payment Date:', 'event_espresso');
    ?>
										</label>
										<input type="text" class="medium-text" name="payment_date" size="45" value ="<?php 
    echo !empty($payment_date) ? event_date_display($payment_date) : event_date_display(date("d-m-Y"));
    ?>
" />
									</li>
									<li>
										<label for="payment_status">
											<?php 
    _e('Payment Status:', 'event_espresso');
    ?>
										</label>
										<?php 
    $values = array(array('id' => '', 'text' => __('- please select -', 'event_espresso')), array('id' => 'Completed', 'text' => __('Completed', 'event_espresso')), array('id' => 'Pending', 'text' => __('Pending', 'event_espresso')), array('id' => 'Payment Declined', 'text' => __('Payment Declined', 'event_espresso')), array('id' => 'Cancelled', 'text' => __('Cancelled', 'event_espresso')), array('id' => 'Incomplete', 'text' => __('Incomplete', 'event_espresso')), array('id' => 'Refund', 'text' => __('Overpaid', 'event_espresso')));
    echo select_input('payment_status', $values, $payment_status);
    ?>
									</li>
									<li>
										<label>
											<?php 
    _e('Total Amount Owing:', 'event_espresso');
    ?>
 ( <?php 
    echo $org_options['currency_symbol'];
    ?>
 )
										</label>
										<?php 
    $amount_owing = number_format($total_cost - $amount_pd, 2, '.', '');
    if ($amount_owing == 0.0) {
        $amnt_class = ' full-payment';
    } elseif ($amount_owing < $total_cost || $amount_owing > $total_cost) {
        $amnt_class = ' part-payment';
    } elseif ($amount_owing == $total_cost) {
        $amnt_class = ' no-payment';
    }
    ?>
									
										<input class="small-text algn-rght<?php 
    echo $amnt_class;
    ?>
" type="text" name="ttl_ow" disabled="true" value ="<?php 
    echo $amount_owing;
    ?>
" />
										<input type="hidden" name="total_owing" value ="<?php 
    echo $amount_owing;
    ?>
" />&nbsp;&nbsp;
										<a href="admin.php?page=events&event_admin_reports=edit_attendee_record&event_id=<?php 
    echo $event_id;
    ?>
&registration_id=<?php 
    echo $registration_id;
    ?>
&form_action=edit_attendee&show_payment=true">
											<?php 
    _e('Edit Ticket Price(s)', 'event_espresso');
    ?>
										</a>
									</li>
									<li>
										<label>
											<?php 
    _e('Total Amount Paid to Date:', 'event_espresso');
    ?>
 ( <?php 
    echo $org_options['currency_symbol'];
    ?>
 )
										</label>										
										<input class="small-text algn-rght<?php 
    echo $amnt_class;
    ?>
" type="text" name="amnt_pd" disabled="true" value ="<?php 
    echo $amount_pd;
    ?>
" />
										<input type="hidden" name="amount_pd" value ="<?php 
    echo $amount_pd;
    ?>
" />
									</li>
									<li>
										<label>
											<?php 
    _e('Enter New Payment Amount:', 'event_espresso');
    ?>
 ( <?php 
    echo $org_options['currency_symbol'];
    ?>
 )
										</label>										
										<input class="small-text algn-rght" type="text" name="new_payment" value ="" />
									</li>
									<li>
										<label>
											<?php 
    _e('Coupon Code:', 'event_espresso');
    ?>
										</label>
										<input type="text" class="medium-text" name="coupon_code" size="45" value ="<?php 
    echo $coupon_code;
    ?>
" />
									</li>
									<li>
										<label for="txn_type">
											<?php 
    _e('Transaction Type:', 'event_espresso');
    ?>
										</label>
										<?php 
    //												$txn_values=array(
    //													array('id' => '', 'text' => __('N/A', 'event_espresso')),
    //													array('id' => 'web_accept', 'text' => espresso_payment_type('web_accept')),
    //													array('id' => 'CC', 'text' => __('Credit Card', 'event_espresso')),
    //													array('id' => 'INV', 'text' => espresso_payment_type('INV')),
    //													array('id' => 'OFFLINE', 'text' => espresso_payment_type('OFFLINE')),
    //												);
    //												echo select_input('txn_type', $txn_values, $txn_type);
    ?>
											<input type="text" class="medium-text" name="txn_type" size="45" value ="<?php 
    echo stripslashes_deep(htmlentities($txn_type));
    ?>
" />
										</li>
									<li>
										<label>
											<?php 
    _e('Transaction ID: ', 'event_espresso');
    ?>
 <span class="smaller-text"><?php 
    _e('( or cheque #, gateway response, etc )', 'event_espresso');
    ?>
</span>
										</label>
										<input type="text" name="txn_id" size="45" value ="<?php 
    echo $txn_id;
    ?>
" />
									</li>
									<li>
										<label>
											<h4><?php 
    _e('Email Notice', 'event_espresso');
    ?>
</h4>
											<?php 
    _e('Do you want to send a payment received notice to registrant?', 'event_espresso');
    ?>
										</label>
										<label class="radio-btn-lbl">
											<input type="radio" name="send_payment_rec" value="send_message">
											<span class="big-text"><?php 
    _e('Yes', 'event_espresso');
    ?>
</span>
										</label>
										<label class="radio-btn-lbl">
											<input type="radio" name="send_payment_rec" checked value="N">
											<span class="big-text"><?php 
    _e('No', 'event_espresso');
    ?>
</span>
										</label>
									</li>
									<li>
										<p><br/><input type="submit" name="Submit" class="button-primary action"   value="Update Payment"></p>
									</li>
								</ul>
							</fieldset>
							<input type="hidden" name="id" value="<?php 
    echo $id;
    ?>
">
							<input type="hidden" name="registration_id" value="<?php 
    echo $registration_id;
    ?>
">
							<input type="hidden" name="form_action" value="payment">
							<input type="hidden" name="event_id" value="<?php 
    echo $event_id;
    ?>
">
							<input type="hidden" name="attendee_action" value="post_payment">
							<?php 
    wp_nonce_field('payment_' . $registration_id . '_post_payment_nonce');
    ?>
						</form>
					</td>
					<td valign="top">
						<form class="espresso_form" method='post' action="<?php 
    echo $_SERVER['REQUEST_URI'];
    ?>
">
							<input type="hidden" name="id" value="<?php 
    echo $id;
    ?>
">
							<input type="hidden" name="form_action" value="send_invoice">
							<input type="hidden" name="event_id" value="<?php 
    echo $event_id;
    ?>
">
							<input type="hidden" name="registration_id" value="<?php 
    echo $registration_id;
    ?>
">
							<?php 
    wp_nonce_field('send_invoice_' . $registration_id . '_nonce');
    ?>
							<ul>
								<li>
									<?php 
    _e('Use a ', 'event_espresso');
    ?>
									<a href="admin.php?page=event_emails" target="_blank">
									<?php 
    _e('pre-existing email', 'event_espresso');
    ?>
									</a>? <?php 
    echo espresso_db_dropdown('id', 'email_name', EVENTS_EMAIL_TABLE, 'email_name', '', 'desc') . ' <a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=email_manager_info"><img src="' . EVENT_ESPRESSO_PLUGINFULLURL . '/images/question-frame.png" width="16" height="16" /></a>';
    ?>
 </li>
								<li>
									<?php 
    _e('OR', 'event_espresso');
    ?>
								</li>
								<li>
									<?php 
    _e('Create a custom email:', 'event_espresso');
    ?>
								</li>
								<li>
									<?php 
    _e('Invoice Subject', 'event_espresso');
    ?>
									:
									<input type="text" name="invoice_subject" size="45" value="<?php 
    _e('Payment Reminder for [event]', 'event_espresso');
    ?>
" />
								</li>
								<li>
									<p>
										<?php 
    _e('Message:', 'event_espresso');
    ?>
									</p>
									<div class="postbox">
										<?php 
    $email_content = __('Dear [fname] [lname], <p>Our records show that we have not received your payment of [cost] for [event_link].</p> <p>Please visit [payment_url] to view your payment options.</p><p>[invoice_link]</p><p>Sincerely,<br />' . ($Organization = $org_options['organization'] . '</p>'), 'event_espresso');
    if (function_exists('wp_editor')) {
        $args = array("textarea_rows" => 8, "textarea_name" => "invoice_message", "editor_class" => "my_editor_custom");
        wp_editor(espresso_admin_format_content($email_content), "invoice_message", $args);
    } else {
        echo '<textarea name="invoice_message" class="theEditor" id="invoice_message">' . espresso_admin_format_content($email_content) . '</textarea>';
        espresso_tiny_mce();
    }
    ?>
										<table id="email-confirmation-form" cellspacing="0">
											<tbody>
												<tr>
													<td class="aer-word-count"></td>
													<td class="autosave-info"><span>&nbsp;</span></td>
												</tr>
											</tbody>
										</table>
										<p><a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=custom_email_info">
											<?php 
    _e('View Custom Email Tags', 'event_espresso');
    ?>
											</a> | <a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=custom_email_example">
											<?php 
    _e('Email Example', 'event_espresso');
    ?>
											</a></p>
									</div>
								</li>
								<?php 
    if ($org_options["use_attendee_pre_approval"] == "Y") {
        $pre_approve = is_attendee_approved($event_id, $id) == true ? 1 : 0;
        ?>
								<li>
									<?php 
        _e("Attendee approved?", "event_espresso");
        ?>
									:
									<?php 
        $pre_approval_values = array(array('id' => '0', 'text' => __('Yes', 'event_espresso')), array('id' => '1', 'text' => __('No', 'event_espresso')));
        echo select_input("pre_approve", $pre_approval_values, $pre_approve);
        ?>
									<br />
									<?php 
        _e("(If not approved then invoice will not be sent.)", "event_espresso");
        ?>
								</li>
								<?php 
    }
    ?>
								<li>
									<br/>
									<input type="submit" class="button-primary action"   name="Submit" value="Send Invoice">
								</li>
							</ul>
						</form>
					</td>
				</tr>
			</table>

		</div>
	</div>
</div>
<?php 
    //This show what tags can be added to a custom email.
    event_espresso_custom_email_info();
    //event_list_attendees();
}
Пример #8
0
function event_espresso_email_config_mnu()
{
    global $wpdb, $current_user, $espresso_premium;
    ?>


    <div class="wrap">
        <div id="icon-options-event" class="icon32"> </div>
        <h2><?php 
    echo _e('Manage Event Emails', 'event_espresso');
    ?>
            <?php 
    if (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'edit' && $_REQUEST['action'] != 'add_new_email') {
        echo '<a href="admin.php?page=event_emails&amp;action=add_new_email" class="button add-new-h2" style="margin-left: 20px;">' . __('Add New Email', 'event_espresso') . '</a>';
    }
    ?>
        </h2>
        <div id="poststuff" class="metabox-holder has-right-sidebar">
            <?php 
    event_espresso_display_right_column();
    ?>
            <div id="post-body">
                <div id="post-body-content">


                    <?php 
    if (!empty($_POST['delete_email'])) {
        if (is_array($_POST['checkbox'])) {
            while (list($key, $value) = each($_POST['checkbox'])) {
                $del_id = $key;
                //Delete email data
                $sql = "DELETE FROM " . EVENTS_EMAIL_TABLE . " WHERE id='{$del_id}'";
                $wpdb->query($sql);
            }
        }
        ?>
                        <div id="message" class="updated fade">
                            <p><strong>
                                    <?php 
        _e('Emails have been successfully deleted.', 'event_espresso');
        ?>
                                </strong></p>
                        </div>
                    <?php 
    }
    ?>
                    <?php 
    if (isset($_REQUEST['action'])) {
        switch ($_REQUEST['action']) {
            case 'update':
                update_event_email();
                break;
            case 'add':
                add_email_to_db();
                break;
            case 'add_new_email':
                add_new_event_email();
                break;
            case 'edit':
                edit_event_email();
                break;
        }
    }
    ?>

                    <p><?php 
    _e('Create customized emails for use in multiple events.', 'event_espresso');
    ?>
</p>
                    <form id="form1" name="form1" method="post" action="<?php 
    echo $_SERVER["REQUEST_URI"];
    ?>
">
                        <table id="table1" class="widefat manage-emails">
                            <thead>
                                <tr>
                                    <th class="manage-column column-cb check-column" id="cb" scope="col" style="width:3.5%;"><input type="checkbox"></th>
                                    <th class="manage-column column-comments num" id="id" style="padding-top:7px; width:3.5%;" scope="col" title="Click to Sort"><?php 
    _e('ID', 'event_espresso');
    ?>
</th>
                                    <th class="manage-column column-title" id="name" scope="col" title="Click to Sort" style="width:60%;"><?php 
    _e('Name', 'event_espresso');
    ?>
</th>
                                    <?php 
    if (function_exists('espresso_is_admin') && espresso_is_admin() == true) {
        ?>
                                        <th class="manage-column column-creator" id="creator" scope="col" title="Click to Sort" style="width:10%;"><?php 
        _e('Creator', 'event_espresso');
        ?>
</th>
                                    <?php 
    }
    ?>
                                    <th class="manage-column column-title" id="action" scope="col" title="Click to Sort" style="width:30%;"><?php 
    _e('Action', 'event_espresso');
    ?>
</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php 
    $sql = "SELECT * FROM " . EVENTS_EMAIL_TABLE . " e";
    if (function_exists('espresso_member_data') && (espresso_member_data('role') == 'espresso_event_manager' || espresso_member_data('role') == 'espresso_group_admin')) {
        $sql .= " JOIN {$wpdb->users} u on u.ID = e.wp_user WHERE e.wp_user = "******" ORDER BY e.id ASC");
        foreach ($results as $result) {
            $email_id = $result->id;
            $email_name = stripslashes($result->email_name);
            $email_text = stripslashes($result->email_text);
            $wp_user = $result->wp_user;
            ?>
                                        <tr>
                                            <td><input name="checkbox[<?php 
            echo $email_id;
            ?>
]" type="checkbox"  title="Delete <?php 
            echo stripslashes($email_name);
            ?>
"></td>
                                            <td><?php 
            echo $email_id;
            ?>
</td>
                                             <td class="post-title page-title column-title"><strong><a href="admin.php?page=event_emails&action=edit&id=<?php 
            echo $email_id;
            ?>
"><?php 
            echo $email_name;
            ?>
</a></strong>
              <div class="row-actions"><span class="edit"><a href="admin.php?page=event_emails&action=edit&id=<?php 
            echo $email_id;
            ?>
"><?php 
            _e('Edit', 'event_espresso');
            ?>
</a> | </span><span class="delete"><a onclick="return confirmDelete();" class="delete submitdelete" href="admin.php?page=event_emails&action=delete_email&id=<?php 
            echo $email_id;
            ?>
"><?php 
            _e('Delete', 'event_espresso');
            ?>
</a></span></div>
              </td>
                                            <?php 
            if (function_exists('espresso_user_meta') && espresso_is_admin() == true) {
                ?>
                                                <td><?php 
                echo espresso_user_meta($wp_user, 'user_firstname') != '' ? espresso_user_meta($wp_user, 'user_firstname') . ' ' . espresso_user_meta($wp_user, 'user_lastname') : espresso_user_meta($wp_user, 'display_name');
                ?>
</td>
                                            <?php 
            }
            ?>
                                            <td><a href="admin.php?page=event_emails&action=edit&id=<?php 
            echo $email_id;
            ?>
">
                                                    <?php 
            _e('Edit Email', 'event_espresso');
            ?>
                                                </a></td>
                                        </tr>
                                    <?php 
        }
    }
    ?>
                            </tbody>
                        </table>
                        <p>

                            <input type="checkbox" name="sAll" onclick="selectAll(this)" />
                            <strong>
                                <?php 
    _e('Check All', 'event_espresso');
    ?>
                            </strong>
                            <input name="delete_email" type="submit" class="button-secondary" id="delete_email" value="<?php 
    _e('Delete Email', 'event_espresso');
    ?>
" style="margin-left:100px;" onclick="return confirmDelete();"> <?php 
    echo '<a href="admin.php?page=event_emails&amp;action=add_new_email" style="margin-left:5px"class="button-primary">' . __('Add New Email', 'event_espresso') . '</a>';
    ?>
                        </p>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <script>
        jQuery(document).ready(function($) {

            /* show the table data */
            var mytable = $('#table1').dataTable( {
                "bStateSave": true,
                "sPaginationType": "full_numbers",

                "oLanguage": {	"sSearch": "<strong><?php 
    _e('Live Search Filter', 'event_espresso');
    ?>
:</strong>",
                    "sZeroRecords": "<?php 
    _e('No Records Found!', 'event_espresso');
    ?>
" },
                "aoColumns": [
                    { "bSortable": false },
                    null,
                    null,
    <?php 
    echo function_exists('espresso_is_admin') && espresso_is_admin() == true ? 'null,' : '';
    ?>
                    null,

                ]

            } );

        } );
    </script>

    <?php 
    echo event_espresso_custom_email_info();
}