Completed
Branch FET-10896-improvements-to-floa... (000e49)
by
unknown
163:03 queued 150:10
created

DisplayTicketSelector::displayViewDetailsButton()   B

Complexity

Conditions 4
Paths 8

Size

Total Lines 45
Code Lines 36

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 36
nc 8
nop 1
dl 0
loc 45
rs 8.5806
c 0
b 0
f 0
1
<?php
2
namespace EventEspresso\modules\ticket_selector;
3
4
use EE_Datetime;
5
use EE_Error;
6
use EE_Event;
7
use EE_Registry;
8
use EE_System;
9
use EE_Ticket_Selector_Config;
10
use EED_Events_Archive;
11
use EEH_Event_View;
12
use EEH_HTML;
13
use EEH_Template;
14
use EEH_URL;
15
use EEM_Event;
16
use EEM_Ticket;
17
use WP_Post;
18
19
if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
20
    exit( 'No direct script access allowed' );
21
}
22
23
24
25
/**
26
 * Class DisplayTicketSelector
27
 * Description
28
 *
29
 * @package       Event Espresso
30
 * @subpackage    core
31
 * @author        Brent Christensen
32
 * @since         $VID:$
33
 */
34
class DisplayTicketSelector
35
{
36
37
    /**
38
     * event that ticket selector is being generated for
39
     *
40
     * @access protected
41
     * @var EE_Event $event
42
     */
43
    protected $event;
44
45
    /**
46
     * Used to flag when the ticket selector is being called from an external iframe.
47
     *
48
     * @var bool $iframe
49
     */
50
    protected $iframe = false;
51
52
    /**
53
     * max attendees that can register for event at one time
54
     *
55
     * @var int $max_attendees
56
     */
57
    private $max_attendees = EE_INF;
58
59
    /**
60
     *@var string $date_format
61
     */
62
    private $date_format;
63
64
    /**
65
     *@var string $time_format
66
     */
67
    private $time_format;
68
69
70
71
    /**
72
     * DisplayTicketSelector constructor.
73
     */
74
    public function __construct()
75
    {
76
        $this->date_format = apply_filters(
77
            'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format',
78
            get_option('date_format')
79
        );
80
        $this->time_format = apply_filters(
81
            'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format',
82
            get_option('time_format')
83
        );
84
    }
85
86
87
88
    /**
89
     * @param boolean $iframe
90
     */
91
    public function setIframe( $iframe = true )
92
    {
93
        $this->iframe = filter_var( $iframe, FILTER_VALIDATE_BOOLEAN );
94
    }
95
96
97
    /**
98
     * finds and sets the \EE_Event object for use throughout class
99
     *
100
     * @param mixed $event
101
     * @return bool
102
     * @throws EE_Error
103
     */
104
    protected function setEvent( $event = null )
105
    {
106
        if ( $event === null ) {
107
            global $post;
108
            $event = $post;
109
        }
110
        if ( $event instanceof EE_Event ) {
111
            $this->event = $event;
112
        } else if ( $event instanceof WP_Post ) {
0 ignored issues
show
Bug introduced by
The class WP_Post does not exist. Is this class maybe located in a folder that is not analyzed, or in a newer version of your dependencies than listed in your composer.lock/composer.json?
Loading history...
113
            if ( isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) {
114
                $this->event = $event->EE_Event;
115
            } else if ( $event->post_type === 'espresso_events' ) {
116
                $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event );
117
                $this->event = $event->EE_Event;
118
            }
119 View Code Duplication
        } else {
120
            $user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' );
121
            $dev_msg = $user_msg . __(
122
                    'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.',
123
                    'event_espresso'
124
                );
125
            EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
126
            return false;
127
        }
128
        return true;
129
    }
130
131
132
133
    /**
134
     * @return int
135
     */
136
    public function getMaxAttendees()
137
    {
138
        return $this->max_attendees;
139
    }
140
141
142
143
    /**
144
     * @param int $max_attendees
145
     */
146
    public function setMaxAttendees($max_attendees)
