@@ -14,24 +14,24 @@ |
||
14 | 14 | class TicketSelectorIframeEmbedButton extends IframeEmbedButton |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * TicketSelectorIframeEmbedButton constructor. |
|
19 | - */ |
|
20 | - public function __construct() |
|
21 | - { |
|
22 | - parent::__construct( |
|
23 | - esc_html__('Ticket Selector', 'event_espresso'), |
|
24 | - 'ticket_selector' |
|
25 | - ); |
|
26 | - } |
|
17 | + /** |
|
18 | + * TicketSelectorIframeEmbedButton constructor. |
|
19 | + */ |
|
20 | + public function __construct() |
|
21 | + { |
|
22 | + parent::__construct( |
|
23 | + esc_html__('Ticket Selector', 'event_espresso'), |
|
24 | + 'ticket_selector' |
|
25 | + ); |
|
26 | + } |
|
27 | 27 | |
28 | 28 | |
29 | - /** |
|
30 | - * Adds an iframe embed code button to the Event editor. |
|
31 | - */ |
|
32 | - public function addEventEditorIframeEmbedButton() |
|
33 | - { |
|
34 | - // add button for iframe code to event editor. |
|
35 | - $this->addEventEditorIframeEmbedButtonFilter(); |
|
36 | - } |
|
29 | + /** |
|
30 | + * Adds an iframe embed code button to the Event editor. |
|
31 | + */ |
|
32 | + public function addEventEditorIframeEmbedButton() |
|
33 | + { |
|
34 | + // add button for iframe code to event editor. |
|
35 | + $this->addEventEditorIframeEmbedButtonFilter(); |
|
36 | + } |
|
37 | 37 | } |
@@ -14,121 +14,121 @@ |
||
14 | 14 | class TicketSelectorStandard extends TicketSelector |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * @var string $date_format |
|
19 | - */ |
|
20 | - protected $date_format; |
|
17 | + /** |
|
18 | + * @var string $date_format |
|
19 | + */ |
|
20 | + protected $date_format; |
|
21 | 21 | |
22 | - /** |
|
23 | - * @var string $time_format |
|
24 | - */ |
|
25 | - protected $time_format; |
|
22 | + /** |
|
23 | + * @var string $time_format |
|
24 | + */ |
|
25 | + protected $time_format; |
|
26 | 26 | |
27 | - /** |
|
28 | - * @var \EE_Ticket_Selector_Config $ticket_selector_config |
|
29 | - */ |
|
30 | - protected $ticket_selector_config; |
|
27 | + /** |
|
28 | + * @var \EE_Ticket_Selector_Config $ticket_selector_config |
|
29 | + */ |
|
30 | + protected $ticket_selector_config; |
|
31 | 31 | |
32 | - /** |
|
33 | - * @var \EE_Tax_Config $tax_config |
|
34 | - */ |
|
35 | - protected $tax_config; |
|
32 | + /** |
|
33 | + * @var \EE_Tax_Config $tax_config |
|
34 | + */ |
|
35 | + protected $tax_config; |
|
36 | 36 | |
37 | 37 | |
38 | - /** |
|
39 | - * TicketSelectorSimple constructor. |
|
40 | - * |
|
41 | - * @param \EE_Event $event |
|
42 | - * @param \EE_Ticket[] $tickets |
|
43 | - * @param int $max_attendees |
|
44 | - * @param array $template_args |
|
45 | - * @param string $date_format |
|
46 | - * @param string $time_format |
|
47 | - * @param \EE_Ticket_Selector_Config $ticket_selector_config |
|
48 | - * @param \EE_Tax_Config $tax_config |
|
49 | - */ |
|
50 | - public function __construct( |
|
51 | - \EE_Event $event, |
|
52 | - array $tickets, |
|
53 | - $max_attendees, |
|
54 | - array $template_args, |
|
55 | - $date_format = 'Y-m-d', |
|
56 | - $time_format = 'g:i a', |
|
57 | - \EE_Ticket_Selector_Config $ticket_selector_config = null, |
|
58 | - \EE_Tax_Config $tax_config = null |
|
59 | - ) { |
|
60 | - $this->date_format = $date_format; |
|
61 | - $this->time_format = $time_format; |
|
62 | - // get EE_Ticket_Selector_Config and TicketDetails |
|
63 | - $this->ticket_selector_config = isset(\EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector) |
|
64 | - ? \EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector |
|
65 | - : new \EE_Ticket_Selector_Config(); |
|
66 | - // $template_settings->setDatetimeSelectorThreshold(2); |
|
67 | - // \EEH_Debug_Tools::printr($template_settings->getShowDatetimeSelector(), 'getShowDatetimeSelector', __FILE__, __LINE__); |
|
68 | - // \EEH_Debug_Tools::printr($template_settings->getDatetimeSelectorThreshold(), 'getDatetimeSelectorThreshold', __FILE__, __LINE__); |
|
69 | - $this->tax_config = isset(\EE_Registry::instance()->CFG->tax_settings) |
|
70 | - ? \EE_Registry::instance()->CFG->tax_settings |
|
71 | - : new \EE_Tax_Config(); |
|
72 | - parent::__construct($event, $tickets, $max_attendees, $template_args); |
|
73 | - } |
|
38 | + /** |
|
39 | + * TicketSelectorSimple constructor. |
|
40 | + * |
|
41 | + * @param \EE_Event $event |
|
42 | + * @param \EE_Ticket[] $tickets |
|
43 | + * @param int $max_attendees |
|
44 | + * @param array $template_args |
|
45 | + * @param string $date_format |
|
46 | + * @param string $time_format |
|
47 | + * @param \EE_Ticket_Selector_Config $ticket_selector_config |
|
48 | + * @param \EE_Tax_Config $tax_config |
|
49 | + */ |
|
50 | + public function __construct( |
|
51 | + \EE_Event $event, |
|
52 | + array $tickets, |
|
53 | + $max_attendees, |
|
54 | + array $template_args, |
|
55 | + $date_format = 'Y-m-d', |
|
56 | + $time_format = 'g:i a', |
|
57 | + \EE_Ticket_Selector_Config $ticket_selector_config = null, |
|
58 | + \EE_Tax_Config $tax_config = null |
|
59 | + ) { |
|
60 | + $this->date_format = $date_format; |
|
61 | + $this->time_format = $time_format; |
|
62 | + // get EE_Ticket_Selector_Config and TicketDetails |
|
63 | + $this->ticket_selector_config = isset(\EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector) |
|
64 | + ? \EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector |
|
65 | + : new \EE_Ticket_Selector_Config(); |
|
66 | + // $template_settings->setDatetimeSelectorThreshold(2); |
|
67 | + // \EEH_Debug_Tools::printr($template_settings->getShowDatetimeSelector(), 'getShowDatetimeSelector', __FILE__, __LINE__); |
|
68 | + // \EEH_Debug_Tools::printr($template_settings->getDatetimeSelectorThreshold(), 'getDatetimeSelectorThreshold', __FILE__, __LINE__); |
|
69 | + $this->tax_config = isset(\EE_Registry::instance()->CFG->tax_settings) |
|
70 | + ? \EE_Registry::instance()->CFG->tax_settings |
|
71 | + : new \EE_Tax_Config(); |
|
72 | + parent::__construct($event, $tickets, $max_attendees, $template_args); |
|
73 | + } |
|
74 | 74 | |
75 | 75 | |
76 | - /** |
|
77 | - * sets any and all template args that are required for this Ticket Selector |
|
78 | - * |
|
79 | - * @return void |
|
80 | - * @throws \EE_Error |
|
81 | - */ |
|
82 | - protected function addTemplateArgs() |
|
83 | - { |
|
84 | - $row = 1; |
|
85 | - $ticket_row_html = ''; |
|
86 | - $required_ticket_sold_out = false; |
|
87 | - // flag to indicate that at least one taxable ticket has been encountered |
|
88 | - $taxable_tickets = false; |
|
89 | - $datetime_selector = null; |
|
90 | - $this->template_args['datetime_selector'] = ''; |
|
91 | - if ($this->ticket_selector_config->getShowDatetimeSelector() |
|
92 | - !== \EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR |
|
93 | - ) { |
|
94 | - $datetime_selector = new DatetimeSelector( |
|
95 | - $this->event, |
|
96 | - $this->tickets, |
|
97 | - $this->ticket_selector_config, |
|
98 | - $this->date_format, |
|
99 | - $this->time_format |
|
100 | - ); |
|
101 | - $this->template_args['datetime_selector'] = $datetime_selector->getDatetimeSelector(); |
|
102 | - } |
|
103 | - $total_tickets = count($this->tickets); |
|
104 | - // loop through tickets |
|
105 | - foreach ($this->tickets as $TKT_ID => $ticket) { |
|
106 | - if ($ticket instanceof \EE_Ticket) { |
|
107 | - $cols = 2; |
|
108 | - $taxable_tickets = $ticket->taxable() ? true : $taxable_tickets; |
|
109 | - $ticket_selector_row = new TicketSelectorRowStandard( |
|
110 | - new TicketDetails($ticket, $this->ticket_selector_config, $this->template_args), |
|
111 | - $this->tax_config, |
|
112 | - $total_tickets, |
|
113 | - $this->max_attendees, |
|
114 | - $row, |
|
115 | - $cols, |
|
116 | - $required_ticket_sold_out, |
|
117 | - $this->template_args['event_status'], |
|
118 | - $datetime_selector instanceof DatetimeSelector |
|
119 | - ? $datetime_selector->getTicketDatetimeClasses($ticket) |
|
120 | - : '' |
|
121 | - ); |
|
122 | - $ticket_row_html .= $ticket_selector_row->getHtml(); |
|
123 | - $required_ticket_sold_out = $ticket_selector_row->getRequiredTicketSoldOut(); |
|
124 | - $row++; |
|
125 | - } |
|
126 | - } |
|
127 | - $this->template_args['row'] = $row; |
|
128 | - $this->template_args['ticket_row_html'] = $ticket_row_html; |
|
129 | - $this->template_args['taxable_tickets'] = $taxable_tickets; |
|
130 | - $this->template_args['prices_displayed_including_taxes'] = $this->tax_config->prices_displayed_including_taxes; |
|
131 | - $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'standard_ticket_selector.template.php'; |
|
132 | - remove_all_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector'); |
|
133 | - } |
|
76 | + /** |
|
77 | + * sets any and all template args that are required for this Ticket Selector |
|
78 | + * |
|
79 | + * @return void |
|
80 | + * @throws \EE_Error |
|
81 | + */ |
|
82 | + protected function addTemplateArgs() |
|
83 | + { |
|
84 | + $row = 1; |
|
85 | + $ticket_row_html = ''; |
|
86 | + $required_ticket_sold_out = false; |
|
87 | + // flag to indicate that at least one taxable ticket has been encountered |
|
88 | + $taxable_tickets = false; |
|
89 | + $datetime_selector = null; |
|
90 | + $this->template_args['datetime_selector'] = ''; |
|
91 | + if ($this->ticket_selector_config->getShowDatetimeSelector() |
|
92 | + !== \EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR |
|
93 | + ) { |
|
94 | + $datetime_selector = new DatetimeSelector( |
|
95 | + $this->event, |
|
96 | + $this->tickets, |
|
97 | + $this->ticket_selector_config, |
|
98 | + $this->date_format, |
|
99 | + $this->time_format |
|
100 | + ); |
|
101 | + $this->template_args['datetime_selector'] = $datetime_selector->getDatetimeSelector(); |
|
102 | + } |
|
103 | + $total_tickets = count($this->tickets); |
|
104 | + // loop through tickets |
|
105 | + foreach ($this->tickets as $TKT_ID => $ticket) { |
|
106 | + if ($ticket instanceof \EE_Ticket) { |
|
107 | + $cols = 2; |
|
108 | + $taxable_tickets = $ticket->taxable() ? true : $taxable_tickets; |
|
109 | + $ticket_selector_row = new TicketSelectorRowStandard( |
|
110 | + new TicketDetails($ticket, $this->ticket_selector_config, $this->template_args), |
|
111 | + $this->tax_config, |
|
112 | + $total_tickets, |
|
113 | + $this->max_attendees, |
|
114 | + $row, |
|
115 | + $cols, |
|
116 | + $required_ticket_sold_out, |
|
117 | + $this->template_args['event_status'], |
|
118 | + $datetime_selector instanceof DatetimeSelector |
|
119 | + ? $datetime_selector->getTicketDatetimeClasses($ticket) |
|
120 | + : '' |
|
121 | + ); |
|
122 | + $ticket_row_html .= $ticket_selector_row->getHtml(); |
|
123 | + $required_ticket_sold_out = $ticket_selector_row->getRequiredTicketSoldOut(); |
|
124 | + $row++; |
|
125 | + } |
|
126 | + } |
|
127 | + $this->template_args['row'] = $row; |
|
128 | + $this->template_args['ticket_row_html'] = $ticket_row_html; |
|
129 | + $this->template_args['taxable_tickets'] = $taxable_tickets; |
|
130 | + $this->template_args['prices_displayed_including_taxes'] = $this->tax_config->prices_displayed_including_taxes; |
|
131 | + $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'standard_ticket_selector.template.php'; |
|
132 | + remove_all_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector'); |
|
133 | + } |
|
134 | 134 | } |
@@ -128,7 +128,7 @@ |
||
128 | 128 | $this->template_args['ticket_row_html'] = $ticket_row_html; |
129 | 129 | $this->template_args['taxable_tickets'] = $taxable_tickets; |
130 | 130 | $this->template_args['prices_displayed_including_taxes'] = $this->tax_config->prices_displayed_including_taxes; |
131 | - $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'standard_ticket_selector.template.php'; |
|
131 | + $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH.'standard_ticket_selector.template.php'; |
|
132 | 132 | remove_all_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector'); |
133 | 133 | } |
134 | 134 | } |
@@ -14,26 +14,26 @@ |
||
14 | 14 | class TicketSelectorRowSimple extends TicketSelectorRow |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * @throws EE_Error |
|
19 | - */ |
|
20 | - public function setupTicketStatusDisplay() |
|
21 | - { |
|
22 | - $remaining = $this->ticket->remaining(); |
|
23 | - $this->setTicketMinAndMax($remaining); |
|
24 | - $this->setTicketStatusClasses($remaining); |
|
25 | - $this->setTicketStatusDisplay($remaining); |
|
26 | - } |
|
17 | + /** |
|
18 | + * @throws EE_Error |
|
19 | + */ |
|
20 | + public function setupTicketStatusDisplay() |
|
21 | + { |
|
22 | + $remaining = $this->ticket->remaining(); |
|
23 | + $this->setTicketMinAndMax($remaining); |
|
24 | + $this->setTicketStatusClasses($remaining); |
|
25 | + $this->setTicketStatusDisplay($remaining); |
|
26 | + } |
|
27 | 27 | |
28 | 28 | |
29 | - public function getTicketDescription() |
|
30 | - { |
|
31 | - $filtered_row_content = $this->getFilteredRowContents(); |
|
32 | - if ($filtered_row_content !== false) { |
|
33 | - remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
34 | - add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_false'); |
|
35 | - return $filtered_row_content; |
|
36 | - } |
|
37 | - return $this->ticket->description(); |
|
38 | - } |
|
29 | + public function getTicketDescription() |
|
30 | + { |
|
31 | + $filtered_row_content = $this->getFilteredRowContents(); |
|
32 | + if ($filtered_row_content !== false) { |
|
33 | + remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
34 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_false'); |
|
35 | + return $filtered_row_content; |
|
36 | + } |
|
37 | + return $this->ticket->description(); |
|
38 | + } |
|
39 | 39 | } |
@@ -22,81 +22,81 @@ |
||
22 | 22 | class TicketSelectorIframe extends Iframe |
23 | 23 | { |
24 | 24 | |
25 | - /** |
|
26 | - * TicketSelectorIframe constructor. |
|
27 | - * |
|
28 | - * @throws InvalidArgumentException |
|
29 | - * @throws InvalidInterfaceException |
|
30 | - * @throws InvalidDataTypeException |
|
31 | - * @throws DomainException |
|
32 | - * @throws EE_Error |
|
33 | - * @throws ReflectionException |
|
34 | - */ |
|
35 | - public function __construct() |
|
36 | - { |
|
37 | - EE_Registry::instance()->REQ->set_espresso_page(true); |
|
38 | - /** @type \EEM_Event $EEM_Event */ |
|
39 | - $EEM_Event = EE_Registry::instance()->load_model('Event'); |
|
40 | - $event = $EEM_Event->get_one_by_ID( |
|
41 | - EE_Registry::instance()->REQ->get('event', 0) |
|
42 | - ); |
|
43 | - $ticket_selector = new DisplayTicketSelector(); |
|
44 | - $ticket_selector->setIframe(true); |
|
45 | - parent::__construct( |
|
46 | - esc_html__('Ticket Selector', 'event_espresso'), |
|
47 | - $ticket_selector->display($event) |
|
48 | - ); |
|
49 | - $this->addStylesheets( |
|
50 | - apply_filters( |
|
51 | - 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
|
52 | - array( |
|
53 | - 'ticket_selector_embed' => TICKET_SELECTOR_ASSETS_URL |
|
54 | - . 'ticket_selector_embed.css?ver=' |
|
55 | - . EVENT_ESPRESSO_VERSION, |
|
56 | - 'ticket_selector' => TICKET_SELECTOR_ASSETS_URL |
|
57 | - . 'ticket_selector.css?ver=' |
|
58 | - . EVENT_ESPRESSO_VERSION, |
|
59 | - ), |
|
60 | - $this |
|
61 | - ) |
|
62 | - ); |
|
63 | - if (! apply_filters('FHEE__EED_Ticket_Selector__ticket_selector_iframe__load_theme_css', false, $this)) { |
|
64 | - $this->addStylesheets(array('site_theme' => '')); |
|
65 | - } |
|
66 | - $this->addScripts( |
|
67 | - apply_filters( |
|
68 | - 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
|
69 | - array( |
|
70 | - 'ticket_selector_iframe_embed' => TICKET_SELECTOR_ASSETS_URL |
|
71 | - . 'ticket_selector_iframe_embed.js?ver=' |
|
72 | - . EVENT_ESPRESSO_VERSION, |
|
73 | - ), |
|
74 | - $this |
|
75 | - ) |
|
76 | - ); |
|
77 | - $js_attributes = apply_filters( |
|
78 | - 'FHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__js_attributes', |
|
79 | - array(), |
|
80 | - $this |
|
81 | - ); |
|
82 | - if (! empty($js_attributes)) { |
|
83 | - $this->addScriptAttributes($js_attributes); |
|
84 | - } |
|
85 | - $this->addLocalizedVars( |
|
86 | - apply_filters( |
|
87 | - 'FHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__localized_vars', |
|
88 | - array( |
|
89 | - 'ticket_selector_iframe' => true, |
|
90 | - 'EEDTicketSelectorMsg' => __( |
|
91 | - 'Please choose at least one ticket before continuing.', |
|
92 | - 'event_espresso' |
|
93 | - ), |
|
94 | - ) |
|
95 | - ) |
|
96 | - ); |
|
97 | - do_action( |
|
98 | - 'AHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__complete', |
|
99 | - $this |
|
100 | - ); |
|
101 | - } |
|
25 | + /** |
|
26 | + * TicketSelectorIframe constructor. |
|
27 | + * |
|
28 | + * @throws InvalidArgumentException |
|
29 | + * @throws InvalidInterfaceException |
|
30 | + * @throws InvalidDataTypeException |
|
31 | + * @throws DomainException |
|
32 | + * @throws EE_Error |
|
33 | + * @throws ReflectionException |
|
34 | + */ |
|
35 | + public function __construct() |
|
36 | + { |
|
37 | + EE_Registry::instance()->REQ->set_espresso_page(true); |
|
38 | + /** @type \EEM_Event $EEM_Event */ |
|
39 | + $EEM_Event = EE_Registry::instance()->load_model('Event'); |
|
40 | + $event = $EEM_Event->get_one_by_ID( |
|
41 | + EE_Registry::instance()->REQ->get('event', 0) |
|
42 | + ); |
|
43 | + $ticket_selector = new DisplayTicketSelector(); |
|
44 | + $ticket_selector->setIframe(true); |
|
45 | + parent::__construct( |
|
46 | + esc_html__('Ticket Selector', 'event_espresso'), |
|
47 | + $ticket_selector->display($event) |
|
48 | + ); |
|
49 | + $this->addStylesheets( |
|
50 | + apply_filters( |
|
51 | + 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
|
52 | + array( |
|
53 | + 'ticket_selector_embed' => TICKET_SELECTOR_ASSETS_URL |
|
54 | + . 'ticket_selector_embed.css?ver=' |
|
55 | + . EVENT_ESPRESSO_VERSION, |
|
56 | + 'ticket_selector' => TICKET_SELECTOR_ASSETS_URL |
|
57 | + . 'ticket_selector.css?ver=' |
|
58 | + . EVENT_ESPRESSO_VERSION, |
|
59 | + ), |
|
60 | + $this |
|
61 | + ) |
|
62 | + ); |
|
63 | + if (! apply_filters('FHEE__EED_Ticket_Selector__ticket_selector_iframe__load_theme_css', false, $this)) { |
|
64 | + $this->addStylesheets(array('site_theme' => '')); |
|
65 | + } |
|
66 | + $this->addScripts( |
|
67 | + apply_filters( |
|
68 | + 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
|
69 | + array( |
|
70 | + 'ticket_selector_iframe_embed' => TICKET_SELECTOR_ASSETS_URL |
|
71 | + . 'ticket_selector_iframe_embed.js?ver=' |
|
72 | + . EVENT_ESPRESSO_VERSION, |
|
73 | + ), |
|
74 | + $this |
|
75 | + ) |
|
76 | + ); |
|
77 | + $js_attributes = apply_filters( |
|
78 | + 'FHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__js_attributes', |
|
79 | + array(), |
|
80 | + $this |
|
81 | + ); |
|
82 | + if (! empty($js_attributes)) { |
|
83 | + $this->addScriptAttributes($js_attributes); |
|
84 | + } |
|
85 | + $this->addLocalizedVars( |
|
86 | + apply_filters( |
|
87 | + 'FHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__localized_vars', |
|
88 | + array( |
|
89 | + 'ticket_selector_iframe' => true, |
|
90 | + 'EEDTicketSelectorMsg' => __( |
|
91 | + 'Please choose at least one ticket before continuing.', |
|
92 | + 'event_espresso' |
|
93 | + ), |
|
94 | + ) |
|
95 | + ) |
|
96 | + ); |
|
97 | + do_action( |
|
98 | + 'AHEE__EventEspresso_modules_ticket_selector_TicketSelectorIframe__construct__complete', |
|
99 | + $this |
|
100 | + ); |
|
101 | + } |
|
102 | 102 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $this |
61 | 61 | ) |
62 | 62 | ); |
63 | - if (! apply_filters('FHEE__EED_Ticket_Selector__ticket_selector_iframe__load_theme_css', false, $this)) { |
|
63 | + if ( ! apply_filters('FHEE__EED_Ticket_Selector__ticket_selector_iframe__load_theme_css', false, $this)) { |
|
64 | 64 | $this->addStylesheets(array('site_theme' => '')); |
65 | 65 | } |
66 | 66 | $this->addScripts( |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | array(), |
80 | 80 | $this |
81 | 81 | ); |
82 | - if (! empty($js_attributes)) { |
|
82 | + if ( ! empty($js_attributes)) { |
|
83 | 83 | $this->addScriptAttributes($js_attributes); |
84 | 84 | } |
85 | 85 | $this->addLocalizedVars( |
@@ -18,368 +18,368 @@ |
||
18 | 18 | abstract class TicketSelectorRow |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * @var EE_Ticket $ticket |
|
23 | - */ |
|
24 | - protected $ticket; |
|
25 | - |
|
26 | - /** |
|
27 | - * @var int $total_tickets |
|
28 | - */ |
|
29 | - protected $total_tickets; |
|
30 | - |
|
31 | - /** |
|
32 | - * @var int $max_attendees |
|
33 | - */ |
|
34 | - protected $max_attendees; |
|
35 | - |
|
36 | - /** |
|
37 | - * @var string $date_format |
|
38 | - */ |
|
39 | - protected $date_format; |
|
40 | - |
|
41 | - /** |
|
42 | - * @var int $EVT_ID |
|
43 | - */ |
|
44 | - protected $EVT_ID; |
|
45 | - |
|
46 | - /** |
|
47 | - * @var string $event_status |
|
48 | - */ |
|
49 | - protected $event_status; |
|
50 | - |
|
51 | - /** |
|
52 | - * @var boolean $required_ticket_sold_out |
|
53 | - */ |
|
54 | - protected $required_ticket_sold_out; |
|
55 | - |
|
56 | - /** |
|
57 | - * @var string $ticket_status_display |
|
58 | - */ |
|
59 | - protected $ticket_status_display; |
|
60 | - |
|
61 | - /** |
|
62 | - * @var int $max |
|
63 | - */ |
|
64 | - protected $max = 0; |
|
65 | - |
|
66 | - /** |
|
67 | - * @var int $min |
|
68 | - */ |
|
69 | - protected $min = 0; |
|
70 | - |
|
71 | - /** |
|
72 | - * @var float $ticket_price |
|
73 | - */ |
|
74 | - protected $ticket_price = 0.00; |
|
75 | - |
|
76 | - /** |
|
77 | - * @var bool $ticket_bundle |
|
78 | - */ |
|
79 | - protected $ticket_bundle = false; |
|
80 | - |
|
81 | - /** |
|
82 | - * @var string $ticket_status_id |
|
83 | - */ |
|
84 | - protected $ticket_status_id = EE_Ticket::sold_out; |
|
85 | - |
|
86 | - /** |
|
87 | - * @var string $ticket_status_html |
|
88 | - */ |
|
89 | - protected $ticket_status_html = 'ticket-sales-sold-out'; |
|
90 | - |
|
91 | - /** |
|
92 | - * @var string $status_class |
|
93 | - */ |
|
94 | - protected $status_class = 'ticket-sales-sold-out lt-grey-text'; |
|
95 | - |
|
96 | - |
|
97 | - /** |
|
98 | - * @param EE_Ticket $ticket |
|
99 | - * @param int $max_attendees |
|
100 | - * @param string $date_format |
|
101 | - * @param string $event_status |
|
102 | - * @param bool $required_ticket_sold_out |
|
103 | - * @param int $total_tickets |
|
104 | - * @throws EE_Error |
|
105 | - * @throws UnexpectedEntityException |
|
106 | - */ |
|
107 | - public function __construct( |
|
108 | - EE_Ticket $ticket, |
|
109 | - $max_attendees, |
|
110 | - $date_format, |
|
111 | - $event_status, |
|
112 | - $required_ticket_sold_out = false, |
|
113 | - $total_tickets = 1 |
|
114 | - ) { |
|
115 | - $this->ticket = $ticket; |
|
116 | - $this->max_attendees = $max_attendees; |
|
117 | - $this->date_format = $date_format; |
|
118 | - $this->EVT_ID = $this->ticket->get_event_ID(); |
|
119 | - $this->event_status = $event_status; |
|
120 | - $this->required_ticket_sold_out = $required_ticket_sold_out; |
|
121 | - $this->total_tickets = $total_tickets; |
|
122 | - } |
|
123 | - |
|
124 | - |
|
125 | - /** |
|
126 | - * getTicketStatusClasses |
|
127 | - * |
|
128 | - * @param int $remaining |
|
129 | - * @return void |
|
130 | - * @throws EE_Error |
|
131 | - */ |
|
132 | - protected function setTicketStatusClasses($remaining = 0) |
|
133 | - { |
|
134 | - // if a previous required ticket with the same sale start date is sold out, |
|
135 | - // then mark this ticket as sold out as well. |
|
136 | - // tickets that go on sale at a later date than the required ticket will NOT be affected |
|
137 | - $this->ticket_status_id = $this->required_ticket_sold_out !== false |
|
138 | - && $this->required_ticket_sold_out === $this->ticket->start_date() |
|
139 | - ? EE_Ticket::sold_out |
|
140 | - : $this->ticket->ticket_status(); |
|
141 | - $this->ticket_status_id = $this->event_status === EE_Datetime::sold_out |
|
142 | - ? EE_Ticket::sold_out |
|
143 | - : $this->ticket_status_id; |
|
144 | - // check ticket status |
|
145 | - switch ($this->ticket_status_id) { |
|
146 | - // sold_out |
|
147 | - case EE_Ticket::sold_out: |
|
148 | - $ticket_status_class = 'ticket-sales-sold-out'; |
|
149 | - $this->status_class = 'ticket-sales-sold-out lt-grey-text'; |
|
150 | - break; |
|
151 | - // expired |
|
152 | - case EE_Ticket::expired: |
|
153 | - $ticket_status_class = 'ticket-sales-expired'; |
|
154 | - $this->status_class = 'ticket-sales-expired lt-grey-text'; |
|
155 | - break; |
|
156 | - // archived |
|
157 | - case EE_Ticket::archived: |
|
158 | - $ticket_status_class = 'archived-ticket'; |
|
159 | - $this->status_class = 'archived-ticket hidden'; |
|
160 | - break; |
|
161 | - // pending |
|
162 | - case EE_Ticket::pending: |
|
163 | - $ticket_status_class = 'ticket-pending'; |
|
164 | - $this->status_class = 'ticket-pending'; |
|
165 | - break; |
|
166 | - // on sale |
|
167 | - case EE_Ticket::onsale: |
|
168 | - default: |
|
169 | - $ticket_status_class = 'ticket-on-sale'; |
|
170 | - $this->status_class = 'ticket-on-sale'; |
|
171 | - break; |
|
172 | - } |
|
173 | - $this->ticket_status_html = EEH_HTML::span( |
|
174 | - $this->ticket->ticket_status(true, ($remaining > 0)), |
|
175 | - "{$ticket_status_class}-{$this->ticket->ID()}", |
|
176 | - $ticket_status_class |
|
177 | - ); |
|
178 | - } |
|
179 | - |
|
180 | - |
|
181 | - /** |
|
182 | - * @return string |
|
183 | - */ |
|
184 | - public function getTicketStatusDisplay() |
|
185 | - { |
|
186 | - return $this->ticket_status_display; |
|
187 | - } |
|
188 | - |
|
189 | - |
|
190 | - /** |
|
191 | - * setTicketStatusDisplay |
|
192 | - * |
|
193 | - * @param int $remaining |
|
194 | - * @throws EE_Error |
|
195 | - */ |
|
196 | - protected function setTicketStatusDisplay($remaining) |
|
197 | - { |
|
198 | - $this->ticket_status_display = ''; |
|
199 | - // now depending on the ticket and other circumstances... |
|
200 | - if ($this->max_attendees === 0) { |
|
201 | - // registration is CLOSED because admin set max attendees to ZERO |
|
202 | - $this->ticket_status_display = $this->registrationClosed(); |
|
203 | - } elseif ($this->ticket_status_id === EE_Ticket::sold_out || $remaining === 0) { |
|
204 | - // SOLD OUT - no tickets remaining |
|
205 | - $this->ticket_status_display = $this->ticketsSoldOut(); |
|
206 | - } elseif ($this->ticket_status_id === EE_Ticket::expired || $this->ticket_status_id === EE_Ticket::archived) { |
|
207 | - // expired or archived ticket |
|
208 | - $this->ticket_status_display = $this->ticket_status_html; |
|
209 | - } elseif ($this->ticket_status_id === EE_Ticket::pending) { |
|
210 | - // ticket not on sale yet |
|
211 | - $this->ticket_status_display = $this->ticketsSalesPending(); |
|
212 | - } elseif ($this->ticket->min() > $remaining) { |
|
213 | - // min qty purchasable is less than tickets available |
|
214 | - $this->ticket_status_display = $this->notEnoughTicketsAvailable(); |
|
215 | - } |
|
216 | - } |
|
217 | - |
|
218 | - |
|
219 | - /** |
|
220 | - * registrationClosed |
|
221 | - */ |
|
222 | - protected function registrationClosed() |
|
223 | - { |
|
224 | - return EEH_HTML::span( |
|
225 | - apply_filters( |
|
226 | - 'FHEE__ticket_selector_chart_template__ticket_closed_msg', |
|
227 | - __('Closed', 'event_espresso') |
|
228 | - ), |
|
229 | - '', |
|
230 | - 'sold-out' |
|
231 | - ); |
|
232 | - } |
|
233 | - |
|
234 | - |
|
235 | - /** |
|
236 | - * ticketsSoldOut |
|
237 | - */ |
|
238 | - protected function ticketsSoldOut() |
|
239 | - { |
|
240 | - return EEH_HTML::span( |
|
241 | - apply_filters( |
|
242 | - 'FHEE__ticket_selector_chart_template__ticket_sold_out_msg', |
|
243 | - __('Sold Out', 'event_espresso') |
|
244 | - ), |
|
245 | - '', |
|
246 | - 'sold-out' |
|
247 | - ); |
|
248 | - } |
|
249 | - |
|
250 | - |
|
251 | - /** |
|
252 | - * ticketsSalesPending |
|
253 | - * |
|
254 | - * @throws EE_Error |
|
255 | - */ |
|
256 | - protected function ticketsSalesPending() |
|
257 | - { |
|
258 | - return EEH_HTML::span( |
|
259 | - EEH_HTML::span( |
|
260 | - apply_filters( |
|
261 | - 'FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', |
|
262 | - __('Goes On Sale', 'event_espresso') |
|
263 | - ), |
|
264 | - '', |
|
265 | - 'ticket-pending' |
|
266 | - ) |
|
267 | - . EEH_HTML::br() |
|
268 | - . EEH_HTML::span( |
|
269 | - $this->ticket->get_i18n_datetime( |
|
270 | - 'TKT_start_date', |
|
271 | - apply_filters( |
|
272 | - 'FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', |
|
273 | - $this->date_format |
|
274 | - ) |
|
275 | - ), |
|
276 | - '', |
|
277 | - 'small-text' |
|
278 | - ), |
|
279 | - '', |
|
280 | - 'ticket-pending-pg' |
|
281 | - ); |
|
282 | - } |
|
283 | - |
|
284 | - |
|
285 | - /** |
|
286 | - * notEnoughTicketsAvailable |
|
287 | - */ |
|
288 | - protected function notEnoughTicketsAvailable() |
|
289 | - { |
|
290 | - return EEH_HTML::div( |
|
291 | - EEH_HTML::span( |
|
292 | - apply_filters( |
|
293 | - 'FHEE__ticket_selector_chart_template__ticket_not_available_msg', |
|
294 | - __('Not Available', 'event_espresso') |
|
295 | - ), |
|
296 | - '', |
|
297 | - 'archived-ticket small-text' |
|
298 | - ) |
|
299 | - . EEH_HTML::br(), |
|
300 | - '', |
|
301 | - 'archived-ticket-pg' |
|
302 | - ); |
|
303 | - } |
|
304 | - |
|
305 | - |
|
306 | - /** |
|
307 | - * setTicketMinAndMax |
|
308 | - * |
|
309 | - * @param int $remaining |
|
310 | - * @return void |
|
311 | - * @throws EE_Error |
|
312 | - */ |
|
313 | - protected function setTicketMinAndMax($remaining) |
|
314 | - { |
|
315 | - // offer the number of $tickets_remaining or $this->max_attendees, whichever is smaller |
|
316 | - $this->max = min($remaining, $this->max_attendees); |
|
317 | - // but... we also want to restrict the number of tickets by the ticket max setting, |
|
318 | - // however, the max still can't be higher than what was just set above |
|
319 | - $this->max = $this->ticket->max() > 0 |
|
320 | - ? min($this->ticket->max(), $this->max) |
|
321 | - : $this->max; |
|
322 | - // and we also want to restrict the minimum number of tickets by the ticket min setting |
|
323 | - $this->min = $this->ticket->min() > 0 |
|
324 | - ? $this->ticket->min() |
|
325 | - : 0; |
|
326 | - // and if the ticket is required, then make sure that min qty is at least 1 |
|
327 | - $this->min = $this->ticket->required() |
|
328 | - ? max($this->min, 1) |
|
329 | - : $this->min; |
|
330 | - } |
|
331 | - |
|
332 | - |
|
333 | - /** |
|
334 | - * Allow plugins to hook in and abort the generation and display of this row to do |
|
335 | - * something elseif they want. |
|
336 | - * For an addon to abort things, all they have to do is register a filter with this hook, and |
|
337 | - * return a value that is NOT false. Whatever is returned gets echoed instead of the |
|
338 | - * current row. |
|
339 | - * |
|
340 | - * @return string|bool |
|
341 | - */ |
|
342 | - protected function getFilteredRowHtml() |
|
343 | - { |
|
344 | - return apply_filters( |
|
345 | - 'FHEE__ticket_selector_chart_template__do_ticket_entire_row', |
|
346 | - false, |
|
347 | - $this->ticket, |
|
348 | - $this->max, |
|
349 | - $this->min, |
|
350 | - $this->required_ticket_sold_out, |
|
351 | - $this->ticket_price, |
|
352 | - $this->ticket_bundle, |
|
353 | - $this->ticket_status_html, |
|
354 | - $this->status_class, |
|
355 | - $this |
|
356 | - ); |
|
357 | - } |
|
358 | - |
|
359 | - |
|
360 | - /** |
|
361 | - * Allow plugins to hook in and abort the generation and display of the contents of this |
|
362 | - * row to do something elseif they want. |
|
363 | - * For an addon to abort things, all they have to do is register a filter with this hook, and |
|
364 | - * return a value that is NOT false. Whatever is returned gets echoed instead of the |
|
365 | - * current row. |
|
366 | - * |
|
367 | - * @return string|bool |
|
368 | - */ |
|
369 | - protected function getFilteredRowContents() |
|
370 | - { |
|
371 | - return apply_filters( |
|
372 | - 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', |
|
373 | - false, |
|
374 | - $this->ticket, |
|
375 | - $this->max, |
|
376 | - $this->min, |
|
377 | - $this->required_ticket_sold_out, |
|
378 | - $this->ticket_price, |
|
379 | - $this->ticket_bundle, |
|
380 | - $this->ticket_status_html, |
|
381 | - $this->status_class, |
|
382 | - $this |
|
383 | - ); |
|
384 | - } |
|
21 | + /** |
|
22 | + * @var EE_Ticket $ticket |
|
23 | + */ |
|
24 | + protected $ticket; |
|
25 | + |
|
26 | + /** |
|
27 | + * @var int $total_tickets |
|
28 | + */ |
|
29 | + protected $total_tickets; |
|
30 | + |
|
31 | + /** |
|
32 | + * @var int $max_attendees |
|
33 | + */ |
|
34 | + protected $max_attendees; |
|
35 | + |
|
36 | + /** |
|
37 | + * @var string $date_format |
|
38 | + */ |
|
39 | + protected $date_format; |
|
40 | + |
|
41 | + /** |
|
42 | + * @var int $EVT_ID |
|
43 | + */ |
|
44 | + protected $EVT_ID; |
|
45 | + |
|
46 | + /** |
|
47 | + * @var string $event_status |
|
48 | + */ |
|
49 | + protected $event_status; |
|
50 | + |
|
51 | + /** |
|
52 | + * @var boolean $required_ticket_sold_out |
|
53 | + */ |
|
54 | + protected $required_ticket_sold_out; |
|
55 | + |
|
56 | + /** |
|
57 | + * @var string $ticket_status_display |
|
58 | + */ |
|
59 | + protected $ticket_status_display; |
|
60 | + |
|
61 | + /** |
|
62 | + * @var int $max |
|
63 | + */ |
|
64 | + protected $max = 0; |
|
65 | + |
|
66 | + /** |
|
67 | + * @var int $min |
|
68 | + */ |
|
69 | + protected $min = 0; |
|
70 | + |
|
71 | + /** |
|
72 | + * @var float $ticket_price |
|
73 | + */ |
|
74 | + protected $ticket_price = 0.00; |
|
75 | + |
|
76 | + /** |
|
77 | + * @var bool $ticket_bundle |
|
78 | + */ |
|
79 | + protected $ticket_bundle = false; |
|
80 | + |
|
81 | + /** |
|
82 | + * @var string $ticket_status_id |
|
83 | + */ |
|
84 | + protected $ticket_status_id = EE_Ticket::sold_out; |
|
85 | + |
|
86 | + /** |
|
87 | + * @var string $ticket_status_html |
|
88 | + */ |
|
89 | + protected $ticket_status_html = 'ticket-sales-sold-out'; |
|
90 | + |
|
91 | + /** |
|
92 | + * @var string $status_class |
|
93 | + */ |
|
94 | + protected $status_class = 'ticket-sales-sold-out lt-grey-text'; |
|
95 | + |
|
96 | + |
|
97 | + /** |
|
98 | + * @param EE_Ticket $ticket |
|
99 | + * @param int $max_attendees |
|
100 | + * @param string $date_format |
|
101 | + * @param string $event_status |
|
102 | + * @param bool $required_ticket_sold_out |
|
103 | + * @param int $total_tickets |
|
104 | + * @throws EE_Error |
|
105 | + * @throws UnexpectedEntityException |
|
106 | + */ |
|
107 | + public function __construct( |
|
108 | + EE_Ticket $ticket, |
|
109 | + $max_attendees, |
|
110 | + $date_format, |
|
111 | + $event_status, |
|
112 | + $required_ticket_sold_out = false, |
|
113 | + $total_tickets = 1 |
|
114 | + ) { |
|
115 | + $this->ticket = $ticket; |
|
116 | + $this->max_attendees = $max_attendees; |
|
117 | + $this->date_format = $date_format; |
|
118 | + $this->EVT_ID = $this->ticket->get_event_ID(); |
|
119 | + $this->event_status = $event_status; |
|
120 | + $this->required_ticket_sold_out = $required_ticket_sold_out; |
|
121 | + $this->total_tickets = $total_tickets; |
|
122 | + } |
|
123 | + |
|
124 | + |
|
125 | + /** |
|
126 | + * getTicketStatusClasses |
|
127 | + * |
|
128 | + * @param int $remaining |
|
129 | + * @return void |
|
130 | + * @throws EE_Error |
|
131 | + */ |
|
132 | + protected function setTicketStatusClasses($remaining = 0) |
|
133 | + { |
|
134 | + // if a previous required ticket with the same sale start date is sold out, |
|
135 | + // then mark this ticket as sold out as well. |
|
136 | + // tickets that go on sale at a later date than the required ticket will NOT be affected |
|
137 | + $this->ticket_status_id = $this->required_ticket_sold_out !== false |
|
138 | + && $this->required_ticket_sold_out === $this->ticket->start_date() |
|
139 | + ? EE_Ticket::sold_out |
|
140 | + : $this->ticket->ticket_status(); |
|
141 | + $this->ticket_status_id = $this->event_status === EE_Datetime::sold_out |
|
142 | + ? EE_Ticket::sold_out |
|
143 | + : $this->ticket_status_id; |
|
144 | + // check ticket status |
|
145 | + switch ($this->ticket_status_id) { |
|
146 | + // sold_out |
|
147 | + case EE_Ticket::sold_out: |
|
148 | + $ticket_status_class = 'ticket-sales-sold-out'; |
|
149 | + $this->status_class = 'ticket-sales-sold-out lt-grey-text'; |
|
150 | + break; |
|
151 | + // expired |
|
152 | + case EE_Ticket::expired: |
|
153 | + $ticket_status_class = 'ticket-sales-expired'; |
|
154 | + $this->status_class = 'ticket-sales-expired lt-grey-text'; |
|
155 | + break; |
|
156 | + // archived |
|
157 | + case EE_Ticket::archived: |
|
158 | + $ticket_status_class = 'archived-ticket'; |
|
159 | + $this->status_class = 'archived-ticket hidden'; |
|
160 | + break; |
|
161 | + // pending |
|
162 | + case EE_Ticket::pending: |
|
163 | + $ticket_status_class = 'ticket-pending'; |
|
164 | + $this->status_class = 'ticket-pending'; |
|
165 | + break; |
|
166 | + // on sale |
|
167 | + case EE_Ticket::onsale: |
|
168 | + default: |
|
169 | + $ticket_status_class = 'ticket-on-sale'; |
|
170 | + $this->status_class = 'ticket-on-sale'; |
|
171 | + break; |
|
172 | + } |
|
173 | + $this->ticket_status_html = EEH_HTML::span( |
|
174 | + $this->ticket->ticket_status(true, ($remaining > 0)), |
|
175 | + "{$ticket_status_class}-{$this->ticket->ID()}", |
|
176 | + $ticket_status_class |
|
177 | + ); |
|
178 | + } |
|
179 | + |
|
180 | + |
|
181 | + /** |
|
182 | + * @return string |
|
183 | + */ |
|
184 | + public function getTicketStatusDisplay() |
|
185 | + { |
|
186 | + return $this->ticket_status_display; |
|
187 | + } |
|
188 | + |
|
189 | + |
|
190 | + /** |
|
191 | + * setTicketStatusDisplay |
|
192 | + * |
|
193 | + * @param int $remaining |
|
194 | + * @throws EE_Error |
|
195 | + */ |
|
196 | + protected function setTicketStatusDisplay($remaining) |
|
197 | + { |
|
198 | + $this->ticket_status_display = ''; |
|
199 | + // now depending on the ticket and other circumstances... |
|
200 | + if ($this->max_attendees === 0) { |
|
201 | + // registration is CLOSED because admin set max attendees to ZERO |
|
202 | + $this->ticket_status_display = $this->registrationClosed(); |
|
203 | + } elseif ($this->ticket_status_id === EE_Ticket::sold_out || $remaining === 0) { |
|
204 | + // SOLD OUT - no tickets remaining |
|
205 | + $this->ticket_status_display = $this->ticketsSoldOut(); |
|
206 | + } elseif ($this->ticket_status_id === EE_Ticket::expired || $this->ticket_status_id === EE_Ticket::archived) { |
|
207 | + // expired or archived ticket |
|
208 | + $this->ticket_status_display = $this->ticket_status_html; |
|
209 | + } elseif ($this->ticket_status_id === EE_Ticket::pending) { |
|
210 | + // ticket not on sale yet |
|
211 | + $this->ticket_status_display = $this->ticketsSalesPending(); |
|
212 | + } elseif ($this->ticket->min() > $remaining) { |
|
213 | + // min qty purchasable is less than tickets available |
|
214 | + $this->ticket_status_display = $this->notEnoughTicketsAvailable(); |
|
215 | + } |
|
216 | + } |
|
217 | + |
|
218 | + |
|
219 | + /** |
|
220 | + * registrationClosed |
|
221 | + */ |
|
222 | + protected function registrationClosed() |
|
223 | + { |
|
224 | + return EEH_HTML::span( |
|
225 | + apply_filters( |
|
226 | + 'FHEE__ticket_selector_chart_template__ticket_closed_msg', |
|
227 | + __('Closed', 'event_espresso') |
|
228 | + ), |
|
229 | + '', |
|
230 | + 'sold-out' |
|
231 | + ); |
|
232 | + } |
|
233 | + |
|
234 | + |
|
235 | + /** |
|
236 | + * ticketsSoldOut |
|
237 | + */ |
|
238 | + protected function ticketsSoldOut() |
|
239 | + { |
|
240 | + return EEH_HTML::span( |
|
241 | + apply_filters( |
|
242 | + 'FHEE__ticket_selector_chart_template__ticket_sold_out_msg', |
|
243 | + __('Sold Out', 'event_espresso') |
|
244 | + ), |
|
245 | + '', |
|
246 | + 'sold-out' |
|
247 | + ); |
|
248 | + } |
|
249 | + |
|
250 | + |
|
251 | + /** |
|
252 | + * ticketsSalesPending |
|
253 | + * |
|
254 | + * @throws EE_Error |
|
255 | + */ |
|
256 | + protected function ticketsSalesPending() |
|
257 | + { |
|
258 | + return EEH_HTML::span( |
|
259 | + EEH_HTML::span( |
|
260 | + apply_filters( |
|
261 | + 'FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', |
|
262 | + __('Goes On Sale', 'event_espresso') |
|
263 | + ), |
|
264 | + '', |
|
265 | + 'ticket-pending' |
|
266 | + ) |
|
267 | + . EEH_HTML::br() |
|
268 | + . EEH_HTML::span( |
|
269 | + $this->ticket->get_i18n_datetime( |
|
270 | + 'TKT_start_date', |
|
271 | + apply_filters( |
|
272 | + 'FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', |
|
273 | + $this->date_format |
|
274 | + ) |
|
275 | + ), |
|
276 | + '', |
|
277 | + 'small-text' |
|
278 | + ), |
|
279 | + '', |
|
280 | + 'ticket-pending-pg' |
|
281 | + ); |
|
282 | + } |
|
283 | + |
|
284 | + |
|
285 | + /** |
|
286 | + * notEnoughTicketsAvailable |
|
287 | + */ |
|
288 | + protected function notEnoughTicketsAvailable() |
|
289 | + { |
|
290 | + return EEH_HTML::div( |
|
291 | + EEH_HTML::span( |
|
292 | + apply_filters( |
|
293 | + 'FHEE__ticket_selector_chart_template__ticket_not_available_msg', |
|
294 | + __('Not Available', 'event_espresso') |
|
295 | + ), |
|
296 | + '', |
|
297 | + 'archived-ticket small-text' |
|
298 | + ) |
|
299 | + . EEH_HTML::br(), |
|
300 | + '', |
|
301 | + 'archived-ticket-pg' |
|
302 | + ); |
|
303 | + } |
|
304 | + |
|
305 | + |
|
306 | + /** |
|
307 | + * setTicketMinAndMax |
|
308 | + * |
|
309 | + * @param int $remaining |
|
310 | + * @return void |
|
311 | + * @throws EE_Error |
|
312 | + */ |
|
313 | + protected function setTicketMinAndMax($remaining) |
|
314 | + { |
|
315 | + // offer the number of $tickets_remaining or $this->max_attendees, whichever is smaller |
|
316 | + $this->max = min($remaining, $this->max_attendees); |
|
317 | + // but... we also want to restrict the number of tickets by the ticket max setting, |
|
318 | + // however, the max still can't be higher than what was just set above |
|
319 | + $this->max = $this->ticket->max() > 0 |
|
320 | + ? min($this->ticket->max(), $this->max) |
|
321 | + : $this->max; |
|
322 | + // and we also want to restrict the minimum number of tickets by the ticket min setting |
|
323 | + $this->min = $this->ticket->min() > 0 |
|
324 | + ? $this->ticket->min() |
|
325 | + : 0; |
|
326 | + // and if the ticket is required, then make sure that min qty is at least 1 |
|
327 | + $this->min = $this->ticket->required() |
|
328 | + ? max($this->min, 1) |
|
329 | + : $this->min; |
|
330 | + } |
|
331 | + |
|
332 | + |
|
333 | + /** |
|
334 | + * Allow plugins to hook in and abort the generation and display of this row to do |
|
335 | + * something elseif they want. |
|
336 | + * For an addon to abort things, all they have to do is register a filter with this hook, and |
|
337 | + * return a value that is NOT false. Whatever is returned gets echoed instead of the |
|
338 | + * current row. |
|
339 | + * |
|
340 | + * @return string|bool |
|
341 | + */ |
|
342 | + protected function getFilteredRowHtml() |
|
343 | + { |
|
344 | + return apply_filters( |
|
345 | + 'FHEE__ticket_selector_chart_template__do_ticket_entire_row', |
|
346 | + false, |
|
347 | + $this->ticket, |
|
348 | + $this->max, |
|
349 | + $this->min, |
|
350 | + $this->required_ticket_sold_out, |
|
351 | + $this->ticket_price, |
|
352 | + $this->ticket_bundle, |
|
353 | + $this->ticket_status_html, |
|
354 | + $this->status_class, |
|
355 | + $this |
|
356 | + ); |
|
357 | + } |
|
358 | + |
|
359 | + |
|
360 | + /** |
|
361 | + * Allow plugins to hook in and abort the generation and display of the contents of this |
|
362 | + * row to do something elseif they want. |
|
363 | + * For an addon to abort things, all they have to do is register a filter with this hook, and |
|
364 | + * return a value that is NOT false. Whatever is returned gets echoed instead of the |
|
365 | + * current row. |
|
366 | + * |
|
367 | + * @return string|bool |
|
368 | + */ |
|
369 | + protected function getFilteredRowContents() |
|
370 | + { |
|
371 | + return apply_filters( |
|
372 | + 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', |
|
373 | + false, |
|
374 | + $this->ticket, |
|
375 | + $this->max, |
|
376 | + $this->min, |
|
377 | + $this->required_ticket_sold_out, |
|
378 | + $this->ticket_price, |
|
379 | + $this->ticket_bundle, |
|
380 | + $this->ticket_status_html, |
|
381 | + $this->status_class, |
|
382 | + $this |
|
383 | + ); |
|
384 | + } |
|
385 | 385 | } |
@@ -15,186 +15,186 @@ |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | |
18 | - /** |
|
19 | - * @var \EE_Ticket $ticket |
|
20 | - */ |
|
21 | - protected $ticket; |
|
22 | - |
|
23 | - /** |
|
24 | - * @var \EE_Ticket_Selector_Config $template_settings |
|
25 | - */ |
|
26 | - protected $template_settings; |
|
27 | - |
|
28 | - /** |
|
29 | - * @var string $date_format |
|
30 | - */ |
|
31 | - protected $date_format; |
|
32 | - |
|
33 | - /** |
|
34 | - * @var string $time_format |
|
35 | - */ |
|
36 | - protected $time_format; |
|
37 | - |
|
38 | - /** |
|
39 | - * @var boolean $event_is_expired |
|
40 | - */ |
|
41 | - protected $event_is_expired; |
|
42 | - |
|
43 | - |
|
44 | - /** |
|
45 | - * TicketDetails constructor. |
|
46 | - * |
|
47 | - * @param \EE_Ticket $ticket |
|
48 | - * @param \EE_Ticket_Selector_Config $template_settings |
|
49 | - * @param array $template_args |
|
50 | - */ |
|
51 | - public function __construct( |
|
52 | - \EE_Ticket $ticket, |
|
53 | - \EE_Ticket_Selector_Config $template_settings, |
|
54 | - array $template_args |
|
55 | - ) { |
|
56 | - $this->ticket = $ticket; |
|
57 | - $this->template_settings = $template_settings; |
|
58 | - $this->date_format = $template_args['date_format']; |
|
59 | - $this->time_format = $template_args['time_format']; |
|
60 | - $this->event_is_expired = $template_args['event_is_expired']; |
|
61 | - } |
|
62 | - |
|
63 | - |
|
64 | - /** |
|
65 | - * @return \EE_Ticket |
|
66 | - */ |
|
67 | - public function getTicket() |
|
68 | - { |
|
69 | - return $this->ticket; |
|
70 | - } |
|
71 | - |
|
72 | - |
|
73 | - /** |
|
74 | - * @return bool |
|
75 | - */ |
|
76 | - public function showTicketDetails() |
|
77 | - { |
|
78 | - return $this->template_settings->show_ticket_details; |
|
79 | - } |
|
80 | - |
|
81 | - |
|
82 | - /** |
|
83 | - * @return \EE_Ticket_Selector_Config |
|
84 | - */ |
|
85 | - public function getTemplateSettings() |
|
86 | - { |
|
87 | - return $this->template_settings; |
|
88 | - } |
|
89 | - |
|
90 | - |
|
91 | - /** |
|
92 | - * @return string |
|
93 | - */ |
|
94 | - public function getDateFormat() |
|
95 | - { |
|
96 | - return $this->date_format; |
|
97 | - } |
|
98 | - |
|
99 | - |
|
100 | - /** |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - public function getTimeFormat() |
|
104 | - { |
|
105 | - return $this->time_format; |
|
106 | - } |
|
107 | - |
|
108 | - |
|
109 | - /** |
|
110 | - * @return string |
|
111 | - */ |
|
112 | - public function getShowHideLinks() |
|
113 | - { |
|
114 | - if (! $this->showTicketDetails()) { |
|
115 | - return ''; |
|
116 | - } |
|
117 | - return \EEH_HTML::link( |
|
118 | - '', |
|
119 | - sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '), |
|
120 | - esc_attr( |
|
121 | - apply_filters( |
|
122 | - 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', |
|
123 | - __('click to show additional ticket details', 'event_espresso') |
|
124 | - ) |
|
125 | - ), |
|
126 | - "display-{$this->cssId()}", |
|
127 | - 'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js', |
|
128 | - '', |
|
129 | - 'rel="' . $this->cssId() . '"' |
|
130 | - ) . \EEH_HTML::link( |
|
131 | - '', |
|
132 | - sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '), |
|
133 | - esc_attr( |
|
134 | - apply_filters( |
|
135 | - 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', |
|
136 | - __('click to hide additional ticket details', 'event_espresso') |
|
137 | - ) |
|
138 | - ), |
|
139 | - "hide-{$this->cssId()}", |
|
140 | - 'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js', |
|
141 | - 'display:none;', |
|
142 | - 'rel="' . $this->cssId() . '"' |
|
143 | - ); |
|
144 | - } |
|
145 | - |
|
146 | - |
|
147 | - /** |
|
148 | - * @return string |
|
149 | - */ |
|
150 | - public function cssId() |
|
151 | - { |
|
152 | - return apply_filters( |
|
153 | - 'FHEE__ticket_selector_chart_template__ticket_details_css_id', |
|
154 | - "tckt-slctr-tkt-details-{$this->ticket->get_event_ID()}-{$this->ticket->ID()}" |
|
155 | - ); |
|
156 | - } |
|
157 | - |
|
158 | - |
|
159 | - /** |
|
160 | - * @param float $ticket_price |
|
161 | - * @param int $remaining |
|
162 | - * @param int $cols |
|
163 | - * @return string |
|
164 | - */ |
|
165 | - public function display( |
|
166 | - $ticket_price = 0.00, |
|
167 | - $remaining, |
|
168 | - $cols = 2 |
|
169 | - ) { |
|
170 | - $template_args = array(); |
|
171 | - $template_args['ticket'] = $this->ticket; |
|
172 | - $template_args['ticket_price'] = $ticket_price; |
|
173 | - $template_args['remaining'] = $remaining; |
|
174 | - $template_args['cols'] = $cols; |
|
175 | - $template_args['show_ticket_details'] = $this->template_settings->show_ticket_details; |
|
176 | - $template_args['show_ticket_sale_columns'] = $this->template_settings->show_ticket_sale_columns; |
|
177 | - $template_args['ticket_details_row_class'] = espresso_get_object_css_class($this->ticket, '', 'details'); |
|
178 | - $template_args['ticket_details_css_id'] = $this->cssId(); |
|
179 | - $template_args['display_ticket_price'] = $ticket_price !== 0 && apply_filters( |
|
180 | - 'FHEE__ticket_selector_chart_template__display_ticket_price_details', |
|
181 | - true |
|
182 | - ); |
|
183 | - $template_args['price_breakdown_heading'] = apply_filters( |
|
184 | - 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', |
|
185 | - esc_html__('Price', 'event_espresso') |
|
186 | - ); |
|
187 | - $template_args['date_format'] = $this->date_format; |
|
188 | - $template_args['time_format'] = $this->time_format; |
|
189 | - $template_args['event_is_expired'] = $this->event_is_expired; |
|
190 | - |
|
191 | - return \EEH_Template::locate_template( |
|
192 | - apply_filters( |
|
193 | - 'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path', |
|
194 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php', |
|
195 | - $this->ticket |
|
196 | - ), |
|
197 | - $template_args |
|
198 | - ); |
|
199 | - } |
|
18 | + /** |
|
19 | + * @var \EE_Ticket $ticket |
|
20 | + */ |
|
21 | + protected $ticket; |
|
22 | + |
|
23 | + /** |
|
24 | + * @var \EE_Ticket_Selector_Config $template_settings |
|
25 | + */ |
|
26 | + protected $template_settings; |
|
27 | + |
|
28 | + /** |
|
29 | + * @var string $date_format |
|
30 | + */ |
|
31 | + protected $date_format; |
|
32 | + |
|
33 | + /** |
|
34 | + * @var string $time_format |
|
35 | + */ |
|
36 | + protected $time_format; |
|
37 | + |
|
38 | + /** |
|
39 | + * @var boolean $event_is_expired |
|
40 | + */ |
|
41 | + protected $event_is_expired; |
|
42 | + |
|
43 | + |
|
44 | + /** |
|
45 | + * TicketDetails constructor. |
|
46 | + * |
|
47 | + * @param \EE_Ticket $ticket |
|
48 | + * @param \EE_Ticket_Selector_Config $template_settings |
|
49 | + * @param array $template_args |
|
50 | + */ |
|
51 | + public function __construct( |
|
52 | + \EE_Ticket $ticket, |
|
53 | + \EE_Ticket_Selector_Config $template_settings, |
|
54 | + array $template_args |
|
55 | + ) { |
|
56 | + $this->ticket = $ticket; |
|
57 | + $this->template_settings = $template_settings; |
|
58 | + $this->date_format = $template_args['date_format']; |
|
59 | + $this->time_format = $template_args['time_format']; |
|
60 | + $this->event_is_expired = $template_args['event_is_expired']; |
|
61 | + } |
|
62 | + |
|
63 | + |
|
64 | + /** |
|
65 | + * @return \EE_Ticket |
|
66 | + */ |
|
67 | + public function getTicket() |
|
68 | + { |
|
69 | + return $this->ticket; |
|
70 | + } |
|
71 | + |
|
72 | + |
|
73 | + /** |
|
74 | + * @return bool |
|
75 | + */ |
|
76 | + public function showTicketDetails() |
|
77 | + { |
|
78 | + return $this->template_settings->show_ticket_details; |
|
79 | + } |
|
80 | + |
|
81 | + |
|
82 | + /** |
|
83 | + * @return \EE_Ticket_Selector_Config |
|
84 | + */ |
|
85 | + public function getTemplateSettings() |
|
86 | + { |
|
87 | + return $this->template_settings; |
|
88 | + } |
|
89 | + |
|
90 | + |
|
91 | + /** |
|
92 | + * @return string |
|
93 | + */ |
|
94 | + public function getDateFormat() |
|
95 | + { |
|
96 | + return $this->date_format; |
|
97 | + } |
|
98 | + |
|
99 | + |
|
100 | + /** |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + public function getTimeFormat() |
|
104 | + { |
|
105 | + return $this->time_format; |
|
106 | + } |
|
107 | + |
|
108 | + |
|
109 | + /** |
|
110 | + * @return string |
|
111 | + */ |
|
112 | + public function getShowHideLinks() |
|
113 | + { |
|
114 | + if (! $this->showTicketDetails()) { |
|
115 | + return ''; |
|
116 | + } |
|
117 | + return \EEH_HTML::link( |
|
118 | + '', |
|
119 | + sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '), |
|
120 | + esc_attr( |
|
121 | + apply_filters( |
|
122 | + 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', |
|
123 | + __('click to show additional ticket details', 'event_espresso') |
|
124 | + ) |
|
125 | + ), |
|
126 | + "display-{$this->cssId()}", |
|
127 | + 'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js', |
|
128 | + '', |
|
129 | + 'rel="' . $this->cssId() . '"' |
|
130 | + ) . \EEH_HTML::link( |
|
131 | + '', |
|
132 | + sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '), |
|
133 | + esc_attr( |
|
134 | + apply_filters( |
|
135 | + 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', |
|
136 | + __('click to hide additional ticket details', 'event_espresso') |
|
137 | + ) |
|
138 | + ), |
|
139 | + "hide-{$this->cssId()}", |
|
140 | + 'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js', |
|
141 | + 'display:none;', |
|
142 | + 'rel="' . $this->cssId() . '"' |
|
143 | + ); |
|
144 | + } |
|
145 | + |
|
146 | + |
|
147 | + /** |
|
148 | + * @return string |
|
149 | + */ |
|
150 | + public function cssId() |
|
151 | + { |
|
152 | + return apply_filters( |
|
153 | + 'FHEE__ticket_selector_chart_template__ticket_details_css_id', |
|
154 | + "tckt-slctr-tkt-details-{$this->ticket->get_event_ID()}-{$this->ticket->ID()}" |
|
155 | + ); |
|
156 | + } |
|
157 | + |
|
158 | + |
|
159 | + /** |
|
160 | + * @param float $ticket_price |
|
161 | + * @param int $remaining |
|
162 | + * @param int $cols |
|
163 | + * @return string |
|
164 | + */ |
|
165 | + public function display( |
|
166 | + $ticket_price = 0.00, |
|
167 | + $remaining, |
|
168 | + $cols = 2 |
|
169 | + ) { |
|
170 | + $template_args = array(); |
|
171 | + $template_args['ticket'] = $this->ticket; |
|
172 | + $template_args['ticket_price'] = $ticket_price; |
|
173 | + $template_args['remaining'] = $remaining; |
|
174 | + $template_args['cols'] = $cols; |
|
175 | + $template_args['show_ticket_details'] = $this->template_settings->show_ticket_details; |
|
176 | + $template_args['show_ticket_sale_columns'] = $this->template_settings->show_ticket_sale_columns; |
|
177 | + $template_args['ticket_details_row_class'] = espresso_get_object_css_class($this->ticket, '', 'details'); |
|
178 | + $template_args['ticket_details_css_id'] = $this->cssId(); |
|
179 | + $template_args['display_ticket_price'] = $ticket_price !== 0 && apply_filters( |
|
180 | + 'FHEE__ticket_selector_chart_template__display_ticket_price_details', |
|
181 | + true |
|
182 | + ); |
|
183 | + $template_args['price_breakdown_heading'] = apply_filters( |
|
184 | + 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', |
|
185 | + esc_html__('Price', 'event_espresso') |
|
186 | + ); |
|
187 | + $template_args['date_format'] = $this->date_format; |
|
188 | + $template_args['time_format'] = $this->time_format; |
|
189 | + $template_args['event_is_expired'] = $this->event_is_expired; |
|
190 | + |
|
191 | + return \EEH_Template::locate_template( |
|
192 | + apply_filters( |
|
193 | + 'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path', |
|
194 | + TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php', |
|
195 | + $this->ticket |
|
196 | + ), |
|
197 | + $template_args |
|
198 | + ); |
|
199 | + } |
|
200 | 200 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function getShowHideLinks() |
113 | 113 | { |
114 | - if (! $this->showTicketDetails()) { |
|
114 | + if ( ! $this->showTicketDetails()) { |
|
115 | 115 | return ''; |
116 | 116 | } |
117 | 117 | return \EEH_HTML::link( |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | "display-{$this->cssId()}", |
127 | 127 | 'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js', |
128 | 128 | '', |
129 | - 'rel="' . $this->cssId() . '"' |
|
130 | - ) . \EEH_HTML::link( |
|
129 | + 'rel="'.$this->cssId().'"' |
|
130 | + ).\EEH_HTML::link( |
|
131 | 131 | '', |
132 | 132 | sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '), |
133 | 133 | esc_attr( |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | "hide-{$this->cssId()}", |
140 | 140 | 'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js', |
141 | 141 | 'display:none;', |
142 | - 'rel="' . $this->cssId() . '"' |
|
142 | + 'rel="'.$this->cssId().'"' |
|
143 | 143 | ); |
144 | 144 | } |
145 | 145 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | return \EEH_Template::locate_template( |
192 | 192 | apply_filters( |
193 | 193 | 'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path', |
194 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php', |
|
194 | + TICKET_SELECTOR_TEMPLATES_PATH.'ticket_details.template.php', |
|
195 | 195 | $this->ticket |
196 | 196 | ), |
197 | 197 | $template_args |
@@ -19,57 +19,57 @@ |
||
19 | 19 | class TicketSelectorSimple extends TicketSelector |
20 | 20 | { |
21 | 21 | |
22 | - /** |
|
23 | - * @var EE_Ticket $ticket |
|
24 | - */ |
|
25 | - protected $ticket; |
|
22 | + /** |
|
23 | + * @var EE_Ticket $ticket |
|
24 | + */ |
|
25 | + protected $ticket; |
|
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * TicketSelectorSimple constructor. |
|
30 | - * |
|
31 | - * @param EE_Event $event |
|
32 | - * @param EE_Ticket $ticket |
|
33 | - * @param int $max_attendees |
|
34 | - * @param array $template_args |
|
35 | - * @throws EE_Error |
|
36 | - */ |
|
37 | - public function __construct(EE_Event $event, EE_Ticket $ticket, $max_attendees, array $template_args) |
|
38 | - { |
|
39 | - $this->ticket = $ticket; |
|
40 | - parent::__construct( |
|
41 | - $event, |
|
42 | - array($this->ticket), |
|
43 | - $max_attendees, |
|
44 | - $template_args |
|
45 | - ); |
|
46 | - } |
|
28 | + /** |
|
29 | + * TicketSelectorSimple constructor. |
|
30 | + * |
|
31 | + * @param EE_Event $event |
|
32 | + * @param EE_Ticket $ticket |
|
33 | + * @param int $max_attendees |
|
34 | + * @param array $template_args |
|
35 | + * @throws EE_Error |
|
36 | + */ |
|
37 | + public function __construct(EE_Event $event, EE_Ticket $ticket, $max_attendees, array $template_args) |
|
38 | + { |
|
39 | + $this->ticket = $ticket; |
|
40 | + parent::__construct( |
|
41 | + $event, |
|
42 | + array($this->ticket), |
|
43 | + $max_attendees, |
|
44 | + $template_args |
|
45 | + ); |
|
46 | + } |
|
47 | 47 | |
48 | 48 | |
49 | - /** |
|
50 | - * sets any and all template args that are required for this Ticket Selector |
|
51 | - * |
|
52 | - * @return void |
|
53 | - * @throws \EventEspresso\core\exceptions\UnexpectedEntityException |
|
54 | - * @throws EE_Error |
|
55 | - */ |
|
56 | - protected function addTemplateArgs() |
|
57 | - { |
|
58 | - unset($this->template_args['tickets']); |
|
59 | - $this->template_args['ticket'] = $this->ticket; |
|
60 | - $ticket_selector_row = new TicketSelectorRowSimple( |
|
61 | - $this->ticket, |
|
62 | - $this->max_attendees, |
|
63 | - $this->template_args['date_format'], |
|
64 | - $this->template_args['event_status'] |
|
65 | - ); |
|
66 | - $this->template_args['TKT_ID'] = $this->ticket->ID(); |
|
67 | - $ticket_selector_row->setupTicketStatusDisplay(); |
|
68 | - $this->template_args['ticket_status_display'] = $ticket_selector_row->getTicketStatusDisplay(); |
|
69 | - if (empty($this->template_args['ticket_status_display'])) { |
|
70 | - add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
71 | - } |
|
72 | - $this->template_args['ticket_description'] = $ticket_selector_row->getTicketDescription(); |
|
73 | - $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'simple_ticket_selector.template.php'; |
|
74 | - } |
|
49 | + /** |
|
50 | + * sets any and all template args that are required for this Ticket Selector |
|
51 | + * |
|
52 | + * @return void |
|
53 | + * @throws \EventEspresso\core\exceptions\UnexpectedEntityException |
|
54 | + * @throws EE_Error |
|
55 | + */ |
|
56 | + protected function addTemplateArgs() |
|
57 | + { |
|
58 | + unset($this->template_args['tickets']); |
|
59 | + $this->template_args['ticket'] = $this->ticket; |
|
60 | + $ticket_selector_row = new TicketSelectorRowSimple( |
|
61 | + $this->ticket, |
|
62 | + $this->max_attendees, |
|
63 | + $this->template_args['date_format'], |
|
64 | + $this->template_args['event_status'] |
|
65 | + ); |
|
66 | + $this->template_args['TKT_ID'] = $this->ticket->ID(); |
|
67 | + $ticket_selector_row->setupTicketStatusDisplay(); |
|
68 | + $this->template_args['ticket_status_display'] = $ticket_selector_row->getTicketStatusDisplay(); |
|
69 | + if (empty($this->template_args['ticket_status_display'])) { |
|
70 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
71 | + } |
|
72 | + $this->template_args['ticket_description'] = $ticket_selector_row->getTicketDescription(); |
|
73 | + $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'simple_ticket_selector.template.php'; |
|
74 | + } |
|
75 | 75 | } |
@@ -70,6 +70,6 @@ |
||
70 | 70 | add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
71 | 71 | } |
72 | 72 | $this->template_args['ticket_description'] = $ticket_selector_row->getTicketDescription(); |
73 | - $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'simple_ticket_selector.template.php'; |
|
73 | + $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH.'simple_ticket_selector.template.php'; |
|
74 | 74 | } |
75 | 75 | } |
@@ -12,107 +12,107 @@ |
||
12 | 12 | abstract class TicketSelector |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * @var \EE_Event $event |
|
17 | - */ |
|
18 | - protected $event; |
|
19 | - |
|
20 | - /** |
|
21 | - * @var \EE_Ticket[] $tickets |
|
22 | - */ |
|
23 | - protected $tickets; |
|
24 | - |
|
25 | - /** |
|
26 | - * @var int max_attendees |
|
27 | - */ |
|
28 | - protected $max_attendees; |
|
29 | - |
|
30 | - /** |
|
31 | - * @var array $template_args |
|
32 | - */ |
|
33 | - protected $template_args; |
|
34 | - |
|
35 | - |
|
36 | - /** |
|
37 | - * TicketSelectorSimple constructor. |
|
38 | - * |
|
39 | - * @param \EE_Event $event |
|
40 | - * @param \EE_Ticket[] $tickets |
|
41 | - * @param int $max_attendees |
|
42 | - * @param array $template_args |
|
43 | - * @throws \EE_Error |
|
44 | - */ |
|
45 | - public function __construct(\EE_Event $event, array $tickets, $max_attendees, array $template_args) |
|
46 | - { |
|
47 | - $this->event = $event; |
|
48 | - $this->tickets = $tickets; |
|
49 | - $this->max_attendees = $max_attendees; |
|
50 | - $this->template_args = $template_args; |
|
51 | - $this->template_args['hidden_inputs'] = $this->getHiddenInputs(); |
|
52 | - $this->addTemplateArgs(); |
|
53 | - } |
|
54 | - |
|
55 | - |
|
56 | - /** |
|
57 | - * sets any and all template args that are required for this Ticket Selector |
|
58 | - * |
|
59 | - * @return void |
|
60 | - */ |
|
61 | - abstract protected function addTemplateArgs(); |
|
62 | - |
|
63 | - |
|
64 | - /** |
|
65 | - * loadTicketSelectorTemplate |
|
66 | - * |
|
67 | - * @return string |
|
68 | - */ |
|
69 | - protected function loadTicketSelectorTemplate() |
|
70 | - { |
|
71 | - try { |
|
72 | - return \EEH_Template::locate_template( |
|
73 | - apply_filters( |
|
74 | - 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', |
|
75 | - $this->template_args['template_path'], |
|
76 | - $this->event |
|
77 | - ), |
|
78 | - $this->template_args |
|
79 | - ); |
|
80 | - } catch (\Exception $e) { |
|
81 | - \EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
82 | - } |
|
83 | - return ''; |
|
84 | - } |
|
85 | - |
|
86 | - |
|
87 | - /** |
|
88 | - * The __toString method allows a class to decide how it will react when it is converted to a string. |
|
89 | - * |
|
90 | - * @return string |
|
91 | - * @link http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.tostring |
|
92 | - */ |
|
93 | - public function __toString() |
|
94 | - { |
|
95 | - return $this->loadTicketSelectorTemplate(); |
|
96 | - } |
|
97 | - |
|
98 | - |
|
99 | - /** |
|
100 | - * getHiddenInputs |
|
101 | - * |
|
102 | - * @return string |
|
103 | - * @throws \EE_Error |
|
104 | - */ |
|
105 | - public function getHiddenInputs() |
|
106 | - { |
|
107 | - // $rows = count($this->tickets); |
|
108 | - $html = '<input type="hidden" name="noheader" value="true"/>'; |
|
109 | - $html .= '<input type="hidden" name="tkt-slctr-return-url-' . $this->event->ID() . '"'; |
|
110 | - $html .= ' value="' . \EEH_URL::current_url() . $this->template_args['anchor_id'] . '"/>'; |
|
111 | - $html .= '<input type="hidden" name="tkt-slctr-rows-' . $this->event->ID(); |
|
112 | - $html .= '" value="' . count($this->tickets) . '"/>'; |
|
113 | - $html .= '<input type="hidden" name="tkt-slctr-max-atndz-' . $this->event->ID(); |
|
114 | - $html .= '" value="' . $this->template_args['max_atndz'] . '"/>'; |
|
115 | - $html .= '<input type="hidden" name="tkt-slctr-event-id" value="' . $this->event->ID() . '"/>'; |
|
116 | - return $html; |
|
117 | - } |
|
15 | + /** |
|
16 | + * @var \EE_Event $event |
|
17 | + */ |
|
18 | + protected $event; |
|
19 | + |
|
20 | + /** |
|
21 | + * @var \EE_Ticket[] $tickets |
|
22 | + */ |
|
23 | + protected $tickets; |
|
24 | + |
|
25 | + /** |
|
26 | + * @var int max_attendees |
|
27 | + */ |
|
28 | + protected $max_attendees; |
|
29 | + |
|
30 | + /** |
|
31 | + * @var array $template_args |
|
32 | + */ |
|
33 | + protected $template_args; |
|
34 | + |
|
35 | + |
|
36 | + /** |
|
37 | + * TicketSelectorSimple constructor. |
|
38 | + * |
|
39 | + * @param \EE_Event $event |
|
40 | + * @param \EE_Ticket[] $tickets |
|
41 | + * @param int $max_attendees |
|
42 | + * @param array $template_args |
|
43 | + * @throws \EE_Error |
|
44 | + */ |
|
45 | + public function __construct(\EE_Event $event, array $tickets, $max_attendees, array $template_args) |
|
46 | + { |
|
47 | + $this->event = $event; |
|
48 | + $this->tickets = $tickets; |
|
49 | + $this->max_attendees = $max_attendees; |
|
50 | + $this->template_args = $template_args; |
|
51 | + $this->template_args['hidden_inputs'] = $this->getHiddenInputs(); |
|
52 | + $this->addTemplateArgs(); |
|
53 | + } |
|
54 | + |
|
55 | + |
|
56 | + /** |
|
57 | + * sets any and all template args that are required for this Ticket Selector |
|
58 | + * |
|
59 | + * @return void |
|
60 | + */ |
|
61 | + abstract protected function addTemplateArgs(); |
|
62 | + |
|
63 | + |
|
64 | + /** |
|
65 | + * loadTicketSelectorTemplate |
|
66 | + * |
|
67 | + * @return string |
|
68 | + */ |
|
69 | + protected function loadTicketSelectorTemplate() |
|
70 | + { |
|
71 | + try { |
|
72 | + return \EEH_Template::locate_template( |
|
73 | + apply_filters( |
|
74 | + 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', |
|
75 | + $this->template_args['template_path'], |
|
76 | + $this->event |
|
77 | + ), |
|
78 | + $this->template_args |
|
79 | + ); |
|
80 | + } catch (\Exception $e) { |
|
81 | + \EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
82 | + } |
|
83 | + return ''; |
|
84 | + } |
|
85 | + |
|
86 | + |
|
87 | + /** |
|
88 | + * The __toString method allows a class to decide how it will react when it is converted to a string. |
|
89 | + * |
|
90 | + * @return string |
|
91 | + * @link http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.tostring |
|
92 | + */ |
|
93 | + public function __toString() |
|
94 | + { |
|
95 | + return $this->loadTicketSelectorTemplate(); |
|
96 | + } |
|
97 | + |
|
98 | + |
|
99 | + /** |
|
100 | + * getHiddenInputs |
|
101 | + * |
|
102 | + * @return string |
|
103 | + * @throws \EE_Error |
|
104 | + */ |
|
105 | + public function getHiddenInputs() |
|
106 | + { |
|
107 | + // $rows = count($this->tickets); |
|
108 | + $html = '<input type="hidden" name="noheader" value="true"/>'; |
|
109 | + $html .= '<input type="hidden" name="tkt-slctr-return-url-' . $this->event->ID() . '"'; |
|
110 | + $html .= ' value="' . \EEH_URL::current_url() . $this->template_args['anchor_id'] . '"/>'; |
|
111 | + $html .= '<input type="hidden" name="tkt-slctr-rows-' . $this->event->ID(); |
|
112 | + $html .= '" value="' . count($this->tickets) . '"/>'; |
|
113 | + $html .= '<input type="hidden" name="tkt-slctr-max-atndz-' . $this->event->ID(); |
|
114 | + $html .= '" value="' . $this->template_args['max_atndz'] . '"/>'; |
|
115 | + $html .= '<input type="hidden" name="tkt-slctr-event-id" value="' . $this->event->ID() . '"/>'; |
|
116 | + return $html; |
|
117 | + } |
|
118 | 118 | } |
@@ -106,13 +106,13 @@ |
||
106 | 106 | { |
107 | 107 | // $rows = count($this->tickets); |
108 | 108 | $html = '<input type="hidden" name="noheader" value="true"/>'; |
109 | - $html .= '<input type="hidden" name="tkt-slctr-return-url-' . $this->event->ID() . '"'; |
|
110 | - $html .= ' value="' . \EEH_URL::current_url() . $this->template_args['anchor_id'] . '"/>'; |
|
111 | - $html .= '<input type="hidden" name="tkt-slctr-rows-' . $this->event->ID(); |
|
112 | - $html .= '" value="' . count($this->tickets) . '"/>'; |
|
113 | - $html .= '<input type="hidden" name="tkt-slctr-max-atndz-' . $this->event->ID(); |
|
114 | - $html .= '" value="' . $this->template_args['max_atndz'] . '"/>'; |
|
115 | - $html .= '<input type="hidden" name="tkt-slctr-event-id" value="' . $this->event->ID() . '"/>'; |
|
109 | + $html .= '<input type="hidden" name="tkt-slctr-return-url-'.$this->event->ID().'"'; |
|
110 | + $html .= ' value="'.\EEH_URL::current_url().$this->template_args['anchor_id'].'"/>'; |
|
111 | + $html .= '<input type="hidden" name="tkt-slctr-rows-'.$this->event->ID(); |
|
112 | + $html .= '" value="'.count($this->tickets).'"/>'; |
|
113 | + $html .= '<input type="hidden" name="tkt-slctr-max-atndz-'.$this->event->ID(); |
|
114 | + $html .= '" value="'.$this->template_args['max_atndz'].'"/>'; |
|
115 | + $html .= '<input type="hidden" name="tkt-slctr-event-id" value="'.$this->event->ID().'"/>'; |
|
116 | 116 | return $html; |
117 | 117 | } |
118 | 118 | } |
@@ -15,55 +15,55 @@ |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | |
18 | - /** |
|
19 | - * EventsArchiveIframe constructor. |
|
20 | - * |
|
21 | - * @param \EED_Events_Archive $EED_Events_Archive |
|
22 | - * @throws \DomainException |
|
23 | - */ |
|
24 | - public function __construct($EED_Events_Archive) |
|
25 | - { |
|
26 | - \EE_Registry::instance()->REQ->set_espresso_page(true); |
|
27 | - add_filter('FHEE__EED_Events_Archive__event_list_iframe', '__return_true'); |
|
28 | - $EED_Events_Archive->event_list(); |
|
29 | - /** @var \EventEspresso\core\domain\entities\shortcodes\EspressoEvents $event_list */ |
|
30 | - $event_list = \EE_Registry::instance()->create('EventEspresso\core\domain\entities\shortcodes\EspressoEvents'); |
|
31 | - parent::__construct( |
|
32 | - esc_html__('Event List', 'event_espresso'), |
|
33 | - $event_list->processShortcode() |
|
34 | - ); |
|
35 | - $this->addStylesheets( |
|
36 | - apply_filters( |
|
37 | - 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
|
38 | - array( |
|
39 | - 'espresso_default' => is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css') |
|
40 | - ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION |
|
41 | - : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
42 | - ), |
|
43 | - $this |
|
44 | - ) |
|
45 | - ); |
|
46 | - $this->addScripts( |
|
47 | - apply_filters( |
|
48 | - 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js', |
|
49 | - array( |
|
50 | - 'gmap_api' => sprintf( |
|
51 | - 'https://maps.googleapis.com/maps/api/js?key=%s', |
|
52 | - apply_filters( |
|
53 | - 'FHEE__EEH_Maps__espresso_google_maps_js__api_key', |
|
54 | - \EE_Registry::instance()->CFG->map_settings->google_map_api_key |
|
55 | - ) |
|
56 | - ), |
|
57 | - 'ee_gmap' => EE_HELPERS_ASSETS . 'ee_gmap.js?ver=1.0', |
|
58 | - ), |
|
59 | - $this |
|
60 | - ) |
|
61 | - ); |
|
62 | - $this->addLocalizedVars( |
|
63 | - array( |
|
64 | - 'ee_gmap' => \EEH_Maps::$gmap_vars, |
|
65 | - ), |
|
66 | - 'ee_gmap_vars' |
|
67 | - ); |
|
68 | - } |
|
18 | + /** |
|
19 | + * EventsArchiveIframe constructor. |
|
20 | + * |
|
21 | + * @param \EED_Events_Archive $EED_Events_Archive |
|
22 | + * @throws \DomainException |
|
23 | + */ |
|
24 | + public function __construct($EED_Events_Archive) |
|
25 | + { |
|
26 | + \EE_Registry::instance()->REQ->set_espresso_page(true); |
|
27 | + add_filter('FHEE__EED_Events_Archive__event_list_iframe', '__return_true'); |
|
28 | + $EED_Events_Archive->event_list(); |
|
29 | + /** @var \EventEspresso\core\domain\entities\shortcodes\EspressoEvents $event_list */ |
|
30 | + $event_list = \EE_Registry::instance()->create('EventEspresso\core\domain\entities\shortcodes\EspressoEvents'); |
|
31 | + parent::__construct( |
|
32 | + esc_html__('Event List', 'event_espresso'), |
|
33 | + $event_list->processShortcode() |
|
34 | + ); |
|
35 | + $this->addStylesheets( |
|
36 | + apply_filters( |
|
37 | + 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
|
38 | + array( |
|
39 | + 'espresso_default' => is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css') |
|
40 | + ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION |
|
41 | + : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
42 | + ), |
|
43 | + $this |
|
44 | + ) |
|
45 | + ); |
|
46 | + $this->addScripts( |
|
47 | + apply_filters( |
|
48 | + 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js', |
|
49 | + array( |
|
50 | + 'gmap_api' => sprintf( |
|
51 | + 'https://maps.googleapis.com/maps/api/js?key=%s', |
|
52 | + apply_filters( |
|
53 | + 'FHEE__EEH_Maps__espresso_google_maps_js__api_key', |
|
54 | + \EE_Registry::instance()->CFG->map_settings->google_map_api_key |
|
55 | + ) |
|
56 | + ), |
|
57 | + 'ee_gmap' => EE_HELPERS_ASSETS . 'ee_gmap.js?ver=1.0', |
|
58 | + ), |
|
59 | + $this |
|
60 | + ) |
|
61 | + ); |
|
62 | + $this->addLocalizedVars( |
|
63 | + array( |
|
64 | + 'ee_gmap' => \EEH_Maps::$gmap_vars, |
|
65 | + ), |
|
66 | + 'ee_gmap_vars' |
|
67 | + ); |
|
68 | + } |
|
69 | 69 | } |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | apply_filters( |
37 | 37 | 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
38 | 38 | array( |
39 | - 'espresso_default' => is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css') |
|
40 | - ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION |
|
41 | - : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
39 | + 'espresso_default' => is_readable(EVENT_ESPRESSO_UPLOAD_DIR.'css/style.css') |
|
40 | + ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION |
|
41 | + : EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION, |
|
42 | 42 | ), |
43 | 43 | $this |
44 | 44 | ) |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | \EE_Registry::instance()->CFG->map_settings->google_map_api_key |
55 | 55 | ) |
56 | 56 | ), |
57 | - 'ee_gmap' => EE_HELPERS_ASSETS . 'ee_gmap.js?ver=1.0', |
|
57 | + 'ee_gmap' => EE_HELPERS_ASSETS.'ee_gmap.js?ver=1.0', |
|
58 | 58 | ), |
59 | 59 | $this |
60 | 60 | ) |