/**
  * Display the cart for the user or the admin to select the dates, times and prices
  *
  * long description
  *
  * @since 1.0.0
  * @param int $var
  * @return string
  */
 function show_cart($values = null)
 {
     //echo "<pre class='prettyprint'>" . print_r( $_SESSION, true ) . "</pre>";
     $this->_refresh_data();
     if (is_null($values)) {
         $events_in_cart = $this->get_cart_values('_events');
     } else {
         $events_in_cart = $values['_events'];
     }
     if (empty($events_in_cart)) {
         return $this->epl_util->epl_invoke_error(20);
     }
     $events_in_cart = $this->epl_util->clean_output($events_in_cart);
     global $event_details, $multi_time, $multi_price, $capacity, $current_att_count;
     $r = array();
     foreach ($events_in_cart as $event_id => $event_date) {
         if ($event_id != '') {
             $this->ecm->setup_event_details($event_id);
             $this->set_event_capacity_info();
             //if ( $event_details['_epl_event_available_space_display'] )
             if (epl_get_event_property('_epl_event_available_space_display') != 0) {
                 $r['available_spaces'][$event_id] = $this->capacity_table();
             }
             $multi_time = isset($event_details['_epl_multi_time_select']) && $event_details['_epl_multi_time_select'] == 10;
             $multi_price = isset($event_details['_epl_multi_price_select']) && $event_details['_epl_multi_price_select'] == 10;
             $r['cart_items'][$event_id]['title'] = $event_details['post_title'];
             $r['cart_items'][$event_id]['event_dates'] = $this->get_the_dates();
             //= $this->epl_util->create_element( $epl_fields );
             $r['cart_items'][$event_id]['event_time_and_prices'] = $this->get_time_and_prices_for_cart();
         }
     }
     if (epl_is_free_event()) {
         $r['free_event'] = 1;
         $r['cart_totals'] = null;
         $r['pay_options'] = null;
     } else {
         $r['cart_totals'] = $this->get_the_totals();
         $r['pay_options'] = $this->get_payment_options();
     }
     $r['view_mode'] = $this->mode;
     return $r;
 }
                                                                
                                                                <?php 
$_style = 'style="clear:both;width:100%;margin:10px auto;border:1px solid #eee"';
$_t = get_the_regis_dates_times_prices();
echo str_replace('class="epl_dates_times_prices_table"', $_style, $_t);
?>

                                                                </div>



                                                            </div>
                                                            <div class="" style="margin:10px auto;border:1px solid #eee;padding: 10px;">

                                                            <?php 
if (isset($payment_details) && $payment_details != '' && !epl_is_free_event()) {
    echo str_replace('class="epl_payment_details_table"', $_style, $payment_details);
}
global $email_regis_form;
echo $email_regis_form;
?>
                                                            </div>
                                                        
                                                    </td>
                                                </tr>


                                            </tbody>
                                        </table>
                                    </td>
                                    <!--/content-->
                    <strong style="float:right">On <?php 
echo $regis_date;
?>
</strong>
                    <div class="clear"></div>

                    <?php 
$r = get_the_regis_dates_times_prices($regis_post_id);
echo $r;
?>

                    <table class="epl_payment_details_table">
                        <tbody>

                            <?php 
if ($payment_instructions != '' && !epl_is_zero_total() && !epl_is_free_event()) {
    echo $payment_instructions;
}
?>


                            <tr>
                                <td><?php 
epl_e('Total');
?>
</td>
                                <td><?php 