147
    {
148
        $this->max_attendees = absint(
149
            apply_filters(
150
                'FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets',
151
                $max_attendees
152
            )
153
        );
154
    }
155
156
157
158
    /**
159
     * creates buttons for selecting number of attendees for an event
160
     *
161
     * @param WP_Post|int $event
162
     * @param bool         $view_details
163
     * @return string
164
     * @throws EE_Error
165
     */
166
    public function display( $event = null, $view_details = false )
167
    {
168
        // reset filter for displaying submit button
169
        remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
170
        // poke and prod incoming event till it tells us what it is
171
        if ( ! $this->setEvent( $event ) ) {
172
            return false;
173
        }
174
        // begin gathering template arguments by getting event status
175
        $template_args = array( 'event_status' => $this->event->get_active_status() );
176
        if ( $this->activeEventAndShowTicketSelector($event, $template_args['event_status'], $view_details) ) {
177
            return ! is_single() ? $this->displayViewDetailsButton() : '';
178
        }
179
        // filter the maximum qty that can appear in the Ticket Selector qty dropdowns
180
        $this->setMaxAttendees($this->event->additional_limit());
181
        if ($this->getMaxAttendees() < 1) {
182
            return $this->ticketSalesClosedMessage();
183
        }
184
        // is the event expired ?
185
        $template_args['event_is_expired'] = $this->event->is_expired();
186
        if ( $template_args[ 'event_is_expired' ] ) {
187
            return $this->expiredEventMessage();
188
        }
189
        // get all tickets for this event ordered by the datetime
190
        $tickets = $this->getTickets();
191
        if (count($tickets) < 1) {
192
            return $this->noTicketAvailableMessage();
193
        }
194
        if (EED_Events_Archive::is_iframe()){
195
            $this->setIframe();
196
        }
197
        // redirecting to another site for registration ??
198
        $external_url = (string) $this->event->external_url();
199
        // if redirecting to another site for registration, then we don't load the TS
200
        $ticket_selector = $external_url
201
            ? $this->externalEventRegistration()
202
            : $this->loadTicketSelector($tickets,$template_args);
203
        // now set up the form (but not for the admin)
204
        $ticket_selector = ! is_admin()
205
            ? $this->formOpen($this->event->ID(), $external_url) . $ticket_selector
206
            : $ticket_selector;
207
        // submit button and form close tag
208
        $ticket_selector .= ! is_admin() ? $this->displaySubmitButton($external_url) : '';
209
        return $ticket_selector;
210
    }
211
212
213
214
    /**
215
     * displayTicketSelector
216
     * examines the event properties and determines whether a Ticket Selector should be displayed
217
     *
218
     * @param WP_Post|int $event
219
     * @param string       $_event_active_status
220
     * @param bool         $view_details
221
     * @return bool
222
     * @throws EE_Error
223
     */
224
    protected function activeEventAndShowTicketSelector($event, $_event_active_status, $view_details)
225
    {
226
        $event_post = $this->event instanceof EE_Event ? $this->event->ID() : $event;
227
        return ! is_admin()
228
               && (
229
                   ! $this->event->display_ticket_selector()
230
                   || $view_details
231
                   || post_password_required($event_post)
232
                   || (
233
                       $_event_active_status !== EE_Datetime::active
234
                       && $_event_active_status !== EE_Datetime::upcoming
235
                       && $_event_active_status !== EE_Datetime::sold_out
236
                       && ! (
237
                           $_event_active_status === EE_Datetime::inactive
238
                           && is_user_logged_in()
239
                       )
240
                   )
241
               );
242
    }
243
244
245
246
    /**
247
     * noTicketAvailableMessage
248
     * notice displayed if event is expired
249
     *
250
     * @return string
251
     * @throws EE_Error
252
     */
253
    protected function expiredEventMessage()
254
    {
255
        return '<div class="ee-event-expired-notice"><span class="important-notice">' . esc_html__(
256
            'We\'re sorry, but all tickets sales have ended because the event is expired.',
257
            'event_espresso'
258
        ) . '</span></div><!-- .ee-event-expired-notice -->';
259
    }
