コード例 #1
0
 public static function get_instance()
 {
     if (!self::$instance) {
         self::$instance = new EPL_db_model();
     }
     return self::$instance;
 }
コード例 #2
0
 function __construct()
 {
     parent::__construct();
     global $event_details;
     self::$instance = $this;
     $this->ecm = $this->epl->load_model('epl-common-model');
     $this->edbm = $this->epl->load_model('epl-db-model');
     $this->erm = $this->epl->load_model('epl-registration-model');
     $this->delim = EPL_db_model::get_instance()->delim;
 }
<?php 
$epl = EPL_Base::get_instance();
$delim = EPL_db_model::get_instance()->delim;
$tmpl = array('table_open' => '<table border="1" cellpadding="0" cellspacing="0" class="epl_lookup_result_table">');
$this->epl->epl_table->set_template($tmpl);
$header = epl_get_field_labels($avail_fields);
$_row = array_fill_keys(array_keys($avail_fields), null);
foreach ($lookup_list as $r) {
    if (strpos($r->field_id, $delim)) {
        $fields = explode($delim, $r->field_id);
        $values = explode($delim, $r->value);
    } else {
        $fields = $r->field_id;
        $values = $r->value;
    }
    $raw = array_combine($fields, $values);
    $row = array_merge($_row, $raw);
    $row = epl_process_fields_for_display($row, $avail_fields);
    $raw['user_id'] = $r->user_id;
    $regis_link = epl_anchor(admin_url('post.php?post=' . $r->regis_id . '&action=edit'), $r->regis_key);
    $select_link = '<a href="#" class="epl_lookup_row_select">Select</a><span class="form_data" style="display:none;">' . json_encode($raw) . '</span>' . ($r->user_id > 0 ? " ({$r->user_id})" : '');
    array_unshift($row, $select_link);
    array_unshift($row, $regis_link);
    $epl->epl_table->add_row($row);
}
array_unshift($header, '');
array_unshift($header, '');
$epl->epl_table->set_heading($header);
echo $epl->epl_table->generate();
コード例 #4
0
function __epl_erm__add_registration_to_db($regis_post_ID, $event_id, $user_id = 0)
{
    if (!epl_is_addon_active('DASFERWEQREWE')) {
        return;
    }
    EPL_base::get_instance()->load_model('epl-db-model');
    $user_id = $user_id > 0 ? $user_id : EPL_db_model::get_instance()->find_user_id_for_regis($regis_post_ID);
    if ($user_id != 0) {
        update_user_meta($user_id, '_epl_regis_post_id_' . $regis_post_ID, $regis_post_ID . EPL_PLUGIN_DB_DELIM . $event_id);
    }
}
コード例 #5
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'];
 }