function send_confirmation_email($data) { global $organization_details, $customer_email, $event_details; $data['eb'] = ''; $default_email_body = $this->epl->load_view('front/registration/regis-confirm-email', $data, true); $_notif = epl_get_element('_epl_event_notification', $event_details); $_notif_data = array(); if ($_notif && (!epl_is_empty_array($_notif) || $_notif != '')) { $id = is_array($_notif) ? current($_notif) : $_notif; $_notif_data = get_post($id, ARRAY_A) + (array) $this->ecm->get_post_meta_all($id); $data['eb'] = nl2br($this->notif_tags(stripslashes_deep(html_entity_decode($_notif_data['post_content'], ENT_QUOTES)))); } if (epl_is_empty_array($_notif) || $_notif == '' || epl_get_element('_epl_notification_replace', $event_details, 0) == 0) { $email_body = $this->epl->load_view('front/registration/regis-confirm-email', $data, true); } else { $email_body = $data['eb']; } $email_body = preg_replace('/<div class=\'epl_(.*?)_message\'>(.*?)<\\/div>/', '', $email_body); $from_name = html_entity_decode(epl_get_element('_epl_email_from_name', $_notif_data, get_bloginfo('name')), ENT_QUOTES); $from_email = epl_get_element('_epl_from_email', $_notif_data, get_bloginfo('admin_email')); $subject = html_entity_decode(epl_get_element('_epl_email_subject', $_notif_data, epl__('Registration Confirmation')), ENT_QUOTES); $headers = "From: \"" . $from_name . "\" <{$from_email}> \r\n"; $headers .= 'Reply-To: ' . $from_email . "\r\n"; $headers .= 'X-Mailer: PHP/' . phpversion(); $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=UTF-8\r\n"; if (isset($customer_email) && $customer_email != '') { @wp_mail($customer_email, $subject, $email_body, $headers); } //admin email $_email = epl_get_event_property('_epl_alt_admin_email'); if ($_email == '') { $_email = epl_nz(epl_get_event_option('epl_default_notification_email'), get_bloginfo('admin_email')); } @wp_mail($_email, epl__('New Registration') . ': ' . get_the_event_title(), $default_email_body, $headers); }
function create_new_regis_record($args = array()) { $_post = array('post_type' => 'epl_registration', 'post_title' => strtoupper($this->epl_util->make_unique_id(epl_nz(epl_get_regis_setting('epl_regis_id_length'), 10))), 'post_content' => '', 'post_status' => 'draft'); return wp_insert_post($_post); }
function payment_info_box($post_ID = null) { if (is_null($post_ID)) { $post_ID = (int) $_POST['post_ID']; } if ($GLOBALS['epl_ajax'] || !isset($this->meta)) { $this->meta = $this->ecm->get_post_meta_all($post_ID, true); } $data['post_ID'] = $post_ID; $data['regis_status'] = isset($this->meta['_epl_regis_status']) ? $this->ind_fields['_epl_regis_status']['options'][$this->meta['_epl_regis_status']] : ''; $data['payment_method'] = isset($this->meta['_epl_payment_method']) && $this->meta['_epl_payment_method'] != '' ? $this->ind_fields['_epl_payment_method']['options'][$this->meta['_epl_payment_method']] : ''; $grand_total = epl_get_formatted_curr(epl_nz($this->meta['_epl_grand_total'], 0)); $amount_paid = epl_get_formatted_curr(epl_nz($this->meta['_epl_payment_amount'], 0)); $data['amount_paid'] = epl_get_currency_symbol() . $amount_paid; $data['grand_total'] = epl_get_currency_symbol() . $grand_total; $href = esc_url(add_query_arg(array('epl_action' => 'epl_payment_snapshot', 'post_ID' => $post_ID), $_SERVER['REQUEST_URI'])); $data['snapshot_link'] = '<a data-post_id = "' . $post_ID . '" class="epl_payment_snapshot" href="#"><img src="' . EPL_FULL_URL . 'images/application_view_list.png" /> </a>'; //$data['snapshot_link'] = '<img id = "' . $post_ID . '" class="epl_payment_snapshot" src="' . EPL_FULL_URL . 'images/application_view_list.png" />'; $data['status_class'] = 'epl_status_pending'; if ($this->meta['_epl_regis_status'] == 5) { $data['status_class'] = 'epl_status_paid'; } if ($this->meta['_epl_regis_status'] == 10 || $this->meta['_epl_regis_status'] == 15) { $data['status_class'] = 'epl_status_cancelled'; } return $this->epl->load_view('admin/registrations/regis-list-payment-info', $data, true); }
function time_price_section($param = null) { $rows_to_display = $this->edit_mode ? epl_nz(count($this->data['values']['_epl_start_time']), 1) : 1; $data['epl_price_parent_time_id_key'] = isset($this->data['values']['_epl_price_parent_time_id']) ? $this->data['values']['_epl_price_parent_time_id'] : ''; $epl_fields_to_display = array_keys($this->fields['epl_time_fields']); $_field_args = array('section' => $this->fields['epl_time_fields'], 'fields_to_display' => $epl_fields_to_display, 'meta' => array('_view' => 'raw', '_type' => 'row', '_rows' => $rows_to_display, 'value' => $this->data['values'])); $data['time_fields'] = $this->epl_util->render_fields($_field_args); $data['time_field_labels'] = $this->epl_util->extract_labels($this->fields['epl_time_fields']); //when a new event is opened for creation, the parent id key //needs to be passed to a hidden field for time specific pricing type if (!$this->edit_mode) { /* preg_match( '/\[.+\]/', key( $data['time_fields'] ), $_first_time_key ); $_first_time_key = str_replace( array( '[', ']' ), '', current( ( array ) $_first_time_key ) ); */ $_first_time_key = key($data['time_fields']); $this->fields['epl_price_fields']['_epl_price_parent_time_id']['default_value'] = $_first_time_key; } $list_of_forms = $this->ecm->_get_fields('epl_forms'); $_o = array(); foreach ((array) $list_of_forms as $form_key => $form_atts) { $_o[$form_key] = $form_atts['epl_form_label']; } $this->fields['epl_price_fields']['_epl_price_forms']['options'] = $_o; if (isset($this->fields['epl_price_fields']['_epl_price_to_offset'])) { $this->fields['epl_price_fields']['_epl_price_to_offset']['options'] = $this->data['values']['_epl_price_name']; } $rows_to_display = $this->edit_mode ? epl_nz(count($this->data['values']['_epl_price_name']), 1) : 1; $epl_fields_to_display = array_keys($this->fields['epl_price_fields']); $_field_args = array('section' => $this->fields['epl_price_fields'], 'fields_to_display' => $epl_fields_to_display, 'meta' => array('_view' => 'raw', '_type' => 'row', '_rows' => $rows_to_display, 'value' => $this->data['values'])); //echo "<pre class='prettyprint'>" . __LINE__ . "> " . print_r($this->fields['epl_price_fields'], true). "</pre>"; $data['price_fields'] = $this->epl_util->render_fields($_field_args); $data['price_field_labels'] = $this->epl_util->extract_labels($this->fields['epl_price_fields']); //$data['surcharge_section'] = $this->surcharge_section(); return $this->epl->load_view('admin/events/time-price-' . $this->pricing_type, $data, true); }
if ($payment_amount > $_a['price']) { $_a['paid_per_class'] = $_a['price']; } else { $_a['paid_per_class'] = $payment_amount / $row->num_dates / $row->total_quantity; } } $_a['paid_per_class'] -= $true_discount; $_a['paid_per_class'] += $donation; if ($row->total_quantity >= 1 && $payment_amount < $row->price * $row->total_quantity * $row->num_dates) { $_a['paid_per_class'] = $payment_amount / $row->num_dates / $row->total_quantity; } if ($row->total_quantity == 1 && $payment_amount < $row->price) { $_a['paid_per_class'] = $payment_amount; } } $_a['paid_per_class'] = epl_get_formatted_curr(epl_nz($_a['paid_per_class'], 0)); $total_revenue += str_replace(',', '', $_a['paid_per_class']); unset($_a['paid_per_class']); //attendee data $form_data = $erptm->get_form_data($row->regis_id, $row->event_id, $form_counter); $_f = array(); if ($form_data) { foreach ($form_data as $f) { if (strpos($f->field_id, EPL_PLUGIN_DB_DELIM)) { $fields = explode(EPL_PLUGIN_DB_DELIM, $f->field_id); $values = explode(EPL_PLUGIN_DB_DELIM, $f->value); } else { $fields = array($f->field_id); $values = array($f->value); } $full = array_combine($fields, $values);
function common_js_files() { global $epl_wp_localize_script_args; $_f = array('F', 'm', 'Y', 'j', 'l', 'd', 'S'); $_r = array('MM', 'mm', 'yy', 'd', 'DD', 'dd', ''); //$date_format_for_dp = (strpos('F', get_option( 'date_format' ) === false))?str_ireplace('Y','yy',get_option( 'date_format' )):'m/d/yy'; $date_format_for_dp = str_replace($_f, $_r, epl_nz(epl_get_general_setting('epl_admin_date_format'), get_option('date_format'))); wp_enqueue_script('jquery'); wp_enqueue_script('jquery-migrate-js', "//code.jquery.com/jquery-migrate-1.2.1.min.js", array('jquery')); if (EPL_IS_ADMIN || epl_user_is_admin()) { wp_enqueue_script('select2', $this->epl->load_asset('js/select2.min.js'), array('jquery')); } wp_enqueue_script('events_planner_js', $this->epl->load_asset('js/events-planner.js'), array('jquery')); wp_enqueue_script('tipsy-js', EPL_FULL_URL . 'js/tipsy.js', array('jquery')); wp_enqueue_script('full-calendar-js', $this->epl->load_asset('js/fullcalendar.min.js'), array('jquery')); wp_enqueue_script('jquery-form-js', $this->epl->load_asset('js/jquery.validate.min.js'), array('jquery')); //wp_enqueue_script( 'datatables-js', epl_get_protocol() . '://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js' ); wp_enqueue_script('datatables-js', $this->epl->load_asset('js/jquery.dataTables.min.js'), array('jquery')); $epl_wp_localize_script_args = array('ajaxurl' => admin_url('admin-ajax.php', epl_get_protocol()), 'plugin_url' => EPL_FULL_URL, 'date_format' => $date_format_for_dp, 'time_format' => get_option('time_format'), 'firstDay' => get_option('start_of_week'), 'yearRange' => 'c-10:c+10', 'sc' => epl_sc_is_enabled() ? 1 : 0, 'debug' => EPL_DEBUG ? 1 : 0, 'cart_added_btn_txt' => epl__('In the cart (View)')); $epl_wp_localize_script_args = apply_filters('epl_wp_localize_script_args', $epl_wp_localize_script_args); wp_localize_script('events_planner_js', 'EPL', $epl_wp_localize_script_args); do_action('epl_init_common_js_files', $this); return $this; }
function stripe_process() { global $event_details, $cart_totals; $event_id = $event_details['ID']; $regis_id = $this->erm->get_regis_id(); $post_ID = $this->erm->get_regis_post_id(); $this->epl->load_file('libraries/gateways/stripe/Stripe.php'); $this->ecm->setup_event_details($event_id); $_totals = $this->erm->calculate_cart_totals(true); $gateway_info = $this->erm->get_gateway_info(); $secret_key = $gateway_info['_epl_secret_key']; $publishable_key = $gateway_info['_epl_publishable_key']; $data['stripe'] = array("secret_key" => $secret_key, "publishable_key" => $publishable_key); Stripe::setApiKey($data['stripe']['secret_key']); // Get the credit card details submitted by the form $token = $_POST['stripeToken']; // Create the charge on Stripe's servers - this will charge the user's card try { $charge = Stripe_Charge::create(array("amount" => epl_get_balance_due() * 100, "currency" => strtolower(epl_nz(epl_get_general_setting('epl_currency_code'), 'USD')), "card" => $token, "description" => $event_details['post_title'], "metadata" => array("regis_id" => $post_ID))); $data['post_ID'] = $post_ID; $data['_epl_grand_total'] = $cart_totals['money_totals']['grand_total']; $data['_epl_payment_amount'] = $cart_totals['money_totals']['grand_total']; $data['_epl_payment_date'] = current_time('mysql'); $data['_epl_payment_method'] = $this->erm->get_payment_profile_id(); $data['_epl_transaction_id'] = $charge->id; $data['_epl_prediscount_total'] = epl_get_element('pre_discount_total', $cart_totals['money_totals'], 0); $data['_epl_discount_amount'] = epl_get_element('discount_amount', $cart_totals['money_totals'], 0); $data = apply_filters('epl_stripe_response_data', $data); $this->erm->update_payment_data($data); return true; } catch (Stripe_CardError $e) { $body = $e->getJsonBody(); $err = $body['error']; return '<div class="epl_error">Error: ' . $err['message'] . '</div>'; } }
function get_the_dates() { global $multi_time; $data['date'] = array(); $data['time'] = array(); $datesregis_meta = $this->event_meta['_epl_start_date']; $input_type = epl_nz($this->event_meta['_epl_event_type'], 5) == 5 ? 'radio' : 'checkbox'; foreach ($datesregis_meta as $event_date_id => $event_date) { $value = $this->regis_meta['__epl'][$this->regis_id]['_dates']['_epl_start_date'][$this->event_meta['ID']]; $start_date = $this->event_meta['_epl_start_date'][$event_date_id]; $end_date = $this->event_meta['_epl_start_date'][$event_date_id]; $end_date = $start_date != $end_date ? ' - ' . $end_date : ''; $epl_fields = array('input_type' => $input_type, 'input_name' => "epl_start_date[{$this->event_meta['ID']}][]", 'options' => array($event_date_id => $start_date . $end_date), 'default_checked' => 1, 'display_inline' => true, 'value' => $value); $ok_to_register = epl_is_ok_to_register($this->event_meta, $event_date_id); if ($ok_to_register !== true) { $epl_fields['readonly'] = 1; $epl_fields['default_checked'] = 0; $epl_fields['options'][$event_date_id] .= $ok_to_register; } $epl_fields += (array) $this->overview_trigger; //has to register for all dates. if ($this->event_meta['_epl_event_type'] != 6) { //$epl_fields['readonly'] = 1; } if ($this->mode == 'overview' && !in_array($event_date_id, (array) $value)) { } else { $data['date'][] = $this->epl_util->create_element($epl_fields); } if ($multi_time) { $data['time'][] = $this->_get_time_fields($event_date_id); } //} } return $this->epl->load_view('front/cart/cart-dates', $data, true); }
function payment_info_box($post_ID = null) { global $regis_details; if (is_null($post_ID)) { $post_ID = (int) $_POST['post_ID']; } if ($GLOBALS['epl_ajax'] || !isset($this->regis_meta)) { $regis_details = $this->regis_meta = $this->ecm->setup_regis_details($post_ID, true); } $this->temp_set_payment_method_id(); $data['post_ID'] = $post_ID; //$data['event_id'] = $this->event_id; $data['regis_status_id'] = $this->regis_meta['_epl_regis_status']; $data['regis_status'] = isset($this->regis_meta['_epl_regis_status']) ? $this->ind_fields['_epl_regis_status']['options'][$this->regis_meta['_epl_regis_status']] : ''; $data['payment_method'] = isset($this->regis_meta['_epl_payment_method']) && $this->regis_meta['_epl_payment_method'] != '' ? $this->ind_fields['_epl_payment_method']['options'][$this->regis_meta['_epl_payment_method']] : ''; $data += $this->get_waitlist_info(); $grand_total = get_the_regis_total_amount(false); //epl_get_formatted_curr( epl_nz( $this->regis_meta['_epl_grand_total'], 0 ) ); $amount_paid = epl_get_formatted_curr(epl_nz($this->regis_meta['_epl_payment_amount'], 0)); $data['grand_total'] = epl_get_formatted_curr($grand_total, null, true); $href = add_query_arg(array('epl_action' => 'epl_payment_snapshot', 'post_ID' => $post_ID), epl_get_url()); $data['snapshot_link'] = '<a data-post_id = "' . $post_ID . '" class="epl_payment_snapshot" href="#"><img src="' . EPL_FULL_URL . 'images/application_view_list.png" /> </a>'; //$data['snapshot_link'] = '<img id = "' . $post_ID . '" class="epl_payment_snapshot" src="' . EPL_FULL_URL . 'images/application_view_list.png" />'; $data['status_class'] = 'epl_status_pending'; if ($this->regis_meta['_epl_regis_status'] == 1) { $data['status_class'] = 'epl_status_incomplete'; } elseif ($this->regis_meta['_epl_regis_status'] == 5) { $data['status_class'] = 'epl_status_paid'; } elseif ($this->regis_meta['_epl_regis_status'] == 10) { $data['status_class'] = 'epl_status_cancelled'; } elseif ($this->regis_meta['_epl_regis_status'] == 15) { $data['status_class'] = 'epl_status_refunded'; } elseif ($this->regis_meta['_epl_regis_status'] == 20) { $data['status_class'] = 'epl_status_waitlist'; } return $this->epl->load_view('admin/registration/regis-list-payment-info', $data, true); }
function _exp_checkout_do_payment() { global $event_details; $event_id = $event_details['ID']; if (is_null($event_id)) { return false; } $regis_id = $this->erm->get_regis_id(); $post_ID = $_SESSION['__epl']['post_ID']; $this->ecm->setup_event_details($event_id); $_totals = $this->erm->calculate_totals(); $this->epl->load_file('libraries/gateways/paypal/paypal.php'); $paypal = new EPL_Paypal(); $requestParams = array('TOKEN' => $_GET['token'], 'PAYMENTACTION' => 'Sale', 'PAYERID' => $_GET['PayerID'], 'PAYMENTREQUEST_0_AMT' => $_totals['money_totals']['grand_total'], 'PAYMENTREQUEST_0_CURRENCYCODE' => epl_nz(epl_get_general_setting('epl_currency_code'), 'USD')); $response = $paypal->request('DoExpressCheckoutPayment', $requestParams); if (is_array($response) && $response['ACK'] == 'Success') { $data['post_ID'] = $post_ID; $data['_epl_regis_status'] = '5'; $data['_epl_grand_total'] = $_totals['money_totals']['grand_total']; $data['_epl_payment_amount'] = $response['PAYMENTINFO_0_AMT']; $data['_epl_payment_date'] = current_time('mysql'); $data['_epl_payment_method'] = '_pp_exp'; $data['_epl_transaction_id'] = $response['PAYMENTINFO_0_TRANSACTIONID']; $data = apply_filters('epl_pp_exp_response_data', $data, $response); $this->erm->update_payment_data($data); return true; //echo "DONE"; } else { //display error message return 'ERROR: ' . $response['L_SHORTMESSAGE0'] . '. ' . $response['L_LONGMESSAGE0']; } }
function get_the_regis_payment_amount() { global $regis_details, $event_details; return epl_get_currency_symbol() . epl_get_formatted_curr(epl_nz($regis_details['_epl_payment_amount'])); }
<?php $display_note_field = epl_nz(epl_get_event_option('epl_date_note_enable'), 10) == 10; $display_location_dd = epl_nz(epl_get_event_option('epl_date_location'), 10) == 10; ?> <?php echo epl_show_ad('Control Registration Start and End times in the pro version.'); ?> <table class="epl_form_data_table" cellspacing ="0" id="epl_dates_table"> <thead> <th></th> <?php //echo epl_get_the_labels( $date_field_labels ); ?> <th colspan="3"><img src="<?php echo EPL_FULL_URL; ?> images/calendar.png" class="load_fullcalendar epl_cur_pointer epl_fr" /></th> </thead> <tfoot> <tr> <td colspan="7" style="vertical-align: middle;"> <a href="#" class="add_table_row"><img src ="<?php echo EPL_FULL_URL; ?> images/add.png" /></a> </td> </tr>
function event_list_search() { $this->shortcode_atts['display'] = esc_attr(epl_nz(epl_get_element('result_view', $_POST), 'list')); $this->shortcode_atts['display_cols'] = esc_attr(epl_nz(epl_get_element('display_cols', $_POST))); add_filter('epl_event_list_query_args', array($this, '_epl_event_list_query_arg')); add_filter('epl_event_list_args', array($this, '_epl_event_list_args')); //add_filter( 'posts_clauses', array( $this, '_intercept_query_clauses' ), 20, 1 ); $r = $this->respond(); if (!$GLOBALS['epl_ajax']) { return $this->respond(); } echo $this->epl_util->epl_response(array('html' => $r)); die; }
function send_confirmation_email($data) { global $organization_details, $customer_email, $event_details, $email_regis_form; //$data['email_body'] = ''; $attach_pdf = epl_get_setting('epl_api_option_fields', 'epl_invoice_attach_to_conf', 0) == 10 && epl_is_addon_active('_epl_atp'); $attach_pdf = apply_filters('epl_attach_invoice_to_conf_email', $attach_pdf); $defaults = array('admin_subject' => epl__('New Registration'), 'subject' => epl__('Registration Confirmation')); $default_email_body = $this->epl->load_view('email/default/template-no-custom', $data, true); $_notif = epl_get_element('_epl_event_notification', $event_details); if (epl_is_waitlist_flow()) { $_notif = epl_get_element('_epl_waitlist_notification', $event_details); $defaults['admin_subject'] = epl__('New Waitlist Addition'); } $_notif_data = array(); if (epl_sc_is_enabled() && !epl_is_waitlist_flow()) { $_notif = epl_get_setting('epl_sc_options', 'epl_sc_notification'); } if ($_notif && (!epl_is_empty_array($_notif) || $_notif != '')) { $id = is_array($_notif) ? current($_notif) : $_notif; $_notif_data = get_post($id, ARRAY_A) + (array) $this->ecm->get_post_meta_all($id); $data['email_body'] = $this->notif_tags($_notif_data['post_content'], $data); } if (epl_is_empty_array($_notif) || $_notif == '') { $email_template = 'email/default/template-no-custom'; $email_template_name = epl_get_element('_epl_email_template', $_notif_data); $email_template = $email_template_name ? 'email/' . $email_template_name . '/template.php' : $email_template; $data['base_url'] = EPL_EMAIL_TEMPLATES_URL . $email_template_name . '/'; $email_body = $this->epl->load_view($email_template, $data, true); } else { $email_body = $data['email_body']; } $email_body = preg_replace('/<div class=\'epl_(.*?)_message\'>(.*?)<\\/div>/', '', $email_body); $from_name = stripslashes_deep(html_entity_decode(epl_get_element('_epl_email_from_name', $_notif_data, get_bloginfo('name')), ENT_QUOTES)); $from_email = epl_get_element('_epl_from_email', $_notif_data, get_bloginfo('admin_email')); $subject = stripslashes_deep(html_entity_decode(epl_get_element('_epl_email_subject', $_notif_data, $defaults['subject']), ENT_QUOTES)); $headers = "From: \"" . $from_name . "\" <{$from_email}> \r\n"; $headers .= 'Reply-To: ' . $from_email . "\r\n"; $headers .= 'X-Mailer: PHP/' . phpversion(); $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=UTF-8\r\n"; if ($attach_pdf) { $invoice = $this->erptm->invoice($data['post_ID']); $data['attachment'] = $this->make_pdf($invoice, true, true); } if (isset($customer_email) && count($customer_email) > 0) { $to = implode(',', $customer_email); @wp_mail($to, $subject, $email_body, $headers, epl_get_element('attachment', $data, null)); } //admin email $_email = epl_get_event_property('_epl_alt_admin_email'); if ($_email == '') { $_email = epl_nz(epl_get_event_option('epl_default_notification_email'), get_bloginfo('admin_email')); } $admin_email = array('email' => $_email, 'title' => $defaults['admin_subject'] . ': ' . get_the_event_title(), 'email_body' => $email_body, 'headers' => $headers, 'data' => $data); $admin_email = apply_filters('epl_admin_send_confirmation_email_args', $admin_email); @wp_mail($admin_email['email'], $admin_email['title'], $admin_email['email_body'], $admin_email['headers'], epl_get_element('attachment', $admin_email['data'], null)); if ($attach_pdf) { $this->delete_file($data['attachment']); } }
?> <?php echo get_the_location_zip(); ?> <br /> <?php echo get_the_location_phone(); ?> <br /> </div> <?php } //organization id is stored in $event_details['_epl_event_organization'] if (epl_nz(epl_get_event_property('_epl_display_org_info'), 10) != 0) { ?> <div class ="event_organization"> <span class="heading">Hosted By</span> <a href="<?php echo get_permalink($event_details['_epl_event_organization']); ?> " title="<?php echo get_the_organization_name(); ?> "><?php echo get_the_organization_name(); ?> </a><br /> <?php
function avail_spaces($cap, $num_regis) { return absint($cap - epl_nz($num_regis, 0)); }
function epl_excel_attendee_list() { $event_id = $_REQUEST['event_id']; $_totals = $this->get_event_regis_snapshot($_REQUEST['event_id']); //echo "<pre class='prettyprint'>" . print_r( $_totals, true ) . "</pre>"; $this->set_event_regis_post_ids($_REQUEST['event_id']); global $event_details; //epl_log( "debug", "<pre>" . __LINE__ . '> ' . print_r($event_details, true ) . "</pre>" ); $event_title = $event_details['post_title']; $filename = str_replace(" ", "-", $event_title) . "_" . date_i18n("m-d-Y"); /* header( "Content-type: application/x-msdownload; charset=UTF-8", true, 200 ); header( "Content-Disposition: attachment; filename={$filename}.csv" ); header( "Pragma: no-cache" ); header( "Expires: 0" ); */ //$this->setup_event_details( $event_id ); $this->get_values(); //echo "<pre class='prettyprint'>" . print_r($event_details, true). "</pre>"; $event_ticket_buyer_forms = array_flip((array) $event_details['_epl_primary_regis_forms']); $event_addit_forms = isset($event_details['_epl_addit_regis_forms']) && $event_details['_epl_addit_regis_forms'] != '' ? array_flip($event_details['_epl_addit_regis_forms']) : array(); //find the list of all forms $available_forms = $this->get_list_of_available_forms(); $available_fields = $this->get_list_of_available_fields(); //isolate the forms that are selected inside the event $ticket_buyer_forms = array_intersect_key($available_forms, $event_ticket_buyer_forms); $addit_forms = array_intersect_key($available_forms, $event_addit_forms); //This will combine all the fields in all the forms so that we can construct a header row. $tickey_buyer_fields = array(); foreach ($ticket_buyer_forms as $_form_id => $_form_info) { $tickey_buyer_fields += $_form_info['epl_form_fields']; } $event_addit_fields = array(); foreach ($addit_forms as $_form_id => $_form_info) { $event_addit_fields += $_form_info['epl_form_fields']; } $epl_fields_inside_form = array_flip($tickey_buyer_fields); //get the field ids inside the form $epl_addit_fields_inside_form = array_flip($event_addit_fields); //get the field ids inside the form //when creating a form in form manager, the user may rearrange fields. Find their desired order $epl_fields_to_display = $this->epl_util->sort_array_by_array($available_fields, $epl_fields_inside_form); $epl_addit_fields_to_display = $this->epl_util->sort_array_by_array($available_fields, $epl_addit_fields_inside_form); $epl_fields_to_display = $epl_fields_to_display + $epl_addit_fields_to_display; $csv_row = ''; $header_row = array(); $header_pulled = false; $row = array(); $header_row[] = ''; $header_row[] = epl__('Registration ID'); //$header_row[] = epl__( 'Regis Date' ); //$header_row[] = epl__( 'Event Date' ); //$header_row[] = epl__( 'Time' ); $header_row[] = epl__('Ticket'); $header_row[] = epl__('Status'); $header_row[] = epl__('Payment Method'); $header_row[] = epl__('Total'); $header_row[] = epl__('Amount Paid'); $regis_ids = $this->get_event_regis_post_ids(false); //as of 1.1, the dates are stored as timestamps. //This will format the date for display based on the settings admin date format. foreach ($event_details['_epl_start_date'] as $k => &$v) { $v = epl_admin_date_display($v); } $_d = array(); foreach ($regis_ids as $regis_id => $att_count) { //$regis_data = $this->get_post_meta_all( $regis_id ); $regis_data = $this->setup_regis_details($regis_id); // epl_log( "debug", "<pre>" . __LINE__ . '> ' . print_r($regis_data, true ) . "</pre>" ); //Sometime there may be incomplete db records. These will cause issues below. //In those cases, skip and move to the next item if (!isset($regis_data['_epl_dates']['_epl_start_date'][$event_id])) { continue; } $event_times = $regis_data['_epl_dates']['_epl_start_time'][$event_id]; $event_prices = $regis_data['_epl_dates']['_epl_start_time'][$event_id]; $regis_date = implode(' & ', array_intersect_key($event_details['_epl_start_date'], array_flip((array) $regis_data['_epl_dates']['_epl_start_date'][$event_id]))); $regis_time = implode(' & ', array_intersect_key($event_details['_epl_start_time'], array_flip((array) $regis_data['_epl_dates']['_epl_start_time'][$event_id]))); $date_labels = array(); $date_labels[0] = ''; $time_labels = array(); $time_labels[0] = ''; $ticket_labels = array(); $ticket_labels[0] = $att_count; $purchased_tickets = (array) $regis_data['_epl_dates']['_att_quantity'][$event_id]; $start = 1; foreach ($purchased_tickets as $price_id => $qty) { $_qty = is_array($qty) ? array_sum($qty) : $qty; //current( $qty ); if ($_qty > 0) { $date_label[] = current((array) $regis_data['_epl_dates']['_epl_start_date'][$event_id]); if (epl_get_element('_epl_pricing_type', $event_details) == 10) { if (in_array($event_details['_epl_price_parent_time_id'][$price_id], (array) $regis_data['_epl_dates']['_epl_start_time'][$event_id])) { $time_labels = array_pad($time_labels, $start + $_qty, epl_get_element($event_details['_epl_price_parent_time_id'][$price_id], $event_details['_epl_start_time'])); } else { $time_labels = array_pad($time_labels, $start + $_qty, ''); } } $ticket_labels = array_pad($ticket_labels, $start + $_qty, $event_details['_epl_price_name'][$price_id]); $start += $_qty; } } $_r = array(); $regis_status = isset($regis_data['_epl_regis_status']) ? $this->ind_fields['_epl_regis_status']['options'][$regis_data['_epl_regis_status']] : ''; $payment_method = isset($regis_data['_epl_payment_method']) && $regis_data['_epl_payment_method'] != '' ? $this->ind_fields['_epl_payment_method']['options'][$regis_data['_epl_payment_method']] : ''; $grand_total = epl_get_formatted_curr(epl_nz($regis_data['_epl_grand_total'], 0.0)); $amount_paid = epl_get_formatted_curr(epl_nz($regis_data['_epl_payment_amount'], 0.0)); for ($i = 0; $i <= $att_count; $i++) { $registrant = false; $attendee_info = $regis_data['_epl_attendee_info']; if ($i == 0) { $registrant = true; $row[] = epl__('Registrant'); } else { $row[] = epl_get_element('_epl_addit_regis_form_counter_label', $event_details, epl__('Attendee')); //$grand_total = ''; //$amount_paid = ''; //$regis_status = ''; //$payment_method = ''; } $row[] = $regis_data['__epl']['_regis_id']; //$row[] = $regis_data['post_date']; //$row[] = epl_escape_csv_val( $regis_date ); //$row[] = $regis_time; //(epl_is_date_level_time ( ))?$regis_time:$time_labels[$i]; // $row[] = htmlspecialchars_decode($ticket_labels[$i]); //$regis_price; $row[] = $regis_status; $row[] = $payment_method; $row[] = epl_get_currency_symbol($grand_total); $row[] = $amount_paid; foreach ($epl_fields_to_display as $field_id => $field_atts) { if (!$header_pulled) { $header_row[] = epl_escape_csv_val(html_entity_decode(htmlspecialchars_decode($field_atts['label']), ENT_QUOTES)); } $value = ''; $value = isset($attendee_info[$field_id][$event_id][$i]) ? $attendee_info[$field_id][$event_id][$i] : ''; if ($field_atts['input_type'] == 'select' || $field_atts['input_type'] == 'radio') { $value = isset($field_atts['epl_field_choice_text'][$value]) && $field_atts['epl_field_choice_text'][$value] != '' ? $field_atts['epl_field_choice_text'][$value] : $value; } elseif ($field_atts['input_type'] == 'checkbox') { $value = implode(',', array_intersect_key($field_atts['epl_field_choice_text'], array_flip((array) $value))); } else { $value = html_entity_decode(htmlspecialchars_decode(epl_get_element($i, $attendee_info[$field_id][$event_id])), ENT_QUOTES); } $row[] = htmlentity_decode($value, ENT_QUOTES); //decode special chars (Swedish, Nordic) //array_walk( $row, create_function( '&$item', '$item = utf8_decode($item);' ) ); } $header_pulled = true; if (!$registrant) { $_d[] = $row; } //$csv_row .= implode( ",", $row ) . "\r\n"; $row = array(); } } $filename = epl__('Attendee List') . ', ' . $event_title . ", " . date_i18n("F j, Y"); $this->excel_file_generator($header_row, $_d, $filename); //echo implode( ",", $header_row ) . "\r\n"; //echo $csv_row; exit; }
function epl_is_free_event() { global $event_details; if (epl_nz($event_details['_epl_free_event'], 0) == 10) { return true; } return false; }
function epl_avail_spaces($cap, $num_regis) { if ($cap === '' || $cap == 0) { return $cap; } $avail = intval($cap - epl_nz($num_regis, 0)); return $avail <= 0 ? 0 : $avail; }
<?php $legend_location = epl_nz(epl_get_setting('epl_fullcalendar_options', 'epl_fullcalendar_show_legend'), 0); $legend = array(); if ($legend_location != 0) { $legend[$legend_location] = ''; $terms = epl_object_to_array(get_terms('epl_event_categories')); $event_bcg_color = epl_get_setting('epl_fullcalendar_options', 'epl_fullcalendar_tax_bcg_color'); $event_font_color = epl_get_setting('epl_fullcalendar_options', 'epl_fullcalendar_tax_font_color'); foreach ($terms as $term) { $bc = epl_get_element($term['slug'], $event_bcg_color, '#ffffff'); $tc = epl_get_element($term['slug'], $event_font_color, 'blue'); $legend[$legend_location] .= "<span class='epl_fc_legend_cat' style='background-color:{$bc};color:{$tc}'>{$term['name']}</span>"; } $legend[$legend_location] = '<div class="epl_fc_legend">' . $legend[$legend_location] . '</div>'; } ?> <?php echo epl_get_element(1, $legend); ?> <div id='calendar'></div> <?php echo epl_get_element(10, $legend); ?> <script type='text/javascript'>
function construct_table_array($dates, $return_raw = false) { $r = array(); $date_format = epl_nz(epl_get_general_setting('epl_admin_date_format'), get_option('date_format')); /* * need to know registration start and end dates * need to know the constructed dates * */ //epl_log( "debug", "<pre>" . print_r( $dates, true ) . "</pre>" ); foreach ($dates as $year => $month) { foreach ($month as $_month => $_days) { foreach ($_days as $k => $v) { $_dd = strtotime(epl_admin_dmy_convert($v)); $_d = $return_raw ? $_dd : date_i18n($date_format, $_dd); //$_d =date_i18n( $date_format, $_dd ); //preserving the keys for dates that have already been saved. //Just in case there may be a registration that has been assigned to that date id $_u_k = array_search($_dd, epl_get_element('_epl_start_date', $this->values, array())); if ($_u_k === FALSE) { $_u_k = $this->epl_util->make_unique_id(); } $data['_epl_start_date'][$_u_k] = $_d; //$data['_epl_end_date'][$_u_k] =date_i18n( $date_format, strtotime( "+{$this->ind_event_length} day", $_dd ) ); $data['_epl_end_date'][$_u_k] = $return_raw ? strtotime("+{$this->ind_event_length} day", $_dd) : date_i18n($date_format, strtotime("+{$this->ind_event_length} day", $_dd)); if (isset($_POST['_epl_rec_regis_start_date']) && $_POST['_epl_rec_regis_start_date'] != '') { $data['_epl_regis_start_date'][$_u_k] = date_i18n($date_format, strtotime(epl_admin_dmy_convert($_POST['_epl_rec_regis_start_date']))); } elseif (isset($_POST['_epl_rec_regis_start_days_before_start_date']) && $_POST['_epl_rec_regis_start_days_before_start_date'] != '') { $data['_epl_regis_start_date'][$_u_k] = date_i18n($date_format, strtotime("-" . (int) $_POST['_epl_rec_regis_start_days_before_start_date'] . " day", $_dd)); } if (isset($_POST['_epl_rec_regis_end_date']) && $_POST['_epl_rec_regis_end_date'] != '') { $data['_epl_regis_end_date'][$_u_k] = date_i18n($date_format, strtotime(epl_admin_dmy_convert($_POST['_epl_rec_regis_end_date']))); } elseif (isset($_POST['_epl_rec_regis_end_days_before_start_date']) && $_POST['_epl_rec_regis_end_days_before_start_date'] != '') { $data['_epl_regis_end_date'][$_u_k] = date_i18n($date_format, strtotime("-" . (int) $_POST['_epl_rec_regis_end_days_before_start_date'] . " day", $_dd)); } if (isset($_POST['_epl_recurrence_capacity']) && $_POST['_epl_recurrence_capacity'] != '') { $data['_epl_date_capacity'][$_u_k] = (int) $_POST['_epl_recurrence_capacity']; } } } } if ($return_raw) { return $data; } //epl_log( "debug", "<pre>" . print_r($data, true ) . "</pre>" ); /* $rows_to_display = count( $data['_epl_start_date'] ); $fields_to_display = array_keys( $this->fields['epl_date_fields'] ); $_field_args = array( 'section' => $this->fields['epl_date_fields'], 'fields_to_display' => $fields_to_display, 'meta' => array( '_view' => 1, '_type' => 'row', '_rows' => $rows_to_display, 'value' => $data ) ); */ $rows_to_display = count($data['_epl_start_date']); $epl_fields_to_display = array_keys($this->fields['epl_date_fields']); $_field_args = array('section' => $this->fields['epl_date_fields'], 'fields_to_display' => $epl_fields_to_display, 'meta' => array('_view' => 'raw', '_type' => 'row', '_rows' => $rows_to_display, 'value' => $data)); $data['date_fields'] = $this->epl_util->render_fields($_field_args); $data['date_field_labels'] = $this->epl_util->extract_labels($this->fields['epl_date_fields']); //epl_log( "<pre>" . print_r($data['date_fields'], true ) . "</pre>", 1 ); //echo "<pre class='prettyprint'>" . print_r($data['date_fields'], true). "</pre>"; $r = $this->epl->load_view('admin/events/dates-section', $data, true); return $r; }
/* * Configuration fields for the event. * * DO NOT MODIFY. * * Visit wpeventsplanner.com for instructions */ global $epl_fields; $epl_fields['epl_event_type_fields'] = array('_epl_event_type' => array('deact' => false, 'input_type' => 'radio', 'input_name' => '_epl_event_type', 'options' => array(5 => sprintf(epl__('User can only register for %s one day %s.'), '<span class="epl_font_red">', '</span>')), 'default_value' => 5, 'default_checked' => 1)); $epl_fields['epl_event_type_fields'] = apply_filters('epl_event_type_fields', $epl_fields['epl_event_type_fields']); $epl_fields['epl_price_fields'] = array('_epl_price_name' => array('weight' => 10, 'input_type' => 'text', 'input_name' => '_epl_price_name[]', 'label' => epl__('Price Label'), 'class' => 'epl_w100pct req epl_font_bold', 'deact' => false, 'parent_keys' => true), '_epl_price' => array('weight' => 15, 'input_type' => 'text', 'input_name' => '_epl_price[]', 'label' => epl__('Price'), 'deact' => false, 'class' => 'epl_w70 req'), '_epl_member_price' => array('weight' => 17, 'input_type' => 'text', 'input_name' => '_epl_member_price[]', 'label' => epl__('Member Price'), 'class' => 'epl_w70 req'), '_epl_price_min_qty' => array('weight' => 20, 'input_type' => 'text', 'input_name' => '_epl_price_min_qty[]', 'label' => epl__('Min.'), 'class' => 'epl_w30 req', 'default_value' => 1), '_epl_price_max_qty' => array('weight' => 25, 'input_type' => 'text', 'input_name' => '_epl_price_max_qty[]', 'label' => epl__('Max.'), 'class' => 'epl_w30 req', 'default_value' => 1), '_epl_price_zero_qty' => array('weight' => 27, 'input_type' => 'select', 'input_name' => '_epl_price_zero_qty[]', 'label' => epl__('Show 0?'), 'options' => epl_yes_no(), 'default_value' => 10), '_epl_price_type' => array('weight' => 50, 'input_type' => 'select', 'input_name' => '_epl_price_type[]', 'label' => epl__('Type'), 'options' => array('att' => epl__('Attendee'), 'non_att' => epl__('Non-attendee')), 'default_value' => 1), '_epl_price_discountable' => array('weight' => 52, 'input_type' => 'select', 'input_name' => '_epl_price_discountable[]', 'label' => epl__('Discountable?'), 'options' => epl_yes_no(), 'default_value' => 10), '_epl_price_note' => array('weight' => 58, 'input_type' => 'text', 'input_name' => '_epl_price_note[]', 'label' => epl__('Note'), 'placeholder' => epl__('Note to Customer (Optional)'), 'class' => 'epl_w500'), '_epl_price_hide' => array('weight' => 200, 'input_type' => 'select', 'input_name' => '_epl_price_hide[]', 'options' => epl_yes_no(), 'label' => epl__('Hide')), '_epl_price_parent_time_id' => array('weight' => 500, 'input_type' => 'hidden', 'input_name' => '_epl_price_parent_time_id[]', 'default_value' => 0)); $epl_fields['epl_price_fields'] = apply_filters('epl_price_fields', $epl_fields['epl_price_fields']); uasort($epl_fields['epl_price_fields'], 'epl_sort_by_weight'); $epl_fields['epl_price_option_fields'] = array('_epl_free_event' => array('input_type' => 'select', 'input_name' => '_epl_free_event', 'label' => epl__('Is this a free event? '), 'options' => epl_yes_no(), 'default_value' => 0), '_epl_price_per' => array('input_type' => 'select', 'input_name' => '_epl_price_per', 'label' => epl__('Apply prices to'), 'help_text' => epl__('If you are offering multiple days, this will determine if the user pays per day or for the whole event.'), 'options' => array(0 => epl__('The Whole Event'), 10 => epl__('Each Event Date')))); $epl_fields['epl_price_option_fields'] = apply_filters('epl_price_option_fields', $epl_fields['epl_price_option_fields']); $epl_fields['epl_surcharge_fields'] = array('_epl_surcharge_label' => array('weight' => 2, 'input_type' => 'text', 'input_name' => '_epl_surcharge_label', 'label' => epl__('Surcharge Label'), 'help_text' => epl__('Label that will be displayed to the user'), 'default_value' => epl_get_regis_setting('epl_surcharge_label')), '_epl_surcharge_method' => array('weight' => 5, 'input_type' => 'select', 'input_name' => '_epl_surcharge_method', 'label' => epl__('Surcharge Method'), 'options' => array('add' => epl__('Add')), 'class' => ''), '_epl_surcharge_amount' => array('weight' => 10, 'input_type' => 'text', 'input_name' => '_epl_surcharge_amount', 'label' => epl__('Amount'), 'class' => 'epl_w60', 'data_type' => 'float', 'default_value' => epl_nz(epl_get_regis_setting('epl_surcharge_amount'), '0.00')), '_epl_surcharge_type' => array('weight' => 15, 'input_type' => 'select', 'input_name' => '_epl_surcharge_type', 'label' => epl__('Surcharge Type'), 'options' => array(5 => epl__('Fixed'), 10 => epl__('Percent')), 'default_value' => epl_get_regis_setting('epl_surcharge_before_discount')), '_epl_surcharge_before_discount' => array('weight' => 20, 'input_type' => 'select', 'input_name' => '_epl_surcharge_before_discount', 'label' => epl__('Apply surcharge'), 'options' => array(10 => epl__('Before discount'), 0 => epl__('After discount')), 'default_value' => epl_get_regis_setting('epl_surcharge_type'))); $epl_fields['epl_surcharge_fields'] = apply_filters('epl_surcharge_fields', $epl_fields['epl_surcharge_fields']); uasort($epl_fields['epl_surcharge_fields'], 'epl_sort_by_weight'); $epl_fields['epl_time_option_fields'] = array(); $epl_fields['epl_time_option_fields'] = apply_filters('epl_time_option_fields', $epl_fields['epl_time_option_fields']); $epl_fields['epl_time_fields'] = array('_epl_start_time' => array('weight' => 10, 'input_type' => 'text', 'input_name' => '_epl_start_time[]', 'label' => epl__('Start Time'), 'class' => 'epl_w80 timepicker req', 'parent_keys' => true), '_epl_end_time' => array('weight' => 15, 'input_type' => 'text', 'input_name' => '_epl_end_time[]', 'label' => epl__('End Time'), 'class' => 'epl_w80 timepicker req'), '_epl_time_hide' => array('weight' => 100, 'input_type' => 'select', 'input_name' => '_epl_time_hide[]', 'options' => epl_yes_no(), 'label' => epl__('Hide')), '_epl_time_note' => array('weight' => 60, 'input_type' => 'text', 'input_name' => '_epl_time_note[]', 'help_text' => '', 'placeholder' => epl__('Note (optional)'), 'class' => 'epl_w100pct')); $epl_fields['epl_time_fields'] = apply_filters('epl_time_fields', $epl_fields['epl_time_fields']); uasort($epl_fields['epl_time_fields'], 'epl_sort_by_weight'); $epl_fields['epl_date_fields'] = array('_epl_start_date' => array('weight' => 5, 'input_type' => 'text', 'input_name' => '_epl_start_date[]', 'label' => epl__('Start Date'), 'class' => 'epl_w100 datepicker req', 'query' => 1, 'data_type' => 'unix_time', 'parent_keys' => true, '__func' => 'epl_admin_date_display'), '_epl_end_date' => array('weight' => 10, 'input_type' => 'text', 'input_name' => '_epl_end_date[]', 'label' => epl__('End Date'), 'class' => 'epl_w100 datepicker req ', 'query' => 1, 'data_type' => 'unix_time', '__func' => 'epl_admin_date_display'), '_epl_regis_start_date' => array('weight' => 15, 'input_type' => 'text', 'input_name' => '_epl_regis_start_date[]', 'label' => epl__('Regis. Starts On'), 'class' => 'epl_w100 datepicker req', 'query' => 1, 'data_type' => 'unix_time', '__func' => 'epl_admin_date_display'), '_epl_regis_end_date' => array('weight' => 20, 'input_type' => 'text', 'input_name' => '_epl_regis_end_date[]', 'label' => epl__('Regis. Ends On'), 'class' => 'epl_w100 datepicker req', 'query' => 1, 'data_type' => 'unix_time', '__func' => 'epl_admin_date_display'), '_epl_date_capacity' => array('weight' => 25, 'input_type' => 'text', 'input_name' => '_epl_date_capacity[]', 'label' => epl__('Capacity'), 'class' => 'epl_w40'), '_epl_date_note' => array('weight' => 30, 'input_type' => 'text', 'input_name' => '_epl_date_note[]', 'help_text' => '', 'placeholder' => epl__('Note'), 'class' => 'epl_w400'), '_epl_date_location' => array('input_type' => 'select', 'input_name' => '_epl_date_location[]', 'empty_row' => true, 'options' => get_list_of_available_locations())); $epl_fields['epl_date_fields'] = apply_filters('epl_date_fields', $epl_fields['epl_date_fields']); uasort($epl_fields['epl_date_fields'], 'epl_sort_by_weight'); $epl_fields['epl_date_option_fields'] = array(); $epl_fields['epl_date_option_fields'] = apply_filters('epl_date_option_fields', $epl_fields['epl_date_option_fields']); $epl_fields['epl_class_session_fields'] = array('_epl_class_session_date' => array('weight' => 5, 'input_type' => 'text', 'input_name' => '_epl_class_session_date[]', 'label' => epl__('Session Date'), 'help_text' => '', 'class' => 'epl_w100 datepicker req', '__func' => 'epl_admin_date_display', 'data_type' => 'unix_time', 'parent_keys' => true), '_epl_class_session_name' => array('weight' => 10, 'input_type' => 'text', 'input_name' => '_epl_class_session_name[]', 'label' => epl__('Session Name'), 'help_text' => '', 'class' => 'epl_w100'), '_epl_class_session_note' => array('weight' => 15, 'input_type' => 'text', 'input_name' => '_epl_class_session_note[]', 'label' => epl__('Session Note'), 'help_text' => '', 'class' => 'epl_w200 ')); $epl_fields['epl_class_session_fields'] = apply_filters('epl_class_session_fields', $epl_fields['epl_class_session_fields']); uasort($epl_fields['epl_class_session_fields'], 'epl_sort_by_weight');