function _start_cart_session($start_new = false)
 {
     if ($start_new) {
         unset($_SESSION['__epl']);
         $_SESSION['__epl'] = array();
     }
     if (isset($_SESSION['__epl']['_regis_id'])) {
         $this->regis_id = $_SESSION['__epl']['_regis_id'];
     } else {
         $this->regis_id = strtoupper($this->epl_util->make_unique_id(epl_nz(epl_get_regis_setting('epl_regis_id_length'), 10)));
         $_SESSION['__epl']['_regis_id'] = $this->regis_id;
         $_SESSION['__epl']['_cart_time'] = time();
     }
 }
 function _exp_checkout_do_payment()
 {
     global $event_details, $cart_totals;
     $event_id = $event_details['ID'];
     if (is_null($event_id)) {
         //return false;
     }
     $regis_id = $this->erm->get_regis_id();
     $post_ID = $this->erm->get_regis_post_id();
     $this->ecm->setup_event_details($event_id);
     $line_item_surcharge = false;
     $line_item_surcharge = apply_filters('egm__pp_exp__line_item_surcharge', $line_item_surcharge);
     $_totals = $this->erm->calculate_cart_totals();
     $amount = $cart_totals['money_totals']['grand_total'];
     $amount = epl_get_balance_due();
     $tax = epl_get_element_m('surcharge', 'money_totals', $cart_totals, 0);
     $subtotal = epl_get_element_m('subtotal', 'money_totals', $cart_totals, 0);
     $num_days_in_cart = array();
     $price_multiplier = array();
     $price_multiplier_label = array();
     $discount_amount = number_format(epl_get_element('discount_amount', $cart_totals['money_totals'], 0), 2, ".", "");
     //$subtotal = $discount_amount > 0 ? number_format( $subtotal - $discount_amount, 2 ) : $subtotal;
     $this->epl->load_file('libraries/gateways/paypal/paypal.php');
     $paypal = new EPL_Paypal();
     $gateway_info = $this->erm->get_gateway_info();
     $paypal->_credentials = array('USER' => $gateway_info['_epl_pp_exp_user'], 'PWD' => $gateway_info['_epl_pp_exp_pwd'], 'SIGNATURE' => $gateway_info['_epl_pp_exp_sig']);
     $requestParams = array('TOKEN' => $_GET['token'], 'PAYMENTACTION' => 'Sale', 'PAYERID' => $_GET['PayerID']);
     $orderParams = array('PAYMENTREQUEST_0_AMT' => $amount, 'PAYMENTREQUEST_0_ITEMAMT' => $amount - $tax, 'PAYMENTREQUEST_0_CURRENCYCODE' => epl_nz(epl_get_general_setting('epl_currency_code'), 'USD'), 'PAYMENTREQUEST_0_TAXAMT' => $line_item_surcharge === false ? $tax : 0);
     $counter = 0;
     $tickets = $_SESSION['__epl'][$regis_id]['_dates']['_att_quantity'];
     $dates = isset($_SESSION['__epl'][$regis_id]['_dates']['_epl_start_date']) ? $_SESSION['__epl'][$regis_id]['_dates']['_epl_start_date'] : array();
     $events = $_SESSION['__epl'][$regis_id]['_events'];
     $parallel_pay = epl_get_regis_setting('_epl_enable_PP_parallel_pay') == 10 && !epl_is_empty_array(epl_get_element('_epl_price_parallel_pay_email', $event_details, array()));
     $pp_email = epl_get_element('_epl_pp_exp_email', $gateway_info);
     if ($parallel_pay) {
         $orderParams = array();
         foreach ($tickets as $event_id => $ind_tickets) {
             $this->ecm->setup_event_details($event_id);
             foreach ($ind_tickets as $ticket_id => $ticket_qty) {
                 $ticket_name = epl_get_element($ticket_id, $event_details['_epl_price_name']);
                 $ticket_price = epl_get_element($ticket_id, $event_details['_epl_price']);
                 if (epl_is_eligible_for_member_price($ticket_id)) {
                     $ticket_price = epl_get_element_m($ticket_id, '_epl_member_price', $event_details, $ticket_price);
                 }
                 $qty = is_array($ticket_qty) ? array_sum($ticket_qty) : $ticket_qty;
                 if ($qty > 0) {
                     $orderParams['PAYMENTREQUEST_' . $counter . '_AMT'] = $ticket_price;
                     $orderParams['PAYMENTREQUEST_' . $counter . '_SELLERPAYPALACCOUNTID'] = epl_get_element_m($ticket_id, '_epl_price_parallel_pay_email', $event_details, $pp_email);
                     $orderParams['PAYMENTREQUEST_' . $counter . '_SHIPPINGAMT'] = 0;
                     $orderParams['PAYMENTREQUEST_' . $counter . '_CURRENCYCODE'] = epl_nz(epl_get_general_setting('epl_currency_code'), 'USD');
                     $orderParams['PAYMENTREQUEST_' . $counter . '_ITEMAMT'] = $ticket_price;
                     $orderParams['PAYMENTREQUEST_' . $counter . '_TAXAMT'] = 0;
                     $orderParams['PAYMENTREQUEST_' . $counter . '_DESC'] = substr($ticket_name, 0, 126);
                     $orderParams['PAYMENTREQUEST_' . $counter . '_PAYMENTREQUESTID'] = $post_ID . '-' . $counter;
                     $counter++;
                 }
             }
         }
     }
     $counter = 0;
     $item = array();
     foreach ($tickets as $event_id => $ind_tickets) {
         $this->ecm->setup_event_details($event_id);
         $num_days_in_cart[$event_id] = count(epl_get_element($event_id, $dates, array()));
         $price_multiplier[$event_id] = $event_details['_epl_price_per'] == 10 && !epl_is_date_level_price() ? $num_days_in_cart[$event_id] : 1;
         $price_multiplier_label[$event_id] = $price_multiplier[$event_id] > 1 ? ' - ' . $num_days_in_cart[$event_id] . ' ' . epl__('days') : '';
         foreach ($ind_tickets as $ticket_id => $ticket_qty) {
             $ticket_name = epl_get_element($ticket_id, $event_details['_epl_price_name']);
             $ticket_price = epl_get_element($ticket_id, $event_details['_epl_price']);
             if (epl_is_eligible_for_member_price($ticket_id)) {
                 $ticket_price = epl_get_element_m($ticket_id, '_epl_member_price', $event_details, $ticket_price);
             }
             $qty = is_array($ticket_qty) ? array_sum($ticket_qty) : $ticket_qty;
             if ($qty > 0) {
                 $item['L_PAYMENTREQUEST_0_NAME' . $counter] = substr($event_details['post_title'], 0, 126);
                 $item['L_PAYMENTREQUEST_0_DESC' . $counter] = $ticket_name . $price_multiplier_label[$event_id];
                 //$item['L_PAYMENTREQUEST_0_NUMBER' . $counter] = $ticket_id;
                 $item['L_PAYMENTREQUEST_0_AMT' . $counter] = $ticket_price;
                 $item['L_PAYMENTREQUEST_0_QTY' . $counter] = $qty * $price_multiplier[$event_id];
                 $counter++;
             }
         }
     }
     if ($parallel_pay) {
         $item = array();
         $counter = 0;
         $ticket_counter = 0;
         //this will be incremented if we do line item per ticket qty
         foreach ($tickets as $event_id => $ind_tickets) {
             $this->ecm->setup_event_details($event_id);
             foreach ($ind_tickets as $ticket_id => $ticket_qty) {
                 $ticket_name = epl_get_element($ticket_id, $event_details['_epl_price_name']);
                 $ticket_price = epl_get_element($ticket_id, $event_details['_epl_price']);
                 if (epl_is_eligible_for_member_price($ticket_id)) {
                     $ticket_price = epl_get_element_m($ticket_id, '_epl_member_price', $event_details, $ticket_price);
                 }
                 $qty = is_array($ticket_qty) ? array_sum($ticket_qty) : $ticket_qty;
                 if ($qty > 0) {
                     $item['L_PAYMENTREQUEST_' . $counter . '_NAME' . $ticket_counter] = substr($event_details['post_title'], 0, 126);
                     $item['L_PAYMENTREQUEST_' . $counter . '_DESC' . $ticket_counter] = $ticket_name . $price_multiplier_label[$event_id];
                     //$item['L_PAYMENTREQUEST_0_NUMBER' . $counter] = $ticket_id;
                     $item['L_PAYMENTREQUEST_' . $counter . '_AMT' . $ticket_counter] = $ticket_price;
                     $item['L_PAYMENTREQUEST_' . $counter . '_QTY' . $ticket_counter] = $qty * $price_multiplier[$event_id];
                     $counter++;
                 }
             }
         }
     }
     if (!$parallel_pay) {
         if ($tax > 0 && $line_item_surcharge !== false) {
             //$discount_description = epl_get_element( 'discount_description', $cart_totals['money_totals'], null );
             foreach ($_SESSION['__epl'][$regis_id]['_events'] as $event_id => $event_totals) {
                 $sc = epl_get_element_m('surcharge', 'money_totals', $event_totals, 0);
                 if ($sc == 0) {
                     continue;
                 }
                 $this->ecm->setup_event_details($event_id);
                 $surcharge_label = epl_get_element('_epl_surcharge_label', $event_details, epl__('Surcharge'));
                 $item['L_PAYMENTREQUEST_0_NAME' . $counter] = $surcharge_label;
                 //$item['L_PAYMENTREQUEST_0_DESC' . $counter] = $discount_description;
                 //$item['L_PAYMENTREQUEST_0_NUMBER' . $counter] = $ticket_id;
                 $item['L_PAYMENTREQUEST_0_AMT' . $counter] = $sc;
                 $item['L_PAYMENTREQUEST_0_QTY' . $counter] = 1;
                 $requestParams['PAYMENTREQUEST_0_ITEMAMT'] += $sc;
                 $counter++;
             }
         }
         if ($discount_amount > 0) {
             $discount_description = epl_get_element('discount_description', $cart_totals['money_totals'], null);
             $discount_description = substr($discount_description, 0, 126);
             $item['L_PAYMENTREQUEST_0_NAME' . $counter] = $discount_description;
             //$item['L_PAYMENTREQUEST_0_DESC' . $counter] = $discount_description;
             //$item['L_PAYMENTREQUEST_0_NUMBER' . $counter] = $ticket_id;
             $item['L_PAYMENTREQUEST_0_AMT' . $counter] = -1 * $discount_amount;
             $item['L_PAYMENTREQUEST_0_QTY' . $counter] = 1;
         }
         $alt_total_due = epl_get_element_m('pay_deposit', 'money_totals', $cart_totals) == 1;
         if ($alt_total_due > 0) {
             $counter++;
             $balance_due_desc = epl__('Deposit Offset.  Due at a later date.');
             $balance_due_desc = substr($balance_due_desc, 0, 126);
             $balance_offset = get_the_regis_total_amount(false) - $amount;
             $item['L_PAYMENTREQUEST_0_NAME' . $counter] = $balance_due_desc;
             //$item['L_PAYMENTREQUEST_0_DESC' . $counter] = $discount_description;
             //$item['L_PAYMENTREQUEST_0_NUMBER' . $counter] = $ticket_id;
             $item['L_PAYMENTREQUEST_0_AMT' . $counter] = -1 * $balance_offset;
             $item['L_PAYMENTREQUEST_0_QTY' . $counter] = 1;
         }
         $payment_data = epl_get_regis_payments();
         if (!empty($payment_data)) {
             if (count($payment_data) > 0) {
                 foreach ($payment_data as $time => $p) {
                     $counter++;
                     $payment_made_description = epl__('Offset for payment made on: ') . epl_formatted_date($p['_epl_payment_date']);
                     $payment_made_description = substr($payment_made_description, 0, 126);
                     $item['L_PAYMENTREQUEST_0_NAME' . $counter] = $payment_made_description;
                     //$item['L_PAYMENTREQUEST_0_DESC' . $counter] = $discount_description;
                     //$item['L_PAYMENTREQUEST_0_NUMBER' . $counter] = $ticket_id;
                     $item['L_PAYMENTREQUEST_0_AMT' . $counter] = -1 * $p['_epl_payment_amount'];
                     $item['L_PAYMENTREQUEST_0_QTY' . $counter] = 1;
                 }
             }
         }
         if (($donation_amount = epl_get_element_m('donation_amount', 'money_totals', $cart_totals, 0)) > 0) {
             $counter++;
             $item['L_PAYMENTREQUEST_0_NAME' . $counter] = epl__('Donation');
             $item['L_PAYMENTREQUEST_0_AMT' . $counter] = $donation_amount;
             $item['L_PAYMENTREQUEST_0_QTY' . $counter] = 1;
         }
         if (($original_total = epl_get_element_m('original_total', 'money_totals', $cart_totals, 0)) > 0) {
             $counter++;
             $item['L_PAYMENTREQUEST_0_NAME' . $counter] = epl__('Offset');
             $item['L_PAYMENTREQUEST_0_AMT' . $counter] = -1 * ($original_total - $orderParams['PAYMENTREQUEST_0_AMT']);
             $item['L_PAYMENTREQUEST_0_QTY' . $counter] = 1;
         }
     }
     $request = $requestParams + $item + $orderParams;
     $request = apply_filters('epl_express_checkout_do_payment_request_params', $request);
     $response = $paypal->request('DoExpressCheckoutPayment', $request);
     if (is_array($response) && $response['ACK'] == 'Success') {
         $payment_amount = $response['PAYMENTINFO_0_AMT'];
         $counter = 0;
         if ($parallel_pay) {
             $payment_amount = 0;
             foreach ($tickets as $event_id => $ind_tickets) {
                 $this->ecm->setup_event_details($event_id);
                 foreach ($ind_tickets as $ticket_id => $ticket_qty) {
                     $qty = is_array($ticket_qty) ? array_sum($ticket_qty) : $ticket_qty;
                     if ($qty > 0) {
                         $payment_amount += epl_get_element('PAYMENTINFO_' . $counter . '_AMT', $response, 0);
                         $counter++;
                     }
                 }
             }
         }
         $data['post_ID'] = $post_ID;
         $data['_epl_grand_total'] = $cart_totals['money_totals']['grand_total'];
         $data['_epl_payment_amount'] = $payment_amount;
         $data['_epl_payment_date'] = current_time('mysql');
         $data['_epl_payment_method'] = $this->erm->get_payment_profile_id();
         $data['_epl_transaction_id'] = $response['PAYMENTINFO_0_TRANSACTIONID'];
         $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_pp_exp_response_data', $data, $response);
         $this->erm->update_payment_data($data);
         return true;
         //echo "DONE";
     } else {
         $error = 'ERROR: ' . $response['L_SHORTMESSAGE0'] . '. ' . $response['L_LONGMESSAGE0'];
         echo EPL_Util::get_instance()->epl_invoke_error(0, $error, false);
     }
     return false;
 }
