@@ -16,689 +16,689 @@ |
||
16 | 16 | */ |
17 | 17 | class EE_Event_Registrations_List_Table extends EE_Admin_List_Table |
18 | 18 | { |
19 | - /** |
|
20 | - * @var RequestInterface |
|
21 | - */ |
|
22 | - protected $request; |
|
23 | - |
|
24 | - /** |
|
25 | - * @var Extend_Registrations_Admin_Page |
|
26 | - */ |
|
27 | - protected $_admin_page; |
|
28 | - |
|
29 | - /** |
|
30 | - * The event ID if one is specified in the request |
|
31 | - * |
|
32 | - * @var int |
|
33 | - */ |
|
34 | - protected $event_id = 0; |
|
35 | - |
|
36 | - /** |
|
37 | - * This property will hold the related Datetimes on an event IF the event id is included in the request. |
|
38 | - * |
|
39 | - * @var DatetimesForEventCheckIn |
|
40 | - */ |
|
41 | - protected $datetimes_for_event = []; |
|
42 | - |
|
43 | - /** |
|
44 | - * The DTT_ID if the current view has a specified datetime. |
|
45 | - * |
|
46 | - * @var int |
|
47 | - */ |
|
48 | - protected $datetime_id = 0; |
|
49 | - |
|
50 | - /** |
|
51 | - * @var EE_Datetime |
|
52 | - */ |
|
53 | - protected $datetime; |
|
54 | - |
|
55 | - /** |
|
56 | - * @var EE_Event |
|
57 | - */ |
|
58 | - protected $event; |
|
59 | - |
|
60 | - /** |
|
61 | - * @var DatetimesForEventCheckIn |
|
62 | - */ |
|
63 | - protected $datetimes_for_current_row; |
|
64 | - |
|
65 | - /** |
|
66 | - * @var bool |
|
67 | - */ |
|
68 | - protected $hide_expired; |
|
69 | - |
|
70 | - /** |
|
71 | - * @var bool |
|
72 | - */ |
|
73 | - protected $hide_upcoming; |
|
74 | - |
|
75 | - /** |
|
76 | - * @var array |
|
77 | - * @since 4.10.31.p |
|
78 | - */ |
|
79 | - protected $_status; |
|
80 | - |
|
81 | - |
|
82 | - /** |
|
83 | - * EE_Event_Registrations_List_Table constructor. |
|
84 | - * |
|
85 | - * @param Registrations_Admin_Page $admin_page |
|
86 | - * @throws EE_Error |
|
87 | - * @throws ReflectionException |
|
88 | - */ |
|
89 | - public function __construct($admin_page) |
|
90 | - { |
|
91 | - $this->request = LoaderFactory::getLoader()->getShared(RequestInterface::class); |
|
92 | - $this->resolveRequestVars(); |
|
93 | - parent::__construct($admin_page); |
|
94 | - } |
|
95 | - |
|
96 | - |
|
97 | - /** |
|
98 | - * @throws EE_Error |
|
99 | - * @throws ReflectionException |
|
100 | - * @since $VID:$ |
|
101 | - */ |
|
102 | - private function resolveRequestVars() |
|
103 | - { |
|
104 | - $this->event_id = $this->request->getRequestParam('event_id', 0, 'int'); |
|
105 | - $this->datetimes_for_event = DatetimesForEventCheckIn::fromEventID($this->event_id); |
|
106 | - // if we're filtering for a specific event and it only has one datetime, then grab its ID |
|
107 | - $datetime = $this->datetimes_for_event->getOneDatetimeForEvent(); |
|
108 | - $this->datetime_id = $datetime instanceof EE_Datetime ? $datetime->ID() : 0; |
|
109 | - // else check the request, but use the above as the default (and hope they match if BOTH exist, LOLZ) |
|
110 | - $this->datetime_id = $this->request->getRequestParam( |
|
111 | - 'DTT_ID', |
|
112 | - $this->datetime_id, |
|
113 | - 'int' |
|
114 | - ); |
|
115 | - } |
|
116 | - |
|
117 | - |
|
118 | - /** |
|
119 | - * @throws EE_Error |
|
120 | - */ |
|
121 | - protected function _setup_data() |
|
122 | - { |
|
123 | - $this->_data = $this->_view !== 'trash' |
|
124 | - ? $this->_admin_page->get_event_attendees($this->_per_page) |
|
125 | - : $this->_admin_page->get_event_attendees($this->_per_page, false, true); |
|
126 | - |
|
127 | - $this->_all_data_count = $this->_view !== 'trash' |
|
128 | - ? $this->_admin_page->get_event_attendees($this->_per_page, true) |
|
129 | - : $this->_admin_page->get_event_attendees($this->_per_page, true, true); |
|
130 | - } |
|
131 | - |
|
132 | - |
|
133 | - /** |
|
134 | - * @throws ReflectionException |
|
135 | - * @throws EE_Error |
|
136 | - */ |
|
137 | - protected function _set_properties() |
|
138 | - { |
|
139 | - $return_url = $this->getReturnUrl(); |
|
140 | - |
|
141 | - $EVT_ID = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : 0; |
|
142 | - $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0; |
|
143 | - |
|
144 | - $this->_wp_list_args = [ |
|
145 | - 'singular' => esc_html__('registrant', 'event_espresso'), |
|
146 | - 'plural' => esc_html__('registrants', 'event_espresso'), |
|
147 | - 'ajax' => true, |
|
148 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
149 | - ]; |
|
150 | - $columns = []; |
|
151 | - |
|
152 | - $this->_columns = [ |
|
153 | - '_REG_att_checked_in' => '<span class="dashicons dashicons-yes ee-icon-size-18"></span>', |
|
154 | - 'ATT_name' => esc_html__('Registrant', 'event_espresso'), |
|
155 | - 'ATT_email' => esc_html__('Email Address', 'event_espresso'), |
|
156 | - 'Event' => esc_html__('Event', 'event_espresso'), |
|
157 | - 'PRC_name' => esc_html__('TKT Option', 'event_espresso'), |
|
158 | - '_REG_final_price' => esc_html__('Price', 'event_espresso'), |
|
159 | - 'TXN_paid' => esc_html__('Paid', 'event_espresso'), |
|
160 | - 'TXN_total' => esc_html__('Total', 'event_espresso'), |
|
161 | - ]; |
|
162 | - // Add/remove columns when an event has been selected |
|
163 | - if (! empty($EVT_ID)) { |
|
164 | - // Render a checkbox column |
|
165 | - $columns['cb'] = '<input type="checkbox" />'; |
|
166 | - $this->_has_checkbox_column = true; |
|
167 | - // Remove the 'Event' column |
|
168 | - unset($this->_columns['Event']); |
|
169 | - $this->setBottomButtons(); |
|
170 | - } |
|
171 | - $this->_columns = array_merge($columns, $this->_columns); |
|
172 | - $this->_primary_column = '_REG_att_checked_in'; |
|
173 | - |
|
174 | - $csv_report = RegistrationsCsvReportParams::getRequestParams($return_url, $this->_req_data, $EVT_ID, $DTT_ID); |
|
175 | - if (! empty($csv_report)) { |
|
176 | - $this->_bottom_buttons['csv_reg_report'] = $csv_report; |
|
177 | - } |
|
178 | - |
|
179 | - $this->_sortable_columns = [ |
|
180 | - /** |
|
181 | - * Allows users to change the default sort if they wish. |
|
182 | - * Returning a falsey on this filter will result in the default sort to be by firstname rather than last name. |
|
183 | - * |
|
184 | - * Note: usual naming conventions for filters aren't followed here so that just one filter can be used to |
|
185 | - * change the sorts on any list table involving registration contacts. If you want to only change the filter |
|
186 | - * for a specific list table you can use the provided reference to this object instance. |
|
187 | - */ |
|
188 | - 'ATT_name' => [ |
|
189 | - 'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name', |
|
190 | - true, |
|
191 | - $this, |
|
192 | - ] |
|
193 | - ? ['ATT_lname' => true] |
|
194 | - : ['ATT_fname' => true], |
|
195 | - 'Event' => ['Event.EVT_name' => false], |
|
196 | - ]; |
|
197 | - $this->_hidden_columns = []; |
|
198 | - $this->_evt = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
199 | - $this->datetimes_for_event = $this->_evt instanceof EE_Event ? $this->_evt->datetimes_ordered() : []; |
|
200 | - } |
|
201 | - |
|
202 | - |
|
203 | - /** |
|
204 | - * @param EE_Registration $item |
|
205 | - * @return string |
|
206 | - */ |
|
207 | - protected function _get_row_class($item): string |
|
208 | - { |
|
209 | - $class = parent::_get_row_class($item); |
|
210 | - if ($this->_has_checkbox_column) { |
|
211 | - $class .= ' has-checkbox-column'; |
|
212 | - } |
|
213 | - return $class; |
|
214 | - } |
|
215 | - |
|
216 | - |
|
217 | - /** |
|
218 | - * @return array |
|
219 | - * @throws EE_Error |
|
220 | - * @throws ReflectionException |
|
221 | - */ |
|
222 | - protected function _get_table_filters(): array |
|
223 | - { |
|
224 | - $filters = []; |
|
225 | - $this->hide_expired = $this->request->getRequestParam('hide_expired', false, 'bool'); |
|
226 | - $this->hide_upcoming = $this->request->getRequestParam('hide_upcoming', false, 'bool'); |
|
227 | - $hide_expired_checked = $this->hide_expired ? 'checked' : ''; |
|
228 | - $hide_upcoming_checked = $this->hide_upcoming ? 'checked' : ''; |
|
229 | - // get datetimes for ALL active events (note possible capability restrictions) |
|
230 | - $events = $this->datetimes_for_event->getAllDatetimesForAllEvents(); |
|
231 | - $event_options[] = [ |
|
232 | - 'id' => 0, |
|
233 | - 'text' => esc_html__(' - select an event - ', 'event_espresso'), |
|
234 | - ]; |
|
235 | - /** @var EE_Event $event */ |
|
236 | - foreach ($events as $event) { |
|
237 | - // any registrations for this event? |
|
238 | - if (! $event instanceof EE_Event/* || ! $event->get_count_of_all_registrations()*/) { |
|
239 | - continue; |
|
240 | - } |
|
241 | - $expired_class = $event->is_expired() ? 'ee-expired-event' : ''; |
|
242 | - $upcoming_class = $event->is_upcoming() ? ' ee-upcoming-event' : ''; |
|
243 | - |
|
244 | - $event_options[] = [ |
|
245 | - 'id' => $event->ID(), |
|
246 | - 'text' => apply_filters( |
|
247 | - 'FHEE__EE_Event_Registrations___get_table_filters__event_name', |
|
248 | - $event->name(), |
|
249 | - $event |
|
250 | - ), |
|
251 | - 'class' => $expired_class . $upcoming_class, |
|
252 | - ]; |
|
253 | - if ($event->ID() === $this->event_id) { |
|
254 | - $this->hide_expired = $expired_class === '' ? $this->hide_expired : false; |
|
255 | - $hide_expired_checked = $expired_class === '' ? $hide_expired_checked : ''; |
|
256 | - $this->hide_upcoming = $upcoming_class === '' ? $this->hide_upcoming : false; |
|
257 | - $hide_upcoming_checked = $upcoming_class === '' ? $hide_upcoming_checked : ''; |
|
258 | - } |
|
259 | - } |
|
260 | - |
|
261 | - $select_class = $this->hide_expired ? 'ee-hide-expired-events' : ''; |
|
262 | - $select_class .= $this->hide_upcoming ? ' ee-hide-upcoming-events' : ''; |
|
263 | - |
|
264 | - $filters[] = ' |
|
19 | + /** |
|
20 | + * @var RequestInterface |
|
21 | + */ |
|
22 | + protected $request; |
|
23 | + |
|
24 | + /** |
|
25 | + * @var Extend_Registrations_Admin_Page |
|
26 | + */ |
|
27 | + protected $_admin_page; |
|
28 | + |
|
29 | + /** |
|
30 | + * The event ID if one is specified in the request |
|
31 | + * |
|
32 | + * @var int |
|
33 | + */ |
|
34 | + protected $event_id = 0; |
|
35 | + |
|
36 | + /** |
|
37 | + * This property will hold the related Datetimes on an event IF the event id is included in the request. |
|
38 | + * |
|
39 | + * @var DatetimesForEventCheckIn |
|
40 | + */ |
|
41 | + protected $datetimes_for_event = []; |
|
42 | + |
|
43 | + /** |
|
44 | + * The DTT_ID if the current view has a specified datetime. |
|
45 | + * |
|
46 | + * @var int |
|
47 | + */ |
|
48 | + protected $datetime_id = 0; |
|
49 | + |
|
50 | + /** |
|
51 | + * @var EE_Datetime |
|
52 | + */ |
|
53 | + protected $datetime; |
|
54 | + |
|
55 | + /** |
|
56 | + * @var EE_Event |
|
57 | + */ |
|
58 | + protected $event; |
|
59 | + |
|
60 | + /** |
|
61 | + * @var DatetimesForEventCheckIn |
|
62 | + */ |
|
63 | + protected $datetimes_for_current_row; |
|
64 | + |
|
65 | + /** |
|
66 | + * @var bool |
|
67 | + */ |
|
68 | + protected $hide_expired; |
|
69 | + |
|
70 | + /** |
|
71 | + * @var bool |
|
72 | + */ |
|
73 | + protected $hide_upcoming; |
|
74 | + |
|
75 | + /** |
|
76 | + * @var array |
|
77 | + * @since 4.10.31.p |
|
78 | + */ |
|
79 | + protected $_status; |
|
80 | + |
|
81 | + |
|
82 | + /** |
|
83 | + * EE_Event_Registrations_List_Table constructor. |
|
84 | + * |
|
85 | + * @param Registrations_Admin_Page $admin_page |
|
86 | + * @throws EE_Error |
|
87 | + * @throws ReflectionException |
|
88 | + */ |
|
89 | + public function __construct($admin_page) |
|
90 | + { |
|
91 | + $this->request = LoaderFactory::getLoader()->getShared(RequestInterface::class); |
|
92 | + $this->resolveRequestVars(); |
|
93 | + parent::__construct($admin_page); |
|
94 | + } |
|
95 | + |
|
96 | + |
|
97 | + /** |
|
98 | + * @throws EE_Error |
|
99 | + * @throws ReflectionException |
|
100 | + * @since $VID:$ |
|
101 | + */ |
|
102 | + private function resolveRequestVars() |
|
103 | + { |
|
104 | + $this->event_id = $this->request->getRequestParam('event_id', 0, 'int'); |
|
105 | + $this->datetimes_for_event = DatetimesForEventCheckIn::fromEventID($this->event_id); |
|
106 | + // if we're filtering for a specific event and it only has one datetime, then grab its ID |
|
107 | + $datetime = $this->datetimes_for_event->getOneDatetimeForEvent(); |
|
108 | + $this->datetime_id = $datetime instanceof EE_Datetime ? $datetime->ID() : 0; |
|
109 | + // else check the request, but use the above as the default (and hope they match if BOTH exist, LOLZ) |
|
110 | + $this->datetime_id = $this->request->getRequestParam( |
|
111 | + 'DTT_ID', |
|
112 | + $this->datetime_id, |
|
113 | + 'int' |
|
114 | + ); |
|
115 | + } |
|
116 | + |
|
117 | + |
|
118 | + /** |
|
119 | + * @throws EE_Error |
|
120 | + */ |
|
121 | + protected function _setup_data() |
|
122 | + { |
|
123 | + $this->_data = $this->_view !== 'trash' |
|
124 | + ? $this->_admin_page->get_event_attendees($this->_per_page) |
|
125 | + : $this->_admin_page->get_event_attendees($this->_per_page, false, true); |
|
126 | + |
|
127 | + $this->_all_data_count = $this->_view !== 'trash' |
|
128 | + ? $this->_admin_page->get_event_attendees($this->_per_page, true) |
|
129 | + : $this->_admin_page->get_event_attendees($this->_per_page, true, true); |
|
130 | + } |
|
131 | + |
|
132 | + |
|
133 | + /** |
|
134 | + * @throws ReflectionException |
|
135 | + * @throws EE_Error |
|
136 | + */ |
|
137 | + protected function _set_properties() |
|
138 | + { |
|
139 | + $return_url = $this->getReturnUrl(); |
|
140 | + |
|
141 | + $EVT_ID = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : 0; |
|
142 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0; |
|
143 | + |
|
144 | + $this->_wp_list_args = [ |
|
145 | + 'singular' => esc_html__('registrant', 'event_espresso'), |
|
146 | + 'plural' => esc_html__('registrants', 'event_espresso'), |
|
147 | + 'ajax' => true, |
|
148 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
149 | + ]; |
|
150 | + $columns = []; |
|
151 | + |
|
152 | + $this->_columns = [ |
|
153 | + '_REG_att_checked_in' => '<span class="dashicons dashicons-yes ee-icon-size-18"></span>', |
|
154 | + 'ATT_name' => esc_html__('Registrant', 'event_espresso'), |
|
155 | + 'ATT_email' => esc_html__('Email Address', 'event_espresso'), |
|
156 | + 'Event' => esc_html__('Event', 'event_espresso'), |
|
157 | + 'PRC_name' => esc_html__('TKT Option', 'event_espresso'), |
|
158 | + '_REG_final_price' => esc_html__('Price', 'event_espresso'), |
|
159 | + 'TXN_paid' => esc_html__('Paid', 'event_espresso'), |
|
160 | + 'TXN_total' => esc_html__('Total', 'event_espresso'), |
|
161 | + ]; |
|
162 | + // Add/remove columns when an event has been selected |
|
163 | + if (! empty($EVT_ID)) { |
|
164 | + // Render a checkbox column |
|
165 | + $columns['cb'] = '<input type="checkbox" />'; |
|
166 | + $this->_has_checkbox_column = true; |
|
167 | + // Remove the 'Event' column |
|
168 | + unset($this->_columns['Event']); |
|
169 | + $this->setBottomButtons(); |
|
170 | + } |
|
171 | + $this->_columns = array_merge($columns, $this->_columns); |
|
172 | + $this->_primary_column = '_REG_att_checked_in'; |
|
173 | + |
|
174 | + $csv_report = RegistrationsCsvReportParams::getRequestParams($return_url, $this->_req_data, $EVT_ID, $DTT_ID); |
|
175 | + if (! empty($csv_report)) { |
|
176 | + $this->_bottom_buttons['csv_reg_report'] = $csv_report; |
|
177 | + } |
|
178 | + |
|
179 | + $this->_sortable_columns = [ |
|
180 | + /** |
|
181 | + * Allows users to change the default sort if they wish. |
|
182 | + * Returning a falsey on this filter will result in the default sort to be by firstname rather than last name. |
|
183 | + * |
|
184 | + * Note: usual naming conventions for filters aren't followed here so that just one filter can be used to |
|
185 | + * change the sorts on any list table involving registration contacts. If you want to only change the filter |
|
186 | + * for a specific list table you can use the provided reference to this object instance. |
|
187 | + */ |
|
188 | + 'ATT_name' => [ |
|
189 | + 'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name', |
|
190 | + true, |
|
191 | + $this, |
|
192 | + ] |
|
193 | + ? ['ATT_lname' => true] |
|
194 | + : ['ATT_fname' => true], |
|
195 | + 'Event' => ['Event.EVT_name' => false], |
|
196 | + ]; |
|
197 | + $this->_hidden_columns = []; |
|
198 | + $this->_evt = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
199 | + $this->datetimes_for_event = $this->_evt instanceof EE_Event ? $this->_evt->datetimes_ordered() : []; |
|
200 | + } |
|
201 | + |
|
202 | + |
|
203 | + /** |
|
204 | + * @param EE_Registration $item |
|
205 | + * @return string |
|
206 | + */ |
|
207 | + protected function _get_row_class($item): string |
|
208 | + { |
|
209 | + $class = parent::_get_row_class($item); |
|
210 | + if ($this->_has_checkbox_column) { |
|
211 | + $class .= ' has-checkbox-column'; |
|
212 | + } |
|
213 | + return $class; |
|
214 | + } |
|
215 | + |
|
216 | + |
|
217 | + /** |
|
218 | + * @return array |
|
219 | + * @throws EE_Error |
|
220 | + * @throws ReflectionException |
|
221 | + */ |
|
222 | + protected function _get_table_filters(): array |
|
223 | + { |
|
224 | + $filters = []; |
|
225 | + $this->hide_expired = $this->request->getRequestParam('hide_expired', false, 'bool'); |
|
226 | + $this->hide_upcoming = $this->request->getRequestParam('hide_upcoming', false, 'bool'); |
|
227 | + $hide_expired_checked = $this->hide_expired ? 'checked' : ''; |
|
228 | + $hide_upcoming_checked = $this->hide_upcoming ? 'checked' : ''; |
|
229 | + // get datetimes for ALL active events (note possible capability restrictions) |
|
230 | + $events = $this->datetimes_for_event->getAllDatetimesForAllEvents(); |
|
231 | + $event_options[] = [ |
|
232 | + 'id' => 0, |
|
233 | + 'text' => esc_html__(' - select an event - ', 'event_espresso'), |
|
234 | + ]; |
|
235 | + /** @var EE_Event $event */ |
|
236 | + foreach ($events as $event) { |
|
237 | + // any registrations for this event? |
|
238 | + if (! $event instanceof EE_Event/* || ! $event->get_count_of_all_registrations()*/) { |
|
239 | + continue; |
|
240 | + } |
|
241 | + $expired_class = $event->is_expired() ? 'ee-expired-event' : ''; |
|
242 | + $upcoming_class = $event->is_upcoming() ? ' ee-upcoming-event' : ''; |
|
243 | + |
|
244 | + $event_options[] = [ |
|
245 | + 'id' => $event->ID(), |
|
246 | + 'text' => apply_filters( |
|
247 | + 'FHEE__EE_Event_Registrations___get_table_filters__event_name', |
|
248 | + $event->name(), |
|
249 | + $event |
|
250 | + ), |
|
251 | + 'class' => $expired_class . $upcoming_class, |
|
252 | + ]; |
|
253 | + if ($event->ID() === $this->event_id) { |
|
254 | + $this->hide_expired = $expired_class === '' ? $this->hide_expired : false; |
|
255 | + $hide_expired_checked = $expired_class === '' ? $hide_expired_checked : ''; |
|
256 | + $this->hide_upcoming = $upcoming_class === '' ? $this->hide_upcoming : false; |
|
257 | + $hide_upcoming_checked = $upcoming_class === '' ? $hide_upcoming_checked : ''; |
|
258 | + } |
|
259 | + } |
|
260 | + |
|
261 | + $select_class = $this->hide_expired ? 'ee-hide-expired-events' : ''; |
|
262 | + $select_class .= $this->hide_upcoming ? ' ee-hide-upcoming-events' : ''; |
|
263 | + |
|
264 | + $filters[] = ' |
|
265 | 265 | <div class="ee-event-filter__wrapper"> |
266 | 266 | <label class="ee-event-filter-main-label">' . esc_html__('Check-in Status for', 'event_espresso') . '</label> |
267 | 267 | <div class="ee-event-filter"> |
268 | 268 | <span class="ee-event-selector"> |
269 | 269 | <label for="event_id">' . esc_html__('Event', 'event_espresso') . '</label> |
270 | 270 | ' . EEH_Form_Fields::select_input( |
271 | - 'event_id', |
|
272 | - $event_options, |
|
273 | - $this->event_id, |
|
274 | - '', |
|
275 | - $select_class |
|
276 | - ) . ' |
|
271 | + 'event_id', |
|
272 | + $event_options, |
|
273 | + $this->event_id, |
|
274 | + '', |
|
275 | + $select_class |
|
276 | + ) . ' |
|
277 | 277 | </span>'; |
278 | - // DTT datetimes filter |
|
279 | - $datetimes_for_event = $this->datetimes_for_event->getAllDatetimesForEvent($hide_upcoming_checked === 'checked'); |
|
280 | - if (count($datetimes_for_event) > 1) { |
|
281 | - $datetimes[0] = esc_html__(' - select a datetime - ', 'event_espresso'); |
|
282 | - foreach ($datetimes_for_event as $datetime) { |
|
283 | - if ($datetime instanceof EE_Datetime) { |
|
284 | - $datetime_string = $datetime->name(); |
|
285 | - $datetime_string = ! empty($datetime_string) ? $datetime_string . ': ' : ''; |
|
286 | - $datetime_string .= $datetime->date_and_time_range(); |
|
287 | - $datetime_string .= $datetime->is_active() ? ' ∗' : ''; |
|
288 | - $datetime_string .= $datetime->is_expired() ? ' «' : ''; |
|
289 | - $datetime_string .= $datetime->is_upcoming() ? ' »' : ''; |
|
290 | - // now put it all together |
|
291 | - $datetimes[ $datetime->ID() ] = $datetime_string; |
|
292 | - } |
|
293 | - } |
|
294 | - $filters[] = ' |
|
278 | + // DTT datetimes filter |
|
279 | + $datetimes_for_event = $this->datetimes_for_event->getAllDatetimesForEvent($hide_upcoming_checked === 'checked'); |
|
280 | + if (count($datetimes_for_event) > 1) { |
|
281 | + $datetimes[0] = esc_html__(' - select a datetime - ', 'event_espresso'); |
|
282 | + foreach ($datetimes_for_event as $datetime) { |
|
283 | + if ($datetime instanceof EE_Datetime) { |
|
284 | + $datetime_string = $datetime->name(); |
|
285 | + $datetime_string = ! empty($datetime_string) ? $datetime_string . ': ' : ''; |
|
286 | + $datetime_string .= $datetime->date_and_time_range(); |
|
287 | + $datetime_string .= $datetime->is_active() ? ' ∗' : ''; |
|
288 | + $datetime_string .= $datetime->is_expired() ? ' «' : ''; |
|
289 | + $datetime_string .= $datetime->is_upcoming() ? ' »' : ''; |
|
290 | + // now put it all together |
|
291 | + $datetimes[ $datetime->ID() ] = $datetime_string; |
|
292 | + } |
|
293 | + } |
|
294 | + $filters[] = ' |
|
295 | 295 | <span class="ee-datetime-selector"> |
296 | 296 | <label for="DTT_ID">' . esc_html__('Datetime', 'event_espresso') . '</label> |
297 | 297 | ' . EEH_Form_Fields::select_input( |
298 | - 'DTT_ID', |
|
299 | - $datetimes, |
|
300 | - $this->datetime_id |
|
301 | - ) . ' |
|
298 | + 'DTT_ID', |
|
299 | + $datetimes, |
|
300 | + $this->datetime_id |
|
301 | + ) . ' |
|
302 | 302 | </span>'; |
303 | - } |
|
304 | - $filters[] = ' |
|
303 | + } |
|
304 | + $filters[] = ' |
|
305 | 305 | <span class="ee-hide-upcoming-check"> |
306 | 306 | <label for="js-ee-hide-upcoming-events"> |
307 | 307 | <input type="checkbox" id="js-ee-hide-upcoming-events" name="hide_upcoming" ' |
308 | - . $hide_upcoming_checked |
|
309 | - . '> |
|
308 | + . $hide_upcoming_checked |
|
309 | + . '> |
|
310 | 310 | ' |
311 | - . esc_html__('Hide Upcoming Events', 'event_espresso') |
|
312 | - . ' |
|
311 | + . esc_html__('Hide Upcoming Events', 'event_espresso') |
|
312 | + . ' |
|
313 | 313 | </label> |
314 | 314 | <span class="ee-help-btn dashicons dashicons-editor-help ee-aria-tooltip" aria-label="' |
315 | - . esc_html__( |
|
316 | - 'Will not display events with start dates in the future (ie: have not yet begun)', |
|
317 | - 'event_espresso' |
|
318 | - ) |
|
319 | - . '"></span> |
|
315 | + . esc_html__( |
|
316 | + 'Will not display events with start dates in the future (ie: have not yet begun)', |
|
317 | + 'event_espresso' |
|
318 | + ) |
|
319 | + . '"></span> |
|
320 | 320 | </span> |
321 | 321 | <span class="ee-hide-expired-check"> |
322 | 322 | <label for="js-ee-hide-expired-events"> |
323 | 323 | <input type="checkbox" id="js-ee-hide-expired-events" name="hide_expired" ' |
324 | - . $hide_expired_checked |
|
325 | - . '> |
|
324 | + . $hide_expired_checked |
|
325 | + . '> |
|
326 | 326 | ' |
327 | - . esc_html__('Hide Expired Events', 'event_espresso') |
|
328 | - . ' |
|
327 | + . esc_html__('Hide Expired Events', 'event_espresso') |
|
328 | + . ' |
|
329 | 329 | </label> |
330 | 330 | <span class="ee-help-btn dashicons dashicons-editor-help ee-aria-tooltip" aria-label="' |
331 | - . esc_html__( |
|
332 | - 'Will not display events with end dates in the past (ie: have already finished)', |
|
333 | - 'event_espresso' |
|
334 | - ) |
|
335 | - . '"></span> |
|
331 | + . esc_html__( |
|
332 | + 'Will not display events with end dates in the past (ie: have already finished)', |
|
333 | + 'event_espresso' |
|
334 | + ) |
|
335 | + . '"></span> |
|
336 | 336 | </span> |
337 | 337 | </div> |
338 | 338 | </div>'; |
339 | - return $filters; |
|
340 | - } |
|
341 | - |
|
342 | - |
|
343 | - /** |
|
344 | - * @throws EE_Error |
|
345 | - * @throws ReflectionException |
|
346 | - */ |
|
347 | - protected function _add_view_counts() |
|
348 | - { |
|
349 | - $this->_views['all']['count'] = $this->_get_total_event_attendees(); |
|
350 | - } |
|
351 | - |
|
352 | - |
|
353 | - /** |
|
354 | - * @return int |
|
355 | - * @throws EE_Error |
|
356 | - * @throws ReflectionException |
|
357 | - */ |
|
358 | - protected function _get_total_event_attendees(): int |
|
359 | - { |
|
360 | - $query_params = []; |
|
361 | - if ($this->event_id) { |
|
362 | - $query_params[0]['EVT_ID'] = $this->event_id; |
|
363 | - } |
|
364 | - // if DTT is included we only show for that datetime. Otherwise we're showing for all datetimes (the event). |
|
365 | - if ($this->datetime_id) { |
|
366 | - $query_params[0]['Ticket.Datetime.DTT_ID'] = $this->datetime_id; |
|
367 | - } |
|
368 | - $status_ids_array = apply_filters( |
|
369 | - 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', |
|
370 | - [EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved] |
|
371 | - ); |
|
372 | - $query_params[0]['STS_ID'] = ['IN', $status_ids_array]; |
|
373 | - return EEM_Registration::instance()->count($query_params); |
|
374 | - } |
|
375 | - |
|
376 | - |
|
377 | - /** |
|
378 | - * @param EE_Registration $item |
|
379 | - * @return string |
|
380 | - * @throws EE_Error |
|
381 | - * @throws ReflectionException |
|
382 | - */ |
|
383 | - public function column_cb($item): string |
|
384 | - { |
|
385 | - return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID()); |
|
386 | - } |
|
387 | - |
|
388 | - |
|
389 | - /** |
|
390 | - * column_REG_att_checked_in |
|
391 | - * |
|
392 | - * @param EE_Registration $registration |
|
393 | - * @return string |
|
394 | - * @throws EE_Error |
|
395 | - * @throws InvalidArgumentException |
|
396 | - * @throws InvalidDataTypeException |
|
397 | - * @throws InvalidInterfaceException |
|
398 | - * @throws ReflectionException |
|
399 | - */ |
|
400 | - public function column__REG_att_checked_in(EE_Registration $registration): string |
|
401 | - { |
|
402 | - // we need a local variable for the datetime for each row |
|
403 | - // (so that we don't pollute state for the entire table) |
|
404 | - // so let's try to get it from the registration's event |
|
405 | - $DTT_ID = $this->datetime_id; |
|
406 | - if (! $DTT_ID) { |
|
407 | - $reg_ticket_datetimes = $registration->ticket()->datetimes(); |
|
408 | - if (count($reg_ticket_datetimes) === 1) { |
|
409 | - $reg_ticket_datetime = reset($reg_ticket_datetimes); |
|
410 | - $DTT_ID = $reg_ticket_datetime instanceof EE_Datetime ? $reg_ticket_datetime->ID() : 0; |
|
411 | - } |
|
412 | - } |
|
413 | - |
|
414 | - if (! $DTT_ID) { |
|
415 | - $this->datetimes_for_current_row = DatetimesForEventCheckIn::fromRegistration($registration); |
|
416 | - $datetime = $this->datetimes_for_current_row->getOneDatetimeForEvent($DTT_ID); |
|
417 | - $DTT_ID = $datetime instanceof EE_Datetime ? $datetime->ID() : 0; |
|
418 | - } |
|
419 | - |
|
420 | - $checkin_status_dashicon = CheckinStatusDashicon::fromRegistrationAndDatetimeId( |
|
421 | - $registration, |
|
422 | - $DTT_ID |
|
423 | - ); |
|
424 | - |
|
425 | - $aria_label = $checkin_status_dashicon->ariaLabel(); |
|
426 | - $dashicon_class = $checkin_status_dashicon->cssClasses(); |
|
427 | - $attributes = ' onClick="return false"'; |
|
428 | - $button_class = 'button button--secondary button--icon-only ee-aria-tooltip ee-aria-tooltip--big-box'; |
|
429 | - |
|
430 | - if ( |
|
431 | - $DTT_ID |
|
432 | - && EE_Registry::instance()->CAP->current_user_can( |
|
433 | - 'ee_edit_checkin', |
|
434 | - 'espresso_registrations_toggle_checkin_status', |
|
435 | - $registration->ID() |
|
436 | - ) |
|
437 | - ) { |
|
438 | - // overwrite the disabled attribute with data attributes for performing checkin |
|
439 | - $attributes = 'data-_regid="' . $registration->ID() . '"'; |
|
440 | - $attributes .= ' data-dttid="' . $DTT_ID . '"'; |
|
441 | - $attributes .= ' data-nonce="' . wp_create_nonce('checkin_nonce') . '"'; |
|
442 | - $button_class .= ' clickable trigger-checkin'; |
|
443 | - } |
|
444 | - |
|
445 | - $content = ' |
|
339 | + return $filters; |
|
340 | + } |
|
341 | + |
|
342 | + |
|
343 | + /** |
|
344 | + * @throws EE_Error |
|
345 | + * @throws ReflectionException |
|
346 | + */ |
|
347 | + protected function _add_view_counts() |
|
348 | + { |
|
349 | + $this->_views['all']['count'] = $this->_get_total_event_attendees(); |
|
350 | + } |
|
351 | + |
|
352 | + |
|
353 | + /** |
|
354 | + * @return int |
|
355 | + * @throws EE_Error |
|
356 | + * @throws ReflectionException |
|
357 | + */ |
|
358 | + protected function _get_total_event_attendees(): int |
|
359 | + { |
|
360 | + $query_params = []; |
|
361 | + if ($this->event_id) { |
|
362 | + $query_params[0]['EVT_ID'] = $this->event_id; |
|
363 | + } |
|
364 | + // if DTT is included we only show for that datetime. Otherwise we're showing for all datetimes (the event). |
|
365 | + if ($this->datetime_id) { |
|
366 | + $query_params[0]['Ticket.Datetime.DTT_ID'] = $this->datetime_id; |
|
367 | + } |
|
368 | + $status_ids_array = apply_filters( |
|
369 | + 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', |
|
370 | + [EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved] |
|
371 | + ); |
|
372 | + $query_params[0]['STS_ID'] = ['IN', $status_ids_array]; |
|
373 | + return EEM_Registration::instance()->count($query_params); |
|
374 | + } |
|
375 | + |
|
376 | + |
|
377 | + /** |
|
378 | + * @param EE_Registration $item |
|
379 | + * @return string |
|
380 | + * @throws EE_Error |
|
381 | + * @throws ReflectionException |
|
382 | + */ |
|
383 | + public function column_cb($item): string |
|
384 | + { |
|
385 | + return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID()); |
|
386 | + } |
|
387 | + |
|
388 | + |
|
389 | + /** |
|
390 | + * column_REG_att_checked_in |
|
391 | + * |
|
392 | + * @param EE_Registration $registration |
|
393 | + * @return string |
|
394 | + * @throws EE_Error |
|
395 | + * @throws InvalidArgumentException |
|
396 | + * @throws InvalidDataTypeException |
|
397 | + * @throws InvalidInterfaceException |
|
398 | + * @throws ReflectionException |
|
399 | + */ |
|
400 | + public function column__REG_att_checked_in(EE_Registration $registration): string |
|
401 | + { |
|
402 | + // we need a local variable for the datetime for each row |
|
403 | + // (so that we don't pollute state for the entire table) |
|
404 | + // so let's try to get it from the registration's event |
|
405 | + $DTT_ID = $this->datetime_id; |
|
406 | + if (! $DTT_ID) { |
|
407 | + $reg_ticket_datetimes = $registration->ticket()->datetimes(); |
|
408 | + if (count($reg_ticket_datetimes) === 1) { |
|
409 | + $reg_ticket_datetime = reset($reg_ticket_datetimes); |
|
410 | + $DTT_ID = $reg_ticket_datetime instanceof EE_Datetime ? $reg_ticket_datetime->ID() : 0; |
|
411 | + } |
|
412 | + } |
|
413 | + |
|
414 | + if (! $DTT_ID) { |
|
415 | + $this->datetimes_for_current_row = DatetimesForEventCheckIn::fromRegistration($registration); |
|
416 | + $datetime = $this->datetimes_for_current_row->getOneDatetimeForEvent($DTT_ID); |
|
417 | + $DTT_ID = $datetime instanceof EE_Datetime ? $datetime->ID() : 0; |
|
418 | + } |
|
419 | + |
|
420 | + $checkin_status_dashicon = CheckinStatusDashicon::fromRegistrationAndDatetimeId( |
|
421 | + $registration, |
|
422 | + $DTT_ID |
|
423 | + ); |
|
424 | + |
|
425 | + $aria_label = $checkin_status_dashicon->ariaLabel(); |
|
426 | + $dashicon_class = $checkin_status_dashicon->cssClasses(); |
|
427 | + $attributes = ' onClick="return false"'; |
|
428 | + $button_class = 'button button--secondary button--icon-only ee-aria-tooltip ee-aria-tooltip--big-box'; |
|
429 | + |
|
430 | + if ( |
|
431 | + $DTT_ID |
|
432 | + && EE_Registry::instance()->CAP->current_user_can( |
|
433 | + 'ee_edit_checkin', |
|
434 | + 'espresso_registrations_toggle_checkin_status', |
|
435 | + $registration->ID() |
|
436 | + ) |
|
437 | + ) { |
|
438 | + // overwrite the disabled attribute with data attributes for performing checkin |
|
439 | + $attributes = 'data-_regid="' . $registration->ID() . '"'; |
|
440 | + $attributes .= ' data-dttid="' . $DTT_ID . '"'; |
|
441 | + $attributes .= ' data-nonce="' . wp_create_nonce('checkin_nonce') . '"'; |
|
442 | + $button_class .= ' clickable trigger-checkin'; |
|
443 | + } |
|
444 | + |
|
445 | + $content = ' |
|
446 | 446 | <button aria-label="' . $aria_label . '" class="' . $button_class . '" ' . $attributes . '> |
447 | 447 | <span class="' . $dashicon_class . '" ></span> |
448 | 448 | </button> |
449 | 449 | <span class="show-on-mobile-view-only">' . $this->column_ATT_name($registration) . '</span>'; |
450 | - return $this->columnContent('_REG_att_checked_in', $content, 'center'); |
|
451 | - } |
|
452 | - |
|
453 | - |
|
454 | - /** |
|
455 | - * @param EE_Registration $registration |
|
456 | - * @return string |
|
457 | - * @throws EE_Error |
|
458 | - * @throws ReflectionException |
|
459 | - */ |
|
460 | - public function column_ATT_name(EE_Registration $registration): string |
|
461 | - { |
|
462 | - $attendee = $registration->attendee(); |
|
463 | - if (! $attendee instanceof EE_Attendee) { |
|
464 | - return esc_html__('No contact record for this registration.', 'event_espresso'); |
|
465 | - } |
|
466 | - // edit attendee link |
|
467 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
468 | - ['action' => 'view_registration', '_REG_ID' => $registration->ID()], |
|
469 | - REG_ADMIN_URL |
|
470 | - ); |
|
471 | - $name_link = ' |
|
450 | + return $this->columnContent('_REG_att_checked_in', $content, 'center'); |
|
451 | + } |
|
452 | + |
|
453 | + |
|
454 | + /** |
|
455 | + * @param EE_Registration $registration |
|
456 | + * @return string |
|
457 | + * @throws EE_Error |
|
458 | + * @throws ReflectionException |
|
459 | + */ |
|
460 | + public function column_ATT_name(EE_Registration $registration): string |
|
461 | + { |
|
462 | + $attendee = $registration->attendee(); |
|
463 | + if (! $attendee instanceof EE_Attendee) { |
|
464 | + return esc_html__('No contact record for this registration.', 'event_espresso'); |
|
465 | + } |
|
466 | + // edit attendee link |
|
467 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
468 | + ['action' => 'view_registration', '_REG_ID' => $registration->ID()], |
|
469 | + REG_ADMIN_URL |
|
470 | + ); |
|
471 | + $name_link = ' |
|
472 | 472 | <span class="ee-status-dot ee-status-bg--' . esc_attr($registration->status_ID()) . ' ee-aria-tooltip" |
473 | 473 | aria-label="' . EEH_Template::pretty_status($registration->status_ID(), false, 'sentence') . '"> |
474 | 474 | </span>'; |
475 | - $name_link .= EE_Registry::instance()->CAP->current_user_can( |
|
476 | - 'ee_edit_contacts', |
|
477 | - 'espresso_registrations_edit_attendee' |
|
478 | - ) |
|
479 | - ? '<a class="ee-aria-tooltip" href="' . $edit_lnk_url . '" aria-label="' . esc_attr__( |
|
480 | - 'View Registration Details', |
|
481 | - 'event_espresso' |
|
482 | - ) . '">' |
|
483 | - . $registration->attendee()->full_name() |
|
484 | - . '</a>' |
|
485 | - : $registration->attendee()->full_name(); |
|
486 | - $name_link .= $registration->count() === 1 |
|
487 | - ? ' <sup><div class="dashicons dashicons-star-filled gold-icon"></div></sup> ' |
|
488 | - : ''; |
|
489 | - // add group details |
|
490 | - $name_link .= ' ' . sprintf( |
|
491 | - esc_html__('(%s of %s)', 'event_espresso'), |
|
492 | - $registration->count(), |
|
493 | - $registration->group_size() |
|
494 | - ); |
|
495 | - // add regcode |
|
496 | - $link = EE_Admin_Page::add_query_args_and_nonce( |
|
497 | - ['action' => 'view_registration', '_REG_ID' => $registration->ID()], |
|
498 | - REG_ADMIN_URL |
|
499 | - ); |
|
500 | - $name_link .= '<br>'; |
|
501 | - $name_link .= EE_Registry::instance()->instance()->CAP->current_user_can( |
|
502 | - 'ee_read_registration', |
|
503 | - 'view_registration', |
|
504 | - $registration->ID() |
|
505 | - ) |
|
506 | - ? '<a class="ee-aria-tooltip" href="' . $link . '" aria-label="' . esc_attr__( |
|
507 | - 'View Registration Details', |
|
508 | - 'event_espresso' |
|
509 | - ) . '">' |
|
510 | - . $registration->reg_code() |
|
511 | - . '</a>' |
|
512 | - : $registration->reg_code(); |
|
513 | - |
|
514 | - $actions = []; |
|
515 | - if ( |
|
516 | - $this->datetime_id |
|
517 | - && EE_Registry::instance()->CAP->current_user_can( |
|
518 | - 'ee_read_checkins', |
|
519 | - 'espresso_registrations_registration_checkins' |
|
520 | - ) |
|
521 | - ) { |
|
522 | - $checkin_list_url = EE_Admin_Page::add_query_args_and_nonce( |
|
523 | - ['action' => 'registration_checkins', '_REG_ID' => $registration->ID(), 'DTT_ID' => $this->datetime_id], |
|
524 | - REG_ADMIN_URL |
|
525 | - ); |
|
526 | - // get the timestamps for this registration's checkins, related to the selected datetime |
|
527 | - /** @var EE_Checkin[] $checkins */ |
|
528 | - $checkins = $registration->get_many_related('Checkin', [['DTT_ID' => $this->datetime_id]]); |
|
529 | - if (! empty($checkins)) { |
|
530 | - // get the last timestamp |
|
531 | - $last_checkin = end($checkins); |
|
532 | - // get timestamp string |
|
533 | - $timestamp_string = $last_checkin->get_datetime('CHK_timestamp'); |
|
534 | - $actions['checkin'] = ' |
|
475 | + $name_link .= EE_Registry::instance()->CAP->current_user_can( |
|
476 | + 'ee_edit_contacts', |
|
477 | + 'espresso_registrations_edit_attendee' |
|
478 | + ) |
|
479 | + ? '<a class="ee-aria-tooltip" href="' . $edit_lnk_url . '" aria-label="' . esc_attr__( |
|
480 | + 'View Registration Details', |
|
481 | + 'event_espresso' |
|
482 | + ) . '">' |
|
483 | + . $registration->attendee()->full_name() |
|
484 | + . '</a>' |
|
485 | + : $registration->attendee()->full_name(); |
|
486 | + $name_link .= $registration->count() === 1 |
|
487 | + ? ' <sup><div class="dashicons dashicons-star-filled gold-icon"></div></sup> ' |
|
488 | + : ''; |
|
489 | + // add group details |
|
490 | + $name_link .= ' ' . sprintf( |
|
491 | + esc_html__('(%s of %s)', 'event_espresso'), |
|
492 | + $registration->count(), |
|
493 | + $registration->group_size() |
|
494 | + ); |
|
495 | + // add regcode |
|
496 | + $link = EE_Admin_Page::add_query_args_and_nonce( |
|
497 | + ['action' => 'view_registration', '_REG_ID' => $registration->ID()], |
|
498 | + REG_ADMIN_URL |
|
499 | + ); |
|
500 | + $name_link .= '<br>'; |
|
501 | + $name_link .= EE_Registry::instance()->instance()->CAP->current_user_can( |
|
502 | + 'ee_read_registration', |
|
503 | + 'view_registration', |
|
504 | + $registration->ID() |
|
505 | + ) |
|
506 | + ? '<a class="ee-aria-tooltip" href="' . $link . '" aria-label="' . esc_attr__( |
|
507 | + 'View Registration Details', |
|
508 | + 'event_espresso' |
|
509 | + ) . '">' |
|
510 | + . $registration->reg_code() |
|
511 | + . '</a>' |
|
512 | + : $registration->reg_code(); |
|
513 | + |
|
514 | + $actions = []; |
|
515 | + if ( |
|
516 | + $this->datetime_id |
|
517 | + && EE_Registry::instance()->CAP->current_user_can( |
|
518 | + 'ee_read_checkins', |
|
519 | + 'espresso_registrations_registration_checkins' |
|
520 | + ) |
|
521 | + ) { |
|
522 | + $checkin_list_url = EE_Admin_Page::add_query_args_and_nonce( |
|
523 | + ['action' => 'registration_checkins', '_REG_ID' => $registration->ID(), 'DTT_ID' => $this->datetime_id], |
|
524 | + REG_ADMIN_URL |
|
525 | + ); |
|
526 | + // get the timestamps for this registration's checkins, related to the selected datetime |
|
527 | + /** @var EE_Checkin[] $checkins */ |
|
528 | + $checkins = $registration->get_many_related('Checkin', [['DTT_ID' => $this->datetime_id]]); |
|
529 | + if (! empty($checkins)) { |
|
530 | + // get the last timestamp |
|
531 | + $last_checkin = end($checkins); |
|
532 | + // get timestamp string |
|
533 | + $timestamp_string = $last_checkin->get_datetime('CHK_timestamp'); |
|
534 | + $actions['checkin'] = ' |
|
535 | 535 | <a class="ee-aria-tooltip" |
536 | 536 | href="' . $checkin_list_url . '" |
537 | 537 | aria-label="' . esc_attr__( |
538 | - 'View this registrant\'s check-ins/checkouts for the datetime', |
|
539 | - 'event_espresso' |
|
540 | - ) . '" |
|
538 | + 'View this registrant\'s check-ins/checkouts for the datetime', |
|
539 | + 'event_espresso' |
|
540 | + ) . '" |
|
541 | 541 | > |
542 | 542 | ' . $last_checkin->getCheckInText() . ': ' . $timestamp_string . ' |
543 | 543 | </a>'; |
544 | - } |
|
545 | - } |
|
546 | - $content = (! empty($this->datetime_id) && ! empty($checkins)) |
|
547 | - ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions, true)) |
|
548 | - : $name_link; |
|
549 | - return $this->columnContent('ATT_name', $content); |
|
550 | - } |
|
551 | - |
|
552 | - |
|
553 | - /** |
|
554 | - * @param EE_Registration $registration |
|
555 | - * @return string |
|
556 | - * @throws EE_Error |
|
557 | - * @throws EE_Error |
|
558 | - * @throws ReflectionException |
|
559 | - */ |
|
560 | - public function column_ATT_email(EE_Registration $registration): string |
|
561 | - { |
|
562 | - $attendee = $registration->attendee(); |
|
563 | - $content = $attendee instanceof EE_Attendee ? $attendee->email() : ''; |
|
564 | - return $this->columnContent('ATT_email', $content); |
|
565 | - } |
|
566 | - |
|
567 | - |
|
568 | - /** |
|
569 | - * @param EE_Registration $registration |
|
570 | - * @return string |
|
571 | - * @throws EE_Error |
|
572 | - * @throws ReflectionException |
|
573 | - */ |
|
574 | - public function column_Event(EE_Registration $registration): string |
|
575 | - { |
|
576 | - try { |
|
577 | - $event = $this->event instanceof EE_Event ? $this->event : $registration->event(); |
|
578 | - $checkin_link_url = EE_Admin_Page::add_query_args_and_nonce( |
|
579 | - ['action' => 'event_registrations', 'event_id' => $event->ID()], |
|
580 | - REG_ADMIN_URL |
|
581 | - ); |
|
582 | - $content = EE_Registry::instance()->CAP->current_user_can( |
|
583 | - 'ee_read_checkins', |
|
584 | - 'espresso_registrations_registration_checkins' |
|
585 | - ) ? '<a class="ee-aria-tooltip" href="' . $checkin_link_url . '" aria-label="' |
|
586 | - . esc_attr__( |
|
587 | - 'View Checkins for this Event', |
|
588 | - 'event_espresso' |
|
589 | - ) . '">' . $event->name() . '</a>' : $event->name(); |
|
590 | - } catch (EntityNotFoundException $e) { |
|
591 | - $content = esc_html__('Unknown', 'event_espresso'); |
|
592 | - } |
|
593 | - return $this->columnContent('Event', $content); |
|
594 | - } |
|
595 | - |
|
596 | - |
|
597 | - /** |
|
598 | - * @param EE_Registration $registration |
|
599 | - * @return string |
|
600 | - * @throws EE_Error |
|
601 | - * @throws ReflectionException |
|
602 | - */ |
|
603 | - public function column_PRC_name(EE_Registration $registration): string |
|
604 | - { |
|
605 | - $content = $registration->ticket() instanceof EE_Ticket |
|
606 | - ? $registration->ticket()->name() |
|
607 | - : esc_html__( |
|
608 | - "Unknown", |
|
609 | - "event_espresso" |
|
610 | - ); |
|
611 | - return $this->columnContent('PRC_name', $content); |
|
612 | - } |
|
613 | - |
|
614 | - |
|
615 | - /** |
|
616 | - * column_REG_final_price |
|
617 | - * |
|
618 | - * @param EE_Registration $registration |
|
619 | - * @return string |
|
620 | - * @throws EE_Error |
|
621 | - */ |
|
622 | - public function column__REG_final_price(EE_Registration $registration): string |
|
623 | - { |
|
624 | - return $this->columnContent('_REG_final_price', $registration->pretty_final_price(), 'end'); |
|
625 | - } |
|
626 | - |
|
627 | - |
|
628 | - /** |
|
629 | - * column_TXN_paid |
|
630 | - * |
|
631 | - * @param EE_Registration $registration |
|
632 | - * @return string |
|
633 | - * @throws EE_Error |
|
634 | - * @throws ReflectionException |
|
635 | - */ |
|
636 | - public function column_TXN_paid(EE_Registration $registration): string |
|
637 | - { |
|
638 | - $content = ''; |
|
639 | - if ($registration->count() === 1) { |
|
640 | - if ($registration->transaction()->paid() >= $registration->transaction()->total()) { |
|
641 | - return '<div class="dashicons dashicons-yes green-icon"></div>'; |
|
642 | - } else { |
|
643 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
644 | - ['action' => 'view_transaction', 'TXN_ID' => $registration->transaction_ID()], |
|
645 | - TXN_ADMIN_URL |
|
646 | - ); |
|
647 | - $content = EE_Registry::instance()->CAP->current_user_can( |
|
648 | - 'ee_read_transaction', |
|
649 | - 'espresso_transactions_view_transaction' |
|
650 | - ) ? ' |
|
544 | + } |
|
545 | + } |
|
546 | + $content = (! empty($this->datetime_id) && ! empty($checkins)) |
|
547 | + ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions, true)) |
|
548 | + : $name_link; |
|
549 | + return $this->columnContent('ATT_name', $content); |
|
550 | + } |
|
551 | + |
|
552 | + |
|
553 | + /** |
|
554 | + * @param EE_Registration $registration |
|
555 | + * @return string |
|
556 | + * @throws EE_Error |
|
557 | + * @throws EE_Error |
|
558 | + * @throws ReflectionException |
|
559 | + */ |
|
560 | + public function column_ATT_email(EE_Registration $registration): string |
|
561 | + { |
|
562 | + $attendee = $registration->attendee(); |
|
563 | + $content = $attendee instanceof EE_Attendee ? $attendee->email() : ''; |
|
564 | + return $this->columnContent('ATT_email', $content); |
|
565 | + } |
|
566 | + |
|
567 | + |
|
568 | + /** |
|
569 | + * @param EE_Registration $registration |
|
570 | + * @return string |
|
571 | + * @throws EE_Error |
|
572 | + * @throws ReflectionException |
|
573 | + */ |
|
574 | + public function column_Event(EE_Registration $registration): string |
|
575 | + { |
|
576 | + try { |
|
577 | + $event = $this->event instanceof EE_Event ? $this->event : $registration->event(); |
|
578 | + $checkin_link_url = EE_Admin_Page::add_query_args_and_nonce( |
|
579 | + ['action' => 'event_registrations', 'event_id' => $event->ID()], |
|
580 | + REG_ADMIN_URL |
|
581 | + ); |
|
582 | + $content = EE_Registry::instance()->CAP->current_user_can( |
|
583 | + 'ee_read_checkins', |
|
584 | + 'espresso_registrations_registration_checkins' |
|
585 | + ) ? '<a class="ee-aria-tooltip" href="' . $checkin_link_url . '" aria-label="' |
|
586 | + . esc_attr__( |
|
587 | + 'View Checkins for this Event', |
|
588 | + 'event_espresso' |
|
589 | + ) . '">' . $event->name() . '</a>' : $event->name(); |
|
590 | + } catch (EntityNotFoundException $e) { |
|
591 | + $content = esc_html__('Unknown', 'event_espresso'); |
|
592 | + } |
|
593 | + return $this->columnContent('Event', $content); |
|
594 | + } |
|
595 | + |
|
596 | + |
|
597 | + /** |
|
598 | + * @param EE_Registration $registration |
|
599 | + * @return string |
|
600 | + * @throws EE_Error |
|
601 | + * @throws ReflectionException |
|
602 | + */ |
|
603 | + public function column_PRC_name(EE_Registration $registration): string |
|
604 | + { |
|
605 | + $content = $registration->ticket() instanceof EE_Ticket |
|
606 | + ? $registration->ticket()->name() |
|
607 | + : esc_html__( |
|
608 | + "Unknown", |
|
609 | + "event_espresso" |
|
610 | + ); |
|
611 | + return $this->columnContent('PRC_name', $content); |
|
612 | + } |
|
613 | + |
|
614 | + |
|
615 | + /** |
|
616 | + * column_REG_final_price |
|
617 | + * |
|
618 | + * @param EE_Registration $registration |
|
619 | + * @return string |
|
620 | + * @throws EE_Error |
|
621 | + */ |
|
622 | + public function column__REG_final_price(EE_Registration $registration): string |
|
623 | + { |
|
624 | + return $this->columnContent('_REG_final_price', $registration->pretty_final_price(), 'end'); |
|
625 | + } |
|
626 | + |
|
627 | + |
|
628 | + /** |
|
629 | + * column_TXN_paid |
|
630 | + * |
|
631 | + * @param EE_Registration $registration |
|
632 | + * @return string |
|
633 | + * @throws EE_Error |
|
634 | + * @throws ReflectionException |
|
635 | + */ |
|
636 | + public function column_TXN_paid(EE_Registration $registration): string |
|
637 | + { |
|
638 | + $content = ''; |
|
639 | + if ($registration->count() === 1) { |
|
640 | + if ($registration->transaction()->paid() >= $registration->transaction()->total()) { |
|
641 | + return '<div class="dashicons dashicons-yes green-icon"></div>'; |
|
642 | + } else { |
|
643 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
644 | + ['action' => 'view_transaction', 'TXN_ID' => $registration->transaction_ID()], |
|
645 | + TXN_ADMIN_URL |
|
646 | + ); |
|
647 | + $content = EE_Registry::instance()->CAP->current_user_can( |
|
648 | + 'ee_read_transaction', |
|
649 | + 'espresso_transactions_view_transaction' |
|
650 | + ) ? ' |
|
651 | 651 | <a class="ee-aria-tooltip ee-status-color--' |
652 | - . $registration->transaction()->status_ID() |
|
653 | - . '" href="' |
|
654 | - . $view_txn_lnk_url |
|
655 | - . '" aria-label="' |
|
656 | - . esc_attr__('View Transaction', 'event_espresso') |
|
657 | - . '"> |
|
652 | + . $registration->transaction()->status_ID() |
|
653 | + . '" href="' |
|
654 | + . $view_txn_lnk_url |
|
655 | + . '" aria-label="' |
|
656 | + . esc_attr__('View Transaction', 'event_espresso') |
|
657 | + . '"> |
|
658 | 658 | ' |
659 | - . $registration->transaction()->pretty_paid() |
|
660 | - . ' |
|
659 | + . $registration->transaction()->pretty_paid() |
|
660 | + . ' |
|
661 | 661 | </a> |
662 | 662 | ' : $registration->transaction()->pretty_paid(); |
663 | - } |
|
664 | - } |
|
665 | - return $this->columnContent('TXN_paid', $content, 'end'); |
|
666 | - } |
|
667 | - |
|
668 | - |
|
669 | - /** |
|
670 | - * column_TXN_total |
|
671 | - * |
|
672 | - * @param EE_Registration $registration |
|
673 | - * @return string |
|
674 | - * @throws EE_Error |
|
675 | - * @throws ReflectionException |
|
676 | - */ |
|
677 | - public function column_TXN_total(EE_Registration $registration): string |
|
678 | - { |
|
679 | - $content = ''; |
|
680 | - $txn = $registration->transaction(); |
|
681 | - $view_txn_url = add_query_arg(['action' => 'view_transaction', 'TXN_ID' => $txn->ID()], TXN_ADMIN_URL); |
|
682 | - if ($registration->get('REG_count') === 1) { |
|
683 | - $line_total_obj = $txn->total_line_item(); |
|
684 | - $txn_total = $line_total_obj instanceof EE_Line_Item |
|
685 | - ? $line_total_obj->get_pretty('LIN_total') |
|
686 | - : esc_html__( |
|
687 | - 'View Transaction', |
|
688 | - 'event_espresso' |
|
689 | - ); |
|
690 | - $content = EE_Registry::instance()->CAP->current_user_can( |
|
691 | - 'ee_read_transaction', |
|
692 | - 'espresso_transactions_view_transaction' |
|
693 | - ) ? '<a class="ee-aria-tooltip" href="' |
|
694 | - . $view_txn_url |
|
695 | - . '" aria-label="' |
|
696 | - . esc_attr__('View Transaction', 'event_espresso') |
|
697 | - . '">' |
|
698 | - . $txn_total |
|
699 | - . '</a>' |
|
700 | - : $txn_total; |
|
701 | - } |
|
702 | - return $this->columnContent('TXN_total', $content, 'end'); |
|
703 | - } |
|
663 | + } |
|
664 | + } |
|
665 | + return $this->columnContent('TXN_paid', $content, 'end'); |
|
666 | + } |
|
667 | + |
|
668 | + |
|
669 | + /** |
|
670 | + * column_TXN_total |
|
671 | + * |
|
672 | + * @param EE_Registration $registration |
|
673 | + * @return string |
|
674 | + * @throws EE_Error |
|
675 | + * @throws ReflectionException |
|
676 | + */ |
|
677 | + public function column_TXN_total(EE_Registration $registration): string |
|
678 | + { |
|
679 | + $content = ''; |
|
680 | + $txn = $registration->transaction(); |
|
681 | + $view_txn_url = add_query_arg(['action' => 'view_transaction', 'TXN_ID' => $txn->ID()], TXN_ADMIN_URL); |
|
682 | + if ($registration->get('REG_count') === 1) { |
|
683 | + $line_total_obj = $txn->total_line_item(); |
|
684 | + $txn_total = $line_total_obj instanceof EE_Line_Item |
|
685 | + ? $line_total_obj->get_pretty('LIN_total') |
|
686 | + : esc_html__( |
|
687 | + 'View Transaction', |
|
688 | + 'event_espresso' |
|
689 | + ); |
|
690 | + $content = EE_Registry::instance()->CAP->current_user_can( |
|
691 | + 'ee_read_transaction', |
|
692 | + 'espresso_transactions_view_transaction' |
|
693 | + ) ? '<a class="ee-aria-tooltip" href="' |
|
694 | + . $view_txn_url |
|
695 | + . '" aria-label="' |
|
696 | + . esc_attr__('View Transaction', 'event_espresso') |
|
697 | + . '">' |
|
698 | + . $txn_total |
|
699 | + . '</a>' |
|
700 | + : $txn_total; |
|
701 | + } |
|
702 | + return $this->columnContent('TXN_total', $content, 'end'); |
|
703 | + } |
|
704 | 704 | } |