echo get_the_regis_total_amount();
?>
</td>
                            </tr>
 function get_registration_details($post_id = null)
 {
     global $epl_current_step, $regis_details, $event_details;
     $epl_current_step = 'thank_you_page';
     $post_id = epl_nz($post_id, get_the_ID());
     $regis_meta = $this->setup_regis_details(get_the_ID());
     if (!epl_user_is_admin() && epl_check_token() === false) {
         @header('HTTP/1.0 404 Not Found');
         return "<div class='epl_error'>" . epl__('You have reached this page in error.') . "</div>";
     }
     $event_id = key((array) $regis_meta['_epl_events']);
     $event_meta = $this->setup_event_details($event_id);
     //$earm = $this->epl->load_model( 'epl-regis-admin-model' );
     $erm = $this->epl->load_model('epl-registration-model');
     $ercm = $this->epl->load_model('epl-recurrence-model');
     $data['event_id'] = $event_id;
     $regis_id = $regis_details['__epl']['_regis_id'];
     epl_do_messages($regis_details['__epl'][$regis_id]['_events']);
     $data['regis_status_id'] = get_the_regis_status(null, true);
     $erm->set_mode('overview')->setup_current_data($regis_meta);
     $data['cart_data'] = $erm->show_cart();
     $data['cart_data'] = $this->epl->load_view('front/registration/regis-cart-section', $data, true);
     $data['cart_totals'] = $erm->calculate_cart_totals();
     $redirect_to = apply_filters('epl_ecm__get_registration_details__redirect_to', '');
     if ($redirect_to != '') {
         wp_redirect($redirect_to, 301);
         die;
     }
     // $data['cart_totals'] = $this->epl->load_view( 'front/registration/regis-totals-section', $data, true );
     $payment_method_id = EPL_registration_model::get_instance()->get_payment_profile_id();
     if (!epl_is_free_event()) {
         $data['gateway_info'] = $this->get_post_meta_all($payment_method_id);
     }
     $data['payment_instructions'] = $this->epl->load_view('front/registration/regis-payment-instr', $data, true);
     $data['payment_details'] = $this->epl->load_view('front/registration/regis-payment-details', $data, true);
     //registration form
     $data['regis_form'] = $erm->regis_form(null, 'front/registration/');
     /* $ercm->hide_past = false;
        $d = $ercm->recurrence_dates_from_dates_section( );
        echo $this->epl_util->construct_calendar( $d ); */
     //the list of events
     $params = array('input_type' => 'select', 'input_name' => 'event_list_id', 'id' => 'event_list_id', 'label' => epl__('Event'), 'options' => $this->get_all_events());
     //echo "<pre class='prettyprint'>" . print_r($params, true). "</pre>";
     $data['fields'][] = $this->epl_util->create_element($params);
     $r = $this->epl->load_view('front/registration/regis-thank-you-page', $data, true);
     return $r;
 }
Esempio n. 5
0
        ?>
            <div id="epl_alt_totals_wrapper" class="epl_section epl_ov_a epl_ta_r" style="background-color:pink;font-size:20px;">

                <span class="epl_fl"><?php 
        epl_e('Alternate Total');
        ?>
</span><span class=""> <?php 
        echo $cart_data['alt_total'];
        ?>