260
261
262
263
    /**
264
     * noTicketAvailableMessage
265
     * notice displayed if event has no more tickets available
266
     *
267
     * @return string
268
     * @throws EE_Error
269
     */
270 View Code Duplication
    protected function noTicketAvailableMessage()
271
    {
272
        $no_ticket_available_msg = esc_html__( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' );
273
        if (current_user_can('edit_post', $this->event->ID())) {
274
            $no_ticket_available_msg .= sprintf(
275
                esc_html__(
276
                    '%1$sNote to Event Admin:%2$sNo tickets were found for this event. This effectively turns off ticket sales. Please ensure that at least one ticket is available for if you want people to be able to register.%3$s(click to edit this event)%4$s',
277
                    'event_espresso'
278
                ),
279
                '<div class="ee-attention" style="text-align: left;"><b>',
280
                '</b><br />',
281
                '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link($this->event->ID()).'">',
282
                '</a></span></div><!-- .ee-attention noTicketAvailableMessage -->'
283
            );
284
        }
285
        return '
286
            <div class="ee-event-expired-notice">
287
                <span class="important-notice">' . $no_ticket_available_msg . '</span>
288
            </div><!-- .ee-event-expired-notice -->';
289
    }
290
291
292
293
    /**
294
     * ticketSalesClosed
295
     * notice displayed if event ticket sales are turned off
296
     *
297
     * @return string
298
     * @throws EE_Error
299
     */
300 View Code Duplication
    protected function ticketSalesClosedMessage()
301
    {
302
        $sales_closed_msg = esc_html__(
303
            'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.',
304
            'event_espresso'
305
        );
306
        if (current_user_can('edit_post', $this->event->ID())) {
307
            $sales_closed_msg .= sprintf(
308
                esc_html__(
309
                    '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s',
310
                    'event_espresso'
311
                ),
312
                '<div class="ee-attention" style="text-align: left;"><b>',
313
                '</b><br />',
314
                '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link($this->event->ID()).'">',
315
                '</a></span></div><!-- .ee-attention ticketSalesClosedMessage -->'
316
            );
317
        }
318
        return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>';
319
    }
320
321
322
323
    /**
324
     * getTickets
325
     *
326
     * @return \EE_Base_Class[]|\EE_Ticket[]
327
     * @throws EE_Error
328
     */
329
    protected function getTickets()
330
    {
331
        $ticket_query_args = array(
332
            array('Datetime.EVT_ID' => $this->event->ID()),
333
            'order_by' => array(
334
                'TKT_order'              => 'ASC',
335
                'TKT_required'           => 'DESC',
336
                'TKT_start_date'         => 'ASC',
337
                'TKT_end_date'           => 'ASC',
338
                'Datetime.DTT_EVT_start' => 'DESC',
339
            ),
340
        );
341
        if (
342
            ! (
343
                EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector instanceof EE_Ticket_Selector_Config
344
                && EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets
345
            )
346
        ) {
347
            //use the correct applicable time query depending on what version of core is being run.
348
            $current_time = method_exists('EEM_Datetime', 'current_time_for_query')
349
                ? time()
350
                : current_time('timestamp');
351
            $ticket_query_args[0]['TKT_end_date'] = array('>', $current_time);
352
        }
353
        return EEM_Ticket::instance()->get_all($ticket_query_args);
354
    }
355
356
357
358
    /**
359
     * loadTicketSelector
360
     * begins to assemble template arguments
361
     * and decides whether to load a "simple" ticket selector, or the standard
362
     *
363
     * @param \EE_Ticket[] $tickets
364
     * @param array $template_args
365
     * @return string
366
     * @throws EE_Error
367
     */
368
    protected function loadTicketSelector(array $tickets, array $template_args)
369
    {
370
        $template_args['event'] = $this->event;
371
        $template_args['EVT_ID'] = $this->event->ID();
372
        $template_args['event_is_expired'] = $this->event->is_expired();
373
        $template_args['max_atndz'] = $this->getMaxAttendees();
374
        $template_args['date_format'] = $this->date_format;
375
        $template_args['time_format'] = $this->time_format;
376
        /**
377
         * Filters the anchor ID used when redirecting to the Ticket Selector if no quantity selected
378
         *
379
         * @since 4.9.13
380
         * @param     string  '#tkt-slctr-tbl-' . $EVT_ID The html ID to anchor to
381
         * @param int $EVT_ID The Event ID
382
         */
383
        $template_args['anchor_id'] = apply_filters(
384
            'FHEE__EE_Ticket_Selector__redirect_anchor_id',
385
            '#tkt-slctr-tbl-' . $this->event->ID(),
386
            $this->event->ID()
387
        );
388
        $template_args['tickets'] = $tickets;
389
        $template_args['ticket_count'] = count($tickets);
390
        $ticket_selector = $this->simpleTicketSelector( $tickets, $template_args);
391
        return $ticket_selector instanceof TicketSelectorSimple
392
            ? $ticket_selector
393
            : new TicketSelectorStandard(
394
                $this->event,
395
                $tickets,
396
                $this->getMaxAttendees(),
397
                $template_args,
398
                $this->date_format,
399
                $this->time_format
400
            );
401
    }
402
403
404
405
    /**
406
     * simpleTicketSelector
407
     * there's one ticket, and max attendees is set to one,
408
     * so if the event is free, then this is a "simple" ticket selector
409
     * a.k.a. "Dude Where's my Ticket Selector?"
410
     *
411
     * @param \EE_Ticket[] $tickets
412
     * @param array  $template_args
413
     * @return string
414
     * @throws EE_Error
415
     */
416
    protected function simpleTicketSelector($tickets, array $template_args)
417
    {
418
        // if there is only ONE ticket with a max qty of ONE
419
        if (count($tickets) > 1 || $this->getMaxAttendees() !== 1) {
420
            return '';
421
        }
422
        /** @var \EE_Ticket $ticket */
423
        $ticket = reset($tickets);
424
        // if the ticket is free... then not much need for the ticket selector
425
        if (
426
            apply_filters(
427
                'FHEE__ticket_selector_chart_template__hide_ticket_selector',
428
                $ticket->is_free(),
429
                $this->event->ID()
430
            )
431
        ) {
432
            return new TicketSelectorSimple(
433
                $this->event,
434
                $ticket,
435
                $this->getMaxAttendees(),
436
                $template_args
437
            );
438
        }
439
        return '';
440
    }
441
442
443
444
    /**
445
     * externalEventRegistration
446
     *
447
     * @return string
448
     */
449
    public function externalEventRegistration()
450
    {
451
        // if not we still need to trigger the display of the submit button
452
        add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
453
        //display notice to admin that registration is external
454
        return is_admin()
455
            ? esc_html__(
456
                'Registration is at an external URL for this event.',
457
                'event_espresso'
458
            )
459
            : '';
460
    }
461
462
463
464
    /**
465
     * formOpen
466
     *
467
     * @param        int    $ID
468
     * @param        string $external_url
469
     * @return        string
470
     */
471
    public function formOpen( $ID = 0, $external_url = '' )
472
    {
473
        // if redirecting, we don't need any anything else
474
        if ( $external_url ) {
475
            $html = '<form method="GET" action="' . EEH_URL::refactor_url($external_url) . '"';
476
            // open link in new window ?
477
            $html .= apply_filters(
478
                'FHEE__EventEspresso_modules_ticket_selector_DisplayTicketSelector__formOpen__external_url_target_blank',
479
                EED_Events_Archive::is_iframe()
480
            )
481
                ? ' target="_blank"'
482
                : '';
483
            $html .= '>';
484
            $query_args = EEH_URL::get_query_string( $external_url );
485
            foreach ( (array)$query_args as $query_arg => $value ) {
486
                $html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">';
487
            }
488
            return $html;
489
        }
490
        // if there is no submit button, then don't start building a form
491
        // because the "View Details" button will build its own form
492
        if ( ! apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false ) ) {
493
            return '';
494
        }
495
        $checkout_url = EEH_Event_View::event_link_url( $ID );
496
        if ( ! $checkout_url ) {
497
            EE_Error::add_error(
498
                esc_html__( 'The URL for the Event Details page could not be retrieved.', 'event_espresso' ),
499
                __FILE__,
500
                __FUNCTION__,
501
                __LINE__
502
            );
503
        }
504
        // set no cache headers and constants
505
        EE_System::do_not_cache();
506
        $extra_params = $this->iframe ? ' target="_blank"' : '';
507
        $html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>';
508
        $html .= '<input type="hidden" name="ee" value="process_ticket_selections">';
509
        $html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, $this->event );
