/** * generates HTML for the Registration main meta box * @access public * @return void */ public function _reg_details_meta_box() { EEH_Autoloader::register_line_item_display_autoloaders(); EEH_Autoloader::register_line_item_filter_autoloaders(); EE_Registry::instance()->load_Helper('Line_Item'); $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); $this->_session = $transaction->session_data(); $filters = new EE_Line_Item_Filter_Collection(); $filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration)); $filters->add(new EE_Non_Zero_Line_Item_Filter()); $line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item()); $filtered_line_item_tree = $line_item_filter_processor->process(); $this->_template_args['REG_ID'] = $this->_registration->ID(); $line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy'); $this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration)); $attendee = $this->_registration->attendee(); $this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_transaction', 'TXN_ID' => $transaction->ID()), TXN_ADMIN_URL), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart') : ''; $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'resend_registration', '_REG_ID' => $this->_registration->ID(), 'redirect_to' => 'view_registration'), REG_ADMIN_URL), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt') : ''; $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; $payment = $transaction->get_first_related('Payment'); $payment = !$payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment; $payment_method = $payment->get_first_related('Payment_Method'); $payment_method = !$payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method; $reg_status_class = 'status-' . $this->_registration->status_ID(); $reg_details = array('payment_method' => $payment_method->name(), 'response_msg' => $payment->gateway_response(), 'registration_id' => $this->_registration->get('REG_code'), 'registration_session' => $this->_registration->session_ID(), 'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '', 'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : ''); if (isset($reg_details['registration_id'])) { $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id']; $this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso'); $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text'; } if (isset($reg_details['payment_method'])) { $this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method']; $this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso'); $this->_template_args['reg_details']['payment_method']['class'] = 'regular-text'; $this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg']; $this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso'); $this->_template_args['reg_details']['response_msg']['class'] = 'regular-text'; } $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session']; $this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text'; $this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address']; $this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso'); $this->_template_args['reg_details']['ip_address']['class'] = 'regular-text'; $this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent']; $this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); $this->_template_args['reg_details']['user_agent']['class'] = 'large-text'; $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL); $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php'; echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); }
/** * generates HTML for the Registration main meta box * @access public * @return void */ public function _reg_details_meta_box() { $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); $this->_session = $transaction->session_data(); $this->_template_args['REG_ID'] = $this->_registration->ID(); $this->_template_args['line_items'] = $transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item'))); $attendee = $this->_registration->attendee(); // process taxes if ($transaction) { //get all "tax" line items for this transaction and we'll use them for the tax display. $taxes = $transaction->get_many_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax))); $this->_template_args['taxes'] = !empty($taxes) ? $taxes : array(); } else { $this->_template_args['taxes'] = array(); } $this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_transaction', 'TXN_ID' => $transaction->ID()), TXN_ADMIN_URL), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart') : ''; $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'resend_registration', '_REG_ID' => $this->_registration->ID(), 'redirect_to' => 'view_registration'), REG_ADMIN_URL), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt') : ''; $this->_template_args['grand_total'] = EEH_Template::format_currency($transaction->total()); $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; $payment = $transaction->get_first_related('Payment'); $payment = !$payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment; $payment_method = $payment->get_first_related('Payment_Method'); $payment_method = !$payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method; $reg_status_class = 'status-' . $this->_registration->status_ID(); $reg_details = array('payment_method' => $payment_method->name(), 'response_msg' => $payment->gateway_response(), 'registration_id' => $this->_registration->get('REG_code'), 'registration_session' => $this->_registration->session_ID(), 'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '', 'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : ''); if (isset($reg_details['registration_id'])) { $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id']; $this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso'); $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text'; } if (isset($reg_details['payment_method'])) { $this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method']; $this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso'); $this->_template_args['reg_details']['payment_method']['class'] = 'regular-text'; $this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg']; $this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso'); $this->_template_args['reg_details']['response_msg']['class'] = 'regular-text'; } $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session']; $this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text'; $this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address']; $this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso'); $this->_template_args['reg_details']['ip_address']['class'] = 'regular-text'; $this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent']; $this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); $this->_template_args['reg_details']['user_agent']['class'] = 'large-text'; $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL); $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php'; echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); }
/** * column_default */ function column_DTT_EVT_start(EE_Registration $item) { $datetime_strings = array(); $remove_defaults = array('default_where_conditions' => 'none'); $ticket = $item->ticket(); $datetimes = $ticket instanceof EE_Ticket ? $ticket->datetimes($remove_defaults) : array(); $query_args = array('action' => 'event_registrations', 'event_id' => $item->event_ID()); foreach ($datetimes as $datetime) { $query_args['DTT_ID'] = $datetime->ID(); $checkin_url = EE_Admin_Page::add_query_args_and_nonce($query_args, REG_ADMIN_URL); $datetime_strings[] = EE_Registry::instance()->CAP->current_user_can('ee_read_checkin', 'espresso_registrations_registration_checkins', $item->ID()) ? '<a href="' . $checkin_url . '" title="' . esc_attr__('View Checkins for this Event', 'event_espresso') . '">' . $datetime->get_i18n_datetime('DTT_EVT_start') . '</a>' : $datetime->get_i18n_datetime('DTT_EVT_start'); } return implode("<br />", $datetime_strings); }
/** * Callback for AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send trigger * * @since 4.3.0 * * @param string $registration_message_trigger_url * @param EE_Registration $registration * @param string $messenger * @param string $message_type * @return string */ public static function registration_message_trigger_url($registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice') { EE_Registry::instance()->load_helper('MSG_Template'); // whitelist $messenger switch ($messenger) { case 'pdf': $sending_messenger = 'pdf'; $generating_messenger = 'html'; break; case 'html': default: $sending_messenger = 'html'; $generating_messenger = 'html'; break; } // whitelist $message_type switch ($message_type) { case 'receipt': $message_type = 'receipt'; break; case 'invoice': default: $message_type = 'invoice'; break; } // verify that both the messenger AND the message type are active if (EEH_MSG_Template::is_messenger_active($sending_messenger) && EEH_MSG_Template::is_mt_active($message_type)) { //need to get the correct message template group for this (i.e. is there a custom invoice for the event this registration is registered for?) $template_query_params = array('MTP_is_active' => TRUE, 'MTP_messenger' => $generating_messenger, 'MTP_message_type' => $message_type, 'Event.EVT_ID' => $registration->event_ID()); //get the message template group. $msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params)); //if we don't have an EE_Message_Template_Group then return if (!$msg_template_group instanceof EE_Message_Template_Group) { // remove EVT_ID from query params so that global templates get picked up unset($template_query_params['Event.EVT_ID']); //get global template as the fallback $msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params)); } //if we don't have an EE_Message_Template_Group then return if (!$msg_template_group instanceof EE_Message_Template_Group) { return ''; } // generate the URL $registration_message_trigger_url = EEH_MSG_Template::generate_url_trigger($sending_messenger, $generating_messenger, 'purchaser', $message_type, $registration, $msg_template_group->ID(), $registration->transaction_ID()); } return $registration_message_trigger_url; }
/** * column_event_name */ function column_event_name(EE_Registration $item) { // page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62 $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $item->event_ID()), EVENTS_ADMIN_URL); $event_name = $item->event_name(); $event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso'); $edit_event = '<a href="' . $edit_event_url . '" title="' . sprintf(__('Edit Event: %s', 'event_espresso'), $event_name) . '">' . wp_trim_words($event_name, 30, '...') . '</a>'; $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id' => $item->event_ID()), REG_ADMIN_URL); $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="' . sprintf(__('Filter this list to only show registrations for %s', 'event_espresso'), $event_name) . '">' . __('View Registrations', 'event_espresso') . '</a>'; return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions)); }