Completed
Branch ENH/remove-evt-column-from-evt... (1b5b62)
by
unknown
25:04 queued 17:22
created
admin/extend/registrations/EE_Event_Registrations_List_Table.class.php 2 patches
Indentation   +557 added lines, -557 removed lines patch added patch discarded remove patch
@@ -12,566 +12,566 @@
 block discarded – undo
12 12
 class EE_Event_Registrations_List_Table extends EE_Admin_List_Table
13 13
 {
14 14
 
15
-    /**
16
-     * This property will hold the related Datetimes on an event IF the event id is included in the request.
17
-     *
18
-     * @var EE_Datetime[]
19
-     */
20
-    protected $_dtts_for_event = array();
21
-
22
-
23
-    /**
24
-     * The event if one is specified in the request
25
-     *
26
-     * @var EE_Event
27
-     */
28
-    protected $_evt = null;
29
-
30
-
31
-    /**
32
-     * The DTT_ID if the current view has a specified datetime.
33
-     *
34
-     * @var int $_cur_dtt_id
35
-     */
36
-    protected $_cur_dtt_id = 0;
37
-
38
-
39
-    /**
40
-     * EE_Event_Registrations_List_Table constructor.
41
-     *
42
-     * @param \Registrations_Admin_Page $admin_page
43
-     */
44
-    public function __construct($admin_page)
45
-    {
46
-        parent::__construct($admin_page);
47
-        $this->_status = $this->_admin_page->get_registration_status_array();
48
-    }
49
-
50
-
51
-    protected function _setup_data()
52
-    {
53
-        $this->_data = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page)
54
-            : $this->_admin_page->get_event_attendees($this->_per_page, false, true);
55
-        $this->_all_data_count = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees(
56
-            $this->_per_page,
57
-            true
58
-        ) : $this->_admin_page->get_event_attendees($this->_per_page, true, true);
59
-    }
60
-
61
-
62
-    protected function _set_properties()
63
-    {
64
-        $evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null;
65
-        $this->_wp_list_args = array(
66
-            'singular' => __('registrant', 'event_espresso'),
67
-            'plural'   => __('registrants', 'event_espresso'),
68
-            'ajax'     => true,
69
-            'screen'   => $this->_admin_page->get_current_screen()->id,
70
-        );
71
-        $columns = array();
72
-        // $columns['_Reg_Status'] = '';
73
-        $this->_columns = array(
74
-            '_REG_att_checked_in' => '<span class="dashicons dashicons-yes ee-icon-size-18"></span>',
75
-            'ATT_name'            => __('Registrant', 'event_espresso'),
76
-            'ATT_email'           => __('Email Address', 'event_espresso'),
77
-            'Event'               => __('Event', 'event_espresso'),
78
-            'PRC_name'            => __('TKT Option', 'event_espresso'),
79
-            '_REG_final_price'    => __('Price', 'event_espresso'),
80
-            'TXN_paid'            => __('Paid', 'event_espresso'),
81
-            'TXN_total'           => __('Total', 'event_espresso'),
82
-        );
83
-        // Add/remove columns when an event has been selected
84
-        if (! empty($evt_id)) {
85
-            // Render a checkbox column
86
-            $columns['cb'] = '<input type="checkbox" />';
87
-            $this->_has_checkbox_column = true;
88
-            // Remove the 'Event' column
89
-            unset($this->_columns['Event']);
90
-        }
91
-        $this->_columns = array_merge($columns, $this->_columns);
92
-        $this->_primary_column = '_REG_att_checked_in';
93
-        if (! empty($evt_id)
94
-            && EE_Registry::instance()->CAP->current_user_can(
95
-                'ee_read_registrations',
96
-                'espresso_registrations_registrations_reports',
97
-                $evt_id
98
-            )
99
-        ) {
100
-            $this->_bottom_buttons = array(
101
-                'report' => array(
102
-                    'route'         => 'registrations_report',
103
-                    'extra_request' =>
104
-                        array(
105
-                            'EVT_ID'     => $evt_id,
106
-                            'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
107
-                        ),
108
-                ),
109
-            );
110
-        }
111
-        $this->_bottom_buttons['report_filtered'] = array(
112
-            'route'         => 'registrations_checkin_report',
113
-            'extra_request' => array(
114
-                'use_filters' => true,
115
-                'filters'     => array_merge(
116
-                    array(
117
-                        'EVT_ID' => $evt_id,
118
-                    ),
119
-                    array_diff_key(
120
-                        $this->_req_data,
121
-                        array_flip(
122
-                            array(
123
-                                'page',
124
-                                'action',
125
-                                'default_nonce',
126
-                            )
127
-                        )
128
-                    )
129
-                ),
130
-                'return_url'  => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
131
-            ),
132
-        );
133
-        $this->_sortable_columns = array(
134
-            /**
135
-             * Allows users to change the default sort if they wish.
136
-             * Returning a falsey on this filter will result in the default sort to be by firstname rather than last name.
137
-             *
138
-             * Note: usual naming conventions for filters aren't followed here so that just one filter can be used to
139
-             * change the sorts on any list table involving registration contacts.  If you want to only change the filter
140
-             * for a specific list table you can use the provided reference to this object instance.
141
-             */
142
-            'ATT_name' => array(
143
-                'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name',
144
-                true,
145
-                $this,
146
-            )
147
-                ? array('ATT_lname' => true)
148
-                : array('ATT_fname' => true),
149
-            'Event'    => array('Event.EVT_name' => false),
150
-        );
151
-        $this->_hidden_columns = array();
152
-        $this->_evt = EEM_Event::instance()->get_one_by_ID($evt_id);
153
-        $this->_dtts_for_event = $this->_evt instanceof EE_Event ? $this->_evt->datetimes_ordered() : array();
154
-    }
155
-
156
-
157
-    /**
158
-     * @param \EE_Registration $item
159
-     * @return string
160
-     */
161
-    protected function _get_row_class($item)
162
-    {
163
-        $class = parent::_get_row_class($item);
164
-        // add status class
165
-        $class .= ' ee-status-strip reg-status-' . $item->status_ID();
166
-        if ($this->_has_checkbox_column) {
167
-            $class .= ' has-checkbox-column';
168
-        }
169
-        return $class;
170
-    }
171
-
172
-
173
-    /**
174
-     * @return array
175
-     * @throws \EE_Error
176
-     */
177
-    protected function _get_table_filters()
178
-    {
179
-        $filters = $where = array();
180
-        $current_EVT_ID = isset($this->_req_data['event_id']) ? (int) $this->_req_data['event_id'] : 0;
181
-        if (empty($this->_dtts_for_event) || count($this->_dtts_for_event) === 1) {
182
-            // this means we don't have an event so let's setup a filter dropdown for all the events to select
183
-            // note possible capability restrictions
184
-            if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
185
-                $where['status**'] = array('!=', 'private');
186
-            }
187
-            if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
188
-                $where['EVT_wp_user'] = get_current_user_id();
189
-            }
190
-            $events = EEM_Event::instance()->get_all(
191
-                array(
192
-                    $where,
193
-                    'order_by' => array('Datetime.DTT_EVT_start' => 'DESC'),
194
-                )
195
-            );
196
-            $evts[] = array(
197
-                'id'   => 0,
198
-                'text' => __('To toggle Check-in status, select an event', 'event_espresso'),
199
-            );
200
-            $checked = 'checked';
201
-            /** @var EE_Event $evt */
202
-            foreach ($events as $evt) {
203
-                // any registrations for this event?
204
-                if (! $evt->get_count_of_all_registrations()) {
205
-                    continue;
206
-                }
207
-                $evts[] = array(
208
-                    'id'    => $evt->ID(),
209
-                    'text'  => apply_filters(
210
-                        'FHEE__EE_Event_Registrations___get_table_filters__event_name',
211
-                        $evt->get('EVT_name'),
212
-                        $evt
213
-                    ),
214
-                    'class' => $evt->is_expired() ? 'ee-expired-event' : '',
215
-                );
216
-                if ($evt->ID() === $current_EVT_ID && $evt->is_expired()) {
217
-                    $checked = '';
218
-                }
219
-            }
220
-            $event_filter = '<div class="ee-event-filter">';
221
-            $event_filter .= EEH_Form_Fields::select_input('event_id', $evts, $current_EVT_ID);
222
-            $event_filter .= '<span class="ee-event-filter-toggle">';
223
-            $event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" ' . $checked . '> ';
224
-            $event_filter .= __('Hide Expired Events', 'event_espresso');
225
-            $event_filter .= '</span>';
226
-            $event_filter .= '</div>';
227
-            $filters[] = $event_filter;
228
-        }
229
-        if (! empty($this->_dtts_for_event)) {
230
-            // DTT datetimes filter
231
-            $this->_cur_dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0;
232
-            if (count($this->_dtts_for_event) > 1) {
233
-                $dtts[0] = __('To toggle check-in status, select a datetime.', 'event_espresso');
234
-                foreach ($this->_dtts_for_event as $dtt) {
235
-                    $datetime_string = $dtt->name();
236
-                    $datetime_string = ! empty($datetime_string) ? ' (' . $datetime_string . ')' : '';
237
-                    $datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time() . $datetime_string;
238
-                    $dtts[ $dtt->ID() ] = $datetime_string;
239
-                }
240
-                $input = new EE_Select_Input(
241
-                    $dtts,
242
-                    array(
243
-                        'html_name' => 'DTT_ID',
244
-                        'html_id'   => 'DTT_ID',
245
-                        'default'   => $this->_cur_dtt_id,
246
-                    )
247
-                );
248
-                $filters[] = $input->get_html_for_input();
249
-                $filters[] = '<input type="hidden" name="event_id" value="' . $current_EVT_ID . '">';
250
-            }
251
-        }
252
-        return $filters;
253
-    }
254
-
255
-
256
-    protected function _add_view_counts()
257
-    {
258
-        $this->_views['all']['count'] = $this->_get_total_event_attendees();
259
-    }
260
-
261
-
262
-    /**
263
-     * @return int
264
-     * @throws \EE_Error
265
-     */
266
-    protected function _get_total_event_attendees()
267
-    {
268
-        $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
269
-        $DTT_ID = $this->_cur_dtt_id;
270
-        $query_params = array();
271
-        if ($EVT_ID) {
272
-            $query_params[0]['EVT_ID'] = $EVT_ID;
273
-        }
274
-        // if DTT is included we only show for that datetime.  Otherwise we're showing for all datetimes (the event).
275
-        if ($DTT_ID) {
276
-            $query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
277
-        }
278
-        $status_ids_array = apply_filters(
279
-            'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array',
280
-            array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)
281
-        );
282
-        $query_params[0]['STS_ID'] = array('IN', $status_ids_array);
283
-        return EEM_Registration::instance()->count($query_params);
284
-    }
285
-
286
-
287
-    /**
288
-     * @param \EE_Registration $item
289
-     * @return string
290
-     */
291
-    public function column__Reg_Status(EE_Registration $item)
292
-    {
293
-        return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>';
294
-    }
295
-
296
-
297
-    /**
298
-     * @param \EE_Registration $item
299
-     * @return string
300
-     * @throws \EE_Error
301
-     */
302
-    public function column_cb($item)
303
-    {
304
-        return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID());
305
-    }
306
-
307
-
308
-    /**
309
-     * column_REG_att_checked_in
310
-     *
311
-     * @param EE_Registration $item
312
-     * @return string
313
-     * @throws EE_Error
314
-     * @throws InvalidArgumentException
315
-     * @throws InvalidDataTypeException
316
-     * @throws InvalidInterfaceException
317
-     */
318
-    public function column__REG_att_checked_in(EE_Registration $item)
319
-    {
320
-        $attendee = $item->attendee();
321
-        $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
322
-
323
-        if ($this->_cur_dtt_id === 0 && count($this->_dtts_for_event) === 1) {
324
-            $latest_related_datetime = $item->get_latest_related_datetime();
325
-            if ($latest_related_datetime instanceof EE_Datetime) {
326
-                $this->_cur_dtt_id = $latest_related_datetime->ID();
327
-            }
328
-        }
329
-        $checkin_status_dashicon = CheckinStatusDashicon::fromRegistrationAndDatetimeId(
330
-            $item,
331
-            $this->_cur_dtt_id
332
-        );
333
-        $nonce = wp_create_nonce('checkin_nonce');
334
-        $toggle_active = ! empty($this->_cur_dtt_id)
335
-                         && EE_Registry::instance()->CAP->current_user_can(
336
-                             'ee_edit_checkin',
337
-                             'espresso_registrations_toggle_checkin_status',
338
-                             $item->ID()
339
-                         )
340
-            ? ' clickable trigger-checkin'
341
-            : '';
342
-        $mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';
343
-        return '<span class="' . $checkin_status_dashicon->cssClasses() . $toggle_active . '"'
344
-               . ' data-_regid="' . $item->ID() . '"'
345
-               . ' data-dttid="' . $this->_cur_dtt_id . '"'
346
-               . ' data-nonce="' . $nonce . '">'
347
-               . '</span>'
348
-               . $mobile_view_content;
349
-    }
350
-
351
-
352
-    /**
353
-     * @param \EE_Registration $item
354
-     * @return mixed|string|void
355
-     * @throws \EE_Error
356
-     */
357
-    public function column_ATT_name(EE_Registration $item)
358
-    {
359
-        $attendee = $item->attendee();
360
-        if (! $attendee instanceof EE_Attendee) {
361
-            return __('No contact record for this registration.', 'event_espresso');
362
-        }
363
-        // edit attendee link
364
-        $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
365
-            array('action' => 'view_registration', '_REG_ID' => $item->ID()),
366
-            REG_ADMIN_URL
367
-        );
368
-        $name_link = EE_Registry::instance()->CAP->current_user_can(
369
-            'ee_edit_contacts',
370
-            'espresso_registrations_edit_attendee'
371
-        )
372
-            ? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__('View Registration Details', 'event_espresso') . '">'
373
-              . $item->attendee()->full_name()
374
-              . '</a>'
375
-            : $item->attendee()->full_name();
376
-        $name_link .= $item->count() === 1
377
-            ? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>	'
378
-            : '';
379
-        // add group details
380
-        $name_link .= '&nbsp;' . sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size());
381
-        // add regcode
382
-        $link = EE_Admin_Page::add_query_args_and_nonce(
383
-            array('action' => 'view_registration', '_REG_ID' => $item->ID()),
384
-            REG_ADMIN_URL
385
-        );
386
-        $name_link .= '<br>';
387
-        $name_link .= EE_Registry::instance()->instance()->CAP->current_user_can(
388
-            'ee_read_registration',
389
-            'view_registration',
390
-            $item->ID()
391
-        )
392
-            ? '<a href="' . $link . '" title="' . esc_attr__('View Registration Details', 'event_espresso') . '">'
393
-              . $item->reg_code()
394
-              . '</a>'
395
-            : $item->reg_code();
396
-        // status
397
-        $name_link .= '<br><span class="ee-status-text-small">';
398
-        $name_link .= EEH_Template::pretty_status($item->status_ID(), false, 'sentence');
399
-        $name_link .= '</span>';
400
-        $actions = array();
401
-        $DTT_ID = $this->_cur_dtt_id;
402
-        $latest_related_datetime = empty($DTT_ID) && ! empty($this->_req_data['event_id']) && $item instanceof EE_Registration
403
-            ? $item->get_latest_related_datetime()
404
-            : null;
405
-        $DTT_ID = $latest_related_datetime instanceof EE_Datetime
406
-            ? $latest_related_datetime->ID()
407
-            : $DTT_ID;
408
-        if (! empty($DTT_ID)
409
-            && EE_Registry::instance()->CAP->current_user_can(
410
-                'ee_read_checkins',
411
-                'espresso_registrations_registration_checkins'
412
-            )
413
-        ) {
414
-            $checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(
415
-                array('action' => 'registration_checkins', '_REG_ID' => $item->ID(), 'DTT_ID' => $DTT_ID),
416
-                REG_ADMIN_URL
417
-            );
418
-            // get the timestamps for this registration's checkins, related to the selected datetime
419
-            $timestamps = $item->get_many_related('Checkin', array(array('DTT_ID' => $DTT_ID)));
420
-            if (! empty($timestamps)) {
421
-                // get the last timestamp
422
-                $last_timestamp = end($timestamps);
423
-                // checked in or checked out?
424
-                $checkin_status = $last_timestamp->get('CHK_in')
425
-                    ? esc_html__('Checked In', 'event_espresso')
426
-                    : esc_html__('Checked Out', 'event_espresso');
427
-                // get timestamp string
428
-                $timestamp_string = $last_timestamp->get_datetime('CHK_timestamp');
429
-                $actions['checkin'] = '<a href="' . $checkin_list_url . '" title="'
430
-                                      . esc_attr__(
431
-                                          'View this registrant\'s check-ins/checkouts for the datetime',
432
-                                          'event_espresso'
433
-                                      ) . '">' . $checkin_status . ': ' . $timestamp_string . '</a>';
434
-            }
435
-        }
436
-        return (! empty($DTT_ID) && ! empty($timestamps))
437
-            ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions, true))
438
-            : $name_link;
439
-    }
440
-
441
-
442
-    /**
443
-     * @param \EE_Registration $item
444
-     * @return string
445
-     */
446
-    public function column_ATT_email(EE_Registration $item)
447
-    {
448
-        $attendee = $item->attendee();
449
-        return $attendee instanceof EE_Attendee ? $attendee->email() : '';
450
-    }
451
-
452
-
453
-    /**
454
-     * @param \EE_Registration $item
455
-     * @return bool|string
456
-     * @throws \EE_Error
457
-     */
458
-    public function column_Event(EE_Registration $item)
459
-    {
460
-        try {
461
-            $event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event();
462
-            $chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
463
-                array('action' => 'event_registrations', 'event_id' => $event->ID()),
464
-                REG_ADMIN_URL
465
-            );
466
-            $event_label = EE_Registry::instance()->CAP->current_user_can(
467
-                'ee_read_checkins',
468
-                'espresso_registrations_registration_checkins'
469
-            ) ? '<a href="' . $chkin_lnk_url . '" title="'
470
-                . esc_attr__(
471
-                    'View Checkins for this Event',
472
-                    'event_espresso'
473
-                ) . '">' . $event->name() . '</a>' : $event->name();
474
-        } catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) {
475
-            $event_label = esc_html__('Unknown', 'event_espresso');
476
-        }
477
-        return $event_label;
478
-    }
479
-
480
-
481
-    /**
482
-     * @param \EE_Registration $item
483
-     * @return mixed|string|void
484
-     */
485
-    public function column_PRC_name(EE_Registration $item)
486
-    {
487
-        return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __("Unknown", "event_espresso");
488
-    }
489
-
490
-
491
-    /**
492
-     * column_REG_final_price
493
-     *
494
-     * @param \EE_Registration $item
495
-     * @return string
496
-     */
497
-    public function column__REG_final_price(EE_Registration $item)
498
-    {
499
-        return '<span class="reg-pad-rght">' . ' ' . $item->pretty_final_price() . '</span>';
500
-    }
501
-
502
-
503
-    /**
504
-     * column_TXN_paid
505
-     *
506
-     * @param \EE_Registration $item
507
-     * @return string
508
-     * @throws \EE_Error
509
-     */
510
-    public function column_TXN_paid(EE_Registration $item)
511
-    {
512
-        if ($item->count() === 1) {
513
-            if ($item->transaction()->paid() >= $item->transaction()->total()) {
514
-                return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
515
-            } else {
516
-                $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
517
-                    array('action' => 'view_transaction', 'TXN_ID' => $item->transaction_ID()),
518
-                    TXN_ADMIN_URL
519
-                );
520
-                return EE_Registry::instance()->CAP->current_user_can(
521
-                    'ee_read_transaction',
522
-                    'espresso_transactions_view_transaction'
523
-                ) ? '
15
+	/**
16
+	 * This property will hold the related Datetimes on an event IF the event id is included in the request.
17
+	 *
18
+	 * @var EE_Datetime[]
19
+	 */
20
+	protected $_dtts_for_event = array();
21
+
22
+
23
+	/**
24
+	 * The event if one is specified in the request
25
+	 *
26
+	 * @var EE_Event
27
+	 */
28
+	protected $_evt = null;
29
+
30
+
31
+	/**
32
+	 * The DTT_ID if the current view has a specified datetime.
33
+	 *
34
+	 * @var int $_cur_dtt_id
35
+	 */
36
+	protected $_cur_dtt_id = 0;
37
+
38
+
39
+	/**
40
+	 * EE_Event_Registrations_List_Table constructor.
41
+	 *
42
+	 * @param \Registrations_Admin_Page $admin_page
43
+	 */
44
+	public function __construct($admin_page)
45
+	{
46
+		parent::__construct($admin_page);
47
+		$this->_status = $this->_admin_page->get_registration_status_array();
48
+	}
49
+
50
+
51
+	protected function _setup_data()
52
+	{
53
+		$this->_data = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page)
54
+			: $this->_admin_page->get_event_attendees($this->_per_page, false, true);
55
+		$this->_all_data_count = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees(
56
+			$this->_per_page,
57
+			true
58
+		) : $this->_admin_page->get_event_attendees($this->_per_page, true, true);
59
+	}
60
+
61
+
62
+	protected function _set_properties()
63
+	{
64
+		$evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null;
65
+		$this->_wp_list_args = array(
66
+			'singular' => __('registrant', 'event_espresso'),
67
+			'plural'   => __('registrants', 'event_espresso'),
68
+			'ajax'     => true,
69
+			'screen'   => $this->_admin_page->get_current_screen()->id,
70
+		);
71
+		$columns = array();
72
+		// $columns['_Reg_Status'] = '';
73
+		$this->_columns = array(
74
+			'_REG_att_checked_in' => '<span class="dashicons dashicons-yes ee-icon-size-18"></span>',
75
+			'ATT_name'            => __('Registrant', 'event_espresso'),
76
+			'ATT_email'           => __('Email Address', 'event_espresso'),
77
+			'Event'               => __('Event', 'event_espresso'),
78
+			'PRC_name'            => __('TKT Option', 'event_espresso'),
79
+			'_REG_final_price'    => __('Price', 'event_espresso'),
80
+			'TXN_paid'            => __('Paid', 'event_espresso'),
81
+			'TXN_total'           => __('Total', 'event_espresso'),
82
+		);
83
+		// Add/remove columns when an event has been selected
84
+		if (! empty($evt_id)) {
85
+			// Render a checkbox column
86
+			$columns['cb'] = '<input type="checkbox" />';
87
+			$this->_has_checkbox_column = true;
88
+			// Remove the 'Event' column
89
+			unset($this->_columns['Event']);
90
+		}
91
+		$this->_columns = array_merge($columns, $this->_columns);
92
+		$this->_primary_column = '_REG_att_checked_in';
93
+		if (! empty($evt_id)
94
+			&& EE_Registry::instance()->CAP->current_user_can(
95
+				'ee_read_registrations',
96
+				'espresso_registrations_registrations_reports',
97
+				$evt_id
98
+			)
99
+		) {
100
+			$this->_bottom_buttons = array(
101
+				'report' => array(
102
+					'route'         => 'registrations_report',
103
+					'extra_request' =>
104
+						array(
105
+							'EVT_ID'     => $evt_id,
106
+							'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
107
+						),
108
+				),
109
+			);
110
+		}
111
+		$this->_bottom_buttons['report_filtered'] = array(
112
+			'route'         => 'registrations_checkin_report',
113
+			'extra_request' => array(
114
+				'use_filters' => true,
115
+				'filters'     => array_merge(
116
+					array(
117
+						'EVT_ID' => $evt_id,
118
+					),
119
+					array_diff_key(
120
+						$this->_req_data,
121
+						array_flip(
122
+							array(
123
+								'page',
124
+								'action',
125
+								'default_nonce',
126
+							)
127
+						)
128
+					)
129
+				),
130
+				'return_url'  => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
131
+			),
132
+		);
133
+		$this->_sortable_columns = array(
134
+			/**
135
+			 * Allows users to change the default sort if they wish.
136
+			 * Returning a falsey on this filter will result in the default sort to be by firstname rather than last name.
137
+			 *
138
+			 * Note: usual naming conventions for filters aren't followed here so that just one filter can be used to
139
+			 * change the sorts on any list table involving registration contacts.  If you want to only change the filter
140
+			 * for a specific list table you can use the provided reference to this object instance.
141
+			 */
142
+			'ATT_name' => array(
143
+				'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name',
144
+				true,
145
+				$this,
146
+			)
147
+				? array('ATT_lname' => true)
148
+				: array('ATT_fname' => true),
149
+			'Event'    => array('Event.EVT_name' => false),
150
+		);
151
+		$this->_hidden_columns = array();
152
+		$this->_evt = EEM_Event::instance()->get_one_by_ID($evt_id);
153
+		$this->_dtts_for_event = $this->_evt instanceof EE_Event ? $this->_evt->datetimes_ordered() : array();
154
+	}
155
+
156
+
157
+	/**
158
+	 * @param \EE_Registration $item
159
+	 * @return string
160
+	 */
161
+	protected function _get_row_class($item)
162
+	{
163
+		$class = parent::_get_row_class($item);
164
+		// add status class
165
+		$class .= ' ee-status-strip reg-status-' . $item->status_ID();
166
+		if ($this->_has_checkbox_column) {
167
+			$class .= ' has-checkbox-column';
168
+		}
169
+		return $class;
170
+	}
171
+
172
+
173
+	/**
174
+	 * @return array
175
+	 * @throws \EE_Error
176
+	 */
177
+	protected function _get_table_filters()
178
+	{
179
+		$filters = $where = array();
180
+		$current_EVT_ID = isset($this->_req_data['event_id']) ? (int) $this->_req_data['event_id'] : 0;
181
+		if (empty($this->_dtts_for_event) || count($this->_dtts_for_event) === 1) {
182
+			// this means we don't have an event so let's setup a filter dropdown for all the events to select
183
+			// note possible capability restrictions
184
+			if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
185
+				$where['status**'] = array('!=', 'private');
186
+			}
187
+			if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
188
+				$where['EVT_wp_user'] = get_current_user_id();
189
+			}
190
+			$events = EEM_Event::instance()->get_all(
191
+				array(
192
+					$where,
193
+					'order_by' => array('Datetime.DTT_EVT_start' => 'DESC'),
194
+				)
195
+			);
196
+			$evts[] = array(
197
+				'id'   => 0,
198
+				'text' => __('To toggle Check-in status, select an event', 'event_espresso'),
199
+			);
200
+			$checked = 'checked';
201
+			/** @var EE_Event $evt */
202
+			foreach ($events as $evt) {
203
+				// any registrations for this event?
204
+				if (! $evt->get_count_of_all_registrations()) {
205
+					continue;
206
+				}
207
+				$evts[] = array(
208
+					'id'    => $evt->ID(),
209
+					'text'  => apply_filters(
210
+						'FHEE__EE_Event_Registrations___get_table_filters__event_name',
211
+						$evt->get('EVT_name'),
212
+						$evt
213
+					),
214
+					'class' => $evt->is_expired() ? 'ee-expired-event' : '',
215
+				);
216
+				if ($evt->ID() === $current_EVT_ID && $evt->is_expired()) {
217
+					$checked = '';
218
+				}
219
+			}
220
+			$event_filter = '<div class="ee-event-filter">';
221
+			$event_filter .= EEH_Form_Fields::select_input('event_id', $evts, $current_EVT_ID);
222
+			$event_filter .= '<span class="ee-event-filter-toggle">';
223
+			$event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" ' . $checked . '> ';
224
+			$event_filter .= __('Hide Expired Events', 'event_espresso');
225
+			$event_filter .= '</span>';
226
+			$event_filter .= '</div>';
227
+			$filters[] = $event_filter;
228
+		}
229
+		if (! empty($this->_dtts_for_event)) {
230
+			// DTT datetimes filter
231
+			$this->_cur_dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0;
232
+			if (count($this->_dtts_for_event) > 1) {
233
+				$dtts[0] = __('To toggle check-in status, select a datetime.', 'event_espresso');
234
+				foreach ($this->_dtts_for_event as $dtt) {
235
+					$datetime_string = $dtt->name();
236
+					$datetime_string = ! empty($datetime_string) ? ' (' . $datetime_string . ')' : '';
237
+					$datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time() . $datetime_string;
238
+					$dtts[ $dtt->ID() ] = $datetime_string;
239
+				}
240
+				$input = new EE_Select_Input(
241
+					$dtts,
242
+					array(
243
+						'html_name' => 'DTT_ID',
244
+						'html_id'   => 'DTT_ID',
245
+						'default'   => $this->_cur_dtt_id,
246
+					)
247
+				);
248
+				$filters[] = $input->get_html_for_input();
249
+				$filters[] = '<input type="hidden" name="event_id" value="' . $current_EVT_ID . '">';
250
+			}
251
+		}
252
+		return $filters;
253
+	}
254
+
255
+
256
+	protected function _add_view_counts()
257
+	{
258
+		$this->_views['all']['count'] = $this->_get_total_event_attendees();
259
+	}
260
+
261
+
262
+	/**
263
+	 * @return int
264
+	 * @throws \EE_Error
265
+	 */
266
+	protected function _get_total_event_attendees()
267
+	{
268
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
269
+		$DTT_ID = $this->_cur_dtt_id;
270
+		$query_params = array();
271
+		if ($EVT_ID) {
272
+			$query_params[0]['EVT_ID'] = $EVT_ID;
273
+		}
274
+		// if DTT is included we only show for that datetime.  Otherwise we're showing for all datetimes (the event).
275
+		if ($DTT_ID) {
276
+			$query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
277
+		}
278
+		$status_ids_array = apply_filters(
279
+			'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array',
280
+			array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)
281
+		);
282
+		$query_params[0]['STS_ID'] = array('IN', $status_ids_array);
283
+		return EEM_Registration::instance()->count($query_params);
284
+	}
285
+
286
+
287
+	/**
288
+	 * @param \EE_Registration $item
289
+	 * @return string
290
+	 */
291
+	public function column__Reg_Status(EE_Registration $item)
292
+	{
293
+		return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>';
294
+	}
295
+
296
+
297
+	/**
298
+	 * @param \EE_Registration $item
299
+	 * @return string
300
+	 * @throws \EE_Error
301
+	 */
302
+	public function column_cb($item)
303
+	{
304
+		return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID());
305
+	}
306
+
307
+
308
+	/**
309
+	 * column_REG_att_checked_in
310
+	 *
311
+	 * @param EE_Registration $item
312
+	 * @return string
313
+	 * @throws EE_Error
314
+	 * @throws InvalidArgumentException
315
+	 * @throws InvalidDataTypeException
316
+	 * @throws InvalidInterfaceException
317
+	 */
318
+	public function column__REG_att_checked_in(EE_Registration $item)
319
+	{
320
+		$attendee = $item->attendee();
321
+		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
322
+
323
+		if ($this->_cur_dtt_id === 0 && count($this->_dtts_for_event) === 1) {
324
+			$latest_related_datetime = $item->get_latest_related_datetime();
325
+			if ($latest_related_datetime instanceof EE_Datetime) {
326
+				$this->_cur_dtt_id = $latest_related_datetime->ID();
327
+			}
328
+		}
329
+		$checkin_status_dashicon = CheckinStatusDashicon::fromRegistrationAndDatetimeId(
330
+			$item,
331
+			$this->_cur_dtt_id
332
+		);
333
+		$nonce = wp_create_nonce('checkin_nonce');
334
+		$toggle_active = ! empty($this->_cur_dtt_id)
335
+						 && EE_Registry::instance()->CAP->current_user_can(
336
+							 'ee_edit_checkin',
337
+							 'espresso_registrations_toggle_checkin_status',
338
+							 $item->ID()
339
+						 )
340
+			? ' clickable trigger-checkin'
341
+			: '';
342
+		$mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';
343
+		return '<span class="' . $checkin_status_dashicon->cssClasses() . $toggle_active . '"'
344
+			   . ' data-_regid="' . $item->ID() . '"'
345
+			   . ' data-dttid="' . $this->_cur_dtt_id . '"'
346
+			   . ' data-nonce="' . $nonce . '">'
347
+			   . '</span>'
348
+			   . $mobile_view_content;
349
+	}
350
+
351
+
352
+	/**
353
+	 * @param \EE_Registration $item
354
+	 * @return mixed|string|void
355
+	 * @throws \EE_Error
356
+	 */
357
+	public function column_ATT_name(EE_Registration $item)
358
+	{
359
+		$attendee = $item->attendee();
360
+		if (! $attendee instanceof EE_Attendee) {
361
+			return __('No contact record for this registration.', 'event_espresso');
362
+		}
363
+		// edit attendee link
364
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
365
+			array('action' => 'view_registration', '_REG_ID' => $item->ID()),
366
+			REG_ADMIN_URL
367
+		);
368
+		$name_link = EE_Registry::instance()->CAP->current_user_can(
369
+			'ee_edit_contacts',
370
+			'espresso_registrations_edit_attendee'
371
+		)
372
+			? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__('View Registration Details', 'event_espresso') . '">'
373
+			  . $item->attendee()->full_name()
374
+			  . '</a>'
375
+			: $item->attendee()->full_name();
376
+		$name_link .= $item->count() === 1
377
+			? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>	'
378
+			: '';
379
+		// add group details
380
+		$name_link .= '&nbsp;' . sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size());
381
+		// add regcode
382
+		$link = EE_Admin_Page::add_query_args_and_nonce(
383
+			array('action' => 'view_registration', '_REG_ID' => $item->ID()),
384
+			REG_ADMIN_URL
385
+		);
386
+		$name_link .= '<br>';
387
+		$name_link .= EE_Registry::instance()->instance()->CAP->current_user_can(
388
+			'ee_read_registration',
389
+			'view_registration',
390
+			$item->ID()
391
+		)
392
+			? '<a href="' . $link . '" title="' . esc_attr__('View Registration Details', 'event_espresso') . '">'
393
+			  . $item->reg_code()
394
+			  . '</a>'
395
+			: $item->reg_code();
396
+		// status
397
+		$name_link .= '<br><span class="ee-status-text-small">';
398
+		$name_link .= EEH_Template::pretty_status($item->status_ID(), false, 'sentence');
399
+		$name_link .= '</span>';
400
+		$actions = array();
401
+		$DTT_ID = $this->_cur_dtt_id;
402
+		$latest_related_datetime = empty($DTT_ID) && ! empty($this->_req_data['event_id']) && $item instanceof EE_Registration
403
+			? $item->get_latest_related_datetime()
404
+			: null;
405
+		$DTT_ID = $latest_related_datetime instanceof EE_Datetime
406
+			? $latest_related_datetime->ID()
407
+			: $DTT_ID;
408
+		if (! empty($DTT_ID)
409
+			&& EE_Registry::instance()->CAP->current_user_can(
410
+				'ee_read_checkins',
411
+				'espresso_registrations_registration_checkins'
412
+			)
413
+		) {
414
+			$checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(
415
+				array('action' => 'registration_checkins', '_REG_ID' => $item->ID(), 'DTT_ID' => $DTT_ID),
416
+				REG_ADMIN_URL
417
+			);
418
+			// get the timestamps for this registration's checkins, related to the selected datetime
419
+			$timestamps = $item->get_many_related('Checkin', array(array('DTT_ID' => $DTT_ID)));
420
+			if (! empty($timestamps)) {
421
+				// get the last timestamp
422
+				$last_timestamp = end($timestamps);
423
+				// checked in or checked out?
424
+				$checkin_status = $last_timestamp->get('CHK_in')
425
+					? esc_html__('Checked In', 'event_espresso')
426
+					: esc_html__('Checked Out', 'event_espresso');
427
+				// get timestamp string
428
+				$timestamp_string = $last_timestamp->get_datetime('CHK_timestamp');
429
+				$actions['checkin'] = '<a href="' . $checkin_list_url . '" title="'
430
+									  . esc_attr__(
431
+										  'View this registrant\'s check-ins/checkouts for the datetime',
432
+										  'event_espresso'
433
+									  ) . '">' . $checkin_status . ': ' . $timestamp_string . '</a>';
434
+			}
435
+		}
436
+		return (! empty($DTT_ID) && ! empty($timestamps))
437
+			? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions, true))
438
+			: $name_link;
439
+	}
440
+
441
+
442
+	/**
443
+	 * @param \EE_Registration $item
444
+	 * @return string
445
+	 */
446
+	public function column_ATT_email(EE_Registration $item)
447
+	{
448
+		$attendee = $item->attendee();
449
+		return $attendee instanceof EE_Attendee ? $attendee->email() : '';
450
+	}
451
+
452
+
453
+	/**
454
+	 * @param \EE_Registration $item
455
+	 * @return bool|string
456
+	 * @throws \EE_Error
457
+	 */
458
+	public function column_Event(EE_Registration $item)
459
+	{
460
+		try {
461
+			$event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event();
462
+			$chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
463
+				array('action' => 'event_registrations', 'event_id' => $event->ID()),
464
+				REG_ADMIN_URL
465
+			);
466
+			$event_label = EE_Registry::instance()->CAP->current_user_can(
467
+				'ee_read_checkins',
468
+				'espresso_registrations_registration_checkins'
469
+			) ? '<a href="' . $chkin_lnk_url . '" title="'
470
+				. esc_attr__(
471
+					'View Checkins for this Event',
472
+					'event_espresso'
473
+				) . '">' . $event->name() . '</a>' : $event->name();
474
+		} catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) {
475
+			$event_label = esc_html__('Unknown', 'event_espresso');
476
+		}
477
+		return $event_label;
478
+	}
479
+
480
+
481
+	/**
482
+	 * @param \EE_Registration $item
483
+	 * @return mixed|string|void
484
+	 */
485
+	public function column_PRC_name(EE_Registration $item)
486
+	{
487
+		return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __("Unknown", "event_espresso");
488
+	}
489
+
490
+
491
+	/**
492
+	 * column_REG_final_price
493
+	 *
494
+	 * @param \EE_Registration $item
495
+	 * @return string
496
+	 */
497
+	public function column__REG_final_price(EE_Registration $item)
498
+	{
499
+		return '<span class="reg-pad-rght">' . ' ' . $item->pretty_final_price() . '</span>';
500
+	}
501
+
502
+
503
+	/**
504
+	 * column_TXN_paid
505
+	 *
506
+	 * @param \EE_Registration $item
507
+	 * @return string
508
+	 * @throws \EE_Error
509
+	 */
510
+	public function column_TXN_paid(EE_Registration $item)
511
+	{
512
+		if ($item->count() === 1) {
513
+			if ($item->transaction()->paid() >= $item->transaction()->total()) {
514
+				return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
515
+			} else {
516
+				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
517
+					array('action' => 'view_transaction', 'TXN_ID' => $item->transaction_ID()),
518
+					TXN_ADMIN_URL
519
+				);
520
+				return EE_Registry::instance()->CAP->current_user_can(
521
+					'ee_read_transaction',
522
+					'espresso_transactions_view_transaction'
523
+				) ? '
524 524
 				<span class="reg-pad-rght">
525 525
 					<a class="status-'
526
-                    . $item->transaction()->status_ID()
527
-                    . '" href="'
528
-                    . $view_txn_lnk_url
529
-                    . '"  title="'
530
-                    . esc_attr__('View Transaction', 'event_espresso')
531
-                    . '">
526
+					. $item->transaction()->status_ID()
527
+					. '" href="'
528
+					. $view_txn_lnk_url
529
+					. '"  title="'
530
+					. esc_attr__('View Transaction', 'event_espresso')
531
+					. '">
532 532
 						'
533
-                    . $item->transaction()->pretty_paid()
534
-                    . '
533
+					. $item->transaction()->pretty_paid()
534
+					. '
535 535
 					</a>
536 536
 				<span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
537
-            }
538
-        } else {
539
-            return '<span class="reg-pad-rght"></span>';
540
-        }
541
-    }
542
-
543
-
544
-    /**
545
-     *        column_TXN_total
546
-     *
547
-     * @param \EE_Registration $item
548
-     * @return string
549
-     * @throws \EE_Error
550
-     */
551
-    public function column_TXN_total(EE_Registration $item)
552
-    {
553
-        $txn = $item->transaction();
554
-        $view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL);
555
-        if ($item->get('REG_count') === 1) {
556
-            $line_total_obj = $txn->total_line_item();
557
-            $txn_total = $line_total_obj instanceof EE_Line_Item
558
-                ? $line_total_obj->get_pretty('LIN_total')
559
-                : __(
560
-                    'View Transaction',
561
-                    'event_espresso'
562
-                );
563
-            return EE_Registry::instance()->CAP->current_user_can(
564
-                'ee_read_transaction',
565
-                'espresso_transactions_view_transaction'
566
-            ) ? '<a href="'
567
-                . $view_txn_url
568
-                . '" title="'
569
-                . esc_attr__('View Transaction', 'event_espresso')
570
-                . '"><span class="reg-pad-rght">'
571
-                . $txn_total
572
-                . '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
573
-        } else {
574
-            return '<span class="reg-pad-rght"></span>';
575
-        }
576
-    }
537
+			}
538
+		} else {
539
+			return '<span class="reg-pad-rght"></span>';
540
+		}
541
+	}
542
+
543
+
544
+	/**
545
+	 *        column_TXN_total
546
+	 *
547
+	 * @param \EE_Registration $item
548
+	 * @return string
549
+	 * @throws \EE_Error
550
+	 */
551
+	public function column_TXN_total(EE_Registration $item)
552
+	{
553
+		$txn = $item->transaction();
554
+		$view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL);
555
+		if ($item->get('REG_count') === 1) {
556
+			$line_total_obj = $txn->total_line_item();
557
+			$txn_total = $line_total_obj instanceof EE_Line_Item
558
+				? $line_total_obj->get_pretty('LIN_total')
559
+				: __(
560
+					'View Transaction',
561
+					'event_espresso'
562
+				);
563
+			return EE_Registry::instance()->CAP->current_user_can(
564
+				'ee_read_transaction',
565
+				'espresso_transactions_view_transaction'
566
+			) ? '<a href="'
567
+				. $view_txn_url
568
+				. '" title="'
569
+				. esc_attr__('View Transaction', 'event_espresso')
570
+				. '"><span class="reg-pad-rght">'
571
+				. $txn_total
572
+				. '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
573
+		} else {
574
+			return '<span class="reg-pad-rght"></span>';
575
+		}
576
+	}
577 577
 }
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             'TXN_total'           => __('Total', 'event_espresso'),
82 82
         );