</span>

            </div>

            <?php 
    }
    if (!epl_is_free_event()) {
        if ($mode != 'overview') {
            ?>
                <div id="epl_payment_choices_wrapper" class="epl_section">
                    <div  class="epl_section_header"><?php 
            epl_e('Select a payment method');
            ?>
</div>
                    <?php 
            echo $cart_data['pay_options'];
            ?>
                </div>
            <?php 
        }
        ?>
        <?php 
 function get_the_event_prices()
 {
     global $event_details;
     $tmpl = array('table_open' => '<table cellpadding="0" cellspacing="0" class="event_prices_table">');
     $this->epl->epl_table->set_template($tmpl);
     foreach ($event_details['_epl_price_name'] as $price_key => $price_data) {
         $price_name = $event_details['_epl_price_name'][$price_key];
         $price = epl_is_free_event() ? '' : epl_get_currency_symbol() . epl_get_formatted_curr($event_details['_epl_price'][$price_key]);
         $this->epl->epl_table->add_row($price_name, $price);
         //$this->epl->epl_table->add_row( $r );
     }
     $r = $this->epl->epl_table->generate();
     $this->epl->epl_table->clear();
     return $r;
 }
 function thank_you_page()
 {
     //$this->rm->set_mode( 'thank_you_page' );
     /*
      * display payment info
      * display overview
      * send email
      * destry session
      */
     //echo "<pre class='prettyprint'>" . print_r($_SESSION, true). "</pre>";
     if ($this->rm->epl_is_empty_cart()) {
         echo $this->epl_util->epl_invoke_error(20, null, false);
     } else {
         $this->ecm->setup_regis_details($_SESSION['__epl']['post_ID']);
         $this->rm->set_mode('overview');
         $data['cart_data'] = $this->rm->show_cart();
         //$data['thank_you_message'] = $this->epl->load_view( 'front/registration/regis-thank-you-section', '', true );
         //$data['content'] = $this->epl->load_view( 'front/cart/cart', $data );
         $data['regis_form'] = $this->rm->regis_form(null, false);
         $data['payment_details'] = $this->epl->load_view('front/registration/regis-payment-details', '', true);
         //$data['prev_step_url'] = esc_url(add_query_arg( 'epl_action', 'regis_form', $_SERVER['REQUEST_URI'] ) );
         if (is_null($data['next_step'])) {
             $data['next_step'] = 'payment_page';
         }
         if (epl_is_free_event()) {
             //$data['form_action'] = esc_url(add_query_arg( 'epl_action', 'thank_you_page', $_SERVER['REQUEST_URI'] ) );
             //$data['next_step'] = 'thank_you_page';
             //$data['next_step_label'] = 'Confirm and Complete';
             $post_ID = $_SESSION['__epl']['post_ID'];
             $data['post_ID'] = $post_ID;
             $data['_epl_regis_status'] = '5';
             $data['_epl_grand_total'] = 0;
             $data['_epl_payment_amount'] = 0;
             $data['_epl_payment_date'] = current_time('mysql');
             $data['_epl_payment_method'] = '';
             $data['_epl_transaction_id'] = '';
             $this->rm->update_payment_data($data);
         }
         $data['mode'] = 'overview';
         $data['overview'] = $this->epl->load_view('front/registration/regis-thank-you-page', $data);
         $email_body = $this->epl->load_view('front/registration/regis-confirm-email', $data, true);
         $this->send_confirmation_email($email_body);
     }
     $_SESSION['__epl'] = array();
     session_regenerate_id();
 }
 function set_next_step_vars($current_step = null)
 {
     //$bt = debug_backtrace();
     //echo "<pre class='prettyprint'>" . __LINE__ . "> " . print_r($bt[0]['line'], true). "</pre>";
     //echo "<pre class='prettyprint'>" . __LINE__ . "> " . print_r($bt[0]['function'], true). "</pre>";
     /*
      * - if on regis form and offline or free, thank you
      * - if regis form and cc or pp, overview
      * - if overview and cc, show card form, complete
      * - if overview and pp, continue
      * - if overview and offline, complete
      *
      * - if epl_regis_flow() and regis form -> payment -> complete
      * - if epl_regis_flow() and regis form and free of offline -> complete
      */
     global $epl_current_step;
     $regis_flow_steps = array(1 => 'show_cart', 5 => 'regis_form', 10 => 'show_cart_overview', 30 => 'redirect', 100 => 'thank_you_page');
     $this->steps = array('show_cart' => array(1 => array('next' => 'regis_form', 'next_label' => epl__('Attendee Information')), 2 => array('next' => 'regis_form', 'next_label' => epl__('Attendee Information'))), 'regis_form' => array(1 => array('prev' => 'show_cart', 'next' => 'show_cart_overview', 'next_label' => epl__('Overview')), 2 => array('prev' => 'show_cart', 'next' => 'thank_you_page', 'next_label' => epl__('Confirm and Complete')), 10 => array('next' => 'thank_you_page', 'next_label' => epl__('Confirm and Complete'))), 'show_cart_overview' => array(1 => array('prev' => 'regis_form', 'next' => 'thank_you_page', 'next_label' => epl__('Confirm and Complete')), 2 => array('prev' => 'regis_form', 'next' => 'show_cart_overview', 'next_label' => epl__('Confirm and Complete')), 10 => array('prev' => 'show_cart', 'next' => 'thank_you_page')), 'payment_page' => array(1 => array('prev' => 'regis_form', 'next' => 'payment_page', 'next_label' => epl__('Overview')), 2 => array('prev' => 'regis_form', 'next' => 'payment_page', 'next_label' => epl__('Confirm and Complete')), 10 => array('next' => 'thank_you_page', 'next_label' => epl__('Confirm and Complete'))));
     $flow = epl_regis_flow();
     $this->step_data = array();
     $gateway_info = $this->erm->get_gateway_info();
     $url_vars_next = $url_vars_prev = array('epl_action' => $this->steps[$current_step][$flow]['next'], 'cart_action' => false, '_date_id' => false);
     $url_vars_prev['epl_action'] = epl_get_element('prev', $this->steps[$current_step][$flow]);
     $this->step_data['form_action'] = add_query_arg($url_vars_next, $this->url);
     $gw_check = false;
     if ($flow == 1 && $epl_current_step == 'show_cart_overview') {
         $gw_check = true;
     } elseif (($flow == 2 || $flow == 10) && $epl_current_step == 'regis_form') {
         $gw_check = true;
     }
     if ($epl_current_step != 'process_cart_action' && $epl_current_step != 'show_cart') {
         $this->step_data['prev_step_url'] = add_query_arg($url_vars_prev, $this->url);
     }
     $this->step_data['next_step'] = $this->steps[$current_step][$flow]['next'];
     $this->step_data['next_step_label'] = $this->steps[$current_step][$flow]['next_label'];
     if (epl_is_free_event() || epl_regis_flow() < 10 && epl_is_zero_total() || $this->erm->has_selected_offline_payment() || epl_is_waitlist_flow() && !epl_is_waitlist_approved()) {
         $this->step_data['next_step_label'] = apply_filters('epl_show_cart_overview_free_next_step_label', $this->steps[$current_step][$flow]['next_label']);
     } elseif (epl_get_element('_epl_pay_type', $gateway_info) == '_pp_exp' && $gw_check) {
         $url_vars_next = array('epl_action' => 'payment_page', 'cart_action' => false, '_date_id' => false);
         $url_vars_prev['epl_action'] = $this->steps[$current_step][$flow]['prev'];
         $this->step_data['form_action'] = add_query_arg($url_vars_next, $this->url);
         $this->step_data['next_step_label'] = apply_filters('epl_show_cart_overview_pp_exp_next_step_label', epl__('Confirm and Continue to PayPal'));
     } elseif (epl_get_element('_epl_pay_type', $gateway_info) == '_payson' && $gw_check) {
         $url_vars_next = array('epl_action' => 'payment_page', 'cart_action' => false, '_date_id' => false);
         $url_vars_prev['epl_action'] = $this->steps[$current_step][$flow]['prev'];
         $this->step_data['form_action'] = add_query_arg($url_vars_next, $this->url);
         $this->step_data['next_step_label'] = apply_filters('epl_show_cart_overview_pp_exp_next_step_label', epl__('Continue to Pay'));
     } elseif (epl_get_element('_epl_pay_type', $gateway_info) == '_moneris' && $gw_check) {
         $this->step_data['next_step_label'] = apply_filters('epl_show_cart_overview_pp_exp_next_step_label', epl__('Continue to Pay'));
         $us_version = epl_get_element('_epl_moneris_country', $gateway_info, 'ca') == 'usa';
         $this->step_data['form_action'] = 'https://www3.moneris.com/HPPDP/index.php';
         if ($gateway_info['_epl_sandbox'] == 10) {
             $this->step_data['form_action'] = 'https://esqa.moneris.com/HPPDP/index.php';
         }
         if ($us_version) {
             $this->step_data['form_action'] = 'https://esplus.moneris.com/DPHPP/index.php';
             if ($gateway_info['_epl_sandbox'] == 10) {
                 $this->step_data['form_action'] = 'https://esplusqa.moneris.com/DPHPP/index.php';
             }
             $this->egm->setup_moneris_form_USA();
         } else {
             $this->egm->setup_moneris_form();
         }
     } elseif (epl_get_element('_epl_pay_type', $gateway_info) == '_auth_net_sim' && $gw_check) {
         $this->step_data['next_step_label'] = apply_filters('epl_show_cart_overview_pp_exp_next_step_label', epl__('Continue to Pay'));
         $this->step_data['form_action'] = 'https://secure.authorize.net/gateway/transact.dll';
         if ($gateway_info['_epl_sandbox'] == 10) {
             $this->step_data['form_action'] = 'https://test.authorize.net/gateway/transact.dll';
         }
         $this->egm->setup_authnet_sim_form();
     } elseif ($this->erm->has_selected_cc_payment() && ($gw_check || $this->error)) {
         $url_vars_next = array('epl_action' => 'payment_page', 'cart_action' => false, '_date_id' => false);
         $this->step_data['form_action'] = add_query_arg($url_vars_next, $this->url);
         $this->step_data['next_step_label'] = apply_filters('epl_show_cart_overview_cc_next_step_label', $this->steps[$current_step][$flow]['next_label']);
     }
     $this->step_data = apply_filters('epl_front__set_next_step_vars__final', $this->step_data, $flow);
     return $this->step_data;
 }
 function notif_tags($email_body, $data)
 {
     global $event_details, $system_email_tags, $email_regis_form;
     if ($this->regis_id == '') {
         return null;
     }
     $email_body = nl2br(stripslashes_deep(html_entity_decode($email_body, ENT_QUOTES)));
     $regis_meta = $this->ecm->setup_regis_details($this->regis_id);
     $reigs_id = $regis_meta['__epl']['_regis_id'];
     $event_id = key($regis_meta['__epl'][$reigs_id]['_events']);
     //find the list of all forms
     $available_forms = $this->ecm->get_list_of_available_forms();
     $available_fields = $this->ecm->get_list_of_available_fields();
     $attendee_info = $regis_meta['__epl'][$reigs_id]['_attendee_info'];
     $_attendee_info = array();
     foreach ($attendee_info as $_f_id => $_att_data) {
         if (!isset($available_fields[$_f_id])) {
             continue;
         }
         //$_attendee_info[$_f_id] = epl_get_element( 0, epl_get_element( $event_id, $_att_data ) );
         $value = epl_get_element(0, $_att_data, false);
         if (!$value) {
             $value = epl_get_element(0, epl_get_element($event_id, $_att_data));
         }
         $input_type = epl_get_element('input_type', $available_fields[$_f_id]);
         if ($input_type == 'select' || $input_type == 'radio') {
             $field_choice_text = epl_get_element($value, $available_fields[$_f_id]['epl_field_choice_text'], null);
             $value = $field_choice_text && $field_choice_text != '' ? $field_choice_text : $value;
         } elseif ($input_type == 'checkbox') {
             $value = implode(',', (array) $value);
         } else {
             //TODO - eek, find a better way
             $value = html_entity_decode(htmlspecialchars_decode($value, ENT_QUOTES));
         }
         $_attendee_info[$_f_id] = $value;
     }
     $event_ticket_buyer_forms = array_flip((array) $event_details['_epl_primary_regis_forms']);
     $gateway_info = array();
     if (!epl_is_free_event()) {
         $gw_id = $this->erm->get_payment_profile_id();
         $gateway_info = $this->ecm->get_post_meta_all($gw_id);
     }
     $data['payment_instructions'] = $this->epl->load_view('front/registration/regis-payment-instr', array('gateway_info' => $gateway_info), true);
     $data['payment_details'] = $this->epl->load_view('front/registration/regis-payment-details', $data, true);
     $registration_detail_link = add_query_arg(array('epl_token' => epl_get_token()), get_permalink($this->regis_id));
     $_system_email_tags = array('registration_id' => get_the_regis_id(), 'registration_detail_link' => '<a href="' . $registration_detail_link . '" target="_blank" alt="' . epl__('Registration Detail Link') . '">' . epl__('Click here') . '</a>', 'event_name' => get_the_title($event_id), 'registration_details' => str_replace('class="epl_dates_times_prices_table"', 'style="clear:both;width:100%;margin:10px auto;border:1px solid #eee"', get_the_regis_dates_times_prices($data['post_ID'])), 'registration_form_data' => $email_regis_form, 'payment_details' => str_replace('class="epl_payment_details_table"', 'style="clear:both;width:100%;margin:10px auto;border:1px solid #eee"', $data['payment_details']), 'waitlist_approved_link' => epl_anchor(epl_get_waitlist_approved_url(), epl__('Register')), 'waitlist_approved_until' => epl_waitlist_approved_until(), 'event_details_link' => epl_anchor(get_permalink($event_details['ID']), get_the_title($event_details['ID'])), 'location_details' => !epl_is_multi_location() && epl_get_event_property('_epl_event_location', true) > 0 ? epl_suffix(', ', get_the_location_name()) . epl_suffix(', ', get_the_location_address() . ' ' . get_the_location_address2()) . get_the_location_city() . ' ' . get_the_location_state() . ' ' . get_the_location_zip() : '', 'location_map_link' => get_the_location_gmap_icon(epl__('Click here'), true));
     $_system_email_tags = apply_filters('epl_system_email_tags', $_system_email_tags);
     //isolate the forms that are selected inside the event
     // $ticket_buyer_forms = array_intersect_key( $available_forms, $event_ticket_buyer_forms );
     /*
      $tickey_buyer_fields = array( );
      foreach ( $ticket_buyer_forms as $_form_id => $_form_info )
      $tickey_buyer_fields += $_form_info['epl_form_fields'];
     */
     preg_match_all('/(?<=\\{)(.*?)(?=\\})/', $email_body, $matches);
     $_tags_in_body = array_flip(epl_get_element(0, $matches, array()));
     $_field_input_tags = array();
     foreach ($available_fields as $f_id => $f_data) {
         $_field_input_tags[$f_data['input_slug']] = $f_id;
     }
     $tagss = array_intersect_key($_field_input_tags, $_tags_in_body);
     $final_tags = array();
     foreach ($tagss as $k => $v) {
         $final_tags[$k] = epl_get_element($v, $_attendee_info);
     }
     $final_tags += $_system_email_tags;
     $find = array_keys($final_tags);
     array_walk($find, create_function('&$val', '$val = "{".$val."}";'));
     $replace = array_values($final_tags);
     return str_ireplace($find, $replace, $email_body);
 }