510
        return $html;
511
    }
512
513
514
515
    /**
516
     * displaySubmitButton
517
     *
518
     * @param  string $external_url
519
     * @return string
520
     * @throws EE_Error
521
     */
522
    public function displaySubmitButton($external_url = '')
523
    {
524
        $html = '';
525
        if ( ! is_admin()) {
526
            // standard TS displayed with submit button, ie: "Register Now"
527
            if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) {
528
                $html .= $this->displayRegisterNowButton();
529
                $html .= empty($external_url)
530
                    ? $this->ticketSelectorEndDiv()
531
                    : $this->clearTicketSelector();
532
                $html .= '<br/>' . $this->formClose();
533
            } else if ($this->getMaxAttendees() === 1) {
534
                // its a "Dude Where's my Ticket Selector?" (DWMTS) type event (ie: $_max_atndz === 1)
535
                if ($this->event->is_sold_out()) {
536
                    // then instead of a View Details or Submit button, just display a "Sold Out" message
537
                    $html .= apply_filters(
538
                        'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__sold_out_msg',
539
                        sprintf(
540
                            __(
541
                                '%1$s"%2$s" is currently sold out.%4$sPlease check back again later, as spots may become available.%3$s',
542
                                'event_espresso'
543
                            ),
544
                            '<p class="no-ticket-selector-msg clear-float">',
545
                            $this->event->name(),
546
                            '</p>',
547
                            '<br />'
548
                        ),
549
                        $this->event
550
                    );
551
                    if (
552
                        apply_filters(
553
                            'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__no_tickets_but_display_register_now_button',
554
                            false,
555
                            $this->event
556
                        )
557
                    ) {
558
                        $html .= $this->displayRegisterNowButton();
559
                    }
560
                    // sold out DWMTS event, no TS, no submit or view details button, but has additional content
561
                    $html .=  $this->ticketSelectorEndDiv();
562
                } else if (
563
                    apply_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector', false)
564
                    && ! is_single()
565
                ) {
566
                    // this is a "Dude Where's my Ticket Selector?" (DWMTS) type event,
567
                    // but no tickets are available, so display event's "View Details" button.
568
                    // it is being viewed via somewhere other than a single post
569
                    $html .= $this->displayViewDetailsButton(true);
570
                } else {
571
                    $html .= $this->ticketSelectorEndDiv();
572
                }
573
            } else if (is_archive()) {
574
                // event list, no tickets available so display event's "View Details" button
575
                $html .= $this->ticketSelectorEndDiv();
576
                $html .= $this->displayViewDetailsButton();
577
            } else {
578
                if (
579
                    apply_filters(
580
                        'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__no_tickets_but_display_register_now_button',
581
                        false,
582
                        $this->event
583
                    )
584
                ) {
585
                    $html .= $this->displayRegisterNowButton();
586
                }
587
                // no submit or view details button, and no additional content
588
                $html .= $this->ticketSelectorEndDiv();
589
            }
590
            if ( ! $this->iframe && ! is_archive()) {
591
                $html .= EEH_Template::powered_by_event_espresso('', '', array('utm_content' => 'ticket_selector'));
592
            }
593
        }