83 83
         // Add/remove columns when an event has been selected
84
-        if (! empty($evt_id)) {
84
+        if ( ! empty($evt_id)) {
85 85
             // Render a checkbox column
86 86
             $columns['cb'] = '<input type="checkbox" />';
87 87
             $this->_has_checkbox_column = true;
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         }
91 91
         $this->_columns = array_merge($columns, $this->_columns);
92 92
         $this->_primary_column = '_REG_att_checked_in';
93
-        if (! empty($evt_id)
93
+        if ( ! empty($evt_id)
94 94
             && EE_Registry::instance()->CAP->current_user_can(
95 95
                 'ee_read_registrations',
96 96
                 'espresso_registrations_registrations_reports',
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
     {
163 163
         $class = parent::_get_row_class($item);
164 164
         // add status class
165
-        $class .= ' ee-status-strip reg-status-' . $item->status_ID();
165
+        $class .= ' ee-status-strip reg-status-'.$item->status_ID();
166 166
         if ($this->_has_checkbox_column) {
167 167
             $class .= ' has-checkbox-column';
168 168
         }
@@ -181,10 +181,10 @@  discard block
 block discarded – undo
181 181
         if (empty($this->_dtts_for_event) || count($this->_dtts_for_event) === 1) {
182 182
             // this means we don't have an event so let's setup a filter dropdown for all the events to select
183 183
             // note possible capability restrictions
184
-            if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
184
+            if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
185 185
                 $where['status**'] = array('!=', 'private');
186 186
             }
187
-            if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
187
+            if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
188 188
                 $where['EVT_wp_user'] = get_current_user_id();
189 189
             }
190 190
             $events = EEM_Event::instance()->get_all(
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
             /** @var EE_Event $evt */
202 202
             foreach ($events as $evt) {
203 203
                 // any registrations for this event?
204
-                if (! $evt->get_count_of_all_registrations()) {
204
+                if ( ! $evt->get_count_of_all_registrations()) {
205 205
                     continue;
206 206
                 }
207 207
                 $evts[] = array(
@@ -220,22 +220,22 @@  discard block
 block discarded – undo
220 220
             $event_filter = '<div class="ee-event-filter">';
221 221
             $event_filter .= EEH_Form_Fields::select_input('event_id', $evts, $current_EVT_ID);
222 222
             $event_filter .= '<span class="ee-event-filter-toggle">';
223
-            $event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" ' . $checked . '> ';
223
+            $event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" '.$checked.'> ';
224 224
             $event_filter .= __('Hide Expired Events', 'event_espresso');
225 225
             $event_filter .= '</span>';
226 226
             $event_filter .= '</div>';
227 227
             $filters[] = $event_filter;
228 228
         }
229
-        if (! empty($this->_dtts_for_event)) {
229
+        if ( ! empty($this->_dtts_for_event)) {
230 230
             // DTT datetimes filter
231 231
             $this->_cur_dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0;
232 232
             if (count($this->_dtts_for_event) > 1) {
233 233
                 $dtts[0] = __('To toggle check-in status, select a datetime.', 'event_espresso');
234 234
                 foreach ($this->_dtts_for_event as $dtt) {
235 235
                     $datetime_string = $dtt->name();
236
-                    $datetime_string = ! empty($datetime_string) ? ' (' . $datetime_string . ')' : '';
237
-                    $datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time() . $datetime_string;
238
-                    $dtts[ $dtt->ID() ] = $datetime_string;
236
+                    $datetime_string = ! empty($datetime_string) ? ' ('.$datetime_string.')' : '';
237
+                    $datetime_string = $dtt->start_date_and_time().' - '.$dtt->end_date_and_time().$datetime_string;
238
+                    $dtts[$dtt->ID()] = $datetime_string;
239 239
                 }
240 240
                 $input = new EE_Select_Input(
241 241
                     $dtts,
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
                     )
247 247
                 );
248 248
                 $filters[] = $input->get_html_for_input();
249
-                $filters[] = '<input type="hidden" name="event_id" value="' . $current_EVT_ID . '">';
249
+                $filters[] = '<input type="hidden" name="event_id" value="'.$current_EVT_ID.'">';
250 250
             }
251 251
         }
252 252
         return $filters;
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
      */
291 291
     public function column__Reg_Status(EE_Registration $item)
292 292
     {
293
-        return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>';
293
+        return '<span class="ee-status-strip ee-status-strip-td reg-status-'.$item->status_ID().'"></span>';
294 294
     }
295 295
 
296 296
 
@@ -339,11 +339,11 @@  discard block
 block discarded – undo
339 339
                          )
340 340
             ? ' clickable trigger-checkin'
341 341
             : '';
342
-        $mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';
343
-        return '<span class="' . $checkin_status_dashicon->cssClasses() . $toggle_active . '"'
344
-               . ' data-_regid="' . $item->ID() . '"'
345
-               . ' data-dttid="' . $this->_cur_dtt_id . '"'
346
-               . ' data-nonce="' . $nonce . '">'
342
+        $mobile_view_content = ' <span class="show-on-mobile-view-only">'.$attendee_name.'</span>';
343
+        return '<span class="'.$checkin_status_dashicon->cssClasses().$toggle_active.'"'
344
+               . ' data-_regid="'.$item->ID().'"'
345
+               . ' data-dttid="'.$this->_cur_dtt_id.'"'
346
+               . ' data-nonce="'.$nonce.'">'
347 347
                . '</span>'
348 348
                . $mobile_view_content;
349 349
     }
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
     public function column_ATT_name(EE_Registration $item)
358 358
     {
359 359
         $attendee = $item->attendee();
360
-        if (! $attendee instanceof EE_Attendee) {
360
+        if ( ! $attendee instanceof EE_Attendee) {
361 361
             return __('No contact record for this registration.', 'event_espresso');
362 362
         }
363 363
         // edit attendee link
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
             'ee_edit_contacts',
370 370
             'espresso_registrations_edit_attendee'
371 371
         )
372
-            ? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__('View Registration Details', 'event_espresso') . '">'
372
+            ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'
373 373
               . $item->attendee()->full_name()
374 374
               . '</a>'
375 375
             : $item->attendee()->full_name();
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
             ? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>	'
378 378
             : '';
379 379
         // add group details
380
-        $name_link .= '&nbsp;' . sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size());
380
+        $name_link .= '&nbsp;'.sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size());
381 381
         // add regcode
382 382
         $link = EE_Admin_Page::add_query_args_and_nonce(
383 383
             array('action' => 'view_registration', '_REG_ID' => $item->ID()),
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
             'view_registration',
390 390
             $item->ID()
391 391
         )
392
-            ? '<a href="' . $link . '" title="' . esc_attr__('View Registration Details', 'event_espresso') . '">'
392
+            ? '<a href="'.$link.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'
393 393
               . $item->reg_code()
394 394
               . '</a>'
395 395
             : $item->reg_code();
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
         $DTT_ID = $latest_related_datetime instanceof EE_Datetime
406 406
             ? $latest_related_datetime->ID()
407 407
             : $DTT_ID;
408
-        if (! empty($DTT_ID)
408
+        if ( ! empty($DTT_ID)
409 409
             && EE_Registry::instance()->CAP->current_user_can(
410 410
                 'ee_read_checkins',
411 411
                 'espresso_registrations_registration_checkins'
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
             );
418 418
             // get the timestamps for this registration's checkins, related to the selected datetime
419 419
             $timestamps = $item->get_many_related('Checkin', array(array('DTT_ID' => $DTT_ID)));
420
-            if (! empty($timestamps)) {
420
+            if ( ! empty($timestamps)) {
421 421
                 // get the last timestamp
422 422
                 $last_timestamp = end($timestamps);
423 423
                 // checked in or checked out?
@@ -426,14 +426,14 @@  discard block
 block discarded – undo
426 426
                     : esc_html__('Checked Out', 'event_espresso');
427 427
                 // get timestamp string
428 428
                 $timestamp_string = $last_timestamp->get_datetime('CHK_timestamp');
429
-                $actions['checkin'] = '<a href="' . $checkin_list_url . '" title="'
429
+                $actions['checkin'] = '<a href="'.$checkin_list_url.'" title="'
430 430
                                       . esc_attr__(
431 431
                                           'View this registrant\'s check-ins/checkouts for the datetime',
432 432
                                           'event_espresso'
433
-                                      ) . '">' . $checkin_status . ': ' . $timestamp_string . '</a>';
433
+                                      ).'">'.$checkin_status.': '.$timestamp_string.'</a>';
434 434
             }
435 435
         }
436
-        return (! empty($DTT_ID) && ! empty($timestamps))
436
+        return ( ! empty($DTT_ID) && ! empty($timestamps))
437 437
             ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions, true))
438 438
             : $name_link;
439 439
     }
@@ -466,11 +466,11 @@  discard block
 block discarded – undo
466 466
             $event_label = EE_Registry::instance()->CAP->current_user_can(
467 467
                 'ee_read_checkins',
468 468
                 'espresso_registrations_registration_checkins'
469
-            ) ? '<a href="' . $chkin_lnk_url . '" title="'
469
+            ) ? '<a href="'.$chkin_lnk_url.'" title="'
470 470
                 . esc_attr__(
471 471
                     'View Checkins for this Event',
472 472
                     'event_espresso'
473
-                ) . '">' . $event->name() . '</a>' : $event->name();
473
+                ).'">'.$event->name().'</a>' : $event->name();
474 474
         } catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) {
475 475
             $event_label = esc_html__('Unknown', 'event_espresso');
476 476
         }
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
      */
497 497
     public function column__REG_final_price(EE_Registration $item)
498 498
     {
499
-        return '<span class="reg-pad-rght">' . ' ' . $item->pretty_final_price() . '</span>';
499
+        return '<span class="reg-pad-rght">'.' '.$item->pretty_final_price().'</span>';
500 500
     }
501 501
 
502 502
 
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
                     . $item->transaction()->pretty_paid()
534 534
                     . '
535 535
 					</a>
536
-				<span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
536
+				<span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>';
537 537
             }
538 538
         } else {
539 539
             return '<span class="reg-pad-rght"></span>';
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
                 . esc_attr__('View Transaction', 'event_espresso')
570 570
                 . '"><span class="reg-pad-rght">'
571 571
                 . $txn_total
572
-                . '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
572
+                . '</span></a>' : '<span class="reg-pad-rght">'.$txn_total.'</span>';
573 573
         } else {
574 574
             return '<span class="reg-pad-rght"></span>';
575 575
         }
Please login to merge, or discard this patch.