@@ -16,216 +16,216 @@ |
||
16 | 16 | class ProcessTicketSelectorPostData |
17 | 17 | { |
18 | 18 | |
19 | - const DATA_KEY_EVENT_ID = 'id'; |
|
20 | - |
|
21 | - const DATA_KEY_MAX_ATNDZ = 'max_atndz'; |
|
22 | - |
|
23 | - const DATA_KEY_QUANTITY = 'qty'; |
|
24 | - |
|
25 | - const DATA_KEY_RETURN_URL = 'return_url'; |
|
26 | - |
|
27 | - const DATA_KEY_ROWS = 'rows'; |
|
28 | - |
|
29 | - const DATA_KEY_TICKET_ID = 'ticket_id'; |
|
30 | - |
|
31 | - const DATA_KEY_TOTAL_TICKETS = 'total_tickets'; |
|
32 | - |
|
33 | - const INPUT_KEY_EVENT_ID = 'tkt-slctr-event-id'; |
|
34 | - |
|
35 | - const INPUT_KEY_MAX_ATNDZ = 'tkt-slctr-max-atndz-'; |
|
36 | - |
|
37 | - const INPUT_KEY_ROWS = 'tkt-slctr-rows-'; |
|
38 | - |
|
39 | - const INPUT_KEY_QTY = 'tkt-slctr-qty-'; |
|
40 | - |
|
41 | - const INPUT_KEY_TICKET_ID = 'tkt-slctr-ticket-id-'; |
|
42 | - |
|
43 | - const INPUT_KEY_RETURN_URL = 'tkt-slctr-return-url-'; |
|
44 | - |
|
45 | - |
|
46 | - /** |
|
47 | - * @var int |
|
48 | - */ |
|
49 | - protected $event_id; |
|
50 | - |
|
51 | - /** |
|
52 | - * @var array |
|
53 | - */ |
|
54 | - protected $inputs_to_clean = []; |
|
55 | - |
|
56 | - /** |
|
57 | - * @var array |
|
58 | - */ |
|
59 | - protected $valid_data = []; |
|
60 | - |
|
61 | - /** |
|
62 | - * @var RequestInterface |
|
63 | - */ |
|
64 | - protected $request; |
|
65 | - |
|
66 | - |
|
67 | - /** |
|
68 | - * @param RequestInterface $request |
|
69 | - */ |
|
70 | - public function __construct(RequestInterface $request) |
|
71 | - { |
|
72 | - $this->request = $request; |
|
73 | - $this->inputs_to_clean = [ |
|
74 | - self::DATA_KEY_MAX_ATNDZ => self::INPUT_KEY_MAX_ATNDZ, |
|
75 | - self::DATA_KEY_RETURN_URL => self::INPUT_KEY_RETURN_URL, |
|
76 | - self::DATA_KEY_ROWS => self::INPUT_KEY_ROWS, |
|
77 | - self::DATA_KEY_TOTAL_TICKETS => self::INPUT_KEY_TICKET_ID, |
|
78 | - self::DATA_KEY_QUANTITY => self::INPUT_KEY_QTY, |
|
79 | - ]; |
|
80 | - } |
|
81 | - |
|
82 | - |
|
83 | - /** |
|
84 | - * @return int |
|
85 | - * @throws DomainException |
|
86 | - */ |
|
87 | - public function getEventId() |
|
88 | - { |
|
89 | - // do we have an event id? |
|
90 | - if ($this->event_id === null) { |
|
91 | - $this->event_id = $this->request->getRequestParam(self::INPUT_KEY_EVENT_ID, 0, 'int'); |
|
92 | - if (! $this->event_id) { |
|
93 | - // $_POST['tkt-slctr-event-id'] was not set ?!?!?!? |
|
94 | - throw new DomainException( |
|
95 | - sprintf( |
|
96 | - esc_html__( |
|
97 | - 'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', |
|
98 | - 'event_espresso' |
|
99 | - ), |
|
100 | - '<br/>' |
|
101 | - ) |
|
102 | - ); |
|
103 | - } |
|
104 | - } |
|
105 | - // event id is valid |
|
106 | - return $this->event_id; |
|
107 | - } |
|
108 | - |
|
109 | - |
|
110 | - /** |
|
111 | - * @return array |
|
112 | - * @throws DomainException |
|
113 | - */ |
|
114 | - public function validatePostData() |
|
115 | - { |
|
116 | - // grab valid id |
|
117 | - $this->valid_data[ self::DATA_KEY_EVENT_ID ] = $this->getEventId(); |
|
118 | - // let's track the total number of tickets ordered.' |
|
119 | - $this->valid_data[ self:: DATA_KEY_TOTAL_TICKETS ] = 0; |
|
120 | - // cycle through $inputs_to_clean array |
|
121 | - foreach ($this->inputs_to_clean as $what => $input_to_clean) { |
|
122 | - $input_key = "{$input_to_clean}{$this->event_id}"; |
|
123 | - // check for POST data |
|
124 | - if ($this->request->requestParamIsSet($input_key)) { |
|
125 | - switch ($what) { |
|
126 | - // integers |
|
127 | - case self::DATA_KEY_ROWS: |
|
128 | - case self::DATA_KEY_MAX_ATNDZ: |
|
129 | - $this->processInteger($what, $input_key); |
|
130 | - break; |
|
131 | - // arrays of integers |
|
132 | - case self::DATA_KEY_QUANTITY: |
|
133 | - $this->processQuantity($input_key); |
|
134 | - break; |
|
135 | - // array of integers |
|
136 | - case self::DATA_KEY_TOTAL_TICKETS: |
|
137 | - $this->processTicketIDs($input_key); |
|
138 | - break; |
|
139 | - case self::DATA_KEY_RETURN_URL: |
|
140 | - $this->processReturnURL($input_key); |
|
141 | - break; |
|
142 | - } |
|
143 | - } |
|
144 | - } |
|
145 | - return $this->valid_data; |
|
146 | - } |
|
147 | - |
|
148 | - |
|
149 | - /** |
|
150 | - * @param string $what |
|
151 | - * @param string $input_key |
|
152 | - */ |
|
153 | - protected function processInteger($what, $input_key) |
|
154 | - { |
|
155 | - $this->valid_data[ $what ] = $this->request->getRequestParam($input_key, 0, 'int'); |
|
156 | - } |
|
157 | - |
|
158 | - |
|
159 | - /** |
|
160 | - * @param string $input_key |
|
161 | - * @throws DomainException |
|
162 | - */ |
|
163 | - protected function processQuantity($input_key) |
|
164 | - { |
|
165 | - /** @var array $row_qty */ |
|
166 | - $row_qty = $this->request->getRequestParam($input_key, [], 'int', true); |
|
167 | - if (empty($row_qty) || ! is_array($row_qty)) { |
|
168 | - throw new DomainException( |
|
169 | - sprintf( |
|
170 | - esc_html__( |
|
171 | - 'An error occurred while trying to retrieve the ticket selections for the event.%sPlease click the back button on your browser and try again.', |
|
172 | - 'event_espresso' |
|
173 | - ), |
|
174 | - '<br/>' |
|
175 | - ) |
|
176 | - ); |
|
177 | - } |
|
178 | - foreach ($this->valid_data[ self::DATA_KEY_TICKET_ID ] as $ticket_id) { |
|
179 | - $qty = isset($row_qty[ $ticket_id ]) ? $row_qty[ $ticket_id ] : 0; |
|
180 | - // sanitize as integers |
|
181 | - $this->valid_data[ self::DATA_KEY_QUANTITY ][] = $qty; |
|
182 | - $this->valid_data[ self:: DATA_KEY_TOTAL_TICKETS ] += $qty; |
|
183 | - } |
|
184 | - } |
|
185 | - |
|
186 | - |
|
187 | - /** |
|
188 | - * @param string $input_key |
|
189 | - */ |
|
190 | - protected function processReturnURL($input_key) |
|
191 | - { |
|
192 | - // grab and sanitize return-url |
|
193 | - $input_value = $this->request->getRequestParam($input_key, '', 'url'); |
|
194 | - // was the request coming from an iframe ? if so, then: |
|
195 | - if (strpos($input_value, 'event_list=iframe')) { |
|
196 | - // get anchor fragment |
|
197 | - $input_value = explode('#', $input_value); |
|
198 | - $input_value = end($input_value); |
|
199 | - // use event list url instead, but append anchor |
|
200 | - $input_value = EEH_Event_View::event_archive_url() . '#' . $input_value; |
|
201 | - } |
|
202 | - $this->valid_data[ self::DATA_KEY_RETURN_URL ] = $input_value; |
|
203 | - } |
|
204 | - |
|
205 | - |
|
206 | - /** |
|
207 | - * @param string $input_key |
|
208 | - * @throws DomainException |
|
209 | - */ |
|
210 | - protected function processTicketIDs($input_key) |
|
211 | - { |
|
212 | - $ticket_ids = (array) $this->request->getRequestParam($input_key, [], 'int', true); |
|
213 | - $filtered_ticket_ids = array_filter($ticket_ids); |
|
214 | - if (empty($filtered_ticket_ids)) { |
|
215 | - throw new DomainException( |
|
216 | - sprintf( |
|
217 | - esc_html__( |
|
218 | - 'An error occurred while trying to retrieve the ticket IDs for the event.%sPlease click the back button on your browser and try again.', |
|
219 | - 'event_espresso' |
|
220 | - ), |
|
221 | - '<br/>' |
|
222 | - ) |
|
223 | - ); |
|
224 | - } |
|
225 | - // cycle thru values |
|
226 | - foreach ($ticket_ids as $key => $value) { |
|
227 | - // allow only integers |
|
228 | - $this->valid_data[ self::DATA_KEY_TICKET_ID ][ $key ] = absint($value); |
|
229 | - } |
|
230 | - } |
|
19 | + const DATA_KEY_EVENT_ID = 'id'; |
|
20 | + |
|
21 | + const DATA_KEY_MAX_ATNDZ = 'max_atndz'; |
|
22 | + |
|
23 | + const DATA_KEY_QUANTITY = 'qty'; |
|
24 | + |
|
25 | + const DATA_KEY_RETURN_URL = 'return_url'; |
|
26 | + |
|
27 | + const DATA_KEY_ROWS = 'rows'; |
|
28 | + |
|
29 | + const DATA_KEY_TICKET_ID = 'ticket_id'; |
|
30 | + |
|
31 | + const DATA_KEY_TOTAL_TICKETS = 'total_tickets'; |
|
32 | + |
|
33 | + const INPUT_KEY_EVENT_ID = 'tkt-slctr-event-id'; |
|
34 | + |
|
35 | + const INPUT_KEY_MAX_ATNDZ = 'tkt-slctr-max-atndz-'; |
|
36 | + |
|
37 | + const INPUT_KEY_ROWS = 'tkt-slctr-rows-'; |
|
38 | + |
|
39 | + const INPUT_KEY_QTY = 'tkt-slctr-qty-'; |
|
40 | + |
|
41 | + const INPUT_KEY_TICKET_ID = 'tkt-slctr-ticket-id-'; |
|
42 | + |
|
43 | + const INPUT_KEY_RETURN_URL = 'tkt-slctr-return-url-'; |
|
44 | + |
|
45 | + |
|
46 | + /** |
|
47 | + * @var int |
|
48 | + */ |
|
49 | + protected $event_id; |
|
50 | + |
|
51 | + /** |
|
52 | + * @var array |
|
53 | + */ |
|
54 | + protected $inputs_to_clean = []; |
|
55 | + |
|
56 | + /** |
|
57 | + * @var array |
|
58 | + */ |
|
59 | + protected $valid_data = []; |
|
60 | + |
|
61 | + /** |
|
62 | + * @var RequestInterface |
|
63 | + */ |
|
64 | + protected $request; |
|
65 | + |
|
66 | + |
|
67 | + /** |
|
68 | + * @param RequestInterface $request |
|
69 | + */ |
|
70 | + public function __construct(RequestInterface $request) |
|
71 | + { |
|
72 | + $this->request = $request; |
|
73 | + $this->inputs_to_clean = [ |
|
74 | + self::DATA_KEY_MAX_ATNDZ => self::INPUT_KEY_MAX_ATNDZ, |
|
75 | + self::DATA_KEY_RETURN_URL => self::INPUT_KEY_RETURN_URL, |
|
76 | + self::DATA_KEY_ROWS => self::INPUT_KEY_ROWS, |
|
77 | + self::DATA_KEY_TOTAL_TICKETS => self::INPUT_KEY_TICKET_ID, |
|
78 | + self::DATA_KEY_QUANTITY => self::INPUT_KEY_QTY, |
|
79 | + ]; |
|
80 | + } |
|
81 | + |
|
82 | + |
|
83 | + /** |
|
84 | + * @return int |
|
85 | + * @throws DomainException |
|
86 | + */ |
|
87 | + public function getEventId() |
|
88 | + { |
|
89 | + // do we have an event id? |
|
90 | + if ($this->event_id === null) { |
|
91 | + $this->event_id = $this->request->getRequestParam(self::INPUT_KEY_EVENT_ID, 0, 'int'); |
|
92 | + if (! $this->event_id) { |
|
93 | + // $_POST['tkt-slctr-event-id'] was not set ?!?!?!? |
|
94 | + throw new DomainException( |
|
95 | + sprintf( |
|
96 | + esc_html__( |
|
97 | + 'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', |
|
98 | + 'event_espresso' |
|
99 | + ), |
|
100 | + '<br/>' |
|
101 | + ) |
|
102 | + ); |
|
103 | + } |
|
104 | + } |
|
105 | + // event id is valid |
|
106 | + return $this->event_id; |
|
107 | + } |
|
108 | + |
|
109 | + |
|
110 | + /** |
|
111 | + * @return array |
|
112 | + * @throws DomainException |
|
113 | + */ |
|
114 | + public function validatePostData() |
|
115 | + { |
|
116 | + // grab valid id |
|
117 | + $this->valid_data[ self::DATA_KEY_EVENT_ID ] = $this->getEventId(); |
|
118 | + // let's track the total number of tickets ordered.' |
|
119 | + $this->valid_data[ self:: DATA_KEY_TOTAL_TICKETS ] = 0; |
|
120 | + // cycle through $inputs_to_clean array |
|
121 | + foreach ($this->inputs_to_clean as $what => $input_to_clean) { |
|
122 | + $input_key = "{$input_to_clean}{$this->event_id}"; |
|
123 | + // check for POST data |
|
124 | + if ($this->request->requestParamIsSet($input_key)) { |
|
125 | + switch ($what) { |
|
126 | + // integers |
|
127 | + case self::DATA_KEY_ROWS: |
|
128 | + case self::DATA_KEY_MAX_ATNDZ: |
|
129 | + $this->processInteger($what, $input_key); |
|
130 | + break; |
|
131 | + // arrays of integers |
|
132 | + case self::DATA_KEY_QUANTITY: |
|
133 | + $this->processQuantity($input_key); |
|
134 | + break; |
|
135 | + // array of integers |
|
136 | + case self::DATA_KEY_TOTAL_TICKETS: |
|
137 | + $this->processTicketIDs($input_key); |
|
138 | + break; |
|
139 | + case self::DATA_KEY_RETURN_URL: |
|
140 | + $this->processReturnURL($input_key); |
|
141 | + break; |
|
142 | + } |
|
143 | + } |
|
144 | + } |
|
145 | + return $this->valid_data; |
|
146 | + } |
|
147 | + |
|
148 | + |
|
149 | + /** |
|
150 | + * @param string $what |
|
151 | + * @param string $input_key |
|
152 | + */ |
|
153 | + protected function processInteger($what, $input_key) |
|
154 | + { |
|
155 | + $this->valid_data[ $what ] = $this->request->getRequestParam($input_key, 0, 'int'); |
|
156 | + } |
|
157 | + |
|
158 | + |
|
159 | + /** |
|
160 | + * @param string $input_key |
|
161 | + * @throws DomainException |
|
162 | + */ |
|
163 | + protected function processQuantity($input_key) |
|
164 | + { |
|
165 | + /** @var array $row_qty */ |
|
166 | + $row_qty = $this->request->getRequestParam($input_key, [], 'int', true); |
|
167 | + if (empty($row_qty) || ! is_array($row_qty)) { |
|
168 | + throw new DomainException( |
|
169 | + sprintf( |
|
170 | + esc_html__( |
|
171 | + 'An error occurred while trying to retrieve the ticket selections for the event.%sPlease click the back button on your browser and try again.', |
|
172 | + 'event_espresso' |
|
173 | + ), |
|
174 | + '<br/>' |
|
175 | + ) |
|
176 | + ); |
|
177 | + } |
|
178 | + foreach ($this->valid_data[ self::DATA_KEY_TICKET_ID ] as $ticket_id) { |
|
179 | + $qty = isset($row_qty[ $ticket_id ]) ? $row_qty[ $ticket_id ] : 0; |
|
180 | + // sanitize as integers |
|
181 | + $this->valid_data[ self::DATA_KEY_QUANTITY ][] = $qty; |
|
182 | + $this->valid_data[ self:: DATA_KEY_TOTAL_TICKETS ] += $qty; |
|
183 | + } |
|
184 | + } |
|
185 | + |
|
186 | + |
|
187 | + /** |
|
188 | + * @param string $input_key |
|
189 | + */ |
|
190 | + protected function processReturnURL($input_key) |
|
191 | + { |
|
192 | + // grab and sanitize return-url |
|
193 | + $input_value = $this->request->getRequestParam($input_key, '', 'url'); |
|
194 | + // was the request coming from an iframe ? if so, then: |
|
195 | + if (strpos($input_value, 'event_list=iframe')) { |
|
196 | + // get anchor fragment |
|
197 | + $input_value = explode('#', $input_value); |
|
198 | + $input_value = end($input_value); |
|
199 | + // use event list url instead, but append anchor |
|
200 | + $input_value = EEH_Event_View::event_archive_url() . '#' . $input_value; |
|
201 | + } |
|
202 | + $this->valid_data[ self::DATA_KEY_RETURN_URL ] = $input_value; |
|
203 | + } |
|
204 | + |
|
205 | + |
|
206 | + /** |
|
207 | + * @param string $input_key |
|
208 | + * @throws DomainException |
|
209 | + */ |
|
210 | + protected function processTicketIDs($input_key) |
|
211 | + { |
|
212 | + $ticket_ids = (array) $this->request->getRequestParam($input_key, [], 'int', true); |
|
213 | + $filtered_ticket_ids = array_filter($ticket_ids); |
|
214 | + if (empty($filtered_ticket_ids)) { |
|
215 | + throw new DomainException( |
|
216 | + sprintf( |
|
217 | + esc_html__( |
|
218 | + 'An error occurred while trying to retrieve the ticket IDs for the event.%sPlease click the back button on your browser and try again.', |
|
219 | + 'event_espresso' |
|
220 | + ), |
|
221 | + '<br/>' |
|
222 | + ) |
|
223 | + ); |
|
224 | + } |
|
225 | + // cycle thru values |
|
226 | + foreach ($ticket_ids as $key => $value) { |
|
227 | + // allow only integers |
|
228 | + $this->valid_data[ self::DATA_KEY_TICKET_ID ][ $key ] = absint($value); |
|
229 | + } |
|
230 | + } |
|
231 | 231 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | // do we have an event id? |
90 | 90 | if ($this->event_id === null) { |
91 | 91 | $this->event_id = $this->request->getRequestParam(self::INPUT_KEY_EVENT_ID, 0, 'int'); |
92 | - if (! $this->event_id) { |
|
92 | + if ( ! $this->event_id) { |
|
93 | 93 | // $_POST['tkt-slctr-event-id'] was not set ?!?!?!? |
94 | 94 | throw new DomainException( |
95 | 95 | sprintf( |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | public function validatePostData() |
115 | 115 | { |
116 | 116 | // grab valid id |
117 | - $this->valid_data[ self::DATA_KEY_EVENT_ID ] = $this->getEventId(); |
|
117 | + $this->valid_data[self::DATA_KEY_EVENT_ID] = $this->getEventId(); |
|
118 | 118 | // let's track the total number of tickets ordered.' |
119 | - $this->valid_data[ self:: DATA_KEY_TOTAL_TICKETS ] = 0; |
|
119 | + $this->valid_data[self:: DATA_KEY_TOTAL_TICKETS] = 0; |
|
120 | 120 | // cycle through $inputs_to_clean array |
121 | 121 | foreach ($this->inputs_to_clean as $what => $input_to_clean) { |
122 | 122 | $input_key = "{$input_to_clean}{$this->event_id}"; |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | protected function processInteger($what, $input_key) |
154 | 154 | { |
155 | - $this->valid_data[ $what ] = $this->request->getRequestParam($input_key, 0, 'int'); |
|
155 | + $this->valid_data[$what] = $this->request->getRequestParam($input_key, 0, 'int'); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | |
@@ -175,11 +175,11 @@ discard block |
||
175 | 175 | ) |
176 | 176 | ); |
177 | 177 | } |
178 | - foreach ($this->valid_data[ self::DATA_KEY_TICKET_ID ] as $ticket_id) { |
|
179 | - $qty = isset($row_qty[ $ticket_id ]) ? $row_qty[ $ticket_id ] : 0; |
|
178 | + foreach ($this->valid_data[self::DATA_KEY_TICKET_ID] as $ticket_id) { |
|
179 | + $qty = isset($row_qty[$ticket_id]) ? $row_qty[$ticket_id] : 0; |
|
180 | 180 | // sanitize as integers |
181 | - $this->valid_data[ self::DATA_KEY_QUANTITY ][] = $qty; |
|
182 | - $this->valid_data[ self:: DATA_KEY_TOTAL_TICKETS ] += $qty; |
|
181 | + $this->valid_data[self::DATA_KEY_QUANTITY][] = $qty; |
|
182 | + $this->valid_data[self:: DATA_KEY_TOTAL_TICKETS] += $qty; |
|
183 | 183 | } |
184 | 184 | } |
185 | 185 | |
@@ -197,9 +197,9 @@ discard block |
||
197 | 197 | $input_value = explode('#', $input_value); |
198 | 198 | $input_value = end($input_value); |
199 | 199 | // use event list url instead, but append anchor |
200 | - $input_value = EEH_Event_View::event_archive_url() . '#' . $input_value; |
|
200 | + $input_value = EEH_Event_View::event_archive_url().'#'.$input_value; |
|
201 | 201 | } |
202 | - $this->valid_data[ self::DATA_KEY_RETURN_URL ] = $input_value; |
|
202 | + $this->valid_data[self::DATA_KEY_RETURN_URL] = $input_value; |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | // cycle thru values |
226 | 226 | foreach ($ticket_ids as $key => $value) { |
227 | 227 | // allow only integers |
228 | - $this->valid_data[ self::DATA_KEY_TICKET_ID ][ $key ] = absint($value); |
|
228 | + $this->valid_data[self::DATA_KEY_TICKET_ID][$key] = absint($value); |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | } |
@@ -20,362 +20,362 @@ |
||
20 | 20 | class TicketSelectorRowStandard extends TicketSelectorRow |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * @var TicketDetails |
|
25 | - */ |
|
26 | - protected $ticket_details; |
|
27 | - |
|
28 | - /** |
|
29 | - * @var EE_Ticket_Selector_Config |
|
30 | - */ |
|
31 | - protected $template_settings; |
|
32 | - |
|
33 | - /** |
|
34 | - * @var EE_Tax_Config |
|
35 | - */ |
|
36 | - protected $tax_settings; |
|
37 | - |
|
38 | - /** |
|
39 | - * @var boolean |
|
40 | - */ |
|
41 | - protected $prices_displayed_including_taxes; |
|
42 | - |
|
43 | - /** |
|
44 | - * @var int |
|
45 | - */ |
|
46 | - protected $row; |
|
47 | - |
|
48 | - /** |
|
49 | - * @var int |
|
50 | - */ |
|
51 | - protected $cols; |
|
52 | - |
|
53 | - /** |
|
54 | - * @var boolean |
|
55 | - */ |
|
56 | - protected $hidden_input_qty; |
|
57 | - |
|
58 | - /** |
|
59 | - * @var string |
|
60 | - */ |
|
61 | - protected $ticket_datetime_classes; |
|
62 | - |
|
63 | - |
|
64 | - /** |
|
65 | - * TicketDetails constructor. |
|
66 | - * |
|
67 | - * @param TicketDetails $ticket_details |
|
68 | - * @param EE_Tax_Config $tax_settings |
|
69 | - * @param int $total_tickets |
|
70 | - * @param int $max_attendees |
|
71 | - * @param int $row |
|
72 | - * @param int $cols |
|
73 | - * @param boolean $required_ticket_sold_out |
|
74 | - * @param string $event_status |
|
75 | - * @param string $ticket_datetime_classes |
|
76 | - * @throws EE_Error |
|
77 | - * @throws UnexpectedEntityException |
|
78 | - */ |
|
79 | - public function __construct( |
|
80 | - TicketDetails $ticket_details, |
|
81 | - EE_Tax_Config $tax_settings, |
|
82 | - $total_tickets, |
|
83 | - $max_attendees, |
|
84 | - $row, |
|
85 | - $cols, |
|
86 | - $required_ticket_sold_out, |
|
87 | - $event_status, |
|
88 | - $ticket_datetime_classes |
|
89 | - ) { |
|
90 | - $this->ticket_details = $ticket_details; |
|
91 | - $this->template_settings = $ticket_details->getTemplateSettings(); |
|
92 | - $this->tax_settings = $tax_settings; |
|
93 | - $this->row = $row; |
|
94 | - $this->cols = $cols; |
|
95 | - $this->ticket_datetime_classes = $ticket_datetime_classes; |
|
96 | - parent::__construct( |
|
97 | - $ticket_details->getTicket(), |
|
98 | - $max_attendees, |
|
99 | - $ticket_details->getDateFormat(), |
|
100 | - $event_status, |
|
101 | - $required_ticket_sold_out, |
|
102 | - $total_tickets |
|
103 | - ); |
|
104 | - } |
|
105 | - |
|
106 | - |
|
107 | - /** |
|
108 | - * other ticket rows will need to know if a required ticket is sold out, |
|
109 | - * so that they are not offered for sale |
|
110 | - * |
|
111 | - * @return boolean |
|
112 | - */ |
|
113 | - public function getRequiredTicketSoldOut() |
|
114 | - { |
|
115 | - return $this->required_ticket_sold_out; |
|
116 | - } |
|
117 | - |
|
118 | - |
|
119 | - /** |
|
120 | - * @return int |
|
121 | - */ |
|
122 | - public function getCols() |
|
123 | - { |
|
124 | - return $this->cols; |
|
125 | - } |
|
126 | - |
|
127 | - |
|
128 | - /** |
|
129 | - * getHtml |
|
130 | - * |
|
131 | - * @return string |
|
132 | - * @throws EE_Error |
|
133 | - * @throws ReflectionException |
|
134 | - */ |
|
135 | - public function getHtml() |
|
136 | - { |
|
137 | - $this->min = 0; |
|
138 | - $this->max = $this->ticket->max(); |
|
139 | - $remaining = $this->ticket->remaining(); |
|
140 | - $this->setTicketMinAndMax($remaining); |
|
141 | - // set flag if ticket is required (flag is set to start date so that future tickets are not blocked) |
|
142 | - $this->required_ticket_sold_out = $this->ticket->required() && ! $remaining |
|
143 | - ? $this->ticket->start_date() |
|
144 | - : $this->required_ticket_sold_out; |
|
145 | - $this->setTicketPriceDetails(); |
|
146 | - $this->setTicketStatusClasses($remaining); |
|
147 | - $filtered_row_html = $this->getFilteredRowHtml(); |
|
148 | - if ($filtered_row_html !== false) { |
|
149 | - return $filtered_row_html; |
|
150 | - } |
|
151 | - $ticket_selector_row_html = EEH_HTML::tr( |
|
152 | - '', |
|
153 | - '', |
|
154 | - "tckt-slctr-tbl-tr {$this->status_class}{$this->ticket_datetime_classes} " |
|
155 | - . espresso_get_object_css_class($this->ticket) |
|
156 | - ); |
|
157 | - $filtered_row_content = $this->getFilteredRowContents(); |
|
158 | - if ($filtered_row_content !== false) { |
|
159 | - $this->hidden_input_qty = true; |
|
160 | - if ($this->max_attendees === 1) { |
|
161 | - return $ticket_selector_row_html |
|
162 | - . $filtered_row_content |
|
163 | - . $this->ticketQtyAndIdHiddenInputs() |
|
164 | - . EEH_HTML::trx(); |
|
165 | - } |
|
166 | - return $ticket_selector_row_html |
|
167 | - . $filtered_row_content |
|
168 | - . EEH_HTML::trx(); |
|
169 | - } |
|
170 | - $this->hidden_input_qty = $this->max_attendees > 1; |
|
171 | - |
|
172 | - $ticket_selector_row_html .= $this->ticketNameTableCell(); |
|
173 | - $ticket_selector_row_html .= $this->ticketPriceTableCell(); |
|
174 | - $ticket_selector_row_html .= EEH_HTML::td( |
|
175 | - '', |
|
176 | - '', |
|
177 | - 'tckt-slctr-tbl-td-qty cntr', |
|
178 | - '', |
|
179 | - 'headers="quantity-' . $this->EVT_ID . '"' |
|
180 | - ); |
|
181 | - $this->setTicketStatusDisplay($remaining); |
|
182 | - if (empty($this->ticket_status_display)) { |
|
183 | - if ($this->max_attendees === 1) { |
|
184 | - // only ONE attendee is allowed to register at a time |
|
185 | - $ticket_selector_row_html .= $this->onlyOneAttendeeCanRegister(); |
|
186 | - } elseif ($this->max > 0) { |
|
187 | - $ticket_selector_row_html .= $this->ticketQuantitySelector(); |
|
188 | - } |
|
189 | - } |
|
190 | - $ticket_selector_row_html .= $this->ticket_status_display; |
|
191 | - $ticket_selector_row_html .= $this->ticketQtyAndIdHiddenInputs(); |
|
192 | - $ticket_selector_row_html .= $this->ticket_details->display( |
|
193 | - $this->ticket_price, |
|
194 | - $remaining, |
|
195 | - $this->cols |
|
196 | - ); |
|
197 | - $ticket_selector_row_html .= EEH_HTML::tdx(); |
|
198 | - $ticket_selector_row_html .= EEH_HTML::trx(); |
|
199 | - |
|
200 | - |
|
201 | - $this->row++; |
|
202 | - return $ticket_selector_row_html; |
|
203 | - } |
|
204 | - |
|
205 | - |
|
206 | - /** |
|
207 | - * getTicketPriceDetails |
|
208 | - * |
|
209 | - * @return void |
|
210 | - * @throws EE_Error |
|
211 | - */ |
|
212 | - protected function setTicketPriceDetails() |
|
213 | - { |
|
214 | - $this->ticket_price = $this->tax_settings->prices_displayed_including_taxes |
|
215 | - ? $this->ticket->get_ticket_total_with_taxes() |
|
216 | - : $this->ticket->get_ticket_subtotal(); |
|
217 | - $this->ticket_bundle = false; |
|
218 | - $ticket_min = $this->ticket->min(); |
|
219 | - // for ticket bundles, set min and max qty the same |
|
220 | - if ($ticket_min !== 0 && $ticket_min === $this->ticket->max()) { |
|
221 | - $this->ticket_price *= $ticket_min; |
|
222 | - $this->ticket_bundle = true; |
|
223 | - } |
|
224 | - $this->ticket_price = apply_filters( |
|
225 | - 'FHEE__ticket_selector_chart_template__ticket_price', |
|
226 | - $this->ticket_price, |
|
227 | - $this->ticket |
|
228 | - ); |
|
229 | - } |
|
230 | - |
|
231 | - |
|
232 | - /** |
|
233 | - * ticketNameTableCell |
|
234 | - * |
|
235 | - * @return string |
|
236 | - * @throws EE_Error |
|
237 | - * @throws ReflectionException |
|
238 | - */ |
|
239 | - protected function ticketNameTableCell() |
|
240 | - { |
|
241 | - $html = EEH_HTML::td( |
|
242 | - '', |
|
243 | - '', |
|
244 | - 'tckt-slctr-tbl-td-name', |
|
245 | - '', |
|
246 | - 'headers="details-' . $this->EVT_ID . '"' |
|
247 | - ); |
|
248 | - $html .= EEH_HTML::strong($this->ticket->get_pretty('TKT_name')); |
|
249 | - $html .= $this->ticket_details->getShowHideLinks(); |
|
250 | - if ($this->ticket->required()) { |
|
251 | - $html .= EEH_HTML::p( |
|
252 | - apply_filters( |
|
253 | - 'FHEE__ticket_selector_chart_template__ticket_required_message', |
|
254 | - esc_html__('This ticket is required and must be purchased.', 'event_espresso') |
|
255 | - ), |
|
256 | - '', |
|
257 | - 'ticket-required-pg' |
|
258 | - ); |
|
259 | - } |
|
260 | - $html .= EEH_HTML::tdx(); |
|
261 | - return $html; |
|
262 | - } |
|
263 | - |
|
264 | - |
|
265 | - /** |
|
266 | - * ticketPriceTableCell |
|
267 | - * |
|
268 | - * @return string |
|
269 | - * @throws EE_Error |
|
270 | - */ |
|
271 | - protected function ticketPriceTableCell() |
|
272 | - { |
|
273 | - $html = ''; |
|
274 | - if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) { |
|
275 | - $html .= EEH_HTML::td( |
|
276 | - '', |
|
277 | - '', |
|
278 | - 'tckt-slctr-tbl-td-price jst-rght', |
|
279 | - '', |
|
280 | - 'headers="price-' . $this->EVT_ID . '"' |
|
281 | - ); |
|
282 | - $html .= EEH_Template::format_currency($this->ticket_price); |
|
283 | - $html .= $this->ticket->taxable() |
|
284 | - ? EEH_HTML::span('*', '', 'taxable-tickets-asterisk grey-text') |
|
285 | - : ''; |
|
286 | - $html .= ' '; |
|
287 | - // phpcs:disable WordPress.WP.I18n.NoEmptyStrings |
|
288 | - $html .= EEH_HTML::span( |
|
289 | - $this->ticket_bundle |
|
290 | - ? apply_filters( |
|
291 | - 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', |
|
292 | - esc_html__(' / bundle', 'event_espresso') |
|
293 | - ) |
|
294 | - : apply_filters( |
|
295 | - 'FHEE__ticket_selector_chart_template__per_ticket_text', |
|
296 | - esc_html__('', 'event_espresso') |
|
297 | - ), |
|
298 | - '', |
|
299 | - 'smaller-text no-bold' |
|
300 | - ); |
|
301 | - $html .= ' '; |
|
302 | - $html .= EEH_HTML::tdx(); |
|
303 | - $this->cols++; |
|
304 | - } |
|
305 | - return $html; |
|
306 | - } |
|
307 | - |
|
308 | - |
|
309 | - /** |
|
310 | - * onlyOneAttendeeCanRegister |
|
311 | - * |
|
312 | - * @return string |
|
313 | - * @throws EE_Error |
|
314 | - */ |
|
315 | - protected function onlyOneAttendeeCanRegister() |
|
316 | - { |
|
317 | - // display submit button since we have tickets available |
|
318 | - add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
319 | - $this->hidden_input_qty = false; |
|
320 | - $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row; |
|
321 | - $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">'; |
|
322 | - $html .= esc_html__('Select this ticket', 'event_espresso') . '</label>'; |
|
323 | - $html .= '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '[' . $this->ticket->ID() . ']"'; |
|
324 | - $html .= ' id="' . $id . '"'; |
|
325 | - $html .= ' class="ticket-selector-tbl-qty-slct" value="1"'; |
|
326 | - $html .= $this->total_tickets === 1 ? ' checked="checked"' : ''; |
|
327 | - $html .= ' title=""/>'; |
|
328 | - return $html; |
|
329 | - } |
|
330 | - |
|
331 | - |
|
332 | - /** |
|
333 | - * ticketQuantitySelector |
|
334 | - * |
|
335 | - * @return string |
|
336 | - * @throws EE_Error |
|
337 | - */ |
|
338 | - protected function ticketQuantitySelector() |
|
339 | - { |
|
340 | - // display submit button since we have tickets available |
|
341 | - add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
342 | - $this->hidden_input_qty = false; |
|
343 | - $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row; |
|
344 | - $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">'; |
|
345 | - $html .= esc_html__('Quantity', 'event_espresso') . '</label>'; |
|
346 | - $html .= '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[' . $this->ticket->ID() . ']"'; |
|
347 | - $html .= ' id="' . $id . '"'; |
|
348 | - $html .= ' class="ticket-selector-tbl-qty-slct">'; |
|
349 | - // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
|
350 | - if ($this->min !== 0 && ! $this->ticket->required()) { |
|
351 | - $html .= '<option value="0"> 0 </option>'; |
|
352 | - } |
|
353 | - // offer ticket quantities from the min to the max |
|
354 | - for ($i = $this->min; $i <= $this->max; $i++) { |
|
355 | - $html .= '<option value="' . $i . '"> ' . $i . ' </option>'; |
|
356 | - } |
|
357 | - $html .= '</select>'; |
|
358 | - return $html; |
|
359 | - } |
|
360 | - |
|
361 | - |
|
362 | - /** |
|
363 | - * getHiddenInputs |
|
364 | - * |
|
365 | - * @return string |
|
366 | - * @throws EE_Error |
|
367 | - */ |
|
368 | - protected function ticketQtyAndIdHiddenInputs() |
|
369 | - { |
|
370 | - $html = ''; |
|
371 | - // depending on group reg we need to change the format for qty |
|
372 | - if ($this->hidden_input_qty) { |
|
373 | - $html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[' |
|
374 | - . $this->ticket->ID() |
|
375 | - . ']" value="0"/>'; |
|
376 | - } |
|
377 | - $html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"'; |
|
378 | - $html .= ' value="' . $this->ticket->ID() . '"/>'; |
|
379 | - return $html; |
|
380 | - } |
|
23 | + /** |
|
24 | + * @var TicketDetails |
|
25 | + */ |
|
26 | + protected $ticket_details; |
|
27 | + |
|
28 | + /** |
|
29 | + * @var EE_Ticket_Selector_Config |
|
30 | + */ |
|
31 | + protected $template_settings; |
|
32 | + |
|
33 | + /** |
|
34 | + * @var EE_Tax_Config |
|
35 | + */ |
|
36 | + protected $tax_settings; |
|
37 | + |
|
38 | + /** |
|
39 | + * @var boolean |
|
40 | + */ |
|
41 | + protected $prices_displayed_including_taxes; |
|
42 | + |
|
43 | + /** |
|
44 | + * @var int |
|
45 | + */ |
|
46 | + protected $row; |
|
47 | + |
|
48 | + /** |
|
49 | + * @var int |
|
50 | + */ |
|
51 | + protected $cols; |
|
52 | + |
|
53 | + /** |
|
54 | + * @var boolean |
|
55 | + */ |
|
56 | + protected $hidden_input_qty; |
|
57 | + |
|
58 | + /** |
|
59 | + * @var string |
|
60 | + */ |
|
61 | + protected $ticket_datetime_classes; |
|
62 | + |
|
63 | + |
|
64 | + /** |
|
65 | + * TicketDetails constructor. |
|
66 | + * |
|
67 | + * @param TicketDetails $ticket_details |
|
68 | + * @param EE_Tax_Config $tax_settings |
|
69 | + * @param int $total_tickets |
|
70 | + * @param int $max_attendees |
|
71 | + * @param int $row |
|
72 | + * @param int $cols |
|
73 | + * @param boolean $required_ticket_sold_out |
|
74 | + * @param string $event_status |
|
75 | + * @param string $ticket_datetime_classes |
|
76 | + * @throws EE_Error |
|
77 | + * @throws UnexpectedEntityException |
|
78 | + */ |
|
79 | + public function __construct( |
|
80 | + TicketDetails $ticket_details, |
|
81 | + EE_Tax_Config $tax_settings, |
|
82 | + $total_tickets, |
|
83 | + $max_attendees, |
|
84 | + $row, |
|
85 | + $cols, |
|
86 | + $required_ticket_sold_out, |
|
87 | + $event_status, |
|
88 | + $ticket_datetime_classes |
|
89 | + ) { |
|
90 | + $this->ticket_details = $ticket_details; |
|
91 | + $this->template_settings = $ticket_details->getTemplateSettings(); |
|
92 | + $this->tax_settings = $tax_settings; |
|
93 | + $this->row = $row; |
|
94 | + $this->cols = $cols; |
|
95 | + $this->ticket_datetime_classes = $ticket_datetime_classes; |
|
96 | + parent::__construct( |
|
97 | + $ticket_details->getTicket(), |
|
98 | + $max_attendees, |
|
99 | + $ticket_details->getDateFormat(), |
|
100 | + $event_status, |
|
101 | + $required_ticket_sold_out, |
|
102 | + $total_tickets |
|
103 | + ); |
|
104 | + } |
|
105 | + |
|
106 | + |
|
107 | + /** |
|
108 | + * other ticket rows will need to know if a required ticket is sold out, |
|
109 | + * so that they are not offered for sale |
|
110 | + * |
|
111 | + * @return boolean |
|
112 | + */ |
|
113 | + public function getRequiredTicketSoldOut() |
|
114 | + { |
|
115 | + return $this->required_ticket_sold_out; |
|
116 | + } |
|
117 | + |
|
118 | + |
|
119 | + /** |
|
120 | + * @return int |
|
121 | + */ |
|
122 | + public function getCols() |
|
123 | + { |
|
124 | + return $this->cols; |
|
125 | + } |
|
126 | + |
|
127 | + |
|
128 | + /** |
|
129 | + * getHtml |
|
130 | + * |
|
131 | + * @return string |
|
132 | + * @throws EE_Error |
|
133 | + * @throws ReflectionException |
|
134 | + */ |
|
135 | + public function getHtml() |
|
136 | + { |
|
137 | + $this->min = 0; |
|
138 | + $this->max = $this->ticket->max(); |
|
139 | + $remaining = $this->ticket->remaining(); |
|
140 | + $this->setTicketMinAndMax($remaining); |
|
141 | + // set flag if ticket is required (flag is set to start date so that future tickets are not blocked) |
|
142 | + $this->required_ticket_sold_out = $this->ticket->required() && ! $remaining |
|
143 | + ? $this->ticket->start_date() |
|
144 | + : $this->required_ticket_sold_out; |
|
145 | + $this->setTicketPriceDetails(); |
|
146 | + $this->setTicketStatusClasses($remaining); |
|
147 | + $filtered_row_html = $this->getFilteredRowHtml(); |
|
148 | + if ($filtered_row_html !== false) { |
|
149 | + return $filtered_row_html; |
|
150 | + } |
|
151 | + $ticket_selector_row_html = EEH_HTML::tr( |
|
152 | + '', |
|
153 | + '', |
|
154 | + "tckt-slctr-tbl-tr {$this->status_class}{$this->ticket_datetime_classes} " |
|
155 | + . espresso_get_object_css_class($this->ticket) |
|
156 | + ); |
|
157 | + $filtered_row_content = $this->getFilteredRowContents(); |
|
158 | + if ($filtered_row_content !== false) { |
|
159 | + $this->hidden_input_qty = true; |
|
160 | + if ($this->max_attendees === 1) { |
|
161 | + return $ticket_selector_row_html |
|
162 | + . $filtered_row_content |
|
163 | + . $this->ticketQtyAndIdHiddenInputs() |
|
164 | + . EEH_HTML::trx(); |
|
165 | + } |
|
166 | + return $ticket_selector_row_html |
|
167 | + . $filtered_row_content |
|
168 | + . EEH_HTML::trx(); |
|
169 | + } |
|
170 | + $this->hidden_input_qty = $this->max_attendees > 1; |
|
171 | + |
|
172 | + $ticket_selector_row_html .= $this->ticketNameTableCell(); |
|
173 | + $ticket_selector_row_html .= $this->ticketPriceTableCell(); |
|
174 | + $ticket_selector_row_html .= EEH_HTML::td( |
|
175 | + '', |
|
176 | + '', |
|
177 | + 'tckt-slctr-tbl-td-qty cntr', |
|
178 | + '', |
|
179 | + 'headers="quantity-' . $this->EVT_ID . '"' |
|
180 | + ); |
|
181 | + $this->setTicketStatusDisplay($remaining); |
|
182 | + if (empty($this->ticket_status_display)) { |
|
183 | + if ($this->max_attendees === 1) { |
|
184 | + // only ONE attendee is allowed to register at a time |
|
185 | + $ticket_selector_row_html .= $this->onlyOneAttendeeCanRegister(); |
|
186 | + } elseif ($this->max > 0) { |
|
187 | + $ticket_selector_row_html .= $this->ticketQuantitySelector(); |
|
188 | + } |
|
189 | + } |
|
190 | + $ticket_selector_row_html .= $this->ticket_status_display; |
|
191 | + $ticket_selector_row_html .= $this->ticketQtyAndIdHiddenInputs(); |
|
192 | + $ticket_selector_row_html .= $this->ticket_details->display( |
|
193 | + $this->ticket_price, |
|
194 | + $remaining, |
|
195 | + $this->cols |
|
196 | + ); |
|
197 | + $ticket_selector_row_html .= EEH_HTML::tdx(); |
|
198 | + $ticket_selector_row_html .= EEH_HTML::trx(); |
|
199 | + |
|
200 | + |
|
201 | + $this->row++; |
|
202 | + return $ticket_selector_row_html; |
|
203 | + } |
|
204 | + |
|
205 | + |
|
206 | + /** |
|
207 | + * getTicketPriceDetails |
|
208 | + * |
|
209 | + * @return void |
|
210 | + * @throws EE_Error |
|
211 | + */ |
|
212 | + protected function setTicketPriceDetails() |
|
213 | + { |
|
214 | + $this->ticket_price = $this->tax_settings->prices_displayed_including_taxes |
|
215 | + ? $this->ticket->get_ticket_total_with_taxes() |
|
216 | + : $this->ticket->get_ticket_subtotal(); |
|
217 | + $this->ticket_bundle = false; |
|
218 | + $ticket_min = $this->ticket->min(); |
|
219 | + // for ticket bundles, set min and max qty the same |
|
220 | + if ($ticket_min !== 0 && $ticket_min === $this->ticket->max()) { |
|
221 | + $this->ticket_price *= $ticket_min; |
|
222 | + $this->ticket_bundle = true; |
|
223 | + } |
|
224 | + $this->ticket_price = apply_filters( |
|
225 | + 'FHEE__ticket_selector_chart_template__ticket_price', |
|
226 | + $this->ticket_price, |
|
227 | + $this->ticket |
|
228 | + ); |
|
229 | + } |
|
230 | + |
|
231 | + |
|
232 | + /** |
|
233 | + * ticketNameTableCell |
|
234 | + * |
|
235 | + * @return string |
|
236 | + * @throws EE_Error |
|
237 | + * @throws ReflectionException |
|
238 | + */ |
|
239 | + protected function ticketNameTableCell() |
|
240 | + { |
|
241 | + $html = EEH_HTML::td( |
|
242 | + '', |
|
243 | + '', |
|
244 | + 'tckt-slctr-tbl-td-name', |
|
245 | + '', |
|
246 | + 'headers="details-' . $this->EVT_ID . '"' |
|
247 | + ); |
|
248 | + $html .= EEH_HTML::strong($this->ticket->get_pretty('TKT_name')); |
|
249 | + $html .= $this->ticket_details->getShowHideLinks(); |
|
250 | + if ($this->ticket->required()) { |
|
251 | + $html .= EEH_HTML::p( |
|
252 | + apply_filters( |
|
253 | + 'FHEE__ticket_selector_chart_template__ticket_required_message', |
|
254 | + esc_html__('This ticket is required and must be purchased.', 'event_espresso') |
|
255 | + ), |
|
256 | + '', |
|
257 | + 'ticket-required-pg' |
|
258 | + ); |
|
259 | + } |
|
260 | + $html .= EEH_HTML::tdx(); |
|
261 | + return $html; |
|
262 | + } |
|
263 | + |
|
264 | + |
|
265 | + /** |
|
266 | + * ticketPriceTableCell |
|
267 | + * |
|
268 | + * @return string |
|
269 | + * @throws EE_Error |
|
270 | + */ |
|
271 | + protected function ticketPriceTableCell() |
|
272 | + { |
|
273 | + $html = ''; |
|
274 | + if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) { |
|
275 | + $html .= EEH_HTML::td( |
|
276 | + '', |
|
277 | + '', |
|
278 | + 'tckt-slctr-tbl-td-price jst-rght', |
|
279 | + '', |
|
280 | + 'headers="price-' . $this->EVT_ID . '"' |
|
281 | + ); |
|
282 | + $html .= EEH_Template::format_currency($this->ticket_price); |
|
283 | + $html .= $this->ticket->taxable() |
|
284 | + ? EEH_HTML::span('*', '', 'taxable-tickets-asterisk grey-text') |
|
285 | + : ''; |
|
286 | + $html .= ' '; |
|
287 | + // phpcs:disable WordPress.WP.I18n.NoEmptyStrings |
|
288 | + $html .= EEH_HTML::span( |
|
289 | + $this->ticket_bundle |
|
290 | + ? apply_filters( |
|
291 | + 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', |
|
292 | + esc_html__(' / bundle', 'event_espresso') |
|
293 | + ) |
|
294 | + : apply_filters( |
|
295 | + 'FHEE__ticket_selector_chart_template__per_ticket_text', |
|
296 | + esc_html__('', 'event_espresso') |
|
297 | + ), |
|
298 | + '', |
|
299 | + 'smaller-text no-bold' |
|
300 | + ); |
|
301 | + $html .= ' '; |
|
302 | + $html .= EEH_HTML::tdx(); |
|
303 | + $this->cols++; |
|
304 | + } |
|
305 | + return $html; |
|
306 | + } |
|
307 | + |
|
308 | + |
|
309 | + /** |
|
310 | + * onlyOneAttendeeCanRegister |
|
311 | + * |
|
312 | + * @return string |
|
313 | + * @throws EE_Error |
|
314 | + */ |
|
315 | + protected function onlyOneAttendeeCanRegister() |
|
316 | + { |
|
317 | + // display submit button since we have tickets available |
|
318 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
319 | + $this->hidden_input_qty = false; |
|
320 | + $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row; |
|
321 | + $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">'; |
|
322 | + $html .= esc_html__('Select this ticket', 'event_espresso') . '</label>'; |
|
323 | + $html .= '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '[' . $this->ticket->ID() . ']"'; |
|
324 | + $html .= ' id="' . $id . '"'; |
|
325 | + $html .= ' class="ticket-selector-tbl-qty-slct" value="1"'; |
|
326 | + $html .= $this->total_tickets === 1 ? ' checked="checked"' : ''; |
|
327 | + $html .= ' title=""/>'; |
|
328 | + return $html; |
|
329 | + } |
|
330 | + |
|
331 | + |
|
332 | + /** |
|
333 | + * ticketQuantitySelector |
|
334 | + * |
|
335 | + * @return string |
|
336 | + * @throws EE_Error |
|
337 | + */ |
|
338 | + protected function ticketQuantitySelector() |
|
339 | + { |
|
340 | + // display submit button since we have tickets available |
|
341 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
342 | + $this->hidden_input_qty = false; |
|
343 | + $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row; |
|
344 | + $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">'; |
|
345 | + $html .= esc_html__('Quantity', 'event_espresso') . '</label>'; |
|
346 | + $html .= '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[' . $this->ticket->ID() . ']"'; |
|
347 | + $html .= ' id="' . $id . '"'; |
|
348 | + $html .= ' class="ticket-selector-tbl-qty-slct">'; |
|
349 | + // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
|
350 | + if ($this->min !== 0 && ! $this->ticket->required()) { |
|
351 | + $html .= '<option value="0"> 0 </option>'; |
|
352 | + } |
|
353 | + // offer ticket quantities from the min to the max |
|
354 | + for ($i = $this->min; $i <= $this->max; $i++) { |
|
355 | + $html .= '<option value="' . $i . '"> ' . $i . ' </option>'; |
|
356 | + } |
|
357 | + $html .= '</select>'; |
|
358 | + return $html; |
|
359 | + } |
|
360 | + |
|
361 | + |
|
362 | + /** |
|
363 | + * getHiddenInputs |
|
364 | + * |
|
365 | + * @return string |
|
366 | + * @throws EE_Error |
|
367 | + */ |
|
368 | + protected function ticketQtyAndIdHiddenInputs() |
|
369 | + { |
|
370 | + $html = ''; |
|
371 | + // depending on group reg we need to change the format for qty |
|
372 | + if ($this->hidden_input_qty) { |
|
373 | + $html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[' |
|
374 | + . $this->ticket->ID() |
|
375 | + . ']" value="0"/>'; |
|
376 | + } |
|
377 | + $html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"'; |
|
378 | + $html .= ' value="' . $this->ticket->ID() . '"/>'; |
|
379 | + return $html; |
|
380 | + } |
|
381 | 381 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | '', |
177 | 177 | 'tckt-slctr-tbl-td-qty cntr', |
178 | 178 | '', |
179 | - 'headers="quantity-' . $this->EVT_ID . '"' |
|
179 | + 'headers="quantity-'.$this->EVT_ID.'"' |
|
180 | 180 | ); |
181 | 181 | $this->setTicketStatusDisplay($remaining); |
182 | 182 | if (empty($this->ticket_status_display)) { |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | '', |
244 | 244 | 'tckt-slctr-tbl-td-name', |
245 | 245 | '', |
246 | - 'headers="details-' . $this->EVT_ID . '"' |
|
246 | + 'headers="details-'.$this->EVT_ID.'"' |
|
247 | 247 | ); |
248 | 248 | $html .= EEH_HTML::strong($this->ticket->get_pretty('TKT_name')); |
249 | 249 | $html .= $this->ticket_details->getShowHideLinks(); |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | '', |
278 | 278 | 'tckt-slctr-tbl-td-price jst-rght', |
279 | 279 | '', |
280 | - 'headers="price-' . $this->EVT_ID . '"' |
|
280 | + 'headers="price-'.$this->EVT_ID.'"' |
|
281 | 281 | ); |
282 | 282 | $html .= EEH_Template::format_currency($this->ticket_price); |
283 | 283 | $html .= $this->ticket->taxable() |
@@ -317,11 +317,11 @@ discard block |
||
317 | 317 | // display submit button since we have tickets available |
318 | 318 | add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
319 | 319 | $this->hidden_input_qty = false; |
320 | - $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row; |
|
321 | - $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">'; |
|
322 | - $html .= esc_html__('Select this ticket', 'event_espresso') . '</label>'; |
|
323 | - $html .= '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '[' . $this->ticket->ID() . ']"'; |
|
324 | - $html .= ' id="' . $id . '"'; |
|
320 | + $id = 'ticket-selector-tbl-qty-slct-'.$this->EVT_ID.'-'.$this->row; |
|
321 | + $html = '<label class="ee-a11y-screen-reader-text" for="'.$id.'">'; |
|
322 | + $html .= esc_html__('Select this ticket', 'event_espresso').'</label>'; |
|
323 | + $html .= '<input type="radio" name="tkt-slctr-qty-'.$this->EVT_ID.'['.$this->ticket->ID().']"'; |
|
324 | + $html .= ' id="'.$id.'"'; |
|
325 | 325 | $html .= ' class="ticket-selector-tbl-qty-slct" value="1"'; |
326 | 326 | $html .= $this->total_tickets === 1 ? ' checked="checked"' : ''; |
327 | 327 | $html .= ' title=""/>'; |
@@ -340,11 +340,11 @@ discard block |
||
340 | 340 | // display submit button since we have tickets available |
341 | 341 | add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
342 | 342 | $this->hidden_input_qty = false; |
343 | - $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row; |
|
344 | - $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">'; |
|
345 | - $html .= esc_html__('Quantity', 'event_espresso') . '</label>'; |
|
346 | - $html .= '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[' . $this->ticket->ID() . ']"'; |
|
347 | - $html .= ' id="' . $id . '"'; |
|
343 | + $id = 'ticket-selector-tbl-qty-slct-'.$this->EVT_ID.'-'.$this->row; |
|
344 | + $html = '<label class="ee-a11y-screen-reader-text" for="'.$id.'">'; |
|
345 | + $html .= esc_html__('Quantity', 'event_espresso').'</label>'; |
|
346 | + $html .= '<select name="tkt-slctr-qty-'.$this->EVT_ID.'['.$this->ticket->ID().']"'; |
|
347 | + $html .= ' id="'.$id.'"'; |
|
348 | 348 | $html .= ' class="ticket-selector-tbl-qty-slct">'; |
349 | 349 | // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
350 | 350 | if ($this->min !== 0 && ! $this->ticket->required()) { |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | } |
353 | 353 | // offer ticket quantities from the min to the max |
354 | 354 | for ($i = $this->min; $i <= $this->max; $i++) { |
355 | - $html .= '<option value="' . $i . '"> ' . $i . ' </option>'; |
|
355 | + $html .= '<option value="'.$i.'"> '.$i.' </option>'; |
|
356 | 356 | } |
357 | 357 | $html .= '</select>'; |
358 | 358 | return $html; |
@@ -370,12 +370,12 @@ discard block |
||
370 | 370 | $html = ''; |
371 | 371 | // depending on group reg we need to change the format for qty |
372 | 372 | if ($this->hidden_input_qty) { |
373 | - $html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[' |
|
373 | + $html .= '<input type="hidden" name="tkt-slctr-qty-'.$this->EVT_ID.'[' |
|
374 | 374 | . $this->ticket->ID() |
375 | 375 | . ']" value="0"/>'; |
376 | 376 | } |
377 | - $html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"'; |
|
378 | - $html .= ' value="' . $this->ticket->ID() . '"/>'; |
|
377 | + $html .= '<input type="hidden" name="tkt-slctr-ticket-id-'.$this->EVT_ID.'[]"'; |
|
378 | + $html .= ' value="'.$this->ticket->ID().'"/>'; |
|
379 | 379 | return $html; |
380 | 380 | } |
381 | 381 | } |