1
|
|
|
<?php |
2
|
|
|
namespace EventEspresso\modules\ticket_selector; |
3
|
|
|
|
4
|
|
|
defined('ABSPATH') || exit; |
5
|
|
|
|
6
|
|
|
|
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class TicketSelector |
10
|
|
|
* Description |
11
|
|
|
* |
12
|
|
|
* @package Event Espresso |
13
|
|
|
* @author Brent Christensen |
14
|
|
|
* @since $VID:$ |
15
|
|
|
*/ |
16
|
|
|
abstract class TicketSelector |
17
|
|
|
{ |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @var \EE_Event $event |
21
|
|
|
*/ |
22
|
|
|
protected $event; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var \EE_Ticket[] $tickets |
26
|
|
|
*/ |
27
|
|
|
protected $tickets; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var int max_attendees |
31
|
|
|
*/ |
32
|
|
|
protected $max_attendees; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var array $template_args |
36
|
|
|
*/ |
37
|
|
|
protected $template_args; |
38
|
|
|
|
39
|
|
|
|
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* TicketSelectorSimple constructor. |
43
|
|
|
* |
44
|
|
|
* @param \EE_Event $event |
45
|
|
|
* @param \EE_Ticket[] $tickets |
46
|
|
|
* @param int $max_attendees |
47
|
|
|
* @param array $template_args |
48
|
|
|
*/ |
49
|
|
|
public function __construct(\EE_Event $event, array $tickets, $max_attendees, array $template_args) |
50
|
|
|
{ |
51
|
|
|
$this->event = $event; |
52
|
|
|
$this->tickets = $tickets; |
53
|
|
|
$this->max_attendees = $max_attendees; |
54
|
|
|
$this->template_args = $template_args; |
55
|
|
|
$this->addTemplateArgs(); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
|
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* sets any and all template args that are required for this Ticket Selector |
62
|
|
|
* |
63
|
|
|
* @return void |
64
|
|
|
*/ |
65
|
|
|
abstract protected function addTemplateArgs(); |
66
|
|
|
|
67
|
|
|
|
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* loadTicketSelectorTemplate |
71
|
|
|
* |
72
|
|
|
* @return string |
73
|
|
|
*/ |
74
|
|
|
protected function loadTicketSelectorTemplate() |
75
|
|
|
{ |
76
|
|
|
try { |
77
|
|
|
return \EEH_Template::locate_template( |
78
|
|
|
apply_filters( |
79
|
|
|
'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', |
80
|
|
|
$this->template_args['template_path'], |
81
|
|
|
$this->event |
82
|
|
|
), |
83
|
|
|
$this->template_args |
84
|
|
|
); |
85
|
|
|
} catch (\Exception $e) { |
86
|
|
|
\EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
87
|
|
|
} |
88
|
|
|
return ''; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
|
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* The __toString method allows a class to decide how it will react when it is converted to a string. |
95
|
|
|
* |
96
|
|
|
* @return string |
97
|
|
|
* @link http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.tostring |
98
|
|
|
*/ |
99
|
|
|
public function __toString() |
100
|
|
|
{ |
101
|
|
|
return $this->loadTicketSelectorTemplate(); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
|
105
|
|
|
|
106
|
|
|
} |
107
|
|
|
// End of file TicketSelector.php |
108
|
|
|
// Location: EventEspresso\modules\ticket_selector/TicketSelector.php |