594
	    return apply_filters(
595
		    'FHEE__EventEspresso_modules_ticket_selector_DisplayTicketSelector__displaySubmitButton__html',
596
		    $html,
597
		    $this->event
598
	    );
599
    }
600
601
602
603
    /**
604
     * @return string
605
     * @throws EE_Error
606
     */
607
    public function displayRegisterNowButton()
608
    {
609
        $btn_text = apply_filters(
610
            'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text',
611
            __('Register Now', 'event_espresso'),
612
            $this->event
613
        );
614
        $external_url = $this->event->external_url();
615
        $html = EEH_HTML::div(
616
            '', 'ticket-selector-submit-' . $this->event->ID() . '-btn-wrap', 'ticket-selector-submit-btn-wrap'
617
        );
618
        $html .= '<input id="ticket-selector-submit-' . $this->event->ID() . '-btn"';
619
        $html .= ' class="ticket-selector-submit-btn ';
620
        $html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"';
621
        $html .= ' type="submit" value="' . $btn_text . '" />';
622
        $html .= EEH_HTML::divx() . '<!-- .ticket-selector-submit-btn-wrap -->';
623
        $html .= apply_filters(
624
            'FHEE__EE_Ticket_Selector__after_ticket_selector_submit',
625
            '',
626
            $this->event
627
        );
628
        return $html;
629
    }
