/**
  * Adds or removes event in the session.
  *
  * @since 1.0.0
  * @param int $var
  * @return string
  */
 function _event_in_session($args)
 {
     global $event_details;
     $action = $args['cart_action'];
     $event_id = $args['event_id'];
     if (!epl_sc_is_enabled() && !isset($this->current_data[$this->regis_id]['_events'][$event_id])) {
         $this->current_data[$this->regis_id] = array();
     }
     if (!is_null($event_id)) {
         if ($action == 'add' && !isset($this->current_data[$this->regis_id]['_events'][$event_id])) {
             $this->current_data[$this->regis_id]['_events'][$event_id] = array();
             epl_set_cart_cookie();
         } elseif ($action == 'delete') {
             unset($this->current_data[$this->regis_id]['_events'][$event_id]);
             unset($this->current_data[$this->regis_id]['_dates']['_epl_start_date'][$event_id]);
             unset($this->current_data[$this->regis_id]['_dates']['_epl_start_time'][$event_id]);
             unset($this->current_data[$this->regis_id]['_dates']['_att_quantity'][$event_id]);
             if (empty($this->current_data[$this->regis_id]['_events'])) {
                 epl_set_cart_cookie('del');
             }
         }
     }
     $this->adjust_for_sc_ok();
     $this->refresh_data();
     epl_do_messages();
     return 1;
 }
 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;
 }