本文整理汇总了PHP中EEM_Event类的典型用法代码示例。如果您正苦于以下问题:PHP EEM_Event类的具体用法?PHP EEM_Event怎么用?PHP EEM_Event使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EEM_Event类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: instance
/**
* This function is a singleton method used to instantiate the EEM_Event object
*
* @access public
* @param string $timezone
* @return EEM_Event
*/
public static function instance($timezone = NULL)
{
// check if instance of EEM_Event already exists
if (!self::$_instance instanceof EEM_Event) {
// instantiate Espresso_model
self::$_instance = new self($timezone);
}
//we might have a timezone set, let set_timezone decide what to do with it
self::$_instance->set_timezone($timezone);
// EEM_Event object
return self::$_instance;
}
开发者ID:antares-ff,项目名称:ANTARES-Test,代码行数:19,代码来源:EEM_Event.model.php
示例2: get_event
/**
* get_event
* attempts to retrieve an EE_Event object any way it can
*
* @access public
* @param int $EVT_ID
* @return object
*/
public static function get_event($EVT_ID = 0)
{
$EVT_ID = $EVT_ID instanceof WP_Post ? $EVT_ID->ID : absint($EVT_ID);
// do we already have the Event you are looking for?
if (EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID) {
return EEH_Event_View::$_event;
}
EEH_Event_View::$_event = NULL;
// international newspaper?
global $post;
// if this is being called from an EE_Event post, then we can just grab the attached EE_Event object
if (isset($post->post_type) && $post->post_type == 'espresso_events' || $EVT_ID) {
// d( $post );
// grab the event we're looking for
if (isset($post->EE_Event) && ($EVT_ID == 0 || $EVT_ID == $post->ID)) {
EEH_Event_View::$_event = $post->EE_Event;
// d( EEH_Event_View::$_event );
}
// now if we STILL do NOT have an EE_Event model object, BUT we have an Event ID...
if (!EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) {
// sigh... pull it from the db
EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
// d( EEH_Event_View::$_event );
}
}
return EEH_Event_View::$_event;
}
开发者ID:robert-osborne,项目名称:event-espresso-core-1,代码行数:35,代码来源:EEH_Event_View.helper.php
示例3: test_REG_final_price_matches_total_of_filtering_line_item_tree__with_sub_line_items
/**
* like test_REG_final_price_matches_total_of_filtering_line_item_tree,
* but makes sure the tickets have sub-prices, because that has shown to have some
* bugs with calculations so far
*/
function test_REG_final_price_matches_total_of_filtering_line_item_tree__with_sub_line_items()
{
$transaction = $this->new_typical_transaction(array('ticket_types' => 2, 'fixed_ticket_price_modifiers' => 2));
//add another ticket purchase for one of the same events
$event1 = EEM_Event::instance()->get_one(array(array('Registration.TXN_ID' => $transaction->ID())));
$event_line_item = EEM_Line_Item::instance()->get_one(array(array('TXN_ID' => $transaction->ID(), 'OBJ_type' => 'Event', 'OBJ_ID' => $event1->ID())));
$discount = $this->new_model_obj_with_dependencies('Line_Item', array('LIN_type' => EEM_Line_Item::type_line_item, 'LIN_name' => 'event discount', 'LIN_total' => -8, 'LIN_unit_price' => -8, 'LIN_percent' => 0, 'LIN_quantity' => 1, 'LIN_parent' => $event_line_item->ID(), 'LIN_percent' => null, 'LIN_order' => count($event_line_item->children())));
$transaction->total_line_item()->recalculate_pre_tax_total();
//and add an unrelated purchase
EEH_Line_Item::add_unrelated_item($transaction->total_line_item(), 'Transaction-Wide Discount', -5);
$totals = EEH_Line_Item::calculate_reg_final_prices_per_line_item($transaction->total_line_item());
// honestly the easiest way to confirm the total was right is to visualize the tree
// var_dump( $totals );
// EEH_Line_Item::visualize( $transaction->total_line_item() );
//for each registration on the tranasction, verify the REG_final_price
//indicated by EEH_Line_Item::calculate_reg_final_prices_per_line_item matches
//what the line item filters would have returned
EEH_Autoloader::register_line_item_filter_autoloaders();
foreach ($transaction->registrations() as $registration) {
$ticket_line_item = EEM_Line_Item::instance()->get_line_item_for_registration($registration);
$reg_final_price_from_line_item_helper = $totals[$ticket_line_item->ID()];
//now get the line item filter's final price
$filters = new EE_Line_Item_Filter_Collection();
$filters->add(new EE_Single_Registration_Line_Item_Filter($registration));
$line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item());
$filtered_line_item_tree = $line_item_filter_processor->process();
$reg_final_price_from_line_item_filter = $filtered_line_item_tree->total();
$this->assertLessThan(0.2, abs($reg_final_price_from_line_item_filter - $reg_final_price_from_line_item_helper));
}
}
开发者ID:teemuoksanen,项目名称:event-espresso-core,代码行数:35,代码来源:EE_Line_Item__EE_Single_Registration_Line_Item_Filter__Integration_Test.php
示例4: _set_new_event
/**
* This allows setting the $_event property to a new event object if the incoming args for the
* new dtt have an event id (or set to default if no evt_id)
*
* @since 4.3.0
* @param int $EVT_ID EE_Event ID
*/
private function _set_new_event($EVT_ID = 0)
{
$this->_event = empty($EVT_ID) ? EEM_Event::instance()->get_one_by_ID($EVT_ID) : $this->factory->event->create();
//fail safe just in case (so we can be sure to have an event).
if (empty($this->_event)) {
$this->_event = $this->factory->event->create();
}
}
开发者ID:DavidSteinbauer,项目名称:event-espresso-core,代码行数:15,代码来源:EE_UnitTest_Factory_For_Datetime.class.php
示例5: _generate_restrictions
/**
*
* @return \EE_Default_Where_Conditions
*/
protected function _generate_restrictions()
{
//if there are no standard caps for this model, then for now all we know
//if they need the default cap to access this
if (!$this->model()->cap_slug()) {
return array(self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions());
}
$event_model = EEM_Event::instance();
return array(EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => new EE_Default_Where_Conditions(array($this->_path_to_event_model . 'status' => 'publish')), EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => new EE_Default_Where_Conditions(array('OR*' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => array($this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, $this->_path_to_event_model . 'status' => 'publish'))), EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => new EE_Default_Where_Conditions(array('OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => array($this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, $this->_path_to_event_model . 'status' => array('!=', 'private')))));
}
开发者ID:DavidSteinbauer,项目名称:event-espresso-core,代码行数:14,代码来源:EE_Restriction_Generator_Event_Related_Public.strategy.php
示例6: test_reset_model
/**
* checks that when we reset a model, that it does so properly and
* also returns the NEW model
*/
public function test_reset_model()
{
$model_a = EE_Registry::instance()->load_model('Event');
$model_a2 = EE_Registry::instance()->load_model('Event');
$model_a3 = EEM_Event::instance();
$this->assertEquals($model_a, $model_a2);
$this->assertEquals($model_a2, $model_a3);
$model_b1 = EEM_Event::reset();
$this->assertNotSame($model_a, $model_b1);
$model_b2 = EE_Registry::instance()->reset_model('Event');
$this->assertNotSame($model_a, $model_b2);
}
开发者ID:DavidSteinbauer,项目名称:event-espresso-core,代码行数:16,代码来源:EE_Registry_Test.php
示例7: spaces_remaining
/**
* Like optimum_sales_now, but minus total sales so far.
* See EE_Event::spaces_remaining_for_sale( true );
*
* @param array $wpdb_row
* @param \WP_REST_Request $request
* @param Base $controller
* @return int
* @throws \EE_Error
*/
public static function spaces_remaining($wpdb_row, $request, $controller)
{
if (is_array($wpdb_row) && isset($wpdb_row['Event_CPT.ID'])) {
$event_obj = \EEM_Event::instance()->get_one_by_ID($wpdb_row['Event_CPT.ID']);
} else {
$event_obj = null;
}
if ($event_obj instanceof \EE_Event) {
return $event_obj->spaces_remaining_for_sale();
} else {
throw new \EE_Error(sprintf(__('Cannot calculate spaces_remaining because the event with ID %1$s (from database row %2$s) was not found', 'event_espresso'), $wpdb_row['Event_CPT.ID'], print_r($wpdb_row, true)));
}
}
开发者ID:aaronfrey,项目名称:PepperLillie-GSP,代码行数:23,代码来源:Event.php
示例8: primary_questions
public function primary_questions($post_id, $post)
{
$this->_event = $this->_adminpage_obj->get_event_object();
$event_id = $this->_event->ID();
?>
<div class="inside">
<p><strong>
<?php
_e('Question Groups', 'event_espresso');
?>
</strong><br />
<?php
_e('Add a pre-populated', 'event_espresso');
?>
<a href="admin.php?page=espresso_registration_form" target="_blank">
<?php
_e('group of questions', 'event_espresso');
?>
</a>
<?php
_e('to your event. The personal information group is required for all events.', 'event_espresso');
?>
</p>
<?php
$QSGs = EEM_Event::instance()->get_all_question_groups();
$EQGs = !empty($event_id) ? $this->_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 1))) : array();
$EQGids = array_keys($EQGs);
//printr( $QSGs, '$QSGs <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
if (!empty($QSGs)) {
$html = count($QSGs) > 10 ? '<div style="height:250px;overflow:auto;">' : '';
foreach ($QSGs as $QSG) {
$checked = in_array($QSG->ID(), $EQGids) || $QSG->get('QSG_system') == 1 ? ' checked="checked"' : '';
$visibility = $QSG->get('QSG_system') == 1 ? ' style="visibility:hidden"' : '';
$edit_link = $this->_adminpage_obj->add_query_args_and_nonce(array('action' => 'edit_question_group', 'QSG_ID' => $QSG->ID()), EE_FORMS_ADMIN_URL);
$html .= '
<p id="event-question-group-' . $QSG->ID() . '">
<input value="' . $QSG->ID() . '" type="checkbox"' . $visibility . ' name="question_groups[' . $QSG->ID() . ']"' . $checked . ' />
<a href="' . $edit_link . '" title="Edit ' . $QSG->get('QSG_name') . ' Group" target="_blank">' . $QSG->get('QSG_name') . '</a>
</p>';
}
$html .= count($QSGs) > 10 ? '</div>' : '';
echo $html;
} else {
echo __('There seems to be a problem with your questions. Please contact [email protected]', 'event_espresso');
}
do_action('AHEE_event_editor_questions_notice');
?>
</div>
<?php
}
开发者ID:antares-ff,项目名称:ANTARES-Test,代码行数:50,代码来源:espresso_events_Registration_Form_Hooks.class.php
示例9: _generate_restrictions
/**
* @return EE_Default_Where_Conditions
* @throws EE_Error
*/
protected function _generate_restrictions()
{
//if there are no standard caps for this model, then for now all we know
//if they need the default cap to access this
if (!$this->model()->cap_slug()) {
return array(self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions());
}
$event_model = EEM_Event::instance();
$restrictions = array(EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => new EE_Default_Where_Conditions(array('OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => array($this->_default_field_name => true, $this->_path_to_event_model . 'status' => 'publish'))), EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => new EE_Default_Where_Conditions(array('OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => array($this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, $this->_default_field_name => true, $this->_path_to_event_model . 'status' => 'publish'))), EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => new EE_Default_Where_Conditions(array('OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => array($this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, $this->_path_to_event_model . 'status' => array('!=', 'private'), $this->_default_field_name => true))), EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_default') => new EE_Default_Where_Conditions(array($this->_default_field_name => false)));
if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_others_default')) {
//if they don't have the "others" default capability, restrict access to only their default ones, and non-default ones
$restrictions[EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others_default')] = new EE_Default_Where_Conditions(array('OR*no_' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others_default') => array('AND' => array(EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, $this->_default_field_name => true), $this->_default_field_name => false)));
}
return $restrictions;
}
开发者ID:DavidSteinbauer,项目名称:event-espresso-core,代码行数:19,代码来源:EE_Restriction_Generator_Default_Public.strategy.php
示例10: test_get_minimum_where_conditions_during_query
/**
* Test that when we set the minimum where conditions, we DO find cpt items
* that are trashed, BUT DO NOT find CPT items of the wrong post_type (whcih might,
* by some hackery, have an entry in the meta table)
* @group 9179
*/
public function test_get_minimum_where_conditions_during_query()
{
$this->assertEquals(0, EEM_Event::instance()->count(array('default_where_conditions' => 'none')));
$e_normal = $this->new_model_obj_with_dependencies('Event', array('status' => EEM_CPT_Base::post_status_publish));
$e_trashed = $this->new_model_obj_with_dependencies('Event', array('status' => EEM_CPT_Base::post_status_trashed));
$monkey_post = $this->factory->post->create_and_get(array('post_type' => 'monkey'));
//now verify we get what we wanted: the normal and trashed event, but not
//the "monkey" post
$events_found = EEM_Event::instance()->get_all(array('default_where_conditions' => 'minimum'));
$this->assertArrayContains($e_normal, $events_found);
$this->assertArrayContains($e_trashed, $events_found);
$this->assertEquals(2, count($events_found));
//incidentally, lets show the problem of using the 'default_where_conditions' => 'none'
//it WOULD count the monkey post. Which is obviously NOT an event!
$this->assertEquals(3, EEM_Event::instance()->count(array('default_where_conditions' => 'none')));
}
开发者ID:teemuoksanen,项目名称:event-espresso-core,代码行数:22,代码来源:EEM_CPT_Base_Test.php
示例11: test_generate_restrictions__basic_and_others_and_private
function test_generate_restrictions__basic_and_others_and_private()
{
//currently events have the 'ee_read_events', 'ee_read_others_events', and 'ee_read_others_private_events' caps
//if that changes, this will need to be updated
$generator = new EE_Restriction_Generator_Protected();
$generator->_construct_finalize(EEM_Event::instance(), EEM_Base::caps_read);
$restrictions = $generator->generate_restrictions();
foreach ($restrictions as $default_where_conditions) {
$default_where_conditions->_finalize_construct(EEM_Event::instance());
}
$this->assertArrayHasKey('ee_read_events', $restrictions);
$this->assertInstanceOf('EE_Return_None_Where_Conditions', $restrictions['ee_read_events']);
$this->assertArrayHasKey('ee_read_others_events', $restrictions);
$this->assertInstanceOf('EE_Default_Where_Conditions', $restrictions['ee_read_others_events']);
$this->assertEquals(array(EEM_Event::instance()->wp_user_field_name() => get_current_user_id()), $restrictions['ee_read_others_events']->get_default_where_conditions());
$this->assertArrayHasKey('ee_read_private_events', $restrictions);
$this->assertInstanceOf('EE_Default_Where_Conditions', $restrictions['ee_read_private_events']);
$this->assertEquals(array('OR*no_' . EE_Restriction_Generator_Base::get_cap_name(EEM_Event::instance(), 'read_private') => array(EEM_Event::instance()->wp_user_field_name() => get_current_user_id(), 'status' => array('!=', 'private'))), $restrictions['ee_read_private_events']->get_default_where_conditions());
$this->assertEquals(3, count($restrictions));
}
开发者ID:DavidSteinbauer,项目名称:event-espresso-core,代码行数:20,代码来源:EE_Restriciton_Generator_Protected_Test.php
示例12: _get_event_admin_id
protected function _get_event_admin_id($event_id)
{
$event = EEM_Event::instance()->get_one_by_ID($event_id);
return $event->wp_user();
}
开发者ID:DavidSteinbauer,项目名称:event-espresso-core,代码行数:5,代码来源:EE_message_type.lib.php
示例13: send_invoice
public function send_invoice($download = FALSE)
{
$template_args = array();
$EE = EE_Registry::instance();
//allow the request to override the default theme defined in the invoice settings
$theme_requested = isset($_REQUEST['theme']) && $_REQUEST['theme'] > 0 && $_REQUEST['theme'] < 8 ? absint($_REQUEST['theme']) : null;
$themes = array(1 => "simple.css", 2 => "bauhaus.css", 3 => "ejs.css", 4 => "horizon.css", 5 => "lola.css", 6 => "tranquility.css", 7 => "union.css");
//Get the CSS file
if (isset($themes[$theme_requested])) {
$template_args['invoice_css'] = $themes[$theme_requested];
} else {
$template_args['invoice_css'] = $this->invoice_payment_method->get_extra_meta('legacy_invoice_css', TRUE, 'simple.css');
}
if (is_dir(EVENT_ESPRESSO_GATEWAY_DIR . '/invoice')) {
$template_args['base_url'] = EVENT_ESPRESSO_GATEWAY_URL . 'Invoice/lib/templates/';
} else {
$template_args['base_url'] = EE_GATEWAYS . '/Invoice/lib/templates/';
}
$primary_attendee = $this->transaction->primary_registration()->attendee();
$template_args['organization'] = $EE->CFG->organization->get_pretty('name');
$template_args['street'] = empty($EE->CFG->organization->address_2) ? $EE->CFG->organization->get_pretty('address_1') : $EE->CFG->organization->get_pretty('address_1') . '<br>' . $EE->CFG->organization->get_pretty('address_2');
$template_args['city'] = $EE->CFG->organization->get_pretty('city');
$template_args['state'] = EE_Registry::instance()->load_model('State')->get_one_by_ID($EE->CFG->organization->STA_ID);
$template_args['country'] = EE_Registry::instance()->load_model('Country')->get_one_by_ID($EE->CFG->organization->CNT_ISO);
$template_args['zip'] = $EE->CFG->organization->get_pretty('zip');
$template_args['email'] = $EE->CFG->organization->get_pretty('email');
$template_args['registration_code'] = $this->registration->reg_code();
$template_args['registration_date'] = $this->registration->date();
$template_args['name'] = $primary_attendee->full_name();
$template_args['attendee_address'] = $primary_attendee->address();
$template_args['attendee_address2'] = $primary_attendee->address2();
$template_args['attendee_city'] = $primary_attendee->city();
$attendee_state = $primary_attendee->state_obj();
if ($attendee_state) {
$attendee_state_name = $attendee_state->name();
} else {
$attendee_state_name = '';
}
$template_args['attendee_state'] = $attendee_state_name;
$template_args['attendee_zip'] = $primary_attendee->zip();
$template_args['ship_name'] = $template_args['name'];
$template_args['ship_address'] = $template_args['attendee_address'];
$template_args['ship_city'] = $template_args['attendee_city'];
$template_args['ship_state'] = $template_args['attendee_state'];
$template_args['ship_zip'] = $template_args['attendee_zip'];
$template_args['total_cost'] = number_format($this->transaction->total(), 2, '.', '');
$template_args['transaction'] = $this->transaction;
$template_args['amount_pd'] = $this->transaction->paid();
$template_args['amount_owed'] = $this->transaction->total() - $this->transaction->paid();
$template_args['payments'] = $this->transaction->approved_payments();
$template_args['net_total'] = '';
$template_args['edit_reg_info_url'] = $this->registration->edit_attendee_information_url();
$template_args['retry_payment_url'] = $this->registration->payment_overview_url();
$template_args['show_line_item_description'] = $this->check_if_any_line_items_have_a_description($this->transaction->total_line_item());
if ($template_args['amount_pd'] != $template_args['total_cost']) {
//$template_args['net_total'] = $this->espressoInvoiceTotals( __('SubTotal', 'event_espresso'), $this->transaction->total());//$this->session_data['cart']['REG']['sub_total']);
$tax_items = $this->transaction->tax_items();
if (!empty($tax_items)) {
foreach ($tax_items as $tax) {
$template_args['net_total'] .= $this->espressoInvoiceTotals($tax->name(), $tax->total());
}
}
$difference = $template_args['amount_pd'] - $template_args['total_cost'];
if ($difference < 0) {
$text = __('Discount', 'event_espresso');
} else {
$text = __('Extra', 'event_espresso');
}
$template_args['discount'] = $this->espressoInvoiceTotals($text, $difference);
}
$template_args['currency_symbol'] = $EE->CFG->currency->sign;
$template_args['template_payment_instructions'] = wpautop(stripslashes_deep(html_entity_decode($this->invoice_payment_method->get_extra_meta('pdf_instructions', TRUE), ENT_QUOTES)));
$template_args['shameless_plug'] = apply_filters('FHEE_Invoice__send_invoice__shameless_plug', true);
if (isset($_GET['receipt'])) {
//receipt-specific stuff
$events_for_txn = EEM_Event::instance()->get_all(array(array('Registration.TXN_ID' => $this->transaction->ID())));
$ticket_line_items_per_event = array();
$registrations_per_line_item = array();
$venues_for_events = array();
foreach ($events_for_txn as $event_id => $event) {
$line_items_for_this_event = EEM_Line_Item::instance()->get_all(array(array('Ticket.Datetime.EVT_ID' => $event_id, 'TXN_ID' => $this->transaction->ID())));
$ticket_line_items_per_event[$event_id] = $line_items_for_this_event;
foreach ($line_items_for_this_event as $line_item_id => $line_item) {
$ticket = $line_item->ticket();
$registrations_for_this_ticket = EEM_Registration::instance()->get_all(array(array('TKT_ID' => $ticket->ID(), 'TXN_ID' => $this->transaction->ID())));
$registrations_per_line_item[$line_item_id] = $registrations_for_this_ticket;
}
$venues_for_events = array_merge($venues_for_events, $event->venues());
}
$tax_total_line_item = EEM_Line_Item::instance()->get_one(array(array('TXN_ID' => $this->transaction->ID(), 'LIN_type' => EEM_Line_Item::type_tax_sub_total)));
$questions_to_skip = array(EEM_Attendee::system_question_fname, EEM_Attendee::system_question_lname, EEM_Attendee::system_question_email);
$template_args['events_for_txn'] = $events_for_txn;
$template_args['ticket_line_items_per_event'] = $ticket_line_items_per_event;
$template_args['registrations_per_line_item'] = $registrations_per_line_item;
$template_args['venues_for_events'] = $venues_for_events;
$template_args['tax_total_line_item'] = $tax_total_line_item;
$template_args['questions_to_skip'] = $questions_to_skip;
// d($template_args);
$template_args['download_link'] = $this->registration->receipt_url('download');
} else {
//.........这里部分代码省略.........
开发者ID:aaronfrey,项目名称:PepperLillie-GSP,代码行数:101,代码来源:Invoice.class.php
示例14: display_line_item
/**
* @param EE_Line_Item $line_item
* @param array $options
* @return mixed
*/
public function display_line_item(EE_Line_Item $line_item, $options = array())
{
EE_Registry::instance()->load_helper('Template');
EE_Registry::instance()->load_helper('HTML');
$html = '';
// set some default options and merge with incoming
$default_options = array('show_desc' => true, 'odd' => false);
$options = array_merge($default_options, (array) $options);
switch ($line_item->type()) {
case EEM_Line_Item::type_line_item:
$this->_show_taxes = $line_item->is_taxable() ? true : $this->_show_taxes;
if ($line_item->OBJ_type() == 'Ticket') {
// item row
$html .= $this->_ticket_row($line_item, $options);
// got any kids?
foreach ($line_item->children() as $child_line_item) {
$this->display_line_item($child_line_item, $options);
}
} else {
// item row
$html .= $this->_item_row($line_item, $options);
// got any kids?
foreach ($line_item->children() as $child_line_item) {
$this->display_line_item($child_line_item, $options);
}
}
break;
case EEM_Line_Item::type_sub_line_item:
$html .= $this->_sub_item_row($line_item, $options);
break;
case EEM_Line_Item::type_sub_total:
static $sub_total = 0;
$event_sub_total = 0;
$text = __('Sub-Total', 'event_espresso');
if ($line_item->OBJ_type() == 'Event') {
$options['event_id'] = $event_id = $line_item->OBJ_ID();
if (!isset($this->_events[$options['event_id']])) {
$event = EEM_Event::instance()->get_one_by_ID($options['event_id']);
if ($event instanceof EE_Event) {
if ($event->default_registration_status() == EEM_Registration::status_id_not_approved) {
return '';
}
}
$this->_events[$options['event_id']] = 0;
$html .= $this->_event_row($line_item);
$text = __('Event Sub-Total', 'event_espresso');
}
}
$child_line_items = $line_item->children();
// loop thru children
foreach ($child_line_items as $child_line_item) {
// recursively feed children back into this method
$html .= $this->display_line_item($child_line_item, $options);
}
$event_sub_total += isset($options['event_id']) ? $this->_events[$options['event_id']] : 0;
$sub_total += $event_sub_total;
if ($line_item->code() != 'pre-tax-subtotal' && count($child_line_items) > 1 || $line_item->code() == 'pre-tax-subtotal' && count($this->_events) > 1) {
$options['sub_total'] = $line_item->OBJ_type() == 'Event' ? $event_sub_total : $sub_total;
$html .= $this->_sub_total_row($line_item, $text, $options);
}
break;
case EEM_Line_Item::type_tax:
if ($this->_show_taxes) {
$this->_taxes_html .= $this->_tax_row($line_item, $options);
}
break;
case EEM_Line_Item::type_tax_sub_total:
if ($this->_show_taxes) {
$child_line_items = $line_item->children();
// loop thru children
foreach ($child_line_items as $child_line_item) {
// recursively feed children back into this method
$html .= $this->display_line_item($child_line_item, $options);
}
if (count($child_line_items) > 1) {
$this->_taxes_html .= $this->_total_tax_row($line_item, __('Tax Total', 'event_espresso'));
}
}
break;
case EEM_Line_Item::type_total:
// get all child line items
$children = $line_item->children();
// loop thru all non-tax child line items
foreach ($children as $child_line_item) {
if ($child_line_item->type() != EEM_Line_Item::type_tax_sub_total) {
// recursively feed children back into this method
$html .= $this->display_line_item($child_line_item, $options);
}
}
// now loop thru tax child line items
foreach ($children as $child_line_item) {
if ($child_line_item->type() == EEM_Line_Item::type_tax_sub_total) {
// recursively feed children back into this method
$html .= $this->display_line_item($child_line_item, $options);
}
//.........这里部分代码省略.........
开发者ID:adrianjonmiller,项目名称:hearts-being-healed,代码行数:101,代码来源:EE_SPCO_Line_Item_Display_Strategy.strategy.php
示例15: process_shortcode
/**
* process_shortcode - ESPRESSO_EVENT_ATTENDEES - Returns a list of attendees to an event.
*
*
*
* [ESPRESSO_EVENT_ATTENDEES] - defaults to attendees for earliest active event, or earliest upcoming event.
* [ESPRESSO_EVENT_ATTENDEES event_id=123] - attendees for specific event.
* [ESPRESSO_EVENT_ATTENDEES datetime_id=245] - attendees for a specific datetime.
* [ESPRESSO_EVENT_ATTENDEES ticket_id=123] - attendees for a specific ticket.
* [ESPRESSO_EVENT_ATTENDEES status=all] - specific registration status (use status id) or all for all attendees
* regardless of status. Note default is to only return approved attendees
* [ESPRESSO_EVENT_ATTENDEES show_gravatar=true] - default is to not return gravatar. Otherwise if this is set
* then return gravatar for email address given.
*
* Note: because of the relationship between event_id, ticket_id, and datetime_id. If more than one of those params
* is included then preference is given to the following:
* - event_id is used whenever its present and any others are ignored.
* - if no event_id then datetime is used whenever its present and any others are ignored.
* - otherwise ticket_id is used if present.
*
* @access public
* @param array $attributes
* @return string
*/
public function process_shortcode($attributes = array())
{
//load helpers
EE_Registry::instance()->load_helper('Event_View');
EE_Registry::instance()->load_helper('Template');
// merge in any attributes passed via fallback shortcode processor
$attributes = array_merge((array) $attributes, (array) $this->_attributes);
//set default attributes
$default_shortcode_attributes = array('event_id' => null, 'datetime_id' => null, 'ticket_id' => null, 'status' => EEM_Registration::status_id_approved, 'show_gravatar' => false);
// allow the defaults to be filtered
$default_shortcode_attributes = apply_filters('EES_Espresso_Event_Attendees__process_shortcode__default_shortcode_atts', $default_shortcode_attributes);
// grab attributes and merge with defaults, then extract
$attributes = array_merge($default_shortcode_attributes, $attributes);
$template_args = array('contacts' => array(), 'event' => null, 'datetime' => null, 'ticket' => null, 'show_gravatar' => $attributes['show_gravatar']);
//start setting up the query for the contacts
$query = array();
$error = false;
//what event?
if (empty($attributes['event_id']) && empty($attributes['datetime_id']) && empty($attributes['ticket_id'])) {
//seems like is_espresso_event_single() isn't working as expected. So using alternate method.
if (is_single() && is_espresso_event()) {
$event = EEH_Event_View::get_event();
if ($event instanceof EE_Event) {
$template_args['event'] = $event;
$query[0]['Registration.EVT_ID'] = $event->ID();
}
} else {
//try getting the earliest active event if none then get the
$events = EEM_Event::instance()->get_active_events(array('limit' => 1, 'order_by' => array('Datetime.DTT_EVT_start' => 'ASC')));
$events = empty($events) ? EEM_Event::instance()->get_upcoming_events(array('limit' => 1, 'order_by' => array('Datetime.DTT_EVT_start' => 'ASC'))) : $events;
$event = reset($events);
if ($event instanceof EE_Event) {
$query[0]['Registration.EVT_ID'] = $event->ID();
$template_args['event'] = $event;
}
}
} elseif (!empty($attributes['event_id'])) {
$event = EEM_Event::instance()->get_one_by_ID($attributes['event_id']);
if ($event instanceof EE_Event) {
$query[0]['Registration.EVT_ID'] = $attributes['event_id'];
$template_args['event'] = $event;
} else {
$error = true;
}
}
//datetime?
if (!empty($attributes['datetime_id']) && empty($attributes['event_id'])) {
$datetime = EEM_Datetime::instance()->get_one_by_ID($attributes['datetime_id']);
if ($datetime instanceof EE_Datetime) {
$query[0]['Registration.Ticket.Datetime.DTT_ID'] = $attributes['datetime_id'];
$query['default_where_conditions'] = 'this_model_only';
$template_args['datetime'] = $datetime;
$template_args['event'] = $datetime->event();
} else {
$error = true;
}
}
//ticket?just
if (!empty($attributes['ticket_id']) && empty($attributes['event_id']) && empty($attributes['datetime_id'])) {
$ticket = EEM_Ticket::instance()->get_one_by_ID($attributes['ticket_id']);
if ($ticket instanceof EE_Ticket) {
$query[0]['Registration.TKT_ID'] = $attributes['ticket_id'];
$template_args['ticket'] = $ticket;
$template_args['event'] = $ticket->first_datetime() instanceof EE_Datetime ? $ticket->first_datetime()->event() : null;
} else {
$error = true;
}
}
//status
$reg_status_array = EEM_Registration::reg_status_array();
if ($attributes['status'] != 'all' && isset($reg_status_array[$attributes['status']])) {
$query[0]['Registration.STS_ID'] = $attributes['status'];
}
$query['group_by'] = array('ATT_ID');
$query['order_by'] = apply_filters('FHEE__EES_Espresso_Event_Attendees__process_shortcode__order_by', array('ATT_lname' => 'ASC', 'ATT_fname' => 'ASC'));
//if we have NO query where conditions, then there was an invalid parameter or the shortcode was used incorrectly
//.........这里部分代码省略.........
开发者ID:DavidSteinbauer,项目名称:event-espresso-core,代码行数:101,代码来源:EES_Espresso_Event_Attendees.shortcode.php
示例16: total_trashed_events
/**
* get total number of trashed events
*
* @access public
* @return int
*/
public function total_trashed_events()
{
$where = array('status' => 'trash');
$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
return $count;
}
开发者ID:aaronfrey,项目名称:PepperLillie-GSP,代码行数:12,代码来源:Events_Admin_Page.core.php
示例17: get_count_of_all_registrations
/**
* This just returns a count of all the registrations for this event
* @access public
* @return int
*/
public function get_count_of_all_registrations()
{
return EEM_Event::instance()->count_related($this, 'Registration');
}
开发者ID:teemuoksanen,项目名称:event-espresso-core,代码行数:9,代码来源:EE_Event.class.php
示例18: get_object_by_id
/**
* return the event object for a given event ID
*
* @since 4.3.0
*
* @param int $EVT_ID the event id for the event to attempt to retrieve
*
* @return null|EE_Event
*/
public function get_object_by_id($EVT_ID)
{
return EEM_Event::instance()->get_one_by_ID($EVT_ID);
}
开发者ID:DavidSteinbauer,项目名称:event-espresso-core,代码行数:13,代码来源:EE_UnitTest_Factory_For_Event.class.php
示例19: _people_list_table
/**
* Set up page for people list table
*
* @return string
*/
protected function _people_list_table()
{
$this->_search_btn_label = __('People', 'event_espresso');
$this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add-person', array(), 'add-new-h2');
if (!empty($this->_req_data['EVT_ID'])) {
$event = EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']);
if ($event instanceof EE_Event) {
$this->
|
请发表评论