@@ -15,1045 +15,1045 @@ |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | |
18 | - /** |
|
19 | - * @var Registrations_Admin_Page |
|
20 | - */ |
|
21 | - protected $_admin_page; |
|
22 | - |
|
23 | - /** |
|
24 | - * @var array |
|
25 | - */ |
|
26 | - private $_status; |
|
27 | - |
|
28 | - /** |
|
29 | - * An array of transaction details for the related transaction to the registration being processed. |
|
30 | - * This is set via the _set_related_details method. |
|
31 | - * |
|
32 | - * @var array |
|
33 | - */ |
|
34 | - protected $_transaction_details = []; |
|
35 | - |
|
36 | - /** |
|
37 | - * An array of event details for the related event to the registration being processed. |
|
38 | - * This is set via the _set_related_details method. |
|
39 | - * |
|
40 | - * @var array |
|
41 | - */ |
|
42 | - protected $_event_details = []; |
|
43 | - |
|
44 | - |
|
45 | - /** |
|
46 | - * @param Registrations_Admin_Page $admin_page |
|
47 | - */ |
|
48 | - public function __construct(Registrations_Admin_Page $admin_page) |
|
49 | - { |
|
50 | - $req_data = $admin_page->get_request_data(); |
|
51 | - if (! empty($req_data['event_id'])) { |
|
52 | - $extra_query_args = []; |
|
53 | - foreach ($admin_page->get_views() as $view_details) { |
|
54 | - $extra_query_args[ $view_details['slug'] ] = ['event_id' => $req_data['event_id']]; |
|
55 | - } |
|
56 | - $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args); |
|
57 | - } |
|
58 | - parent::__construct($admin_page); |
|
59 | - $this->_status = $this->_admin_page->get_registration_status_array(); |
|
60 | - } |
|
61 | - |
|
62 | - |
|
63 | - /** |
|
64 | - * @return void |
|
65 | - * @throws EE_Error |
|
66 | - */ |
|
67 | - protected function _setup_data() |
|
68 | - { |
|
69 | - $this->_data = $this->_admin_page->get_registrations($this->_per_page); |
|
70 | - $this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, true); |
|
71 | - } |
|
72 | - |
|
73 | - |
|
74 | - /** |
|
75 | - * @return void |
|
76 | - */ |
|
77 | - protected function _set_properties() |
|
78 | - { |
|
79 | - $return_url = $this->getReturnUrl(); |
|
80 | - $this->_wp_list_args = [ |
|
81 | - 'singular' => esc_html__('registration', 'event_espresso'), |
|
82 | - 'plural' => esc_html__('registrations', 'event_espresso'), |
|
83 | - 'ajax' => true, |
|
84 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
85 | - ]; |
|
86 | - $ID_column_name = esc_html__('ID', 'event_espresso'); |
|
87 | - $ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">'; |
|
88 | - $ID_column_name .= esc_html__('Registrant Name', 'event_espresso'); |
|
89 | - $ID_column_name .= '</span> '; |
|
90 | - $req_data = $this->_admin_page->get_request_data(); |
|
91 | - if (isset($req_data['event_id'])) { |
|
92 | - $this->_columns = [ |
|
93 | - 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
94 | - '_REG_ID' => $ID_column_name, |
|
95 | - 'ATT_fname' => esc_html__('Name', 'event_espresso'), |
|
96 | - 'ATT_email' => esc_html__('Email', 'event_espresso'), |
|
97 | - '_REG_date' => esc_html__('Reg Date', 'event_espresso'), |
|
98 | - 'PRC_amount' => esc_html__('TKT Price', 'event_espresso'), |
|
99 | - '_REG_final_price' => esc_html__('Final Price', 'event_espresso'), |
|
100 | - 'TXN_total' => esc_html__('Total Txn', 'event_espresso'), |
|
101 | - 'TXN_paid' => esc_html__('Paid', 'event_espresso'), |
|
102 | - 'actions' => esc_html__('Actions', 'event_espresso'), |
|
103 | - ]; |
|
104 | - $route_details = [ |
|
105 | - 'route' => 'registrations_report', |
|
106 | - 'extra_request' => [ |
|
107 | - 'EVT_ID' => $this->_req_data['event_id'], |
|
108 | - 'return_url' => $return_url, |
|
109 | - ] |
|
110 | - ]; |
|
111 | - if (isset($req_data['datetime_id']) && $req_data['datetime_id']) { |
|
112 | - $route_details['extra_request']['DTT_ID'] = $req_data['datetime_id']; |
|
113 | - $this->_bottom_buttons['report_datetime'] = $route_details; |
|
114 | - } else { |
|
115 | - $this->_bottom_buttons['report'] = $route_details; |
|
116 | - } |
|
117 | - } else { |
|
118 | - $this->_columns = [ |
|
119 | - 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
120 | - '_REG_ID' => $ID_column_name, |
|
121 | - 'ATT_fname' => esc_html__('Name', 'event_espresso'), |
|
122 | - '_REG_date' => esc_html__('TXN Date', 'event_espresso'), |
|
123 | - 'event_name' => esc_html__('Event', 'event_espresso'), |
|
124 | - 'DTT_EVT_start' => esc_html__('Event Date', 'event_espresso'), |
|
125 | - '_REG_final_price' => esc_html__('Price', 'event_espresso'), |
|
126 | - '_REG_paid' => esc_html__('Paid', 'event_espresso'), |
|
127 | - 'actions' => esc_html__('Actions', 'event_espresso'), |
|
128 | - ]; |
|
129 | - $this->_bottom_buttons = [ |
|
130 | - 'report_all' => [ |
|
131 | - 'route' => 'registrations_report', |
|
132 | - 'extra_request' => [ |
|
133 | - 'return_url' => $return_url, |
|
134 | - ], |
|
135 | - ], |
|
136 | - ]; |
|
137 | - } |
|
138 | - $this->_primary_column = '_REG_ID'; |
|
139 | - $this->_sortable_columns = [ |
|
140 | - '_REG_date' => ['_REG_date' => true], // true means its already sorted |
|
141 | - /** |
|
142 | - * Allows users to change the default sort if they wish. |
|
143 | - * Returning a falsey on this filter will result in the default sort to be by firstname rather than last |
|
144 | - * name. |
|
145 | - */ |
|
146 | - 'ATT_fname' => [ |
|
147 | - 'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name', |
|
148 | - true, |
|
149 | - $this, |
|
150 | - ] |
|
151 | - ? ['ATT_lname' => false] |
|
152 | - : ['ATT_fname' => false], |
|
153 | - 'event_name' => ['event_name' => false], |
|
154 | - 'DTT_EVT_start' => ['DTT_EVT_start' => false], |
|
155 | - '_REG_ID' => ['_REG_ID' => false], |
|
156 | - ]; |
|
157 | - $this->_hidden_columns = []; |
|
158 | - } |
|
159 | - |
|
160 | - |
|
161 | - /** |
|
162 | - * This simply sets up the row class for the table rows. |
|
163 | - * Allows for easier overriding of child methods for setting up sorting. |
|
164 | - * |
|
165 | - * @param EE_Registration $item the current item |
|
166 | - * @return string |
|
167 | - */ |
|
168 | - protected function _get_row_class($item) |
|
169 | - { |
|
170 | - $class = parent::_get_row_class($item); |
|
171 | - // add status class |
|
172 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
173 | - if ($this->_has_checkbox_column) { |
|
174 | - $class .= ' has-checkbox-column'; |
|
175 | - } |
|
176 | - return $class; |
|
177 | - } |
|
178 | - |
|
179 | - |
|
180 | - /** |
|
181 | - * Set the $_transaction_details property if not set yet. |
|
182 | - * |
|
183 | - * @param EE_Registration $registration |
|
184 | - * @throws EE_Error |
|
185 | - * @throws InvalidArgumentException |
|
186 | - * @throws ReflectionException |
|
187 | - * @throws InvalidDataTypeException |
|
188 | - * @throws InvalidInterfaceException |
|
189 | - */ |
|
190 | - protected function _set_related_details(EE_Registration $registration) |
|
191 | - { |
|
192 | - $transaction = $registration->get_first_related('Transaction'); |
|
193 | - $status = $transaction instanceof EE_Transaction |
|
194 | - ? $transaction->status_ID() |
|
195 | - : EEM_Transaction::failed_status_code; |
|
196 | - $this->_transaction_details = [ |
|
197 | - 'transaction' => $transaction, |
|
198 | - 'status' => $status, |
|
199 | - 'id' => $transaction instanceof EE_Transaction |
|
200 | - ? $transaction->ID() |
|
201 | - : 0, |
|
202 | - 'title_attr' => sprintf( |
|
203 | - esc_html__('View Transaction Details (%s)', 'event_espresso'), |
|
204 | - EEH_Template::pretty_status($status, false, 'sentence') |
|
205 | - ), |
|
206 | - ]; |
|
207 | - try { |
|
208 | - $event = $registration->event(); |
|
209 | - } catch (EntityNotFoundException $e) { |
|
210 | - $event = null; |
|
211 | - } |
|
212 | - $status = $event instanceof EE_Event |
|
213 | - ? $event->get_active_status() |
|
214 | - : EE_Datetime::inactive; |
|
215 | - $this->_event_details = [ |
|
216 | - 'event' => $event, |
|
217 | - 'status' => $status, |
|
218 | - 'id' => $event instanceof EE_Event |
|
219 | - ? $event->ID() |
|
220 | - : 0, |
|
221 | - 'title_attr' => sprintf( |
|
222 | - esc_html__('Edit Event (%s)', 'event_espresso'), |
|
223 | - EEH_Template::pretty_status($status, false, 'sentence') |
|
224 | - ), |
|
225 | - ]; |
|
226 | - } |
|
227 | - |
|
228 | - |
|
229 | - /** |
|
230 | - * _get_table_filters |
|
231 | - * |
|
232 | - * @return array |
|
233 | - */ |
|
234 | - protected function _get_table_filters() |
|
235 | - { |
|
236 | - $filters = []; |
|
237 | - // todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as |
|
238 | - // methods. |
|
239 | - $cur_date = isset($this->_req_data['month_range']) |
|
240 | - ? $this->_req_data['month_range'] |
|
241 | - : ''; |
|
242 | - $cur_category = isset($this->_req_data['EVT_CAT']) |
|
243 | - ? $this->_req_data['EVT_CAT'] |
|
244 | - : -1; |
|
245 | - $reg_status = isset($this->_req_data['_reg_status']) |
|
246 | - ? $this->_req_data['_reg_status'] |
|
247 | - : ''; |
|
248 | - $filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category); |
|
249 | - $filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category); |
|
250 | - $status = []; |
|
251 | - $status[] = ['id' => 0, 'text' => esc_html__('Select Status', 'event_espresso')]; |
|
252 | - foreach ($this->_status as $key => $value) { |
|
253 | - $status[] = ['id' => $key, 'text' => $value]; |
|
254 | - } |
|
255 | - if ($this->_view !== 'incomplete') { |
|
256 | - $filters[] = EEH_Form_Fields::select_input( |
|
257 | - '_reg_status', |
|
258 | - $status, |
|
259 | - isset($this->_req_data['_reg_status']) |
|
260 | - ? strtoupper(sanitize_key($this->_req_data['_reg_status'])) |
|
261 | - : '' |
|
262 | - ); |
|
263 | - } |
|
264 | - if (isset($this->_req_data['event_id'])) { |
|
265 | - $filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id'); |
|
266 | - } |
|
267 | - return $filters; |
|
268 | - } |
|
269 | - |
|
270 | - |
|
271 | - /** |
|
272 | - * @return void |
|
273 | - * @throws EE_Error |
|
274 | - * @throws InvalidArgumentException |
|
275 | - * @throws InvalidDataTypeException |
|
276 | - * @throws InvalidInterfaceException |
|
277 | - */ |
|
278 | - protected function _add_view_counts() |
|
279 | - { |
|
280 | - $this->_views['all']['count'] = $this->_total_registrations(); |
|
281 | - $this->_views['month']['count'] = $this->_total_registrations_this_month(); |
|
282 | - $this->_views['today']['count'] = $this->_total_registrations_today(); |
|
283 | - if ( |
|
284 | - EE_Registry::instance()->CAP->current_user_can( |
|
285 | - 'ee_delete_registrations', |
|
286 | - 'espresso_registrations_trash_registrations' |
|
287 | - ) |
|
288 | - ) { |
|
289 | - $this->_views['incomplete']['count'] = $this->_total_registrations('incomplete'); |
|
290 | - $this->_views['trash']['count'] = $this->_total_registrations('trash'); |
|
291 | - } |
|
292 | - } |
|
293 | - |
|
294 | - |
|
295 | - /** |
|
296 | - * @param string $view |
|
297 | - * @return int |
|
298 | - * @throws EE_Error |
|
299 | - * @throws InvalidArgumentException |
|
300 | - * @throws InvalidDataTypeException |
|
301 | - * @throws InvalidInterfaceException |
|
302 | - */ |
|
303 | - protected function _total_registrations($view = '') |
|
304 | - { |
|
305 | - $_where = []; |
|
306 | - $EVT_ID = isset($this->_req_data['event_id']) |
|
307 | - ? absint($this->_req_data['event_id']) |
|
308 | - : false; |
|
309 | - if ($EVT_ID) { |
|
310 | - $_where['EVT_ID'] = $EVT_ID; |
|
311 | - } |
|
312 | - switch ($view) { |
|
313 | - case 'trash': |
|
314 | - return EEM_Registration::instance()->count_deleted([$_where]); |
|
315 | - case 'incomplete': |
|
316 | - $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
|
317 | - break; |
|
318 | - default: |
|
319 | - $_where['STS_ID'] = ['!=', EEM_Registration::status_id_incomplete]; |
|
320 | - } |
|
321 | - return EEM_Registration::instance()->count([$_where]); |
|
322 | - } |
|
323 | - |
|
324 | - |
|
325 | - /** |
|
326 | - * @return int |
|
327 | - * @throws EE_Error |
|
328 | - * @throws InvalidArgumentException |
|
329 | - * @throws InvalidDataTypeException |
|
330 | - * @throws InvalidInterfaceException |
|
331 | - */ |
|
332 | - protected function _total_registrations_this_month() |
|
333 | - { |
|
334 | - $EVT_ID = isset($this->_req_data['event_id']) |
|
335 | - ? absint($this->_req_data['event_id']) |
|
336 | - : false; |
|
337 | - $_where = $EVT_ID |
|
338 | - ? ['EVT_ID' => $EVT_ID] |
|
339 | - : []; |
|
340 | - $this_year_r = date('Y', current_time('timestamp')); |
|
341 | - $time_start = ' 00:00:00'; |
|
342 | - $time_end = ' 23:59:59'; |
|
343 | - $this_month_r = date('m', current_time('timestamp')); |
|
344 | - $days_this_month = date('t', current_time('timestamp')); |
|
345 | - // setup date query. |
|
346 | - $beginning_string = EEM_Registration::instance()->convert_datetime_for_query( |
|
347 | - 'REG_date', |
|
348 | - $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, |
|
349 | - 'Y-m-d H:i:s' |
|
350 | - ); |
|
351 | - $end_string = EEM_Registration::instance()->convert_datetime_for_query( |
|
352 | - 'REG_date', |
|
353 | - $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, |
|
354 | - 'Y-m-d H:i:s' |
|
355 | - ); |
|
356 | - $_where['REG_date'] = [ |
|
357 | - 'BETWEEN', |
|
358 | - [ |
|
359 | - $beginning_string, |
|
360 | - $end_string, |
|
361 | - ], |
|
362 | - ]; |
|
363 | - $_where['STS_ID'] = ['!=', EEM_Registration::status_id_incomplete]; |
|
364 | - return EEM_Registration::instance()->count([$_where]); |
|
365 | - } |
|
366 | - |
|
367 | - |
|
368 | - /** |
|
369 | - * @return int |
|
370 | - * @throws EE_Error |
|
371 | - * @throws InvalidArgumentException |
|
372 | - * @throws InvalidDataTypeException |
|
373 | - * @throws InvalidInterfaceException |
|
374 | - */ |
|
375 | - protected function _total_registrations_today() |
|
376 | - { |
|
377 | - $EVT_ID = isset($this->_req_data['event_id']) |
|
378 | - ? absint($this->_req_data['event_id']) |
|
379 | - : false; |
|
380 | - $_where = $EVT_ID |
|
381 | - ? ['EVT_ID' => $EVT_ID] |
|
382 | - : []; |
|
383 | - $current_date = date('Y-m-d', current_time('timestamp')); |
|
384 | - $time_start = ' 00:00:00'; |
|
385 | - $time_end = ' 23:59:59'; |
|
386 | - $_where['REG_date'] = [ |
|
387 | - 'BETWEEN', |
|
388 | - [ |
|
389 | - EEM_Registration::instance()->convert_datetime_for_query( |
|
390 | - 'REG_date', |
|
391 | - $current_date . $time_start, |
|
392 | - 'Y-m-d H:i:s' |
|
393 | - ), |
|
394 | - EEM_Registration::instance()->convert_datetime_for_query( |
|
395 | - 'REG_date', |
|
396 | - $current_date . $time_end, |
|
397 | - 'Y-m-d H:i:s' |
|
398 | - ), |
|
399 | - ], |
|
400 | - ]; |
|
401 | - $_where['STS_ID'] = ['!=', EEM_Registration::status_id_incomplete]; |
|
402 | - return EEM_Registration::instance()->count([$_where]); |
|
403 | - } |
|
404 | - |
|
405 | - |
|
406 | - /** |
|
407 | - * @param EE_Registration $item |
|
408 | - * @return string |
|
409 | - * @throws EE_Error |
|
410 | - * @throws InvalidArgumentException |
|
411 | - * @throws InvalidDataTypeException |
|
412 | - * @throws InvalidInterfaceException |
|
413 | - * @throws ReflectionException |
|
414 | - */ |
|
415 | - public function column_cb($item) |
|
416 | - { |
|
417 | - /** checkbox/lock **/ |
|
418 | - $transaction = $item->get_first_related('Transaction'); |
|
419 | - $payment_count = $transaction instanceof EE_Transaction |
|
420 | - ? $transaction->count_related('Payment') |
|
421 | - : 0; |
|
422 | - return $payment_count > 0 || ! EE_Registry::instance()->CAP->current_user_can( |
|
423 | - 'ee_edit_registration', |
|
424 | - 'registration_list_table_checkbox_input', |
|
425 | - $item->ID() |
|
426 | - ) |
|
427 | - ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$d" />', $item->ID()) |
|
428 | - . '<span class="ee-lock-icon"></span>' |
|
429 | - : sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$d" />', $item->ID()); |
|
430 | - } |
|
431 | - |
|
432 | - |
|
433 | - /** |
|
434 | - * @param EE_Registration $item |
|
435 | - * @return string |
|
436 | - * @throws EE_Error |
|
437 | - * @throws InvalidArgumentException |
|
438 | - * @throws InvalidDataTypeException |
|
439 | - * @throws InvalidInterfaceException |
|
440 | - * @throws ReflectionException |
|
441 | - */ |
|
442 | - public function column__REG_ID(EE_Registration $item) |
|
443 | - { |
|
444 | - $attendee = $item->attendee(); |
|
445 | - $content = $item->ID(); |
|
446 | - $content .= '<div class="show-on-mobile-view-only">'; |
|
447 | - $content .= '<br>'; |
|
448 | - $content .= $attendee instanceof EE_Attendee |
|
449 | - ? $attendee->full_name() |
|
450 | - : ''; |
|
451 | - $content .= ' '; |
|
452 | - $content .= sprintf( |
|
453 | - esc_html__('(%1$s / %2$s)', 'event_espresso'), |
|
454 | - $item->count(), |
|
455 | - $item->group_size() |
|
456 | - ); |
|
457 | - $content .= '<br>'; |
|
458 | - $content .= sprintf(esc_html__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
459 | - $content .= '</div>'; |
|
460 | - return $content; |
|
461 | - } |
|
462 | - |
|
463 | - |
|
464 | - /** |
|
465 | - * @param EE_Registration $item |
|
466 | - * @return string |
|
467 | - * @throws EE_Error |
|
468 | - * @throws InvalidArgumentException |
|
469 | - * @throws InvalidDataTypeException |
|
470 | - * @throws InvalidInterfaceException |
|
471 | - * @throws ReflectionException |
|
472 | - */ |
|
473 | - public function column__REG_date(EE_Registration $item) |
|
474 | - { |
|
475 | - $this->_set_related_details($item); |
|
476 | - // Build row actions |
|
477 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
478 | - [ |
|
479 | - 'action' => 'view_transaction', |
|
480 | - 'TXN_ID' => $this->_transaction_details['id'], |
|
481 | - ], |
|
482 | - TXN_ADMIN_URL |
|
483 | - ); |
|
484 | - $view_link = EE_Registry::instance()->CAP->current_user_can( |
|
485 | - 'ee_read_transaction', |
|
486 | - 'espresso_transactions_view_transaction' |
|
487 | - ) |
|
488 | - ? '<a class="ee-status-color-' |
|
489 | - . $this->_transaction_details['status'] |
|
490 | - . '" href="' |
|
491 | - . $view_lnk_url |
|
492 | - . '" title="' |
|
493 | - . esc_attr($this->_transaction_details['title_attr']) |
|
494 | - . '">' |
|
495 | - . $item->get_i18n_datetime('REG_date') |
|
496 | - . '</a>' |
|
497 | - : $item->get_i18n_datetime('REG_date'); |
|
498 | - $view_link .= '<br><span class="ee-status-text-small">' |
|
499 | - . EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence') |
|
500 | - . '</span>'; |
|
501 | - return $view_link; |
|
502 | - } |
|
503 | - |
|
504 | - |
|
505 | - /** |
|
506 | - * @param EE_Registration $item |
|
507 | - * @return string |
|
508 | - * @throws EE_Error |
|
509 | - * @throws InvalidArgumentException |
|
510 | - * @throws InvalidDataTypeException |
|
511 | - * @throws InvalidInterfaceException |
|
512 | - * @throws ReflectionException |
|
513 | - */ |
|
514 | - public function column_event_name(EE_Registration $item) |
|
515 | - { |
|
516 | - $this->_set_related_details($item); |
|
517 | - // page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62 |
|
518 | - $EVT_ID = $item->event_ID(); |
|
519 | - $event_name = $item->event_name(); |
|
520 | - $event_name = |
|
521 | - $event_name |
|
522 | - ?: esc_html__("No Associated Event", 'event_espresso'); |
|
523 | - $event_name = wp_trim_words($event_name, 30, '...'); |
|
524 | - if ($EVT_ID) { |
|
525 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( |
|
526 | - ['action' => 'edit', 'post' => $EVT_ID], |
|
527 | - EVENTS_ADMIN_URL |
|
528 | - ); |
|
529 | - $edit_event = |
|
530 | - EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $EVT_ID) |
|
531 | - ? '<a class="ee-status-color-' |
|
532 | - . $this->_event_details['status'] |
|
533 | - . '" href="' |
|
534 | - . $edit_event_url |
|
535 | - . '" title="' |
|
536 | - . esc_attr($this->_event_details['title_attr']) |
|
537 | - . '">' |
|
538 | - . $event_name |
|
539 | - . '</a>' |
|
540 | - : $event_name; |
|
541 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(['event_id' => $EVT_ID], REG_ADMIN_URL); |
|
542 | - $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="'; |
|
543 | - $actions['event_filter'] .= sprintf( |
|
544 | - esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), |
|
545 | - $event_name |
|
546 | - ); |
|
547 | - $actions['event_filter'] .= '">' . esc_html__('View Registrations', 'event_espresso') . '</a>'; |
|
548 | - } else { |
|
549 | - $edit_event = $event_name; |
|
550 | - $actions['event_filter'] = ''; |
|
551 | - } |
|
552 | - return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions)); |
|
553 | - } |
|
554 | - |
|
555 | - |
|
556 | - /** |
|
557 | - * @param EE_Registration $item |
|
558 | - * @return string |
|
559 | - * @throws EE_Error |
|
560 | - * @throws InvalidArgumentException |
|
561 | - * @throws InvalidDataTypeException |
|
562 | - * @throws InvalidInterfaceException |
|
563 | - * @throws ReflectionException |
|
564 | - */ |
|
565 | - public function column_DTT_EVT_start(EE_Registration $item) |
|
566 | - { |
|
567 | - $datetime_strings = []; |
|
568 | - $ticket = $item->ticket(); |
|
569 | - if ($ticket instanceof EE_Ticket) { |
|
570 | - $remove_defaults = ['default_where_conditions' => 'none']; |
|
571 | - $datetimes = $ticket->datetimes($remove_defaults); |
|
572 | - foreach ($datetimes as $datetime) { |
|
573 | - $datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
574 | - } |
|
575 | - return $this->generateDisplayForDatetimes($datetime_strings); |
|
576 | - } |
|
577 | - return esc_html__('There is no ticket on this registration', 'event_espresso'); |
|
578 | - } |
|
579 | - |
|
580 | - |
|
581 | - /** |
|
582 | - * Receives an array of datetime strings to display and converts them to the html container for the column. |
|
583 | - * |
|
584 | - * @param array $datetime_strings |
|
585 | - * @return string |
|
586 | - */ |
|
587 | - public function generateDisplayForDateTimes(array $datetime_strings) |
|
588 | - { |
|
589 | - $content = '<div class="ee-registration-event-datetimes-container">'; |
|
590 | - $expand_toggle = count($datetime_strings) > 1 |
|
591 | - ? ' <span title="' . esc_attr__('Click to view all dates', 'event_espresso') |
|
592 | - . '" class="ee-js ee-more-datetimes-toggle dashicons dashicons-plus"></span>' |
|
593 | - : ''; |
|
594 | - // get first item for initial visibility |
|
595 | - $content .= '<div class="left">' . array_shift($datetime_strings) . '</div>'; |
|
596 | - $content .= $expand_toggle; |
|
597 | - if ($datetime_strings) { |
|
598 | - $content .= '<div style="clear:both"></div>'; |
|
599 | - $content .= '<div class="ee-registration-event-datetimes-container more-items hidden">'; |
|
600 | - $content .= implode("<br />", $datetime_strings); |
|
601 | - $content .= '</div>'; |
|
602 | - } |
|
603 | - $content .= '</div>'; |
|
604 | - return $content; |
|
605 | - } |
|
606 | - |
|
607 | - |
|
608 | - /** |
|
609 | - * @param EE_Registration $item |
|
610 | - * @return string |
|
611 | - * @throws EE_Error |
|
612 | - * @throws InvalidArgumentException |
|
613 | - * @throws InvalidDataTypeException |
|
614 | - * @throws InvalidInterfaceException |
|
615 | - * @throws ReflectionException |
|
616 | - */ |
|
617 | - public function column_ATT_fname(EE_Registration $item) |
|
618 | - { |
|
619 | - $attendee = $item->attendee(); |
|
620 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
621 | - [ |
|
622 | - 'action' => 'view_registration', |
|
623 | - '_REG_ID' => $item->ID(), |
|
624 | - ], |
|
625 | - REG_ADMIN_URL |
|
626 | - ); |
|
627 | - $attendee_name = $attendee instanceof EE_Attendee |
|
628 | - ? $attendee->full_name() |
|
629 | - : ''; |
|
630 | - $link = EE_Registry::instance()->CAP->current_user_can( |
|
631 | - 'ee_read_registration', |
|
632 | - 'espresso_registrations_view_registration', |
|
633 | - $item->ID() |
|
634 | - ) |
|
635 | - ? '<a href="' |
|
636 | - . $edit_lnk_url |
|
637 | - . '" title="' |
|
638 | - . esc_attr__('View Registration Details', 'event_espresso') |
|
639 | - . '">' |
|
640 | - . $attendee_name |
|
641 | - . '</a>' |
|
642 | - : $attendee_name; |
|
643 | - $link .= $item->count() === 1 |
|
644 | - ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' |
|
645 | - : ''; |
|
646 | - $t = $item->get_first_related('Transaction'); |
|
647 | - $payment_count = $t instanceof EE_Transaction |
|
648 | - ? $t->count_related('Payment') |
|
649 | - : 0; |
|
650 | - // append group count to name |
|
651 | - $link .= ' ' . sprintf(esc_html__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
652 | - // append reg_code |
|
653 | - $link .= '<br>' . sprintf(esc_html__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
654 | - // reg status text for accessibility |
|
655 | - $link .= '<br><span class="ee-status-text-small">' |
|
656 | - . EEH_Template::pretty_status($item->status_ID(), false, 'sentence') |
|
657 | - . '</span>'; |
|
658 | - $action = ['_REG_ID' => $item->ID()]; |
|
659 | - if (isset($this->_req_data['event_id'])) { |
|
660 | - $action['event_id'] = $item->event_ID(); |
|
661 | - } |
|
662 | - // trash/restore/delete actions |
|
663 | - $actions = []; |
|
664 | - if ( |
|
665 | - $this->_view !== 'trash' |
|
666 | - && $payment_count === 0 |
|
667 | - && EE_Registry::instance()->CAP->current_user_can( |
|
668 | - 'ee_delete_registration', |
|
669 | - 'espresso_registrations_trash_registrations', |
|
670 | - $item->ID() |
|
671 | - ) |
|
672 | - ) { |
|
673 | - $action['action'] = 'trash_registrations'; |
|
674 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
675 | - $action, |
|
676 | - REG_ADMIN_URL |
|
677 | - ); |
|
678 | - $actions['trash'] = '<a href="' |
|
679 | - . $trash_lnk_url |
|
680 | - . '" title="' |
|
681 | - . esc_attr__('Trash Registration', 'event_espresso') |
|
682 | - . '">' . esc_html__('Trash', 'event_espresso') . '</a>'; |
|
683 | - } elseif ($this->_view === 'trash') { |
|
684 | - // restore registration link |
|
685 | - if ( |
|
686 | - EE_Registry::instance()->CAP->current_user_can( |
|
687 | - 'ee_delete_registration', |
|
688 | - 'espresso_registrations_restore_registrations', |
|
689 | - $item->ID() |
|
690 | - ) |
|
691 | - ) { |
|
692 | - $action['action'] = 'restore_registrations'; |
|
693 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
694 | - $action, |
|
695 | - REG_ADMIN_URL |
|
696 | - ); |
|
697 | - $actions['restore'] = '<a href="' |
|
698 | - . $restore_lnk_url |
|
699 | - . '" title="' |
|
700 | - . esc_attr__('Restore Registration', 'event_espresso') . '">' |
|
701 | - . esc_html__('Restore', 'event_espresso') . '</a>'; |
|
702 | - } |
|
703 | - if ( |
|
704 | - EE_Registry::instance()->CAP->current_user_can( |
|
705 | - 'ee_delete_registration', |
|
706 | - 'espresso_registrations_ee_delete_registrations', |
|
707 | - $item->ID() |
|
708 | - ) |
|
709 | - ) { |
|
710 | - $action['action'] = 'delete_registrations'; |
|
711 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
712 | - $action, |
|
713 | - REG_ADMIN_URL |
|
714 | - ); |
|
715 | - $actions['delete'] = '<a href="' |
|
716 | - . $delete_lnk_url |
|
717 | - . '" title="' |
|
718 | - . esc_attr__('Delete Registration Permanently', 'event_espresso') |
|
719 | - . '">' |
|
720 | - . esc_html__('Delete', 'event_espresso') |
|
721 | - . '</a>'; |
|
722 | - } |
|
723 | - } |
|
724 | - return sprintf('%1$s %2$s', $link, $this->row_actions($actions)); |
|
725 | - } |
|
726 | - |
|
727 | - |
|
728 | - /** |
|
729 | - * @param EE_Registration $item |
|
730 | - * @return string |
|
731 | - * @throws EE_Error |
|
732 | - * @throws InvalidArgumentException |
|
733 | - * @throws InvalidDataTypeException |
|
734 | - * @throws InvalidInterfaceException |
|
735 | - * @throws ReflectionException |
|
736 | - */ |
|
737 | - public function column_ATT_email(EE_Registration $item) |
|
738 | - { |
|
739 | - $attendee = $item->get_first_related('Attendee'); |
|
740 | - return ! $attendee instanceof EE_Attendee |
|
741 | - ? esc_html__('No attached contact record.', 'event_espresso') |
|
742 | - : $attendee->email(); |
|
743 | - } |
|
744 | - |
|
745 | - |
|
746 | - /** |
|
747 | - * @param EE_Registration $item |
|
748 | - * @return string |
|
749 | - */ |
|
750 | - public function column__REG_count(EE_Registration $item) |
|
751 | - { |
|
752 | - return sprintf(esc_html__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size()); |
|
753 | - } |
|
754 | - |
|
755 | - |
|
756 | - /** |
|
757 | - * @param EE_Registration $item |
|
758 | - * @return string |
|
759 | - * @throws EE_Error |
|
760 | - * @throws ReflectionException |
|
761 | - */ |
|
762 | - public function column_PRC_amount(EE_Registration $item) |
|
763 | - { |
|
764 | - $ticket = $item->ticket(); |
|
765 | - $req_data = $this->_admin_page->get_request_data(); |
|
766 | - $content = isset($req_data['event_id']) && $ticket instanceof EE_Ticket |
|
767 | - ? '<span class="TKT_name">' . $ticket->name() . '</span><br />' |
|
768 | - : ''; |
|
769 | - if ($item->final_price() > 0) { |
|
770 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
771 | - } else { |
|
772 | - // free event |
|
773 | - $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' |
|
774 | - . esc_html__('free', 'event_espresso') |
|
775 | - . '</span>'; |
|
776 | - } |
|
777 | - return $content; |
|
778 | - } |
|
779 | - |
|
780 | - |
|
781 | - /** |
|
782 | - * @param EE_Registration $item |
|
783 | - * @return string |
|
784 | - * @throws EE_Error |
|
785 | - * @throws ReflectionException |
|
786 | - */ |
|
787 | - public function column__REG_final_price(EE_Registration $item) |
|
788 | - { |
|
789 | - $ticket = $item->ticket(); |
|
790 | - $req_data = $this->_admin_page->get_request_data(); |
|
791 | - $content = isset($req_data['event_id']) || ! $ticket instanceof EE_Ticket |
|
792 | - ? '' |
|
793 | - : '<span class="TKT_name">' . $ticket->name() . '</span><br />'; |
|
794 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
795 | - return $content; |
|
796 | - } |
|
797 | - |
|
798 | - |
|
799 | - /** |
|
800 | - * @param EE_Registration $item |
|
801 | - * @return string |
|
802 | - * @throws EE_Error |
|
803 | - */ |
|
804 | - public function column__REG_paid(EE_Registration $item) |
|
805 | - { |
|
806 | - $payment_method = $item->payment_method(); |
|
807 | - $payment_method_name = $payment_method instanceof EE_Payment_Method |
|
808 | - ? $payment_method->admin_name() |
|
809 | - : esc_html__('Unknown', 'event_espresso'); |
|
810 | - $content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>'; |
|
811 | - if ($item->paid() > 0) { |
|
812 | - $content .= '<br><span class="ee-status-text-small">' |
|
813 | - . sprintf( |
|
814 | - esc_html__('...via %s', 'event_espresso'), |
|
815 | - $payment_method_name |
|
816 | - ) |
|
817 | - . '</span>'; |
|
818 | - } |
|
819 | - return $content; |
|
820 | - } |
|
821 | - |
|
822 | - |
|
823 | - /** |
|
824 | - * @param EE_Registration $item |
|
825 | - * @return string |
|
826 | - * @throws EE_Error |
|
827 | - * @throws EntityNotFoundException |
|
828 | - * @throws InvalidArgumentException |
|
829 | - * @throws InvalidDataTypeException |
|
830 | - * @throws InvalidInterfaceException |
|
831 | - * @throws ReflectionException |
|
832 | - */ |
|
833 | - public function column_TXN_total(EE_Registration $item) |
|
834 | - { |
|
835 | - if ($item->transaction()) { |
|
836 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
837 | - [ |
|
838 | - 'action' => 'view_transaction', |
|
839 | - 'TXN_ID' => $item->transaction_ID(), |
|
840 | - ], |
|
841 | - TXN_ADMIN_URL |
|
842 | - ); |
|
843 | - return EE_Registry::instance()->CAP->current_user_can( |
|
844 | - 'ee_read_transaction', |
|
845 | - 'espresso_transactions_view_transaction', |
|
846 | - $item->transaction_ID() |
|
847 | - ) |
|
848 | - ? '<span class="reg-pad-rght"><a class="status-' |
|
849 | - . $item->transaction()->status_ID() |
|
850 | - . '" href="' |
|
851 | - . $view_txn_lnk_url |
|
852 | - . '" title="' |
|
853 | - . esc_attr__('View Transaction', 'event_espresso') |
|
854 | - . '">' |
|
855 | - . $item->transaction()->pretty_total() |
|
856 | - . '</a></span>' |
|
857 | - : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>'; |
|
858 | - } else { |
|
859 | - return esc_html__("None", "event_espresso"); |
|
860 | - } |
|
861 | - } |
|
862 | - |
|
863 | - |
|
864 | - /** |
|
865 | - * @param EE_Registration $item |
|
866 | - * @return string |
|
867 | - * @throws EE_Error |
|
868 | - * @throws EntityNotFoundException |
|
869 | - * @throws InvalidArgumentException |
|
870 | - * @throws InvalidDataTypeException |
|
871 | - * @throws InvalidInterfaceException |
|
872 | - * @throws ReflectionException |
|
873 | - */ |
|
874 | - public function column_TXN_paid(EE_Registration $item) |
|
875 | - { |
|
876 | - if ($item->count() === 1) { |
|
877 | - $transaction = $item->transaction() |
|
878 | - ? $item->transaction() |
|
879 | - : EE_Transaction::new_instance(); |
|
880 | - if ($transaction->paid() >= $transaction->total()) { |
|
881 | - return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
|
882 | - } else { |
|
883 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
884 | - [ |
|
885 | - 'action' => 'view_transaction', |
|
886 | - 'TXN_ID' => $item->transaction_ID(), |
|
887 | - ], |
|
888 | - TXN_ADMIN_URL |
|
889 | - ); |
|
890 | - return EE_Registry::instance()->CAP->current_user_can( |
|
891 | - 'ee_read_transaction', |
|
892 | - 'espresso_transactions_view_transaction', |
|
893 | - $item->transaction_ID() |
|
894 | - ) |
|
895 | - ? '<span class="reg-pad-rght"><a class="status-' |
|
896 | - . $transaction->status_ID() |
|
897 | - . '" href="' |
|
898 | - . $view_txn_lnk_url |
|
899 | - . '" title="' |
|
900 | - . esc_attr__('View Transaction', 'event_espresso') |
|
901 | - . '">' |
|
902 | - . $item->transaction()->pretty_paid() |
|
903 | - . '</a><span>' |
|
904 | - : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
905 | - } |
|
906 | - } |
|
907 | - return ' '; |
|
908 | - } |
|
909 | - |
|
910 | - |
|
911 | - /** |
|
912 | - * column_actions |
|
913 | - * |
|
914 | - * @param EE_Registration $item |
|
915 | - * @return string |
|
916 | - * @throws EE_Error |
|
917 | - * @throws InvalidArgumentException |
|
918 | - * @throws InvalidDataTypeException |
|
919 | - * @throws InvalidInterfaceException |
|
920 | - * @throws ReflectionException |
|
921 | - */ |
|
922 | - public function column_actions(EE_Registration $item) |
|
923 | - { |
|
924 | - $actions = []; |
|
925 | - $attendee = $item->attendee(); |
|
926 | - $this->_set_related_details($item); |
|
927 | - |
|
928 | - // Build row actions |
|
929 | - if ( |
|
930 | - EE_Registry::instance()->CAP->current_user_can( |
|
931 | - 'ee_read_registration', |
|
932 | - 'espresso_registrations_view_registration', |
|
933 | - $item->ID() |
|
934 | - ) |
|
935 | - ) { |
|
936 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
937 | - [ |
|
938 | - 'action' => 'view_registration', |
|
939 | - '_REG_ID' => $item->ID(), |
|
940 | - ], |
|
941 | - REG_ADMIN_URL |
|
942 | - ); |
|
943 | - $actions['view_lnk'] = ' |
|
18 | + /** |
|
19 | + * @var Registrations_Admin_Page |
|
20 | + */ |
|
21 | + protected $_admin_page; |
|
22 | + |
|
23 | + /** |
|
24 | + * @var array |
|
25 | + */ |
|
26 | + private $_status; |
|
27 | + |
|
28 | + /** |
|
29 | + * An array of transaction details for the related transaction to the registration being processed. |
|
30 | + * This is set via the _set_related_details method. |
|
31 | + * |
|
32 | + * @var array |
|
33 | + */ |
|
34 | + protected $_transaction_details = []; |
|
35 | + |
|
36 | + /** |
|
37 | + * An array of event details for the related event to the registration being processed. |
|
38 | + * This is set via the _set_related_details method. |
|
39 | + * |
|
40 | + * @var array |
|
41 | + */ |
|
42 | + protected $_event_details = []; |
|
43 | + |
|
44 | + |
|
45 | + /** |
|
46 | + * @param Registrations_Admin_Page $admin_page |
|
47 | + */ |
|
48 | + public function __construct(Registrations_Admin_Page $admin_page) |
|
49 | + { |
|
50 | + $req_data = $admin_page->get_request_data(); |
|
51 | + if (! empty($req_data['event_id'])) { |
|
52 | + $extra_query_args = []; |
|
53 | + foreach ($admin_page->get_views() as $view_details) { |
|
54 | + $extra_query_args[ $view_details['slug'] ] = ['event_id' => $req_data['event_id']]; |
|
55 | + } |
|
56 | + $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args); |
|
57 | + } |
|
58 | + parent::__construct($admin_page); |
|
59 | + $this->_status = $this->_admin_page->get_registration_status_array(); |
|
60 | + } |
|
61 | + |
|
62 | + |
|
63 | + /** |
|
64 | + * @return void |
|
65 | + * @throws EE_Error |
|
66 | + */ |
|
67 | + protected function _setup_data() |
|
68 | + { |
|
69 | + $this->_data = $this->_admin_page->get_registrations($this->_per_page); |
|
70 | + $this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, true); |
|
71 | + } |
|
72 | + |
|
73 | + |
|
74 | + /** |
|
75 | + * @return void |
|
76 | + */ |
|
77 | + protected function _set_properties() |
|
78 | + { |
|
79 | + $return_url = $this->getReturnUrl(); |
|
80 | + $this->_wp_list_args = [ |
|
81 | + 'singular' => esc_html__('registration', 'event_espresso'), |
|
82 | + 'plural' => esc_html__('registrations', 'event_espresso'), |
|
83 | + 'ajax' => true, |
|
84 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
85 | + ]; |
|
86 | + $ID_column_name = esc_html__('ID', 'event_espresso'); |
|
87 | + $ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">'; |
|
88 | + $ID_column_name .= esc_html__('Registrant Name', 'event_espresso'); |
|
89 | + $ID_column_name .= '</span> '; |
|
90 | + $req_data = $this->_admin_page->get_request_data(); |
|
91 | + if (isset($req_data['event_id'])) { |
|
92 | + $this->_columns = [ |
|
93 | + 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
94 | + '_REG_ID' => $ID_column_name, |
|
95 | + 'ATT_fname' => esc_html__('Name', 'event_espresso'), |
|
96 | + 'ATT_email' => esc_html__('Email', 'event_espresso'), |
|
97 | + '_REG_date' => esc_html__('Reg Date', 'event_espresso'), |
|
98 | + 'PRC_amount' => esc_html__('TKT Price', 'event_espresso'), |
|
99 | + '_REG_final_price' => esc_html__('Final Price', 'event_espresso'), |
|
100 | + 'TXN_total' => esc_html__('Total Txn', 'event_espresso'), |
|
101 | + 'TXN_paid' => esc_html__('Paid', 'event_espresso'), |
|
102 | + 'actions' => esc_html__('Actions', 'event_espresso'), |
|
103 | + ]; |
|
104 | + $route_details = [ |
|
105 | + 'route' => 'registrations_report', |
|
106 | + 'extra_request' => [ |
|
107 | + 'EVT_ID' => $this->_req_data['event_id'], |
|
108 | + 'return_url' => $return_url, |
|
109 | + ] |
|
110 | + ]; |
|
111 | + if (isset($req_data['datetime_id']) && $req_data['datetime_id']) { |
|
112 | + $route_details['extra_request']['DTT_ID'] = $req_data['datetime_id']; |
|
113 | + $this->_bottom_buttons['report_datetime'] = $route_details; |
|
114 | + } else { |
|
115 | + $this->_bottom_buttons['report'] = $route_details; |
|
116 | + } |
|
117 | + } else { |
|
118 | + $this->_columns = [ |
|
119 | + 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
120 | + '_REG_ID' => $ID_column_name, |
|
121 | + 'ATT_fname' => esc_html__('Name', 'event_espresso'), |
|
122 | + '_REG_date' => esc_html__('TXN Date', 'event_espresso'), |
|
123 | + 'event_name' => esc_html__('Event', 'event_espresso'), |
|
124 | + 'DTT_EVT_start' => esc_html__('Event Date', 'event_espresso'), |
|
125 | + '_REG_final_price' => esc_html__('Price', 'event_espresso'), |
|
126 | + '_REG_paid' => esc_html__('Paid', 'event_espresso'), |
|
127 | + 'actions' => esc_html__('Actions', 'event_espresso'), |
|
128 | + ]; |
|
129 | + $this->_bottom_buttons = [ |
|
130 | + 'report_all' => [ |
|
131 | + 'route' => 'registrations_report', |
|
132 | + 'extra_request' => [ |
|
133 | + 'return_url' => $return_url, |
|
134 | + ], |
|
135 | + ], |
|
136 | + ]; |
|
137 | + } |
|
138 | + $this->_primary_column = '_REG_ID'; |
|
139 | + $this->_sortable_columns = [ |
|
140 | + '_REG_date' => ['_REG_date' => true], // true means its already sorted |
|
141 | + /** |
|
142 | + * Allows users to change the default sort if they wish. |
|
143 | + * Returning a falsey on this filter will result in the default sort to be by firstname rather than last |
|
144 | + * name. |
|
145 | + */ |
|
146 | + 'ATT_fname' => [ |
|
147 | + 'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name', |
|
148 | + true, |
|
149 | + $this, |
|
150 | + ] |
|
151 | + ? ['ATT_lname' => false] |
|
152 | + : ['ATT_fname' => false], |
|
153 | + 'event_name' => ['event_name' => false], |
|
154 | + 'DTT_EVT_start' => ['DTT_EVT_start' => false], |
|
155 | + '_REG_ID' => ['_REG_ID' => false], |
|
156 | + ]; |
|
157 | + $this->_hidden_columns = []; |
|
158 | + } |
|
159 | + |
|
160 | + |
|
161 | + /** |
|
162 | + * This simply sets up the row class for the table rows. |
|
163 | + * Allows for easier overriding of child methods for setting up sorting. |
|
164 | + * |
|
165 | + * @param EE_Registration $item the current item |
|
166 | + * @return string |
|
167 | + */ |
|
168 | + protected function _get_row_class($item) |
|
169 | + { |
|
170 | + $class = parent::_get_row_class($item); |
|
171 | + // add status class |
|
172 | + $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
173 | + if ($this->_has_checkbox_column) { |
|
174 | + $class .= ' has-checkbox-column'; |
|
175 | + } |
|
176 | + return $class; |
|
177 | + } |
|
178 | + |
|
179 | + |
|
180 | + /** |
|
181 | + * Set the $_transaction_details property if not set yet. |
|
182 | + * |
|
183 | + * @param EE_Registration $registration |
|
184 | + * @throws EE_Error |
|
185 | + * @throws InvalidArgumentException |
|
186 | + * @throws ReflectionException |
|
187 | + * @throws InvalidDataTypeException |
|
188 | + * @throws InvalidInterfaceException |
|
189 | + */ |
|
190 | + protected function _set_related_details(EE_Registration $registration) |
|
191 | + { |
|
192 | + $transaction = $registration->get_first_related('Transaction'); |
|
193 | + $status = $transaction instanceof EE_Transaction |
|
194 | + ? $transaction->status_ID() |
|
195 | + : EEM_Transaction::failed_status_code; |
|
196 | + $this->_transaction_details = [ |
|
197 | + 'transaction' => $transaction, |
|
198 | + 'status' => $status, |
|
199 | + 'id' => $transaction instanceof EE_Transaction |
|
200 | + ? $transaction->ID() |
|
201 | + : 0, |
|
202 | + 'title_attr' => sprintf( |
|
203 | + esc_html__('View Transaction Details (%s)', 'event_espresso'), |
|
204 | + EEH_Template::pretty_status($status, false, 'sentence') |
|
205 | + ), |
|
206 | + ]; |
|
207 | + try { |
|
208 | + $event = $registration->event(); |
|
209 | + } catch (EntityNotFoundException $e) { |
|
210 | + $event = null; |
|
211 | + } |
|
212 | + $status = $event instanceof EE_Event |
|
213 | + ? $event->get_active_status() |
|
214 | + : EE_Datetime::inactive; |
|
215 | + $this->_event_details = [ |
|
216 | + 'event' => $event, |
|
217 | + 'status' => $status, |
|
218 | + 'id' => $event instanceof EE_Event |
|
219 | + ? $event->ID() |
|
220 | + : 0, |
|
221 | + 'title_attr' => sprintf( |
|
222 | + esc_html__('Edit Event (%s)', 'event_espresso'), |
|
223 | + EEH_Template::pretty_status($status, false, 'sentence') |
|
224 | + ), |
|
225 | + ]; |
|
226 | + } |
|
227 | + |
|
228 | + |
|
229 | + /** |
|
230 | + * _get_table_filters |
|
231 | + * |
|
232 | + * @return array |
|
233 | + */ |
|
234 | + protected function _get_table_filters() |
|
235 | + { |
|
236 | + $filters = []; |
|
237 | + // todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as |
|
238 | + // methods. |
|
239 | + $cur_date = isset($this->_req_data['month_range']) |
|
240 | + ? $this->_req_data['month_range'] |
|
241 | + : ''; |
|
242 | + $cur_category = isset($this->_req_data['EVT_CAT']) |
|
243 | + ? $this->_req_data['EVT_CAT'] |
|
244 | + : -1; |
|
245 | + $reg_status = isset($this->_req_data['_reg_status']) |
|
246 | + ? $this->_req_data['_reg_status'] |
|
247 | + : ''; |
|
248 | + $filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category); |
|
249 | + $filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category); |
|
250 | + $status = []; |
|
251 | + $status[] = ['id' => 0, 'text' => esc_html__('Select Status', 'event_espresso')]; |
|
252 | + foreach ($this->_status as $key => $value) { |
|
253 | + $status[] = ['id' => $key, 'text' => $value]; |
|
254 | + } |
|
255 | + if ($this->_view !== 'incomplete') { |
|
256 | + $filters[] = EEH_Form_Fields::select_input( |
|
257 | + '_reg_status', |
|
258 | + $status, |
|
259 | + isset($this->_req_data['_reg_status']) |
|
260 | + ? strtoupper(sanitize_key($this->_req_data['_reg_status'])) |
|
261 | + : '' |
|
262 | + ); |
|
263 | + } |
|
264 | + if (isset($this->_req_data['event_id'])) { |
|
265 | + $filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id'); |
|
266 | + } |
|
267 | + return $filters; |
|
268 | + } |
|
269 | + |
|
270 | + |
|
271 | + /** |
|
272 | + * @return void |
|
273 | + * @throws EE_Error |
|
274 | + * @throws InvalidArgumentException |
|
275 | + * @throws InvalidDataTypeException |
|
276 | + * @throws InvalidInterfaceException |
|
277 | + */ |
|
278 | + protected function _add_view_counts() |
|
279 | + { |
|
280 | + $this->_views['all']['count'] = $this->_total_registrations(); |
|
281 | + $this->_views['month']['count'] = $this->_total_registrations_this_month(); |
|
282 | + $this->_views['today']['count'] = $this->_total_registrations_today(); |
|
283 | + if ( |
|
284 | + EE_Registry::instance()->CAP->current_user_can( |
|
285 | + 'ee_delete_registrations', |
|
286 | + 'espresso_registrations_trash_registrations' |
|
287 | + ) |
|
288 | + ) { |
|
289 | + $this->_views['incomplete']['count'] = $this->_total_registrations('incomplete'); |
|
290 | + $this->_views['trash']['count'] = $this->_total_registrations('trash'); |
|
291 | + } |
|
292 | + } |
|
293 | + |
|
294 | + |
|
295 | + /** |
|
296 | + * @param string $view |
|
297 | + * @return int |
|
298 | + * @throws EE_Error |
|
299 | + * @throws InvalidArgumentException |
|
300 | + * @throws InvalidDataTypeException |
|
301 | + * @throws InvalidInterfaceException |
|
302 | + */ |
|
303 | + protected function _total_registrations($view = '') |
|
304 | + { |
|
305 | + $_where = []; |
|
306 | + $EVT_ID = isset($this->_req_data['event_id']) |
|
307 | + ? absint($this->_req_data['event_id']) |
|
308 | + : false; |
|
309 | + if ($EVT_ID) { |
|
310 | + $_where['EVT_ID'] = $EVT_ID; |
|
311 | + } |
|
312 | + switch ($view) { |
|
313 | + case 'trash': |
|
314 | + return EEM_Registration::instance()->count_deleted([$_where]); |
|
315 | + case 'incomplete': |
|
316 | + $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
|
317 | + break; |
|
318 | + default: |
|
319 | + $_where['STS_ID'] = ['!=', EEM_Registration::status_id_incomplete]; |
|
320 | + } |
|
321 | + return EEM_Registration::instance()->count([$_where]); |
|
322 | + } |
|
323 | + |
|
324 | + |
|
325 | + /** |
|
326 | + * @return int |
|
327 | + * @throws EE_Error |
|
328 | + * @throws InvalidArgumentException |
|
329 | + * @throws InvalidDataTypeException |
|
330 | + * @throws InvalidInterfaceException |
|
331 | + */ |
|
332 | + protected function _total_registrations_this_month() |
|
333 | + { |
|
334 | + $EVT_ID = isset($this->_req_data['event_id']) |
|
335 | + ? absint($this->_req_data['event_id']) |
|
336 | + : false; |
|
337 | + $_where = $EVT_ID |
|
338 | + ? ['EVT_ID' => $EVT_ID] |
|
339 | + : []; |
|
340 | + $this_year_r = date('Y', current_time('timestamp')); |
|
341 | + $time_start = ' 00:00:00'; |
|
342 | + $time_end = ' 23:59:59'; |
|
343 | + $this_month_r = date('m', current_time('timestamp')); |
|
344 | + $days_this_month = date('t', current_time('timestamp')); |
|
345 | + // setup date query. |
|
346 | + $beginning_string = EEM_Registration::instance()->convert_datetime_for_query( |
|
347 | + 'REG_date', |
|
348 | + $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, |
|
349 | + 'Y-m-d H:i:s' |
|
350 | + ); |
|
351 | + $end_string = EEM_Registration::instance()->convert_datetime_for_query( |
|
352 | + 'REG_date', |
|
353 | + $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, |
|
354 | + 'Y-m-d H:i:s' |
|
355 | + ); |
|
356 | + $_where['REG_date'] = [ |
|
357 | + 'BETWEEN', |
|
358 | + [ |
|
359 | + $beginning_string, |
|
360 | + $end_string, |
|
361 | + ], |
|
362 | + ]; |
|
363 | + $_where['STS_ID'] = ['!=', EEM_Registration::status_id_incomplete]; |
|
364 | + return EEM_Registration::instance()->count([$_where]); |
|
365 | + } |
|
366 | + |
|
367 | + |
|
368 | + /** |
|
369 | + * @return int |
|
370 | + * @throws EE_Error |
|
371 | + * @throws InvalidArgumentException |
|
372 | + * @throws InvalidDataTypeException |
|
373 | + * @throws InvalidInterfaceException |
|
374 | + */ |
|
375 | + protected function _total_registrations_today() |
|
376 | + { |
|
377 | + $EVT_ID = isset($this->_req_data['event_id']) |
|
378 | + ? absint($this->_req_data['event_id']) |
|
379 | + : false; |
|
380 | + $_where = $EVT_ID |
|
381 | + ? ['EVT_ID' => $EVT_ID] |
|
382 | + : []; |
|
383 | + $current_date = date('Y-m-d', current_time('timestamp')); |
|
384 | + $time_start = ' 00:00:00'; |
|
385 | + $time_end = ' 23:59:59'; |
|
386 | + $_where['REG_date'] = [ |
|
387 | + 'BETWEEN', |
|
388 | + [ |
|
389 | + EEM_Registration::instance()->convert_datetime_for_query( |
|
390 | + 'REG_date', |
|
391 | + $current_date . $time_start, |
|
392 | + 'Y-m-d H:i:s' |
|
393 | + ), |
|
394 | + EEM_Registration::instance()->convert_datetime_for_query( |
|
395 | + 'REG_date', |
|
396 | + $current_date . $time_end, |
|
397 | + 'Y-m-d H:i:s' |
|
398 | + ), |
|
399 | + ], |
|
400 | + ]; |
|
401 | + $_where['STS_ID'] = ['!=', EEM_Registration::status_id_incomplete]; |
|
402 | + return EEM_Registration::instance()->count([$_where]); |
|
403 | + } |
|
404 | + |
|
405 | + |
|
406 | + /** |
|
407 | + * @param EE_Registration $item |
|
408 | + * @return string |
|
409 | + * @throws EE_Error |
|
410 | + * @throws InvalidArgumentException |
|
411 | + * @throws InvalidDataTypeException |
|
412 | + * @throws InvalidInterfaceException |
|
413 | + * @throws ReflectionException |
|
414 | + */ |
|
415 | + public function column_cb($item) |
|
416 | + { |
|
417 | + /** checkbox/lock **/ |
|
418 | + $transaction = $item->get_first_related('Transaction'); |
|
419 | + $payment_count = $transaction instanceof EE_Transaction |
|
420 | + ? $transaction->count_related('Payment') |
|
421 | + : 0; |
|
422 | + return $payment_count > 0 || ! EE_Registry::instance()->CAP->current_user_can( |
|
423 | + 'ee_edit_registration', |
|
424 | + 'registration_list_table_checkbox_input', |
|
425 | + $item->ID() |
|
426 | + ) |
|
427 | + ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$d" />', $item->ID()) |
|
428 | + . '<span class="ee-lock-icon"></span>' |
|
429 | + : sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$d" />', $item->ID()); |
|
430 | + } |
|
431 | + |
|
432 | + |
|
433 | + /** |
|
434 | + * @param EE_Registration $item |
|
435 | + * @return string |
|
436 | + * @throws EE_Error |
|
437 | + * @throws InvalidArgumentException |
|
438 | + * @throws InvalidDataTypeException |
|
439 | + * @throws InvalidInterfaceException |
|
440 | + * @throws ReflectionException |
|
441 | + */ |
|
442 | + public function column__REG_ID(EE_Registration $item) |
|
443 | + { |
|
444 | + $attendee = $item->attendee(); |
|
445 | + $content = $item->ID(); |
|
446 | + $content .= '<div class="show-on-mobile-view-only">'; |
|
447 | + $content .= '<br>'; |
|
448 | + $content .= $attendee instanceof EE_Attendee |
|
449 | + ? $attendee->full_name() |
|
450 | + : ''; |
|
451 | + $content .= ' '; |
|
452 | + $content .= sprintf( |
|
453 | + esc_html__('(%1$s / %2$s)', 'event_espresso'), |
|
454 | + $item->count(), |
|
455 | + $item->group_size() |
|
456 | + ); |
|
457 | + $content .= '<br>'; |
|
458 | + $content .= sprintf(esc_html__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
459 | + $content .= '</div>'; |
|
460 | + return $content; |
|
461 | + } |
|
462 | + |
|
463 | + |
|
464 | + /** |
|
465 | + * @param EE_Registration $item |
|
466 | + * @return string |
|
467 | + * @throws EE_Error |
|
468 | + * @throws InvalidArgumentException |
|
469 | + * @throws InvalidDataTypeException |
|
470 | + * @throws InvalidInterfaceException |
|
471 | + * @throws ReflectionException |
|
472 | + */ |
|
473 | + public function column__REG_date(EE_Registration $item) |
|
474 | + { |
|
475 | + $this->_set_related_details($item); |
|
476 | + // Build row actions |
|
477 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
478 | + [ |
|
479 | + 'action' => 'view_transaction', |
|
480 | + 'TXN_ID' => $this->_transaction_details['id'], |
|
481 | + ], |
|
482 | + TXN_ADMIN_URL |
|
483 | + ); |
|
484 | + $view_link = EE_Registry::instance()->CAP->current_user_can( |
|
485 | + 'ee_read_transaction', |
|
486 | + 'espresso_transactions_view_transaction' |
|
487 | + ) |
|
488 | + ? '<a class="ee-status-color-' |
|
489 | + . $this->_transaction_details['status'] |
|
490 | + . '" href="' |
|
491 | + . $view_lnk_url |
|
492 | + . '" title="' |
|
493 | + . esc_attr($this->_transaction_details['title_attr']) |
|
494 | + . '">' |
|
495 | + . $item->get_i18n_datetime('REG_date') |
|
496 | + . '</a>' |
|
497 | + : $item->get_i18n_datetime('REG_date'); |
|
498 | + $view_link .= '<br><span class="ee-status-text-small">' |
|
499 | + . EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence') |
|
500 | + . '</span>'; |
|
501 | + return $view_link; |
|
502 | + } |
|
503 | + |
|
504 | + |
|
505 | + /** |
|
506 | + * @param EE_Registration $item |
|
507 | + * @return string |
|
508 | + * @throws EE_Error |
|
509 | + * @throws InvalidArgumentException |
|
510 | + * @throws InvalidDataTypeException |
|
511 | + * @throws InvalidInterfaceException |
|
512 | + * @throws ReflectionException |
|
513 | + */ |
|
514 | + public function column_event_name(EE_Registration $item) |
|
515 | + { |
|
516 | + $this->_set_related_details($item); |
|
517 | + // page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62 |
|
518 | + $EVT_ID = $item->event_ID(); |
|
519 | + $event_name = $item->event_name(); |
|
520 | + $event_name = |
|
521 | + $event_name |
|
522 | + ?: esc_html__("No Associated Event", 'event_espresso'); |
|
523 | + $event_name = wp_trim_words($event_name, 30, '...'); |
|
524 | + if ($EVT_ID) { |
|
525 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( |
|
526 | + ['action' => 'edit', 'post' => $EVT_ID], |
|
527 | + EVENTS_ADMIN_URL |
|
528 | + ); |
|
529 | + $edit_event = |
|
530 | + EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $EVT_ID) |
|
531 | + ? '<a class="ee-status-color-' |
|
532 | + . $this->_event_details['status'] |
|
533 | + . '" href="' |
|
534 | + . $edit_event_url |
|
535 | + . '" title="' |
|
536 | + . esc_attr($this->_event_details['title_attr']) |
|
537 | + . '">' |
|
538 | + . $event_name |
|
539 | + . '</a>' |
|
540 | + : $event_name; |
|
541 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(['event_id' => $EVT_ID], REG_ADMIN_URL); |
|
542 | + $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="'; |
|
543 | + $actions['event_filter'] .= sprintf( |
|
544 | + esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), |
|
545 | + $event_name |
|
546 | + ); |
|
547 | + $actions['event_filter'] .= '">' . esc_html__('View Registrations', 'event_espresso') . '</a>'; |
|
548 | + } else { |
|
549 | + $edit_event = $event_name; |
|
550 | + $actions['event_filter'] = ''; |
|
551 | + } |
|
552 | + return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions)); |
|
553 | + } |
|
554 | + |
|
555 | + |
|
556 | + /** |
|
557 | + * @param EE_Registration $item |
|
558 | + * @return string |
|
559 | + * @throws EE_Error |
|
560 | + * @throws InvalidArgumentException |
|
561 | + * @throws InvalidDataTypeException |
|
562 | + * @throws InvalidInterfaceException |
|
563 | + * @throws ReflectionException |
|
564 | + */ |
|
565 | + public function column_DTT_EVT_start(EE_Registration $item) |
|
566 | + { |
|
567 | + $datetime_strings = []; |
|
568 | + $ticket = $item->ticket(); |
|
569 | + if ($ticket instanceof EE_Ticket) { |
|
570 | + $remove_defaults = ['default_where_conditions' => 'none']; |
|
571 | + $datetimes = $ticket->datetimes($remove_defaults); |
|
572 | + foreach ($datetimes as $datetime) { |
|
573 | + $datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
574 | + } |
|
575 | + return $this->generateDisplayForDatetimes($datetime_strings); |
|
576 | + } |
|
577 | + return esc_html__('There is no ticket on this registration', 'event_espresso'); |
|
578 | + } |
|
579 | + |
|
580 | + |
|
581 | + /** |
|
582 | + * Receives an array of datetime strings to display and converts them to the html container for the column. |
|
583 | + * |
|
584 | + * @param array $datetime_strings |
|
585 | + * @return string |
|
586 | + */ |
|
587 | + public function generateDisplayForDateTimes(array $datetime_strings) |
|
588 | + { |
|
589 | + $content = '<div class="ee-registration-event-datetimes-container">'; |
|
590 | + $expand_toggle = count($datetime_strings) > 1 |
|
591 | + ? ' <span title="' . esc_attr__('Click to view all dates', 'event_espresso') |
|
592 | + . '" class="ee-js ee-more-datetimes-toggle dashicons dashicons-plus"></span>' |
|
593 | + : ''; |
|
594 | + // get first item for initial visibility |
|
595 | + $content .= '<div class="left">' . array_shift($datetime_strings) . '</div>'; |
|
596 | + $content .= $expand_toggle; |
|
597 | + if ($datetime_strings) { |
|
598 | + $content .= '<div style="clear:both"></div>'; |
|
599 | + $content .= '<div class="ee-registration-event-datetimes-container more-items hidden">'; |
|
600 | + $content .= implode("<br />", $datetime_strings); |
|
601 | + $content .= '</div>'; |
|
602 | + } |
|
603 | + $content .= '</div>'; |
|
604 | + return $content; |
|
605 | + } |
|
606 | + |
|
607 | + |
|
608 | + /** |
|
609 | + * @param EE_Registration $item |
|
610 | + * @return string |
|
611 | + * @throws EE_Error |
|
612 | + * @throws InvalidArgumentException |
|
613 | + * @throws InvalidDataTypeException |
|
614 | + * @throws InvalidInterfaceException |
|
615 | + * @throws ReflectionException |
|
616 | + */ |
|
617 | + public function column_ATT_fname(EE_Registration $item) |
|
618 | + { |
|
619 | + $attendee = $item->attendee(); |
|
620 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
621 | + [ |
|
622 | + 'action' => 'view_registration', |
|
623 | + '_REG_ID' => $item->ID(), |
|
624 | + ], |
|
625 | + REG_ADMIN_URL |
|
626 | + ); |
|
627 | + $attendee_name = $attendee instanceof EE_Attendee |
|
628 | + ? $attendee->full_name() |
|
629 | + : ''; |
|
630 | + $link = EE_Registry::instance()->CAP->current_user_can( |
|
631 | + 'ee_read_registration', |
|
632 | + 'espresso_registrations_view_registration', |
|
633 | + $item->ID() |
|
634 | + ) |
|
635 | + ? '<a href="' |
|
636 | + . $edit_lnk_url |
|
637 | + . '" title="' |
|
638 | + . esc_attr__('View Registration Details', 'event_espresso') |
|
639 | + . '">' |
|
640 | + . $attendee_name |
|
641 | + . '</a>' |
|
642 | + : $attendee_name; |
|
643 | + $link .= $item->count() === 1 |
|
644 | + ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' |
|
645 | + : ''; |
|
646 | + $t = $item->get_first_related('Transaction'); |
|
647 | + $payment_count = $t instanceof EE_Transaction |
|
648 | + ? $t->count_related('Payment') |
|
649 | + : 0; |
|
650 | + // append group count to name |
|
651 | + $link .= ' ' . sprintf(esc_html__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
652 | + // append reg_code |
|
653 | + $link .= '<br>' . sprintf(esc_html__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
654 | + // reg status text for accessibility |
|
655 | + $link .= '<br><span class="ee-status-text-small">' |
|
656 | + . EEH_Template::pretty_status($item->status_ID(), false, 'sentence') |
|
657 | + . '</span>'; |
|
658 | + $action = ['_REG_ID' => $item->ID()]; |
|
659 | + if (isset($this->_req_data['event_id'])) { |
|
660 | + $action['event_id'] = $item->event_ID(); |
|
661 | + } |
|
662 | + // trash/restore/delete actions |
|
663 | + $actions = []; |
|
664 | + if ( |
|
665 | + $this->_view !== 'trash' |
|
666 | + && $payment_count === 0 |
|
667 | + && EE_Registry::instance()->CAP->current_user_can( |
|
668 | + 'ee_delete_registration', |
|
669 | + 'espresso_registrations_trash_registrations', |
|
670 | + $item->ID() |
|
671 | + ) |
|
672 | + ) { |
|
673 | + $action['action'] = 'trash_registrations'; |
|
674 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
675 | + $action, |
|
676 | + REG_ADMIN_URL |
|
677 | + ); |
|
678 | + $actions['trash'] = '<a href="' |
|
679 | + . $trash_lnk_url |
|
680 | + . '" title="' |
|
681 | + . esc_attr__('Trash Registration', 'event_espresso') |
|
682 | + . '">' . esc_html__('Trash', 'event_espresso') . '</a>'; |
|
683 | + } elseif ($this->_view === 'trash') { |
|
684 | + // restore registration link |
|
685 | + if ( |
|
686 | + EE_Registry::instance()->CAP->current_user_can( |
|
687 | + 'ee_delete_registration', |
|
688 | + 'espresso_registrations_restore_registrations', |
|
689 | + $item->ID() |
|
690 | + ) |
|
691 | + ) { |
|
692 | + $action['action'] = 'restore_registrations'; |
|
693 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
694 | + $action, |
|
695 | + REG_ADMIN_URL |
|
696 | + ); |
|
697 | + $actions['restore'] = '<a href="' |
|
698 | + . $restore_lnk_url |
|
699 | + . '" title="' |
|
700 | + . esc_attr__('Restore Registration', 'event_espresso') . '">' |
|
701 | + . esc_html__('Restore', 'event_espresso') . '</a>'; |
|
702 | + } |
|
703 | + if ( |
|
704 | + EE_Registry::instance()->CAP->current_user_can( |
|
705 | + 'ee_delete_registration', |
|
706 | + 'espresso_registrations_ee_delete_registrations', |
|
707 | + $item->ID() |
|
708 | + ) |
|
709 | + ) { |
|
710 | + $action['action'] = 'delete_registrations'; |
|
711 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
712 | + $action, |
|
713 | + REG_ADMIN_URL |
|
714 | + ); |
|
715 | + $actions['delete'] = '<a href="' |
|
716 | + . $delete_lnk_url |
|
717 | + . '" title="' |
|
718 | + . esc_attr__('Delete Registration Permanently', 'event_espresso') |
|
719 | + . '">' |
|
720 | + . esc_html__('Delete', 'event_espresso') |
|
721 | + . '</a>'; |
|
722 | + } |
|
723 | + } |
|
724 | + return sprintf('%1$s %2$s', $link, $this->row_actions($actions)); |
|
725 | + } |
|
726 | + |
|
727 | + |
|
728 | + /** |
|
729 | + * @param EE_Registration $item |
|
730 | + * @return string |
|
731 | + * @throws EE_Error |
|
732 | + * @throws InvalidArgumentException |
|
733 | + * @throws InvalidDataTypeException |
|
734 | + * @throws InvalidInterfaceException |
|
735 | + * @throws ReflectionException |
|
736 | + */ |
|
737 | + public function column_ATT_email(EE_Registration $item) |
|
738 | + { |
|
739 | + $attendee = $item->get_first_related('Attendee'); |
|
740 | + return ! $attendee instanceof EE_Attendee |
|
741 | + ? esc_html__('No attached contact record.', 'event_espresso') |
|
742 | + : $attendee->email(); |
|
743 | + } |
|
744 | + |
|
745 | + |
|
746 | + /** |
|
747 | + * @param EE_Registration $item |
|
748 | + * @return string |
|
749 | + */ |
|
750 | + public function column__REG_count(EE_Registration $item) |
|
751 | + { |
|
752 | + return sprintf(esc_html__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size()); |
|
753 | + } |
|
754 | + |
|
755 | + |
|
756 | + /** |
|
757 | + * @param EE_Registration $item |
|
758 | + * @return string |
|
759 | + * @throws EE_Error |
|
760 | + * @throws ReflectionException |
|
761 | + */ |
|
762 | + public function column_PRC_amount(EE_Registration $item) |
|
763 | + { |
|
764 | + $ticket = $item->ticket(); |
|
765 | + $req_data = $this->_admin_page->get_request_data(); |
|
766 | + $content = isset($req_data['event_id']) && $ticket instanceof EE_Ticket |
|
767 | + ? '<span class="TKT_name">' . $ticket->name() . '</span><br />' |
|
768 | + : ''; |
|
769 | + if ($item->final_price() > 0) { |
|
770 | + $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
771 | + } else { |
|
772 | + // free event |
|
773 | + $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' |
|
774 | + . esc_html__('free', 'event_espresso') |
|
775 | + . '</span>'; |
|
776 | + } |
|
777 | + return $content; |
|
778 | + } |
|
779 | + |
|
780 | + |
|
781 | + /** |
|
782 | + * @param EE_Registration $item |
|
783 | + * @return string |
|
784 | + * @throws EE_Error |
|
785 | + * @throws ReflectionException |
|
786 | + */ |
|
787 | + public function column__REG_final_price(EE_Registration $item) |
|
788 | + { |
|
789 | + $ticket = $item->ticket(); |
|
790 | + $req_data = $this->_admin_page->get_request_data(); |
|
791 | + $content = isset($req_data['event_id']) || ! $ticket instanceof EE_Ticket |
|
792 | + ? '' |
|
793 | + : '<span class="TKT_name">' . $ticket->name() . '</span><br />'; |
|
794 | + $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
795 | + return $content; |
|
796 | + } |
|
797 | + |
|
798 | + |
|
799 | + /** |
|
800 | + * @param EE_Registration $item |
|
801 | + * @return string |
|
802 | + * @throws EE_Error |
|
803 | + */ |
|
804 | + public function column__REG_paid(EE_Registration $item) |
|
805 | + { |
|
806 | + $payment_method = $item->payment_method(); |
|
807 | + $payment_method_name = $payment_method instanceof EE_Payment_Method |
|
808 | + ? $payment_method->admin_name() |
|
809 | + : esc_html__('Unknown', 'event_espresso'); |
|
810 | + $content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>'; |
|
811 | + if ($item->paid() > 0) { |
|
812 | + $content .= '<br><span class="ee-status-text-small">' |
|
813 | + . sprintf( |
|
814 | + esc_html__('...via %s', 'event_espresso'), |
|
815 | + $payment_method_name |
|
816 | + ) |
|
817 | + . '</span>'; |
|
818 | + } |
|
819 | + return $content; |
|
820 | + } |
|
821 | + |
|
822 | + |
|
823 | + /** |
|
824 | + * @param EE_Registration $item |
|
825 | + * @return string |
|
826 | + * @throws EE_Error |
|
827 | + * @throws EntityNotFoundException |
|
828 | + * @throws InvalidArgumentException |
|
829 | + * @throws InvalidDataTypeException |
|
830 | + * @throws InvalidInterfaceException |
|
831 | + * @throws ReflectionException |
|
832 | + */ |
|
833 | + public function column_TXN_total(EE_Registration $item) |
|
834 | + { |
|
835 | + if ($item->transaction()) { |
|
836 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
837 | + [ |
|
838 | + 'action' => 'view_transaction', |
|
839 | + 'TXN_ID' => $item->transaction_ID(), |
|
840 | + ], |
|
841 | + TXN_ADMIN_URL |
|
842 | + ); |
|
843 | + return EE_Registry::instance()->CAP->current_user_can( |
|
844 | + 'ee_read_transaction', |
|
845 | + 'espresso_transactions_view_transaction', |
|
846 | + $item->transaction_ID() |
|
847 | + ) |
|
848 | + ? '<span class="reg-pad-rght"><a class="status-' |
|
849 | + . $item->transaction()->status_ID() |
|
850 | + . '" href="' |
|
851 | + . $view_txn_lnk_url |
|
852 | + . '" title="' |
|
853 | + . esc_attr__('View Transaction', 'event_espresso') |
|
854 | + . '">' |
|
855 | + . $item->transaction()->pretty_total() |
|
856 | + . '</a></span>' |
|
857 | + : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>'; |
|
858 | + } else { |
|
859 | + return esc_html__("None", "event_espresso"); |
|
860 | + } |
|
861 | + } |
|
862 | + |
|
863 | + |
|
864 | + /** |
|
865 | + * @param EE_Registration $item |
|
866 | + * @return string |
|
867 | + * @throws EE_Error |
|
868 | + * @throws EntityNotFoundException |
|
869 | + * @throws InvalidArgumentException |
|
870 | + * @throws InvalidDataTypeException |
|
871 | + * @throws InvalidInterfaceException |
|
872 | + * @throws ReflectionException |
|
873 | + */ |
|
874 | + public function column_TXN_paid(EE_Registration $item) |
|
875 | + { |
|
876 | + if ($item->count() === 1) { |
|
877 | + $transaction = $item->transaction() |
|
878 | + ? $item->transaction() |
|
879 | + : EE_Transaction::new_instance(); |
|
880 | + if ($transaction->paid() >= $transaction->total()) { |
|
881 | + return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
|
882 | + } else { |
|
883 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
884 | + [ |
|
885 | + 'action' => 'view_transaction', |
|
886 | + 'TXN_ID' => $item->transaction_ID(), |
|
887 | + ], |
|
888 | + TXN_ADMIN_URL |
|
889 | + ); |
|
890 | + return EE_Registry::instance()->CAP->current_user_can( |
|
891 | + 'ee_read_transaction', |
|
892 | + 'espresso_transactions_view_transaction', |
|
893 | + $item->transaction_ID() |
|
894 | + ) |
|
895 | + ? '<span class="reg-pad-rght"><a class="status-' |
|
896 | + . $transaction->status_ID() |
|
897 | + . '" href="' |
|
898 | + . $view_txn_lnk_url |
|
899 | + . '" title="' |
|
900 | + . esc_attr__('View Transaction', 'event_espresso') |
|
901 | + . '">' |
|
902 | + . $item->transaction()->pretty_paid() |
|
903 | + . '</a><span>' |
|
904 | + : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
905 | + } |
|
906 | + } |
|
907 | + return ' '; |
|
908 | + } |
|
909 | + |
|
910 | + |
|
911 | + /** |
|
912 | + * column_actions |
|
913 | + * |
|
914 | + * @param EE_Registration $item |
|
915 | + * @return string |
|
916 | + * @throws EE_Error |
|
917 | + * @throws InvalidArgumentException |
|
918 | + * @throws InvalidDataTypeException |
|
919 | + * @throws InvalidInterfaceException |
|
920 | + * @throws ReflectionException |
|
921 | + */ |
|
922 | + public function column_actions(EE_Registration $item) |
|
923 | + { |
|
924 | + $actions = []; |
|
925 | + $attendee = $item->attendee(); |
|
926 | + $this->_set_related_details($item); |
|
927 | + |
|
928 | + // Build row actions |
|
929 | + if ( |
|
930 | + EE_Registry::instance()->CAP->current_user_can( |
|
931 | + 'ee_read_registration', |
|
932 | + 'espresso_registrations_view_registration', |
|
933 | + $item->ID() |
|
934 | + ) |
|
935 | + ) { |
|
936 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
937 | + [ |
|
938 | + 'action' => 'view_registration', |
|
939 | + '_REG_ID' => $item->ID(), |
|
940 | + ], |
|
941 | + REG_ADMIN_URL |
|
942 | + ); |
|
943 | + $actions['view_lnk'] = ' |
|
944 | 944 | <li> |
945 | 945 | <a href="' . $view_lnk_url . '" title="' |
946 | - . esc_attr__('View Registration Details', 'event_espresso') |
|
947 | - . '" class="tiny-text"> |
|
946 | + . esc_attr__('View Registration Details', 'event_espresso') |
|
947 | + . '" class="tiny-text"> |
|
948 | 948 | <div class="dashicons dashicons-clipboard"></div> |
949 | 949 | </a> |
950 | 950 | </li>'; |
951 | - } |
|
952 | - |
|
953 | - if ( |
|
954 | - $attendee instanceof EE_Attendee |
|
955 | - && EE_Registry::instance()->CAP->current_user_can( |
|
956 | - 'ee_edit_contacts', |
|
957 | - 'espresso_registrations_edit_attendee' |
|
958 | - ) |
|
959 | - ) { |
|
960 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
961 | - [ |
|
962 | - 'action' => 'edit_attendee', |
|
963 | - 'post' => $item->attendee_ID(), |
|
964 | - ], |
|
965 | - REG_ADMIN_URL |
|
966 | - ); |
|
967 | - $actions['edit_lnk'] = ' |
|
951 | + } |
|
952 | + |
|
953 | + if ( |
|
954 | + $attendee instanceof EE_Attendee |
|
955 | + && EE_Registry::instance()->CAP->current_user_can( |
|
956 | + 'ee_edit_contacts', |
|
957 | + 'espresso_registrations_edit_attendee' |
|
958 | + ) |
|
959 | + ) { |
|
960 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
961 | + [ |
|
962 | + 'action' => 'edit_attendee', |
|
963 | + 'post' => $item->attendee_ID(), |
|
964 | + ], |
|
965 | + REG_ADMIN_URL |
|
966 | + ); |
|
967 | + $actions['edit_lnk'] = ' |
|
968 | 968 | <li> |
969 | 969 | <a href="' . $edit_lnk_url . '" title="' |
970 | - . esc_attr__('Edit Contact Details', 'event_espresso') |
|
971 | - . '" class="tiny-text"> |
|
970 | + . esc_attr__('Edit Contact Details', 'event_espresso') |
|
971 | + . '" class="tiny-text"> |
|
972 | 972 | <div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div> |
973 | 973 | </a> |
974 | 974 | </li>'; |
975 | - } |
|
976 | - |
|
977 | - if ( |
|
978 | - $attendee instanceof EE_Attendee |
|
979 | - && EE_Registry::instance()->CAP->current_user_can( |
|
980 | - 'ee_send_message', |
|
981 | - 'espresso_registrations_resend_registration', |
|
982 | - $item->ID() |
|
983 | - ) |
|
984 | - ) { |
|
985 | - $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
986 | - [ |
|
987 | - 'action' => 'resend_registration', |
|
988 | - '_REG_ID' => $item->ID(), |
|
989 | - ], |
|
990 | - REG_ADMIN_URL, |
|
991 | - true |
|
992 | - ); |
|
993 | - $actions['resend_reg_lnk'] = ' |
|
975 | + } |
|
976 | + |
|
977 | + if ( |
|
978 | + $attendee instanceof EE_Attendee |
|
979 | + && EE_Registry::instance()->CAP->current_user_can( |
|
980 | + 'ee_send_message', |
|
981 | + 'espresso_registrations_resend_registration', |
|
982 | + $item->ID() |
|
983 | + ) |
|
984 | + ) { |
|
985 | + $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
986 | + [ |
|
987 | + 'action' => 'resend_registration', |
|
988 | + '_REG_ID' => $item->ID(), |
|
989 | + ], |
|
990 | + REG_ADMIN_URL, |
|
991 | + true |
|
992 | + ); |
|
993 | + $actions['resend_reg_lnk'] = ' |
|
994 | 994 | <li> |
995 | 995 | <a href="' . $resend_reg_lnk_url . '" title="' |
996 | - . esc_attr__('Resend Registration Details', 'event_espresso') |
|
997 | - . '" class="tiny-text"> |
|
996 | + . esc_attr__('Resend Registration Details', 'event_espresso') |
|
997 | + . '" class="tiny-text"> |
|
998 | 998 | <div class="dashicons dashicons-email-alt"></div> |
999 | 999 | </a> |
1000 | 1000 | </li>'; |
1001 | - } |
|
1002 | - |
|
1003 | - if ( |
|
1004 | - EE_Registry::instance()->CAP->current_user_can( |
|
1005 | - 'ee_read_transaction', |
|
1006 | - 'espresso_transactions_view_transaction', |
|
1007 | - $this->_transaction_details['id'] |
|
1008 | - ) |
|
1009 | - ) { |
|
1010 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
1011 | - [ |
|
1012 | - 'action' => 'view_transaction', |
|
1013 | - 'TXN_ID' => $this->_transaction_details['id'], |
|
1014 | - ], |
|
1015 | - TXN_ADMIN_URL |
|
1016 | - ); |
|
1017 | - $actions['view_txn_lnk'] = ' |
|
1001 | + } |
|
1002 | + |
|
1003 | + if ( |
|
1004 | + EE_Registry::instance()->CAP->current_user_can( |
|
1005 | + 'ee_read_transaction', |
|
1006 | + 'espresso_transactions_view_transaction', |
|
1007 | + $this->_transaction_details['id'] |
|
1008 | + ) |
|
1009 | + ) { |
|
1010 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
1011 | + [ |
|
1012 | + 'action' => 'view_transaction', |
|
1013 | + 'TXN_ID' => $this->_transaction_details['id'], |
|
1014 | + ], |
|
1015 | + TXN_ADMIN_URL |
|
1016 | + ); |
|
1017 | + $actions['view_txn_lnk'] = ' |
|
1018 | 1018 | <li> |
1019 | 1019 | <a class="ee-status-color-' . $this->_transaction_details['status'] |
1020 | - . ' tiny-text" href="' . $view_txn_lnk_url |
|
1021 | - . '" title="' . $this->_transaction_details['title_attr'] . '"> |
|
1020 | + . ' tiny-text" href="' . $view_txn_lnk_url |
|
1021 | + . '" title="' . $this->_transaction_details['title_attr'] . '"> |
|
1022 | 1022 | <div class="dashicons dashicons-cart"></div> |
1023 | 1023 | </a> |
1024 | 1024 | </li>'; |
1025 | - } |
|
1026 | - |
|
1027 | - // only show invoice link if message type is active. |
|
1028 | - if ( |
|
1029 | - $attendee instanceof EE_Attendee |
|
1030 | - && $item->is_primary_registrant() |
|
1031 | - && EEH_MSG_Template::is_mt_active('invoice') |
|
1032 | - ) { |
|
1033 | - $actions['dl_invoice_lnk'] = ' |
|
1025 | + } |
|
1026 | + |
|
1027 | + // only show invoice link if message type is active. |
|
1028 | + if ( |
|
1029 | + $attendee instanceof EE_Attendee |
|
1030 | + && $item->is_primary_registrant() |
|
1031 | + && EEH_MSG_Template::is_mt_active('invoice') |
|
1032 | + ) { |
|
1033 | + $actions['dl_invoice_lnk'] = ' |
|
1034 | 1034 | <li> |
1035 | 1035 | <a title="' . esc_attr__('View Transaction Invoice', 'event_espresso') |
1036 | - . '" target="_blank" href="' . $item->invoice_url() . '" class="tiny-text"> |
|
1036 | + . '" target="_blank" href="' . $item->invoice_url() . '" class="tiny-text"> |
|
1037 | 1037 | <span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span> |
1038 | 1038 | </a> |
1039 | 1039 | </li>'; |
1040 | - } |
|
1040 | + } |
|
1041 | 1041 | |
1042 | - // message list table link (filtered by REG_ID |
|
1043 | - if ( |
|
1044 | - EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages') |
|
1045 | - ) { |
|
1046 | - $actions['filtered_messages_link'] = ' |
|
1042 | + // message list table link (filtered by REG_ID |
|
1043 | + if ( |
|
1044 | + EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages') |
|
1045 | + ) { |
|
1046 | + $actions['filtered_messages_link'] = ' |
|
1047 | 1047 | <li> |
1048 | 1048 | ' . EEH_MSG_Template::get_message_action_link( |
1049 | - 'see_notifications_for', |
|
1050 | - null, |
|
1051 | - ['_REG_ID' => $item->ID()] |
|
1052 | - ) . ' |
|
1049 | + 'see_notifications_for', |
|
1050 | + null, |
|
1051 | + ['_REG_ID' => $item->ID()] |
|
1052 | + ) . ' |
|
1053 | 1053 | </li>'; |
1054 | - } |
|
1054 | + } |
|
1055 | 1055 | |
1056 | - $actions = apply_filters('FHEE__EE_Registrations_List_Table__column_actions__actions', $actions, $item, $this); |
|
1057 | - return $this->_action_string(implode('', $actions), $item, 'ul', 'reg-overview-actions-ul'); |
|
1058 | - } |
|
1056 | + $actions = apply_filters('FHEE__EE_Registrations_List_Table__column_actions__actions', $actions, $item, $this); |
|
1057 | + return $this->_action_string(implode('', $actions), $item, 'ul', 'reg-overview-actions-ul'); |
|
1058 | + } |
|
1059 | 1059 | } |
@@ -48,10 +48,10 @@ discard block |
||
48 | 48 | public function __construct(Registrations_Admin_Page $admin_page) |
49 | 49 | { |
50 | 50 | $req_data = $admin_page->get_request_data(); |
51 | - if (! empty($req_data['event_id'])) { |
|
51 | + if ( ! empty($req_data['event_id'])) { |
|
52 | 52 | $extra_query_args = []; |
53 | 53 | foreach ($admin_page->get_views() as $view_details) { |
54 | - $extra_query_args[ $view_details['slug'] ] = ['event_id' => $req_data['event_id']]; |
|
54 | + $extra_query_args[$view_details['slug']] = ['event_id' => $req_data['event_id']]; |
|
55 | 55 | } |
56 | 56 | $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args); |
57 | 57 | } |
@@ -83,13 +83,13 @@ discard block |
||
83 | 83 | 'ajax' => true, |
84 | 84 | 'screen' => $this->_admin_page->get_current_screen()->id, |
85 | 85 | ]; |
86 | - $ID_column_name = esc_html__('ID', 'event_espresso'); |
|
86 | + $ID_column_name = esc_html__('ID', 'event_espresso'); |
|
87 | 87 | $ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">'; |
88 | 88 | $ID_column_name .= esc_html__('Registrant Name', 'event_espresso'); |
89 | 89 | $ID_column_name .= '</span> '; |
90 | - $req_data = $this->_admin_page->get_request_data(); |
|
90 | + $req_data = $this->_admin_page->get_request_data(); |
|
91 | 91 | if (isset($req_data['event_id'])) { |
92 | - $this->_columns = [ |
|
92 | + $this->_columns = [ |
|
93 | 93 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
94 | 94 | '_REG_ID' => $ID_column_name, |
95 | 95 | 'ATT_fname' => esc_html__('Name', 'event_espresso'), |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $this->_bottom_buttons['report'] = $route_details; |
116 | 116 | } |
117 | 117 | } else { |
118 | - $this->_columns = [ |
|
118 | + $this->_columns = [ |
|
119 | 119 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
120 | 120 | '_REG_ID' => $ID_column_name, |
121 | 121 | 'ATT_fname' => esc_html__('Name', 'event_espresso'), |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | } |
138 | 138 | $this->_primary_column = '_REG_ID'; |
139 | 139 | $this->_sortable_columns = [ |
140 | - '_REG_date' => ['_REG_date' => true], // true means its already sorted |
|
140 | + '_REG_date' => ['_REG_date' => true], // true means its already sorted |
|
141 | 141 | /** |
142 | 142 | * Allows users to change the default sort if they wish. |
143 | 143 | * Returning a falsey on this filter will result in the default sort to be by firstname rather than last |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | 'DTT_EVT_start' => ['DTT_EVT_start' => false], |
155 | 155 | '_REG_ID' => ['_REG_ID' => false], |
156 | 156 | ]; |
157 | - $this->_hidden_columns = []; |
|
157 | + $this->_hidden_columns = []; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | { |
170 | 170 | $class = parent::_get_row_class($item); |
171 | 171 | // add status class |
172 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
172 | + $class .= ' ee-status-strip reg-status-'.$item->status_ID(); |
|
173 | 173 | if ($this->_has_checkbox_column) { |
174 | 174 | $class .= ' has-checkbox-column'; |
175 | 175 | } |
@@ -343,14 +343,14 @@ discard block |
||
343 | 343 | $this_month_r = date('m', current_time('timestamp')); |
344 | 344 | $days_this_month = date('t', current_time('timestamp')); |
345 | 345 | // setup date query. |
346 | - $beginning_string = EEM_Registration::instance()->convert_datetime_for_query( |
|
346 | + $beginning_string = EEM_Registration::instance()->convert_datetime_for_query( |
|
347 | 347 | 'REG_date', |
348 | - $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, |
|
348 | + $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, |
|
349 | 349 | 'Y-m-d H:i:s' |
350 | 350 | ); |
351 | - $end_string = EEM_Registration::instance()->convert_datetime_for_query( |
|
351 | + $end_string = EEM_Registration::instance()->convert_datetime_for_query( |
|
352 | 352 | 'REG_date', |
353 | - $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, |
|
353 | + $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, |
|
354 | 354 | 'Y-m-d H:i:s' |
355 | 355 | ); |
356 | 356 | $_where['REG_date'] = [ |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | $end_string, |
361 | 361 | ], |
362 | 362 | ]; |
363 | - $_where['STS_ID'] = ['!=', EEM_Registration::status_id_incomplete]; |
|
363 | + $_where['STS_ID'] = ['!=', EEM_Registration::status_id_incomplete]; |
|
364 | 364 | return EEM_Registration::instance()->count([$_where]); |
365 | 365 | } |
366 | 366 | |
@@ -388,17 +388,17 @@ discard block |
||
388 | 388 | [ |
389 | 389 | EEM_Registration::instance()->convert_datetime_for_query( |
390 | 390 | 'REG_date', |
391 | - $current_date . $time_start, |
|
391 | + $current_date.$time_start, |
|
392 | 392 | 'Y-m-d H:i:s' |
393 | 393 | ), |
394 | 394 | EEM_Registration::instance()->convert_datetime_for_query( |
395 | 395 | 'REG_date', |
396 | - $current_date . $time_end, |
|
396 | + $current_date.$time_end, |
|
397 | 397 | 'Y-m-d H:i:s' |
398 | 398 | ), |
399 | 399 | ], |
400 | 400 | ]; |
401 | - $_where['STS_ID'] = ['!=', EEM_Registration::status_id_incomplete]; |
|
401 | + $_where['STS_ID'] = ['!=', EEM_Registration::status_id_incomplete]; |
|
402 | 402 | return EEM_Registration::instance()->count([$_where]); |
403 | 403 | } |
404 | 404 | |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | ], |
482 | 482 | TXN_ADMIN_URL |
483 | 483 | ); |
484 | - $view_link = EE_Registry::instance()->CAP->current_user_can( |
|
484 | + $view_link = EE_Registry::instance()->CAP->current_user_can( |
|
485 | 485 | 'ee_read_transaction', |
486 | 486 | 'espresso_transactions_view_transaction' |
487 | 487 | ) |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | . $item->get_i18n_datetime('REG_date') |
496 | 496 | . '</a>' |
497 | 497 | : $item->get_i18n_datetime('REG_date'); |
498 | - $view_link .= '<br><span class="ee-status-text-small">' |
|
498 | + $view_link .= '<br><span class="ee-status-text-small">' |
|
499 | 499 | . EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence') |
500 | 500 | . '</span>'; |
501 | 501 | return $view_link; |
@@ -522,11 +522,11 @@ discard block |
||
522 | 522 | ?: esc_html__("No Associated Event", 'event_espresso'); |
523 | 523 | $event_name = wp_trim_words($event_name, 30, '...'); |
524 | 524 | if ($EVT_ID) { |
525 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( |
|
525 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( |
|
526 | 526 | ['action' => 'edit', 'post' => $EVT_ID], |
527 | 527 | EVENTS_ADMIN_URL |
528 | 528 | ); |
529 | - $edit_event = |
|
529 | + $edit_event = |
|
530 | 530 | EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $EVT_ID) |
531 | 531 | ? '<a class="ee-status-color-' |
532 | 532 | . $this->_event_details['status'] |
@@ -539,12 +539,12 @@ discard block |
||
539 | 539 | . '</a>' |
540 | 540 | : $event_name; |
541 | 541 | $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(['event_id' => $EVT_ID], REG_ADMIN_URL); |
542 | - $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="'; |
|
542 | + $actions['event_filter'] = '<a href="'.$edit_event_url.'" title="'; |
|
543 | 543 | $actions['event_filter'] .= sprintf( |
544 | 544 | esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), |
545 | 545 | $event_name |
546 | 546 | ); |
547 | - $actions['event_filter'] .= '">' . esc_html__('View Registrations', 'event_espresso') . '</a>'; |
|
547 | + $actions['event_filter'] .= '">'.esc_html__('View Registrations', 'event_espresso').'</a>'; |
|
548 | 548 | } else { |
549 | 549 | $edit_event = $event_name; |
550 | 550 | $actions['event_filter'] = ''; |
@@ -588,11 +588,11 @@ discard block |
||
588 | 588 | { |
589 | 589 | $content = '<div class="ee-registration-event-datetimes-container">'; |
590 | 590 | $expand_toggle = count($datetime_strings) > 1 |
591 | - ? ' <span title="' . esc_attr__('Click to view all dates', 'event_espresso') |
|
591 | + ? ' <span title="'.esc_attr__('Click to view all dates', 'event_espresso') |
|
592 | 592 | . '" class="ee-js ee-more-datetimes-toggle dashicons dashicons-plus"></span>' |
593 | 593 | : ''; |
594 | 594 | // get first item for initial visibility |
595 | - $content .= '<div class="left">' . array_shift($datetime_strings) . '</div>'; |
|
595 | + $content .= '<div class="left">'.array_shift($datetime_strings).'</div>'; |
|
596 | 596 | $content .= $expand_toggle; |
597 | 597 | if ($datetime_strings) { |
598 | 598 | $content .= '<div style="clear:both"></div>'; |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | . $attendee_name |
641 | 641 | . '</a>' |
642 | 642 | : $attendee_name; |
643 | - $link .= $item->count() === 1 |
|
643 | + $link .= $item->count() === 1 |
|
644 | 644 | ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' |
645 | 645 | : ''; |
646 | 646 | $t = $item->get_first_related('Transaction'); |
@@ -648,11 +648,11 @@ discard block |
||
648 | 648 | ? $t->count_related('Payment') |
649 | 649 | : 0; |
650 | 650 | // append group count to name |
651 | - $link .= ' ' . sprintf(esc_html__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
651 | + $link .= ' '.sprintf(esc_html__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
652 | 652 | // append reg_code |
653 | - $link .= '<br>' . sprintf(esc_html__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
653 | + $link .= '<br>'.sprintf(esc_html__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
654 | 654 | // reg status text for accessibility |
655 | - $link .= '<br><span class="ee-status-text-small">' |
|
655 | + $link .= '<br><span class="ee-status-text-small">' |
|
656 | 656 | . EEH_Template::pretty_status($item->status_ID(), false, 'sentence') |
657 | 657 | . '</span>'; |
658 | 658 | $action = ['_REG_ID' => $item->ID()]; |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | . $trash_lnk_url |
680 | 680 | . '" title="' |
681 | 681 | . esc_attr__('Trash Registration', 'event_espresso') |
682 | - . '">' . esc_html__('Trash', 'event_espresso') . '</a>'; |
|
682 | + . '">'.esc_html__('Trash', 'event_espresso').'</a>'; |
|
683 | 683 | } elseif ($this->_view === 'trash') { |
684 | 684 | // restore registration link |
685 | 685 | if ( |
@@ -697,8 +697,8 @@ discard block |
||
697 | 697 | $actions['restore'] = '<a href="' |
698 | 698 | . $restore_lnk_url |
699 | 699 | . '" title="' |
700 | - . esc_attr__('Restore Registration', 'event_espresso') . '">' |
|
701 | - . esc_html__('Restore', 'event_espresso') . '</a>'; |
|
700 | + . esc_attr__('Restore Registration', 'event_espresso').'">' |
|
701 | + . esc_html__('Restore', 'event_espresso').'</a>'; |
|
702 | 702 | } |
703 | 703 | if ( |
704 | 704 | EE_Registry::instance()->CAP->current_user_can( |
@@ -764,10 +764,10 @@ discard block |
||
764 | 764 | $ticket = $item->ticket(); |
765 | 765 | $req_data = $this->_admin_page->get_request_data(); |
766 | 766 | $content = isset($req_data['event_id']) && $ticket instanceof EE_Ticket |
767 | - ? '<span class="TKT_name">' . $ticket->name() . '</span><br />' |
|
767 | + ? '<span class="TKT_name">'.$ticket->name().'</span><br />' |
|
768 | 768 | : ''; |
769 | 769 | if ($item->final_price() > 0) { |
770 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
770 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>'; |
|
771 | 771 | } else { |
772 | 772 | // free event |
773 | 773 | $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' |
@@ -790,8 +790,8 @@ discard block |
||
790 | 790 | $req_data = $this->_admin_page->get_request_data(); |
791 | 791 | $content = isset($req_data['event_id']) || ! $ticket instanceof EE_Ticket |
792 | 792 | ? '' |
793 | - : '<span class="TKT_name">' . $ticket->name() . '</span><br />'; |
|
794 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
793 | + : '<span class="TKT_name">'.$ticket->name().'</span><br />'; |
|
794 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>'; |
|
795 | 795 | return $content; |
796 | 796 | } |
797 | 797 | |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | $payment_method_name = $payment_method instanceof EE_Payment_Method |
808 | 808 | ? $payment_method->admin_name() |
809 | 809 | : esc_html__('Unknown', 'event_espresso'); |
810 | - $content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>'; |
|
810 | + $content = '<span class="reg-pad-rght">'.$item->pretty_paid().'</span>'; |
|
811 | 811 | if ($item->paid() > 0) { |
812 | 812 | $content .= '<br><span class="ee-status-text-small">' |
813 | 813 | . sprintf( |
@@ -854,7 +854,7 @@ discard block |
||
854 | 854 | . '">' |
855 | 855 | . $item->transaction()->pretty_total() |
856 | 856 | . '</a></span>' |
857 | - : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>'; |
|
857 | + : '<span class="reg-pad-rght">'.$item->transaction()->pretty_total().'</span>'; |
|
858 | 858 | } else { |
859 | 859 | return esc_html__("None", "event_espresso"); |
860 | 860 | } |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | . '">' |
902 | 902 | . $item->transaction()->pretty_paid() |
903 | 903 | . '</a><span>' |
904 | - : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
904 | + : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>'; |
|
905 | 905 | } |
906 | 906 | } |
907 | 907 | return ' '; |
@@ -942,7 +942,7 @@ discard block |
||
942 | 942 | ); |
943 | 943 | $actions['view_lnk'] = ' |
944 | 944 | <li> |
945 | - <a href="' . $view_lnk_url . '" title="' |
|
945 | + <a href="' . $view_lnk_url.'" title="' |
|
946 | 946 | . esc_attr__('View Registration Details', 'event_espresso') |
947 | 947 | . '" class="tiny-text"> |
948 | 948 | <div class="dashicons dashicons-clipboard"></div> |
@@ -966,7 +966,7 @@ discard block |
||
966 | 966 | ); |
967 | 967 | $actions['edit_lnk'] = ' |
968 | 968 | <li> |
969 | - <a href="' . $edit_lnk_url . '" title="' |
|
969 | + <a href="' . $edit_lnk_url.'" title="' |
|
970 | 970 | . esc_attr__('Edit Contact Details', 'event_espresso') |
971 | 971 | . '" class="tiny-text"> |
972 | 972 | <div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div> |
@@ -992,7 +992,7 @@ discard block |
||
992 | 992 | ); |
993 | 993 | $actions['resend_reg_lnk'] = ' |
994 | 994 | <li> |
995 | - <a href="' . $resend_reg_lnk_url . '" title="' |
|
995 | + <a href="' . $resend_reg_lnk_url.'" title="' |
|
996 | 996 | . esc_attr__('Resend Registration Details', 'event_espresso') |
997 | 997 | . '" class="tiny-text"> |
998 | 998 | <div class="dashicons dashicons-email-alt"></div> |
@@ -1007,7 +1007,7 @@ discard block |
||
1007 | 1007 | $this->_transaction_details['id'] |
1008 | 1008 | ) |
1009 | 1009 | ) { |
1010 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
1010 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
1011 | 1011 | [ |
1012 | 1012 | 'action' => 'view_transaction', |
1013 | 1013 | 'TXN_ID' => $this->_transaction_details['id'], |
@@ -1017,8 +1017,8 @@ discard block |
||
1017 | 1017 | $actions['view_txn_lnk'] = ' |
1018 | 1018 | <li> |
1019 | 1019 | <a class="ee-status-color-' . $this->_transaction_details['status'] |
1020 | - . ' tiny-text" href="' . $view_txn_lnk_url |
|
1021 | - . '" title="' . $this->_transaction_details['title_attr'] . '"> |
|
1020 | + . ' tiny-text" href="'.$view_txn_lnk_url |
|
1021 | + . '" title="'.$this->_transaction_details['title_attr'].'"> |
|
1022 | 1022 | <div class="dashicons dashicons-cart"></div> |
1023 | 1023 | </a> |
1024 | 1024 | </li>'; |
@@ -1033,7 +1033,7 @@ discard block |
||
1033 | 1033 | $actions['dl_invoice_lnk'] = ' |
1034 | 1034 | <li> |
1035 | 1035 | <a title="' . esc_attr__('View Transaction Invoice', 'event_espresso') |
1036 | - . '" target="_blank" href="' . $item->invoice_url() . '" class="tiny-text"> |
|
1036 | + . '" target="_blank" href="'.$item->invoice_url().'" class="tiny-text"> |
|
1037 | 1037 | <span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span> |
1038 | 1038 | </a> |
1039 | 1039 | </li>'; |
@@ -1049,7 +1049,7 @@ discard block |
||
1049 | 1049 | 'see_notifications_for', |
1050 | 1050 | null, |
1051 | 1051 | ['_REG_ID' => $item->ID()] |
1052 | - ) . ' |
|
1052 | + ).' |
|
1053 | 1053 | </li>'; |
1054 | 1054 | } |
1055 | 1055 |