function epl_check_token($v = null, $forec_check = false)
{
    if (epl_user_is_admin()) {
        return true;
    }
    if (epl_get_regis_setting('epl_regis_add_url_token') != 10) {
        return true;
    }
    if (!isset($_GET['epl_token'])) {
        return false;
    }
    return $_GET['epl_token'] == epl_get_token($v);
}
 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 pre($title)
 {
     /* $new_id = $this->erm->create_new_regis_record();
     
                   wp_redirect("post.php?post={$new_id}&action=edit");
                   die();
                  */
     $title = strtoupper($this->epl_util->make_unique_id(epl_nz(epl_get_regis_setting('epl_regis_id_length'), 10)));
     return $title;
 }
 function pre($title)
 {
     $title = strtoupper($this->epl_util->make_unique_id(epl_nz(epl_get_regis_setting('epl_regis_id_length'), 10)));
     return $title;
 }


        <div class="epl_section">
            <div class="epl_section_header"><?php 
    epl_e('Registration Details');
    ?>
</div>
            <?php 
    echo get_the_regis_dates_times_prices($post_ID);
    ?>

        </div>



        <?php 
    //show the registration form
    echo $regis_form;
}
?>

    <?php 
do_action('epl_regis_complete_bottom_message');
?>

</div>
<?php 
if (isset($tracking_code) || epl_get_element('cnv_tr', $_GET)) {
    echo epl_get_regis_setting('epl_tracking_code');
}
Esempio n. 8
0
            <div class="epl_discount_label"><?php 
    echo epl_get_setting('epl_registration_options', '_epl_discount_input_label', epl__('Discount Code')) . "&nbsp;";
    ?>
            </div>
            <div class="epl_discount_field">
                <?php 
    echo $cart_data['discount_field'];
    ?>
            </div>

        </div>
    <?php 
}
?>
    <?php 
