本文整理汇总了PHP中EE_Transaction::datetime方法的典型用法代码示例。如果您正苦于以下问题:PHP EE_Transaction::datetime方法的具体用法?PHP EE_Transaction::datetime怎么用?PHP EE_Transaction::datetime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EE_Transaction
的用法示例。
在下文中一共展示了EE_Transaction::datetime方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initialize_registrations
/**
* adds related EE_Registration objects for each ticket in the cart to the current EE_Transaction object
*
* @access private
* @return void
*/
private function _initialize_registrations()
{
if ($this->_transaction instanceof EE_Transaction) {
$att_nmbr = 0;
$total_items = $this->_cart->all_ticket_quantity_count();
// now let's add the cart items to the $transaction
foreach ($this->_cart->get_tickets() as $item) {
// grab the related ticket object for this line_item
$ticket = $item->ticket();
if (!$ticket instanceof EE_Ticket) {
EE_Error::add_error(sprintf(__("Line item %s did not contain a valid ticket", "event_espresso"), $item->ID()), __FILE__, __FUNCTION__, __LINE__);
break;
}
$first_datetime = $ticket->get_first_related('Datetime');
if (!$first_datetime instanceof EE_Datetime) {
EE_Error::add_error(sprintf(__("The ticket (%s) is not associated with any valid datetimes.", "event_espresso"), $ticket->name()), __FILE__, __FUNCTION__, __LINE__);
continue;
}
$event = $first_datetime->get_first_related('Event');
if (!$event instanceof EE_Event) {
EE_Error::add_error(sprintf(__("The ticket (%s) is not associated with a valid event.", "event_espresso"), $ticket->name()), __FILE__, __FUNCTION__, __LINE__);
continue;
}
//do the following for each ticket of this type they selected
for ($x = 1; $x <= $item->quantity(); $x++) {
$att_nmbr++;
$reg_url_link = $att_nmbr . '-' . $item->code();
// grab the default reg status for the event
$registration_status = $event->default_registration_status();
// if it's set to "Approved", then temporarily downgrade it to "Pending Payment", so that reg limits and/or ticket sales are not skewed in case the reg process is aborted
$registration_status = $registration_status == EEM_Registration::status_id_approved ? EEM_Registration::status_id_pending_payment : $registration_status;
try {
// now create a new registration for the ticket
$registration = EE_Registration::new_instance(array('EVT_ID' => $event->ID(), 'TXN_ID' => $this->_transaction->ID(), 'TKT_ID' => $ticket->ID(), 'STS_ID' => $registration_status, 'REG_date' => $this->_transaction->datetime(), 'REG_final_price' => $ticket->price(), 'REG_session' => EE_Registry::instance()->SSN->id(), 'REG_count' => $att_nmbr, 'REG_group_size' => $total_items, 'REG_url_link' => $reg_url_link));
// now create relations between various objects
$registration->_add_relation_to($event, 'Event', array(), $event->ID());
$registration->_add_relation_to($item->ticket(), 'Ticket', array(), $item->ticket()->ID());
$this->_transaction->_add_relation_to($registration, 'Registration', array(), $reg_url_link);
// if something failed...
} catch (Exception $e) {
EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
return;
}
}
}
EE_Registry::instance()->SSN->set_session_data(array('transaction' => $this->_transaction));
EE_Registry::instance()->SSN->update();
// echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
}
return;
}
示例2: handle_ipn_for_transaction
/**
* Handle IPN for transaction
*/
public function handle_ipn_for_transaction(EE_Transaction $transaction)
{
global $pronamic_payment, $pronamic_url;
// Transaction ID
$transaction_id = $transaction->ID();
// Payment
$payment = $this->_PAY->get_payment_by_txn_id_chq_nmbr($transaction_id);
if (empty($payment)) {
$payment = EE_Payment::new_instance(array('TXN_ID' => $transaction_id, 'STS_ID' => EEM_Payment::status_id_approved, 'PAY_timestamp' => $transaction->datetime(), 'PAY_amount' => $pronamic_payment->amount, 'PAY_gateway' => __('iDEAL', 'pronamic_ideal'), 'PAY_txn_id_chq_nmbr' => $transaction_id));
} else {
$payment->set_status(EEM_Payment::status_id_approved);
}
// Save
$payment->save();
// URL
$registration = $transaction->primary_registration();
$pronamic_url = $this->_get_return_url($registration);
// Return update
return $this->update_transaction_with_payment($transaction, $payment);
}
示例3: generate_ONE_registration_from_line_item
/**
* generate_ONE_registration_from_line_item
*
* Although a ticket line item may have a quantity greater than 1,
* this method will ONLY CREATE ONE REGISTRATION !!!
* Regardless of the ticket line item quantity.
* This means that any code calling this method is responsible for ensuring
* that the final registration count matches the ticket line item quantity.
* This was done to make it easier to match the number of registrations
* to the number of tickets in the cart, when the cart has been edited
* after SPCO has already been initialized. So if an additional ticket was added to the cart, you can simply pass
* the line item to this method to add a second ticket, and in this case, you would not want to add 2 tickets.
*
* @param EE_Line_Item $line_item
* @param \EE_Transaction $transaction
* @param int $att_nmbr
* @param int $total_ticket_count
* @return \EE_Registration | null
* @throws \EE_Error
*/
public function generate_ONE_registration_from_line_item(EE_Line_Item $line_item, EE_Transaction $transaction, $att_nmbr = 1, $total_ticket_count = 1)
{
// grab the related ticket object for this line_item
$ticket = $line_item->ticket();
if (!$ticket instanceof EE_Ticket) {
EE_Error::add_error(sprintf(__("Line item %s did not contain a valid ticket", "event_espresso"), $line_item->ID()), __FILE__, __FUNCTION__, __LINE__);
return null;
}
$first_datetime = $ticket->get_first_related('Datetime');
if (!$first_datetime instanceof EE_Datetime) {
EE_Error::add_error(sprintf(__("The ticket (%s) is not associated with any valid datetimes.", "event_espresso"), $ticket->name()), __FILE__, __FUNCTION__, __LINE__);
return null;
}
$event = $first_datetime->get_first_related('Event');
if (!$event instanceof EE_Event) {
EE_Error::add_error(sprintf(__("The ticket (%s) is not associated with a valid event.", "event_espresso"), $ticket->name()), __FILE__, __FUNCTION__, __LINE__);
return null;
}
$reg_url_link = $this->generate_reg_url_link($att_nmbr, $line_item);
if ($this->_reg_final_price_per_tkt_line_item === null) {
$this->_reg_final_price_per_tkt_line_item = EEH_Line_Item::calculate_reg_final_prices_per_line_item($transaction->total_line_item());
}
//ok now find this new registration's final price
if (isset($this->_reg_final_price_per_tkt_line_item[$line_item->ID()])) {
$final_price = $this->_reg_final_price_per_tkt_line_item[$line_item->ID()];
} else {
$message = sprintf(__('The ticket line item (ID:%1$d) had no entry in the reg_final_price_per_tkt_line_item array.', 'event_espresso'), $line_item->ID());
if (WP_DEBUG) {
throw new EE_Error($message);
} else {
EE_Log::instance()->log(__CLASS__, __FUNCTION__, $message);
}
$final_price = $ticket->get_ticket_total_with_taxes();
}
// now create a new registration for the ticket
$registration = EE_Registration::new_instance(array('EVT_ID' => $event->ID(), 'TXN_ID' => $transaction->ID(), 'TKT_ID' => $ticket->ID(), 'STS_ID' => EEM_Registration::status_id_incomplete, 'REG_date' => $transaction->datetime(), 'REG_final_price' => $final_price, 'REG_session' => EE_Registry::instance()->SSN->id(), 'REG_count' => $att_nmbr, 'REG_group_size' => $total_ticket_count, 'REG_url_link' => $reg_url_link));
$registration->set_reg_code($this->generate_reg_code($registration));
$registration->save();
$registration->_add_relation_to($event, 'Event', array(), $event->ID());
$registration->_add_relation_to($line_item->ticket(), 'Ticket', array(), $line_item->ticket()->ID());
$transaction->_add_relation_to($registration, 'Registration');
return $registration;
}
示例4: generate_ONE_registration_from_line_item
/**
* generate_ONE_registration_from_line_item
*
* Although a ticket line item may have a quantity greater than 1,
* this method will ONLY CREATE ONE REGISTRATION !!!
* Regardless of the ticket line item quantity.
* This means that any code calling this method is responsible for ensuring
* that the final registration count matches the ticket line item quantity.
* This was done to make it easier to match the number of registrations
* to the number of tickets in the cart, when the cart has been edited
* after SPCO has already been initialized. So if an additional ticket was added to the cart, you can simply pass
* the line item to this method to add a second ticket, and in this case, you would not want to add 2 tickets.
*
* @param EE_Line_Item $line_item
* @param \EE_Transaction $transaction
* @param int $att_nmbr
* @param int $total_ticket_count
* @return \EE_Registration | null
* @throws \EE_Error
*/
public function generate_ONE_registration_from_line_item(EE_Line_Item $line_item, EE_Transaction $transaction, $att_nmbr = 1, $total_ticket_count = 1)
{
// grab the related ticket object for this line_item
$ticket = $line_item->ticket();
if (!$ticket instanceof EE_Ticket) {
EE_Error::add_error(sprintf(__("Line item %s did not contain a valid ticket", "event_espresso"), $line_item->ID()), __FILE__, __FUNCTION__, __LINE__);
return null;
}
$first_datetime = $ticket->get_first_related('Datetime');
if (!$first_datetime instanceof EE_Datetime) {
EE_Error::add_error(sprintf(__("The ticket (%s) is not associated with any valid datetimes.", "event_espresso"), $ticket->name()), __FILE__, __FUNCTION__, __LINE__);
return null;
}
$event = $first_datetime->get_first_related('Event');
if (!$event instanceof EE_Event) {
EE_Error::add_error(sprintf(__("The ticket (%s) is not associated with a valid event.", "event_espresso"), $ticket->name()), __FILE__, __FUNCTION__, __LINE__);
return null;
}
$reg_url_link = $this->generate_reg_url_link($att_nmbr, $line_item);
// now create a new registration for the ticket
$registration = EE_Registration::new_instance(array('EVT_ID' => $event->ID(), 'TXN_ID' => $transaction->ID(), 'TKT_ID' => $ticket->ID(), 'STS_ID' => EEM_Registration::status_id_incomplete, 'REG_date' => $transaction->datetime(), 'REG_final_price' => $ticket->get_ticket_total_with_taxes(), 'REG_session' => EE_Registry::instance()->SSN->id(), 'REG_count' => $att_nmbr, 'REG_group_size' => $total_ticket_count, 'REG_url_link' => $reg_url_link));
$registration->set_reg_code($this->generate_reg_code($registration));
$registration->save();
$registration->_add_relation_to($event, 'Event', array(), $event->ID());
$registration->_add_relation_to($line_item->ticket(), 'Ticket', array(), $line_item->ticket()->ID());
$transaction->_add_relation_to($registration, 'Registration');
return $registration;
}
示例5:
/**
* column_TXN_timestamp
* @param \EE_Transaction $item
* @return string
*/
function column_TXN_timestamp(EE_Transaction $item)
{
$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_transaction', 'TXN_ID' => $item->ID()), TXN_ADMIN_URL);
// is TXN less than 2 hours old ?
if (current_time('timestamp') - EE_Registry::instance()->SSN->lifespan() < strtotime($item->datetime()) && ($item->failed() || $item->is_abandoned())) {
$txn_date = '<a href="' . $view_lnk_url . '" title="' . esc_attr__('View Transaction Details for TXN #', 'event_espresso') . $item->ID() . '">' . __('TXN in progress...', 'event_espresso') . '</a>';
} else {
$txn_date = '<a href="' . $view_lnk_url . '" title="' . esc_attr__('View Transaction Details for TXN #', 'event_espresso') . $item->ID() . '">' . $item->get_i18n_datetime('TXN_timestamp') . '</a>';
}
return $txn_date;
}
开发者ID:robert-osborne,项目名称:event-espresso-core-1,代码行数:16,代码来源:EE_Admin_Transactions_List_Table.class.php
示例6: _get_txn_timestamp
protected function _get_txn_timestamp(EE_Transaction $item)
{
//txn timestamp
// is TXN less than 2 hours old ?
if (time() - EE_Registry::instance()->SSN->lifespan() < $item->datetime(false, true) && ($item->failed() || $item->is_abandoned())) {
$timestamp = __('TXN in progress...', 'event_espresso');
} else {
$timestamp = $item->get_i18n_datetime('TXN_timestamp');
}
return $timestamp;
}
开发者ID:DavidSteinbauer,项目名称:event-espresso-core,代码行数:11,代码来源:EE_Admin_Transactions_List_Table.class.php