本文整理汇总了PHP中EEH_Template::format_currency方法的典型用法代码示例。如果您正苦于以下问题:PHP EEH_Template::format_currency方法的具体用法?PHP EEH_Template::format_currency怎么用?PHP EEH_Template::format_currency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EEH_Template
的用法示例。
在下文中一共展示了EEH_Template::format_currency方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _setup_data
protected function _setup_data()
{
//basically ALL we're going to get from this is the transaction object and use it to build the majority of our info.
$session = $this->_data->get_session_data();
$this->txn = $session['transaction'];
if (empty($this->txn) || !$this->txn instanceof EE_Transaction) {
throw new EE_Error(__('Incoming data for the EE_Session data handler must have a valid EE_Transaction object in order to setup the data'));
}
$this->reg_info = array();
$this->incoming_data = $session;
$this->taxes = $this->txn->tax_total();
$this->grand_total_price_object = '';
//other data from the session (if possible)
$this->user_id = isset($session['user_id']) ? $session['user_id'] : '';
$this->ip_address = isset($session['ip_address']) ? $session['ip_address'] : '';
$this->user_agent = isset($session['user_agent']) ? $session['user_agent'] : '';
$this->init_access = $this->last_access = '';
$this->payment = $this->txn->get_first_related('Payment');
$this->payment = empty($this->payment) ? EE_Payment::new_instance(array('STS_ID' => EEM_Payment::status_id_pending, 'PAY_timestamp' => (int) current_time('timestamp'), 'PAY_gateway' => $this->txn->selected_gateway(), 'PAY_gateway_response' => $this->txn->gateway_response_on_transaction())) : $this->payment;
//if there is no payments associated with the transaction then we just create a default payment object for potential parsing.
$this->billing = $this->payment->details();
EE_Registry::instance()->load_helper('Template');
$this->billing['total_due'] = isset($this->billing['total']) ? EEH_Template::format_currency($this->billing['total']) : '';
//let's get all the registrations associated with this txn
$this->reg_objs = $this->txn->registrations();
$this->_assemble_data();
}
示例2: _setup_data
/**
* This will just setup the _events property in the expected format.
* @return void
*/
protected function _setup_data()
{
//now let's loop and set up the _events property. At the same time we'll set up attendee properties.
//a variable for tracking totals
$running_total = 0;
//get txn
$this->txn = $this->reg_obj->transaction();
$this->taxes = $this->txn->tax_total();
$this->grand_total_price_object = '';
//possible session stuff?
$session = $this->txn->session_data();
$session_data = $session instanceof EE_Session ? $session->get_session_data() : array();
//other data from the session (if possible)
$this->user_id = isset($session_data['user_id']) ? $session_data['user_id'] : '';
$this->ip_address = isset($session_data['ip_address']) ? $session_data['ip_address'] : '';
$this->user_agent = isset($session_data['user_agent']) ? $session_data['user_agent'] : '';
$this->init_access = $this->last_access = '';
$this->payment = $this->txn->get_first_related('Payment');
$this->payment = empty($this->payment) ? EE_Payment::new_instance(array('STS_ID' => EEM_Payment::status_id_pending, 'PAY_timestamp' => (int) current_time('timestamp'), 'PAY_gateway' => $this->txn->selected_gateway(), 'PAY_gateway_response' => $this->txn->gateway_response_on_transaction())) : $this->payment;
//if there is no payments associated with the transaction then we just create a default payment object for potential parsing.
$this->billing = $this->payment->details();
EE_Registry::instance()->load_helper('Template');
$this->billing['total_due'] = isset($this->billing['total']) ? EEH_Template::format_currency($this->billing['total']) : '';
//get reg_objs for txn
$this->reg_objs = $this->txn->registrations();
//now we can set things up like we do for other handlers
$this->_assemble_data();
}
示例3: _parser
protected function _parser($shortcode)
{
EE_Registry::instance()->load_helper('Template');
if (!$this->_data instanceof EE_Ticket) {
return '';
}
//get out cause we can only parse with the ticket object.
switch ($shortcode) {
case '[TICKET_ID]':
return $this->_data->ID();
break;
case '[TICKET_NAME]':
return $this->_data->get('TKT_name');
break;
case '[TICKET_DESCRIPTION]':
return $this->_data->get('TKT_description');
break;
case '[TICKET_PRICE]':
return EEH_Template::format_currency($this->_data->get('TKT_price'));
break;
case '[TKT_QTY_PURCHASED]':
return $this->_extra_data['data']->tickets[$this->_data->ID()]['count'];
break;
}
}
示例4: prepare_for_pretty_echoing
/**
* Schemas:
* 'localized_float': "3,023.00"
* 'no_currency_code': "$3,023.00"
* null: "$3,023.00<span>USD</span>"
* @param type $value_on_field_to_be_outputted
* @param type $schema
* @return string
*/
function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
{
$pretty_float = parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted);
if ($schema == 'localized_float') {
return $pretty_float;
}
if ($schema == 'no_currency_code') {
// echo "schema no currency!";
$display_code = false;
} else {
$display_code = true;
}
//we don't use the $pretty_float because format_currency will take care of it.
return EEH_Template::format_currency($value_on_field_to_be_outputted, false, $display_code);
}
示例5: _parser
protected function _parser($shortcode)
{
EE_Registry::instance()->load_helper('Template');
$this->_ticket = $this->_data instanceof EE_Ticket ? $this->_data : null;
$aee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null;
$aee = !$aee instanceof EE_Messages_Addressee && is_array($this->_extra_data) && isset($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $aee;
//possible EE_Line_Item may be incoming data
$this->_ticket = empty($this->_ticket) && $this->_data instanceof EE_Line_Item && $aee instanceof EE_Messages_Addressee && !empty($aee->line_items_with_children[$this->_data->ID()]['EE_Ticket']) && $aee->line_items_with_children[$this->_data->ID()]['EE_Ticket'] instanceof EE_Ticket ? $aee->line_items_with_children[$this->_data->ID()]['EE_Ticket'] : $this->_ticket;
//if still no ticket, then let's see if there is a reg_obj. If there IS, then we'll try and grab the ticket from the reg_obj instead.
if (empty($this->_ticket)) {
$this->_ticket = $aee instanceof EE_Messages_Addressee && $aee->reg_obj instanceof EE_Registration ? $aee->reg_obj->ticket() : NULL;
}
//If there is no event object by now then get out.
if (!$this->_ticket instanceof EE_Ticket) {
return '';
}
switch ($shortcode) {
case '[TICKET_ID]':
return $this->_ticket->ID();
break;
case '[TICKET_NAME]':
return $this->_ticket->get('TKT_name');
break;
case '[TICKET_DESCRIPTION]':
return $this->_ticket->get('TKT_description');
break;
case '[TICKET_PRICE]':
return EEH_Template::format_currency($this->_ticket->get('TKT_price'));
break;
case '[TICKET_PRICE_WITH_TAXES]':
return EEH_Template::format_currency($this->_ticket->get_ticket_total_with_taxes());
break;
case '[TKT_QTY_PURCHASED]':
return $aee instanceof EE_Messages_Addressee ? $aee->tickets[$this->_ticket->ID()]['count'] : '';
break;
}
if (strpos($shortcode, '[TKT_USES_*') !== FALSE) {
$attrs = $this->_get_shortcode_attrs($shortcode);
$schema = empty($attrs['schema']) ? null : $attrs['schema'];
return $this->_ticket->get_pretty('TKT_uses', $schema);
}
return '';
}
示例6: _setup_data
protected function _setup_data()
{
$this->reg_info = array();
$this->txn = $this->_data['txn_obj'];
$this->payment = $this->_data['pmt_obj'];
$this->incoming_data = $this->_data;
$this->taxes = $this->txn->tax_total();
$this->grand_total_price_object = '';
//not available and not needed?
$session_data = $this->txn->session_data();
//other data from the session (if possible)
$this->user_id = isset($session_data['user_id']) ? $session_data['user_id'] : '';
$this->ip_address = isset($session_data['ip_address']) ? $session_data['ip_address'] : '';
$this->user_agent = isset($session_data['user_agent']) ? $session_data['user_agent'] : '';
$this->init_access = $this->last_access = '';
$this->billing = $this->payment->details();
// check that the gateways didn't blow up
if (!$this->billing instanceof EE_Error) {
EE_Registry::instance()->load_helper('Template');
$this->billing['total_due'] = isset($this->billing['total']) ? EEH_Template::format_currency($this->billing['total']) : '';
}
$this->reg_objs = $this->txn->get_many_related('Registration');
$this->_assemble_data();
}
示例7: _e
</tbody>
<tfoot>
<tr class='total_tr'><td colspan="4"></td>
<td class="item_r"><?php
_e('Total Paid', 'event_espresso');
?>
</td>
<td class="item_r"><?php
echo EEH_Template::format_currency($amount_pd);
?>
</td>
</tr>
<?php
//echo $discount;
?>
<tr class="total_tr">
<td colspan="4"></td>
<td class="total" id="total_currency"><?php
_e('Amount Owed', 'event_espresso');
?>
</td>
<td class="total"><?php
echo EEH_Template::format_currency($total_cost - $amount_pd);
?>
</td>
</tr>
</tfoot>
</table>
</div>
示例8: process_registration_payments
/**
* update registrations REG_paid field after successful payment and link registrations with payment
*
* @param EE_Transaction $transaction
* @param EE_Payment $payment
* @param EE_Registration[] $registrations
* @throws \EE_Error
*/
public function process_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $registrations = array())
{
// only process if payment was successful
if ($payment->status() !== EEM_Payment::status_id_approved) {
return;
}
//EEM_Registration::instance()->show_next_x_db_queries();
if (empty($registrations)) {
// find registrations with monies owing that can receive a payment
$registrations = $transaction->registrations(array(array('STS_ID' => array('IN', EEM_Registration::reg_statuses_that_allow_payment()), 'REG_final_price' => array('!=', 0), 'REG_final_price*' => array('!=', 'REG_paid', true))));
}
// still nothing ??!??
if (empty($registrations)) {
return;
}
// todo: break out the following logic into a separate strategy class
// todo: named something like "Sequential_Reg_Payment_Strategy"
// todo: which would apply payments using the capitalist "first come first paid" approach
// todo: then have another strategy class like "Distributed_Reg_Payment_Strategy"
// todo: which would be the socialist "everybody gets a piece of pie" approach,
// todo: which would be better for deposits, where you want a bit of the payment applied to each registration
$refund = $payment->is_a_refund();
// how much is available to apply to registrations?
$available_payment_amount = abs($payment->amount());
foreach ($registrations as $registration) {
if ($registration instanceof EE_Registration) {
// nothing left?
if ($available_payment_amount <= 0) {
break;
}
if ($refund) {
$available_payment_amount = $this->process_registration_refund($registration, $payment, $available_payment_amount);
} else {
$available_payment_amount = $this->process_registration_payment($registration, $payment, $available_payment_amount);
}
}
}
if ($available_payment_amount > 0 && apply_filters('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false)) {
EE_Error::add_attention(sprintf(__('A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso'), EEH_Template::format_currency($available_payment_amount), implode(', ', array_keys($registrations)), '<br/>', EEH_Template::format_currency($payment->amount())), __FILE__, __FUNCTION__, __LINE__);
}
}
示例9: espresso_event_tickets_available
/**
* espresso_event_tickets_available
* returns the ticket types available for purchase for an event
*
* @param int $EVT_ID
* @param bool $echo
* @param bool $format
* @return string
*/
function espresso_event_tickets_available($EVT_ID = 0, $echo = TRUE, $format = TRUE)
{
EE_Registry::instance()->load_helper('Event_View');
$tickets = EEH_Event_View::event_tickets_available($EVT_ID);
if (is_array($tickets) && !empty($tickets)) {
// if formatting then $html will be a string, else it will be an array of ticket objects
$html = $format ? '<ul id="ee-event-tickets-ul-' . $EVT_ID . '" class="ee-event-tickets-ul">' : array();
foreach ($tickets as $ticket) {
if ($ticket instanceof EE_Ticket) {
if ($format) {
$html .= '<li id="ee-event-tickets-li-' . $ticket->ID() . '" class="ee-event-tickets-li">';
$html .= $ticket->name() . ' ' . EEH_Template::format_currency($ticket->get_ticket_total_with_taxes());
$html .= '</li>';
} else {
$html[] = $ticket;
}
}
}
if ($format) {
$html .= '</ul>';
}
if ($echo && !$format) {
echo $html;
return '';
}
return $html;
}
return '';
}
示例10: column_TKT_price
function column_TKT_price($item)
{
return EEH_Template::format_currency($item->get('TKT_price'));
}
示例11: _sub_item_row
/**
* _sub_item_row
*
* @param EE_Line_Item $line_item
* @param array $options
* @return mixed
*/
private function _sub_item_row(EE_Line_Item $line_item, $options = array())
{
// start of row
$html = EEH_HTML::tr('', 'item sub-item-row');
// name && desc
$name_and_desc = $line_item->name();
$name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '';
// name td
$html .= EEH_HTML::td($name_and_desc, '', 'item_l sub-item');
// discount/surcharge td
if ($line_item->is_percent()) {
$html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c');
} else {
$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
}
// total td
$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght');
// end of row
$html .= EEH_HTML::trx();
return $html;
}
开发者ID:aaronfrey,项目名称:PepperLillie-GSP,代码行数:28,代码来源:EE_Default_Line_Item_Display_Strategy.strategy.php
示例12: _sub_total_row
/**
* _total_row
*
* @param EE_Line_Item $line_item
* @param string $text
* @return mixed
*/
private function _sub_total_row(EE_Line_Item $line_item, $text = '')
{
$html = '';
if ($line_item->total()) {
// start of row
$html = EEH_HTML::tr('', '', 'total_tr odd');
$text = $line_item->code() == 'pre-tax-subtotal' ? EED_Multi_Event_Registration::$event_cart_name . ' ' . $text : $text;
// total td
$html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"');
// total td
$total = $line_item->total();
$html .= EEH_HTML::td(EEH_Template::format_currency($total, false, false), '', 'total jst-rght');
// end of row
$html .= EEH_HTML::trx();
}
return $html;
}
开发者ID:adrianjonmiller,项目名称:hearts-being-healed,代码行数:24,代码来源:EE_Mini_Cart_Table_Line_Item_Display_Strategy.php
示例13: get_payment_row_html
/**
* get_payment_row_html
*
* @access public
* @param EE_Payment $payment
* @return string
*/
public function get_payment_row_html($payment = NULL)
{
$html = '';
if ($payment instanceof EE_Payment) {
$payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined ? '<br /><span class="small-text">' . $payment->gateway_response() . '</span>' : '';
$html .= '
<tr>
<td>
' . $payment->timestamp() . '
</td>
<td>
' . str_replace('_', ' ', $payment->gateway()) . '
</td>
<td class="jst-rght">
' . EEH_Template::format_currency($payment->amount()) . '
</td>
<td class="jst-rght" style="line-height:1;">
' . $payment->pretty_status(TRUE) . $payment_declined_msg . '
</td>
</tr>';
do_action('AHEE__thank_you_page_payment_details_template__after_each_payment', $payment);
}
return $html;
}
示例14: txn_attendees_meta_box
/**
* txn_attendees_meta_box
* generates HTML for the Attendees Transaction main meta box
*
* @access public
* @param WP_Post $post
* @param array $metabox
* @return void
*/
public function txn_attendees_meta_box($post, $metabox = array('args' => array()))
{
extract($metabox['args']);
$this->_template_args['post'] = $post;
$this->_template_args['event_attendees'] = array();
// process items in cart
$line_items = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item')));
if (!empty($line_items)) {
foreach ($line_items as $item) {
if ($item instanceof EE_Line_Item) {
$ticket = $item->ticket();
if (empty($ticket)) {
continue;
//right now we're only handling tickets here. Cause its expected that only tickets will have attendees right?
}
$ticket_price = EEH_Template::format_currency($item->get('LIN_unit_price'));
$event = $ticket->get_first_related('Registration')->get_first_related('Event');
$event_name = $event instanceof EE_Event ? $event->get('EVT_name') . ' - ' . $item->get('LIN_name') : '';
$registrations = $ticket->get_many_related('Registration', array(array('TXN_ID' => $this->_transaction->ID())));
foreach ($registrations as $registration) {
$this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->get('REG_count');
$this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name;
$this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price;
// attendee info
$attendee = $registration->get_first_related('Attendee');
if ($attendee instanceof EE_Attendee) {
$this->_template_args['event_attendees'][$registration->ID()]['att_id'] = $attendee->ID();
$this->_template_args['event_attendees'][$registration->ID()]['attendee'] = $attendee->full_name();
$this->_template_args['event_attendees'][$registration->ID()]['email'] = $attendee->email();
$this->_template_args['event_attendees'][$registration->ID()]['address'] = implode(',<br>', $attendee->full_address_as_array());
} else {
$this->_template_args['event_attendees'][$registration->ID()]['att_id'] = '';
$this->_template_args['event_attendees'][$registration->ID()]['attendee'] = '';
$this->_template_args['event_attendees'][$registration->ID()]['email'] = '';
$this->_template_args['event_attendees'][$registration->ID()]['address'] = '';
}
}
}
}
$this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'attendees'), TXN_ADMIN_URL);
echo EEH_Template::display_template(TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE);
} else {
echo sprintf(__('%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso'), '<p class="important-notice">', '</p>');
}
}
示例15: _registration_payment_data_array
/**
* _registration_payment_data_array
* adds info for 'owing' and 'paid' for each registration to the json response
*
* @access protected
* @param array $REG_IDs
* @return array
*/
protected function _registration_payment_data_array($REG_IDs)
{
$registration_payment_data = array();
//if non empty reg_ids lets get an array of registrations and update the values for the apply_payment/refund rows.
if (!empty($REG_IDs)) {
EE_Registry::instance()->load_helper('Template');
$registrations = EEM_Registration::instance()->get_all(array(array('REG_ID' => array('IN', $REG_IDs))));
foreach ($registrations as $registration) {
if ($registration instanceof EE_Registration) {
$registration_payment_data[$registration->ID()] = array('paid' => $registration->pretty_paid(), 'owing' => EEH_Template::format_currency($registration->final_price() - $registration->paid()));
}
}
}
return $registration_payment_data;
}