if ($mode != 'overview' && epl_get_regis_setting('epl_enable_donation') == 10 || $mode == 'overview' && epl_get_element_m('donation_amount', 'money_totals', $cart_data['cart_totals'], 0) > 0) {
    ?>
        <div id="epl_donation_wrapper" class="epl_section epl_ov_a epl_ta_r">

            <?php 
    echo epl__('Donation') . ":&nbsp;" . $cart_data['donation_field'];
    ?>

        </div>
    <?php 
}
?>

    <?php 
if (!epl_is_zero_total()) {
    ?>
    <div class="invoice_section_full">
        <table class="regis_totals" style="width:400px;margin: 0 auto;">

            <tr>
                <td style="text-align: left;"><?php 
epl_e('Subtotal');
?>
</td>
                <td style="text-align: left;"><?php 
echo epl_get_formatted_curr($regis->subtotal, null, true);
?>
</td>
            </tr>
            <tr>
                <td style="text-align: left;"><?php 
echo epl_get_regis_setting('epl_surcharge_label');
?>
</td>
                <td style="text-align: left;"><?php 
echo epl_get_formatted_curr($regis->surcharge, null, true);
?>
</td>
            </tr>
            <tr>
                <td style="text-align: left;"><?php 
epl_e('Discount');
?>
</td>
                <td style="text-align: left;"><?php 
echo epl_get_formatted_curr($regis->discount_amount, null, true);
?>
        $form_data[$k] = epl_get_element($k, $_f, $v);
    }
    $this->epl->epl_table->add_row(array_values($__row) + $_f);
    $new_record = false;
    if ($has_att_forms) {
        $form_counter++;
    }
}
//construct header row
$header = array();
$header[] = epl__('Regis ID');
$header[] = epl__('Regis Date');
$header[] = epl__('Status');
$header[] = epl__('Purchase');
$header[] = epl__('Amount');
$header[] = epl__('Paid');
$header[] = epl__('Discount Code');
$header[] = epl__('Discount Amount');
if (epl_get_regis_setting('epl_enable_donation') == 10) {
    $header[] = epl__('Donation');
}
$header[] = epl__('Date');
$header[] = epl__('Time');
epl_sort_array_by_array($avail_fields, $default_row);
$header = array_merge($header, epl_get_field_labels(array_intersect_key($avail_fields, $default_row)));
$this->epl->epl_table->set_heading($header);
/* $footer = $this->epl->epl_util->remove_array_vals( array_keys( $header ) );
  $footer[4] = epl__( 'Total Paid' );
  $footer[5] = epl_get_formatted_curr( $total_revenue );
  $this->epl->epl_table->set_footer( array_values( $footer ) ); */