630
631
632
    /**
633
     * displayViewDetailsButton
634
     *
635
     * @param bool $DWMTS indicates a "Dude Where's my Ticket Selector?" (DWMTS) type event
636
     *                    (ie: $_max_atndz === 1) where there are no available tickets,
637
     *                    either because they are sold out, expired, or not yet on sale.
638
     *                    In this case, we need to close the form BEFORE adding any closing divs
639
     * @return string
640
     * @throws EE_Error
641
     */
642
    public function displayViewDetailsButton( $DWMTS = false )
643
    {
644
        if ( ! $this->event->get_permalink() ) {
645
            EE_Error::add_error(
646
                esc_html__( 'The URL for the Event Details page could not be retrieved.', 'event_espresso' ),
647
                __FILE__, __FUNCTION__, __LINE__
648
            );
649
        }
650
        $view_details_btn = '<form method="POST" action="';
651
        $view_details_btn .= apply_filters(
652
            'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_url',
653
            $this->event->get_permalink(),
654
            $this->event
655
        );
656
        $view_details_btn .= '"';
657
        // open link in new window ?
658
        $view_details_btn .= apply_filters(
659
            'FHEE__EventEspresso_modules_ticket_selector_DisplayTicketSelector__displayViewDetailsButton__url_target_blank',
660
            EED_Events_Archive::is_iframe()
661
        )
662
            ? ' target="_blank"'
663
            : '';
664
        $view_details_btn .='>';
665
        $btn_text = apply_filters(
666
            'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text',
667
            esc_html__('View Details', 'event_espresso'),
668
            $this->event
669
        );
670
        $view_details_btn .= '<input id="ticket-selector-submit-'
671
                             . $this->event->ID()
672
                             . '-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'
673
                             . $btn_text
674
                             . '" />';
675
        $view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', $this->event );
676
        if ($DWMTS) {
677
            $view_details_btn .= $this->formClose();
678
            $view_details_btn .= $this->ticketSelectorEndDiv();
679
            $view_details_btn .= '<br/>';
680
        } else {
681
            $view_details_btn .= $this->clearTicketSelector();
682
            $view_details_btn .= '<br/>';
683
            $view_details_btn .= $this->formClose();
684
        }
685
        return $view_details_btn;
686
    }
687
688
689
690
    /**
691
     * @return string
692
     */
693
    public function ticketSelectorEndDiv()
694
    {
695
        return $this->clearTicketSelector() . '</div><!-- ticketSelectorEndDiv -->';
696
    }
697
698
699
700
    /**
701
     * @return string
702
     */
703
    public function clearTicketSelector()
704
    {
705
        // standard TS displayed, appears after a "Register Now" or "view Details" button
706
        return '<div class="clear"></div><!-- clearTicketSelector -->';
707
    }
708
709
710
711
    /**
712
     * @access        public
713
     * @return        string
714
     */
715
    public function formClose()
716
    {
717
        return '</form>';
718
    }
719
720
721
722
}
723
// End of file DisplayTicketSelector.php
724
// Location: /DisplayTicketSelector.php
725