echo $this->epl->epl_table->generate();
function epl_price_fields($epl_fields)
{
    $_a = array('_epl_price_pack_size' => array('weight' => 39, 'input_type' => 'text', 'input_name' => '_epl_price_pack_size[]', 'label' => epl__('Package Size'), 'class' => 'epl_w50', 'default_value' => 1), '_epl_price_capacity' => array('weight' => 40, 'input_type' => 'text', 'input_name' => '_epl_price_capacity[]', 'label' => epl__('Capacity'), 'class' => 'epl_w50'), '_epl_price_date_from' => array('weight' => 45, 'input_type' => 'text', 'input_name' => '_epl_price_date_from[]', 'label' => epl__('From'), 'class' => 'epl_w90 datepicker', 'data_type' => 'unix_time', '__func' => 'epl_admin_date_display'), '_epl_price_date_to' => array('weight' => 50, 'input_type' => 'text', 'input_name' => '_epl_price_date_to[]', 'label' => epl__('To'), 'class' => 'epl_w90 datepicker', 'data_type' => 'unix_time', '__func' => 'epl_admin_date_display'), '_epl_price_member_only' => array('weight' => 53, 'input_type' => 'select', 'input_name' => '_epl_price_member_only[]', 'label' => epl__('Member Only Price'), 'class' => '', 'options' => epl_yes_no(), 'default_value' => 0), '_epl_price_forms' => array('weight' => 60, 'input_type' => 'checkbox', 'input_name' => '_epl_price_forms[]', 'label' => epl__('Price Specific Form (optional)'), 'options' => array(), 'second_key' => '[]', 'help_text' => epl__('Use these forms only if you would like to collect different information if the user selects this price.')), '_epl_price_forms_per' => array('weight' => 65, 'input_type' => 'select', 'input_name' => '_epl_price_forms_per[]', 'label' => epl__('Display the form '), 'options' => array(1 => epl__('For each Attendee'), 2 => epl__('Only Once'))), '_epl_date_specific_price' => array('weight' => 35, 'input_type' => 'text', 'input_name' => '_epl_date_specific_price[]', 'label' => epl__('Date Specific?'), 'readonly' => true, 'display_inline' => true, 'class' => 'epl_w80'), '_epl_time_specific_price' => array('weight' => 35, 'input_type' => 'text', 'input_name' => '_epl_time_specific_price[]', 'label' => epl__('Time Specific?'), 'readonly' => true, 'display_inline' => true, 'class' => 'epl_w80'), '_epl_price_to_offset' => array('weight' => 80, 'input_type' => 'select', 'input_name' => '_epl_price_to_offset[]', 'options' => array(), 'empty_row' => true, 'class' => 'price_to_offset reset_val'), '_epl_price_offset_count' => array('weight' => 85, 'input_type' => 'text', 'input_name' => '_epl_price_offset_count[]', 'class' => 'epl_w40 reset_val', 'default_value' => 0), '_epl_price_surcharge_method' => array('weight' => 90, 'input_type' => 'select', 'input_name' => '_epl_price_surcharge_method[]', 'label' => epl__('Surcharge Method'), 'options' => array('add' => epl__('Add')), 'class' => ''), '_epl_price_surcharge_amount' => array('weight' => 92, 'input_type' => 'text', 'input_name' => '_epl_price_surcharge_amount[]', 'label' => epl__('Amount'), 'class' => 'epl_w60', 'data_type' => 'float'), '_epl_price_surcharge_type' => array('weight' => 94, 'input_type' => 'select', 'input_name' => '_epl_price_surcharge_type[]', 'label' => epl__('Surcharge Type'), 'options' => array(5 => epl__('Fixed'), 10 => epl__('Percent'))), '_epl_price_surcharge_per' => array('weight' => 96, 'input_type' => 'select', 'input_name' => '_epl_price_surcharge_per[]', 'label' => epl__('for'), 'options' => array(5 => epl__('Each quantity'), 10 => epl__('Only once'))));
    if (epl_get_regis_setting('_epl_enable_PP_parallel_pay') == 10) {
        $_a['_epl_price_parallel_pay_email'] = array('weight' => 100, 'input_type' => 'text', 'input_name' => '_epl_price_parallel_pay_email[]', 'label' => epl__('PayPal Parallel Pay Email'), 'class' => '');
    }
    //$_a = ( array ) maybe_unserialize( get_option( 'epl_advance_cap_mod_a' ) );
    //$_a = ( array ) maybe_unserialize( base64_decode(get_option( 'epl_advance_cap_mod', true )) );
    $epl_fields += $_a;
    if (epl_is_addon_active('DASFERWEQREWE')) {
        $epl_fields['_epl_price_pack_type'] = array('weight' => 66, 'input_type' => 'select', 'input_name' => '_epl_price_pack_type[]', 'label' => epl__('Package Type'), 'options' => array('count' => epl__('Count Based'), 'time' => epl__('Time Based')));
        $epl_fields['_epl_price_pack_time_length'] = array('weight' => 65, 'input_type' => 'text', 'input_name' => '_epl_price_pack_time_length[]', 'label' => epl__('Time Length'), 'default_value' => 1, 'class' => 'epl_w40');
        $epl_fields['_epl_price_pack_time_length_type'] = array('weight' => 66, 'input_type' => 'select', 'input_name' => '_epl_price_pack_time_length_type[]', 'label' => '', 'options' => array('day' => epl__('Day'), 'week' => epl__('Week'), 'month' => epl__('Month')));
        /*     $epl_fields['_epl_price_membership_min_level'] = array(
               'weight' => 67,
               'input_type' => 'checkbox',
               'input_name' => '_epl_price_membership_min_level[]',
               'label' => epl__( 'Minimum Membership Level' ),
               'options' => epl_get_roles_arr(),
               'second_key' => '[]',
               'display_inline' => true,
               ); */
    }
    return $epl_fields;
}
Esempio n. 12
0
 function thank_you_page($add_to_db = true)
 {
     global $cart_totals, $wpdb;
     if ($this->erm->is_empty_cart()) {
         return $this->epl_util->epl_invoke_error(20, null, false);
     }
     global $event_details;
     $this->erm->_set_relevant_data();
     if (epl_is_waitlist_flow()) {
         $this->erm->add_registration_to_db();
     }
     // echo "<pre class='prettyprint'>" . __LINE__ . "> " . print_r($_SESSION, true). "</pre>";
     $this->ecm->setup_event_details($this->erm->get_current_event_id());
     if (epl_regis_flow() == 2 && $add_to_db) {
         $this->erm->add_registration_to_db();
     }
     if (epl_regis_flow() == 10) {
         if ($this->erm->ok_to_proceed(true) !== true) {
             return $this->erm->ok_to_proceed;
         }
     }
     $post_ID = epl_get_element_m('post_ID', '__epl', $_SESSION, null);
     if (!$post_ID) {
         $regis_key = $_SESSION['__epl']['_regis_id'];
         $post_ID = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts}\n                 WHERE post_status ='publish' \n                 AND post_type='epl_registration' \n                 AND post_title=%s\n                        ORDER BY ID DESC\n                        LIMIT 1", $regis_key));
         $_SESSION['__epl']['post_ID'] = $post_ID;
     }
     $this->regis_id = $post_ID;
     $this->ecm->setup_regis_details($post_ID);
     $this->erm->set_mode('overview');
     $_totals = $this->erm->calculate_cart_totals();
     $grand_total = $cart_totals['money_totals']['grand_total'];
     $data['cart_data'] = $this->erm->show_cart();
     $data['regis_form'] = $this->erm->regis_form(null, false, false, false);
     $gateway_info = $this->erm->get_gateway_info();
     $data['post_ID'] = $post_ID;
     $data['_epl_regis_status'] = 1;
     $data['_epl_payment_method'] = epl_is_free_event() || epl_is_zero_total() ? '1' : $gateway_info['_epl_pay_type'];
     $data['payment_instructions'] = '';
     if (!epl_is_waitlist_flow() && (epl_is_free_event() || epl_is_zero_total())) {
         $data['_epl_regis_status'] = 5;
         $data['_epl_grand_total'] = '0';
         $data['_epl_payment_amount'] = '0';
         $data['_epl_payment_date'] = '';
         $data['_epl_payment_method'] = '1';
         $data['_epl_transaction_id'] = '';
         $this->erm->update_payment_data($data);
     } elseif ($this->erm->has_selected_offline_payment() || epl_is_waitlist_flow()) {
         $data['_epl_regis_status'] = epl_is_waitlist_flow() ? 20 : 2;
         $data['_epl_payment_method'] = epl_is_waitlist_flow() ? '' : $gateway_info['_epl_pay_type'];
         $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['_epl_grand_total'] = $grand_total;
         $data['_epl_balance_due'] = $grand_total;
         $data['_epl_transaction_id'] = '';
         $data['payment_instructions'] = $this->epl->load_view('front/registration/regis-payment-instr', array('gateway_info' => $gateway_info), true);
         $this->erm->update_payment_data($data);
     }
     $this->ecm->setup_regis_details($post_ID);
     $data['payment_details'] = $this->epl->load_view('front/registration/regis-payment-details', $data, true);
     $data = apply_filters('epl_update_payment_data_thank_you_page', $data);
     if ($this->erm->has_selected_offline_payment()) {
         $data['payment_instructions'] = epl_get_element('_epl_check_instructions', $gateway_info);
     }
     $data['mode'] = 'overview';
     $data['tracking_code'] = 1;
     $data['overview'] = $this->epl->load_view('front/registration/regis-thank-you-page', $data, true);
     $this->epl_util->regis_id = $post_ID;
     if (epl_is_addon_active('ASDFAWEEFADSF')) {
         epl_mailchimp_subscribe();
     }
     do_action('epl_efc__thank_you_page__before_session_destroy', $post_ID);
     $new_user = $this->erm->maybe_add_new_user();
     if ($new_user !== false) {
         $this->erm->assign_event_to_user($post_ID, $new_user);
     }
     $this->epl->load_model('epl-db-model');
     EPL_db_model::get_instance()->reset_table_for_registration($post_ID, get_current_user_id());
     $this->epl_util->send_confirmation_email($data);
     $url = apply_filters('epl_efc__thank_you_page__redirect_url', '');
     $_SESSION['__epl'] = array();
     unset($_SESSION['__epl']);
     @session_destroy();
     $_SESSION = array();
     epl_delete_transient();
     if ($url != '' || $this->epl->locate_template('single-epl_registration.php')) {
         $url = $url != '' ? $url : get_permalink($this->regis_id);
         $url_params = array();
         if (epl_get_regis_setting('epl_tracking_code')) {
             $url_params['cnv_tr'] = 1;
         }
         $url_params['epl_token'] = epl_get_token();
         $url_params = apply_filters('epl_efc__thank_you_page__url_params', $url_params);
         $url = add_query_arg($url_params, $url);
         wp_redirect($url, 301);
         die;
     }
     return $data['overview'];
 }
/*
 * 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');