@@ -15,536 +15,536 @@ |
||
15 | 15 | class Events_Admin_List_Table extends EE_Admin_List_Table |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * @var EE_Datetime |
|
20 | - */ |
|
21 | - private $_dtt; |
|
22 | - |
|
23 | - |
|
24 | - /** |
|
25 | - * Initial setup of data properties for the list table. |
|
26 | - */ |
|
27 | - protected function _setup_data() |
|
28 | - { |
|
29 | - $this->_data = $this->_admin_page->get_events($this->_per_page, $this->_current_page); |
|
30 | - $this->_all_data_count = $this->_admin_page->get_events(0, 0, true); |
|
31 | - } |
|
32 | - |
|
33 | - |
|
34 | - /** |
|
35 | - * Set up of additional properties for the list table. |
|
36 | - */ |
|
37 | - protected function _set_properties() |
|
38 | - { |
|
39 | - $this->_wp_list_args = array( |
|
40 | - 'singular' => esc_html__('event', 'event_espresso'), |
|
41 | - 'plural' => esc_html__('events', 'event_espresso'), |
|
42 | - 'ajax' => true, // for now |
|
43 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
44 | - ); |
|
45 | - $this->_columns = array( |
|
46 | - 'cb' => '<input type="checkbox" />', |
|
47 | - 'id' => esc_html__('ID', 'event_espresso'), |
|
48 | - 'name' => esc_html__('Name', 'event_espresso'), |
|
49 | - 'author' => esc_html__('Author', 'event_espresso'), |
|
50 | - 'venue' => esc_html__('Venue', 'event_espresso'), |
|
51 | - 'start_date_time' => esc_html__('Event Start', 'event_espresso'), |
|
52 | - 'reg_begins' => esc_html__('On Sale', 'event_espresso'), |
|
53 | - 'attendees' => '<span class="dashicons dashicons-groups ee-icon-color-ee-green ee-icon-size-20">' |
|
54 | - . '<span class="screen-reader-text">' |
|
55 | - . esc_html__('Approved Registrations', 'event_espresso') |
|
56 | - . '</span>' |
|
57 | - . '</span>', |
|
58 | - // 'tkts_sold' => esc_html__('Tickets Sold', 'event_espresso'), |
|
59 | - 'actions' => esc_html__('Actions', 'event_espresso'), |
|
60 | - ); |
|
61 | - $this->_sortable_columns = array( |
|
62 | - 'id' => array('EVT_ID' => true), |
|
63 | - 'name' => array('EVT_name' => false), |
|
64 | - 'author' => array('EVT_wp_user' => false), |
|
65 | - 'venue' => array('Venue.VNU_name' => false), |
|
66 | - 'start_date_time' => array('Datetime.DTT_EVT_start' => false), |
|
67 | - 'reg_begins' => array('Datetime.Ticket.TKT_start_date' => false), |
|
68 | - ); |
|
69 | - $this->_primary_column = 'id'; |
|
70 | - $this->_hidden_columns = array('author'); |
|
71 | - } |
|
72 | - |
|
73 | - |
|
74 | - /** |
|
75 | - * @return array |
|
76 | - */ |
|
77 | - protected function _get_table_filters() |
|
78 | - { |
|
79 | - return array(); // no filters with decaf |
|
80 | - } |
|
81 | - |
|
82 | - |
|
83 | - /** |
|
84 | - * Setup of views properties. |
|
85 | - * |
|
86 | - * @throws InvalidDataTypeException |
|
87 | - * @throws InvalidInterfaceException |
|
88 | - * @throws InvalidArgumentException |
|
89 | - */ |
|
90 | - protected function _add_view_counts() |
|
91 | - { |
|
92 | - $this->_views['all']['count'] = $this->_admin_page->total_events(); |
|
93 | - $this->_views['draft']['count'] = $this->_admin_page->total_events_draft(); |
|
94 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
95 | - 'ee_delete_events', |
|
96 | - 'espresso_events_trash_events' |
|
97 | - )) { |
|
98 | - $this->_views['trash']['count'] = $this->_admin_page->total_trashed_events(); |
|
99 | - } |
|
100 | - } |
|
101 | - |
|
102 | - |
|
103 | - /** |
|
104 | - * @param EE_Event $item |
|
105 | - * @return string |
|
106 | - * @throws EE_Error |
|
107 | - */ |
|
108 | - protected function _get_row_class($item) |
|
109 | - { |
|
110 | - $class = parent::_get_row_class($item); |
|
111 | - // add status class |
|
112 | - $class .= $item instanceof EE_Event |
|
113 | - ? ' ee-status-strip event-status-' . $item->get_active_status() |
|
114 | - : ''; |
|
115 | - if ($this->_has_checkbox_column) { |
|
116 | - $class .= ' has-checkbox-column'; |
|
117 | - } |
|
118 | - return $class; |
|
119 | - } |
|
120 | - |
|
121 | - |
|
122 | - /** |
|
123 | - * @param EE_Event $item |
|
124 | - * @return string |
|
125 | - * @throws EE_Error |
|
126 | - */ |
|
127 | - public function column_status(EE_Event $item) |
|
128 | - { |
|
129 | - return '<span class="ee-status-strip ee-status-strip-td event-status-' |
|
130 | - . $item->get_active_status() |
|
131 | - . '"></span>'; |
|
132 | - } |
|
133 | - |
|
134 | - |
|
135 | - /** |
|
136 | - * @param EE_Event $item |
|
137 | - * @return string |
|
138 | - * @throws EE_Error |
|
139 | - */ |
|
140 | - public function column_cb($item) |
|
141 | - { |
|
142 | - if (! $item instanceof EE_Event) { |
|
143 | - return ''; |
|
144 | - } |
|
145 | - $this->_dtt = $item->primary_datetime(); // set this for use in other columns |
|
146 | - // does event have any attached registrations? |
|
147 | - $regs = $item->count_related('Registration'); |
|
148 | - return $regs > 0 && $this->_view === 'trash' |
|
149 | - ? '<span class="ee-lock-icon"></span>' |
|
150 | - : sprintf( |
|
151 | - '<input type="checkbox" name="EVT_IDs[]" value="%s" />', |
|
152 | - $item->ID() |
|
153 | - ); |
|
154 | - } |
|
155 | - |
|
156 | - |
|
157 | - /** |
|
158 | - * @param EE_Event $item |
|
159 | - * @return mixed|string |
|
160 | - * @throws EE_Error |
|
161 | - */ |
|
162 | - public function column_id(EE_Event $item) |
|
163 | - { |
|
164 | - $content = $item->ID(); |
|
165 | - $content .= ' <span class="show-on-mobile-view-only">' . $item->name() . '</span>'; |
|
166 | - return $content; |
|
167 | - } |
|
168 | - |
|
169 | - |
|
170 | - /** |
|
171 | - * @param EE_Event $item |
|
172 | - * @return string |
|
173 | - * @throws EE_Error |
|
174 | - * @throws InvalidArgumentException |
|
175 | - * @throws InvalidDataTypeException |
|
176 | - * @throws InvalidInterfaceException |
|
177 | - */ |
|
178 | - public function column_name(EE_Event $item) |
|
179 | - { |
|
180 | - $edit_query_args = array( |
|
181 | - 'action' => 'edit', |
|
182 | - 'post' => $item->ID(), |
|
183 | - ); |
|
184 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
185 | - $actions = $this->_column_name_action_setup($item); |
|
186 | - $status = ''; // $item->status() !== 'publish' ? ' (' . $item->status() . ')' : ''; |
|
187 | - $content = '<strong><a class="row-title" href="' |
|
188 | - . $edit_link . '">' |
|
189 | - . $item->name() |
|
190 | - . '</a></strong>' |
|
191 | - . $status; |
|
192 | - $content .= '<br><span class="ee-status-text-small">' |
|
193 | - . EEH_Template::pretty_status( |
|
194 | - $item->get_active_status(), |
|
195 | - false, |
|
196 | - 'sentence' |
|
197 | - ) |
|
198 | - . '</span>'; |
|
199 | - $content .= $this->row_actions($actions); |
|
200 | - return $content; |
|
201 | - } |
|
202 | - |
|
203 | - |
|
204 | - /** |
|
205 | - * Just a method for setting up the actions for the name column |
|
206 | - * |
|
207 | - * @param EE_Event $item |
|
208 | - * @return array array of actions |
|
209 | - * @throws EE_Error |
|
210 | - * @throws InvalidArgumentException |
|
211 | - * @throws InvalidDataTypeException |
|
212 | - * @throws InvalidInterfaceException |
|
213 | - */ |
|
214 | - protected function _column_name_action_setup(EE_Event $item) |
|
215 | - { |
|
216 | - // todo: remove when attendees is active |
|
217 | - if (! defined('REG_ADMIN_URL')) { |
|
218 | - define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
219 | - } |
|
220 | - $actions = array(); |
|
221 | - $restore_event_link = ''; |
|
222 | - $delete_event_link = ''; |
|
223 | - $trash_event_link = ''; |
|
224 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
225 | - 'ee_edit_event', |
|
226 | - 'espresso_events_edit', |
|
227 | - $item->ID() |
|
228 | - )) { |
|
229 | - $edit_query_args = array( |
|
230 | - 'action' => 'edit', |
|
231 | - 'post' => $item->ID(), |
|
232 | - ); |
|
233 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
234 | - $actions['edit'] = '<a href="' . $edit_link . '"' |
|
235 | - . ' aria-label="' |
|
236 | - /* Translators: The name of the event */ |
|
237 | - . sprintf(esc_attr__('Edit Event (%s)', 'event_espresso'), $item->name()) |
|
238 | - . '">' |
|
239 | - . esc_html__('Edit', 'event_espresso') |
|
240 | - . '</a>'; |
|
241 | - } |
|
242 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
243 | - 'ee_read_registrations', |
|
244 | - 'espresso_registrations_view_registration' |
|
245 | - ) |
|
246 | - && EE_Registry::instance()->CAP->current_user_can( |
|
247 | - 'ee_read_event', |
|
248 | - 'espresso_registrations_view_registration', |
|
249 | - $item->ID() |
|
250 | - ) |
|
251 | - ) { |
|
252 | - $attendees_query_args = array( |
|
253 | - 'action' => 'default', |
|
254 | - 'event_id' => $item->ID(), |
|
255 | - ); |
|
256 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
257 | - $actions['attendees'] = '<a href="' . $attendees_link . '"' |
|
258 | - . ' aria-label="' |
|
259 | - . sprintf( |
|
260 | - /* Translators: The name of the event */ |
|
261 | - esc_attr__('View Registrations for the event: %s', 'event_espresso'), |
|
262 | - $item->name() |
|
263 | - ) |
|
264 | - . '">' |
|
265 | - . esc_html__('Registrations', 'event_espresso') |
|
266 | - . '</a>'; |
|
267 | - } |
|
268 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
269 | - 'ee_delete_event', |
|
270 | - 'espresso_events_trash_event', |
|
271 | - $item->ID() |
|
272 | - )) { |
|
273 | - $trash_event_query_args = array( |
|
274 | - 'action' => 'trash_event', |
|
275 | - 'EVT_ID' => $item->ID(), |
|
276 | - ); |
|
277 | - $trash_event_link = EE_Admin_Page::add_query_args_and_nonce( |
|
278 | - $trash_event_query_args, |
|
279 | - EVENTS_ADMIN_URL |
|
280 | - ); |
|
281 | - } |
|
282 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
283 | - 'ee_delete_event', |
|
284 | - 'espresso_events_restore_event', |
|
285 | - $item->ID() |
|
286 | - )) { |
|
287 | - $restore_event_query_args = array( |
|
288 | - 'action' => 'restore_event', |
|
289 | - 'EVT_ID' => $item->ID(), |
|
290 | - ); |
|
291 | - $restore_event_link = EE_Admin_Page::add_query_args_and_nonce( |
|
292 | - $restore_event_query_args, |
|
293 | - EVENTS_ADMIN_URL |
|
294 | - ); |
|
295 | - } |
|
296 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
297 | - 'ee_delete_event', |
|
298 | - 'espresso_events_delete_event', |
|
299 | - $item->ID() |
|
300 | - )) { |
|
301 | - $delete_event_query_args = array( |
|
302 | - 'action' => 'delete_event', |
|
303 | - 'EVT_ID' => $item->ID(), |
|
304 | - ); |
|
305 | - $delete_event_link = EE_Admin_Page::add_query_args_and_nonce( |
|
306 | - $delete_event_query_args, |
|
307 | - EVENTS_ADMIN_URL |
|
308 | - ); |
|
309 | - } |
|
310 | - $view_link = get_permalink($item->ID()); |
|
311 | - $actions['view'] = '<a href="' . $view_link . '"' |
|
312 | - . ' aria-label="' |
|
313 | - /* Translators: The name of the event */ |
|
314 | - . sprintf(esc_attr__('View Event (%s)', 'event_espresso'), $item->name()) |
|
315 | - . '">' |
|
316 | - . esc_html__('View', 'event_espresso') |
|
317 | - . '</a>'; |
|
318 | - if ($item->get('status') === 'trash') { |
|
319 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
320 | - 'ee_delete_event', |
|
321 | - 'espresso_events_restore_event', |
|
322 | - $item->ID() |
|
323 | - )) { |
|
324 | - $actions['restore_from_trash'] = '<a href="' . $restore_event_link . '"' |
|
325 | - . ' aria-label="' |
|
326 | - . sprintf( |
|
327 | - /* Translators: The name of the event */ |
|
328 | - esc_attr__( |
|
329 | - 'Restore from Trash the event: %s', |
|
330 | - 'event_espresso' |
|
331 | - ), |
|
332 | - $item->name() |
|
333 | - ) |
|
334 | - . '">' |
|
335 | - . esc_html__('Restore from Trash', 'event_espresso') |
|
336 | - . '</a>'; |
|
337 | - } |
|
338 | - if ($item->count_related('Registration') === 0 |
|
339 | - && EE_Registry::instance()->CAP->current_user_can( |
|
340 | - 'ee_delete_event', |
|
341 | - 'espresso_events_delete_event', |
|
342 | - $item->ID() |
|
343 | - ) |
|
344 | - ) { |
|
345 | - $actions['delete'] = '<a href="' . $delete_event_link . '"' |
|
346 | - . ' aria-label="' |
|
347 | - . sprintf( |
|
348 | - /* Translators: The name of the event. */ |
|
349 | - esc_attr__('Delete Permanently the event: %s', 'event_espresso'), |
|
350 | - $item->name() |
|
351 | - ) |
|
352 | - . '">' |
|
353 | - . esc_html__('Delete Permanently', 'event_espresso') |
|
354 | - . '</a>'; |
|
355 | - } |
|
356 | - } else { |
|
357 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
358 | - 'ee_delete_event', |
|
359 | - 'espresso_events_trash_event', |
|
360 | - $item->ID() |
|
361 | - )) { |
|
362 | - $actions['move to trash'] = '<a href="' . $trash_event_link . '"' |
|
363 | - . ' aria-label="' |
|
364 | - . sprintf( |
|
365 | - /* Translators: The name of the event */ |
|
366 | - esc_attr__('Move the event %s to the trash.', 'event_espresso'), |
|
367 | - $item->name() |
|
368 | - ) |
|
369 | - . '">' |
|
370 | - . esc_html__('Trash', 'event_espresso') |
|
371 | - . '</a>'; |
|
372 | - } |
|
373 | - } |
|
374 | - return $actions; |
|
375 | - } |
|
376 | - |
|
377 | - |
|
378 | - /** |
|
379 | - * @param EE_Event $item |
|
380 | - * @return string |
|
381 | - * @throws EE_Error |
|
382 | - */ |
|
383 | - public function column_author(EE_Event $item) |
|
384 | - { |
|
385 | - // user author info |
|
386 | - $event_author = get_userdata($item->wp_user()); |
|
387 | - $gravatar = get_avatar($item->wp_user(), '15'); |
|
388 | - // filter link |
|
389 | - $query_args = array( |
|
390 | - 'action' => 'default', |
|
391 | - 'EVT_wp_user' => $item->wp_user(), |
|
392 | - ); |
|
393 | - $filter_url = EE_Admin_Page::add_query_args_and_nonce($query_args, EVENTS_ADMIN_URL); |
|
394 | - return $gravatar . ' <a href="' . $filter_url . '"' |
|
395 | - . ' title="' . esc_attr__('Click to filter events by this author.', 'event_espresso') . '">' |
|
396 | - . $event_author->display_name |
|
397 | - . '</a>'; |
|
398 | - } |
|
399 | - |
|
400 | - |
|
401 | - /** |
|
402 | - * @param EE_Event $item |
|
403 | - * @return string |
|
404 | - * @throws EE_Error |
|
405 | - */ |
|
406 | - public function column_venue(EE_Event $item) |
|
407 | - { |
|
408 | - $venue = $item->get_first_related('Venue'); |
|
409 | - return ! empty($venue) |
|
410 | - ? $venue->name() |
|
411 | - : ''; |
|
412 | - } |
|
413 | - |
|
414 | - |
|
415 | - /** |
|
416 | - * @param EE_Event $item |
|
417 | - * @return string |
|
418 | - * @throws EE_Error |
|
419 | - */ |
|
420 | - public function column_start_date_time(EE_Event $item) |
|
421 | - { |
|
422 | - return $this->_dtt instanceof EE_Datetime |
|
423 | - ? $this->_dtt->get_i18n_datetime('DTT_EVT_start') |
|
424 | - : esc_html__('No Date was saved for this Event', 'event_espresso'); |
|
425 | - } |
|
426 | - |
|
427 | - |
|
428 | - /** |
|
429 | - * @param EE_Event $item |
|
430 | - * @return string |
|
431 | - * @throws EE_Error |
|
432 | - */ |
|
433 | - public function column_reg_begins(EE_Event $item) |
|
434 | - { |
|
435 | - $reg_start = $item->get_ticket_with_earliest_start_time(); |
|
436 | - return $reg_start instanceof EE_Ticket |
|
437 | - ? $reg_start->get_i18n_datetime('TKT_start_date') |
|
438 | - : esc_html__('No Tickets have been setup for this Event', 'event_espresso'); |
|
439 | - } |
|
440 | - |
|
441 | - |
|
442 | - /** |
|
443 | - * @param EE_Event $item |
|
444 | - * @return int|string |
|
445 | - * @throws EE_Error |
|
446 | - * @throws InvalidArgumentException |
|
447 | - * @throws InvalidDataTypeException |
|
448 | - * @throws InvalidInterfaceException |
|
449 | - */ |
|
450 | - public function column_attendees(EE_Event $item) |
|
451 | - { |
|
452 | - $attendees_query_args = array( |
|
453 | - 'action' => 'default', |
|
454 | - 'event_id' => $item->ID(), |
|
455 | - ); |
|
456 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
457 | - $registered_attendees = EEM_Registration::instance()->get_event_registration_count($item->ID()); |
|
458 | - return EE_Registry::instance()->CAP->current_user_can( |
|
459 | - 'ee_read_event', |
|
460 | - 'espresso_registrations_view_registration', |
|
461 | - $item->ID() |
|
462 | - ) |
|
463 | - && EE_Registry::instance()->CAP->current_user_can( |
|
464 | - 'ee_read_registrations', |
|
465 | - 'espresso_registrations_view_registration' |
|
466 | - ) |
|
467 | - ? '<a href="' . $attendees_link . '">' . $registered_attendees . '</a>' |
|
468 | - : $registered_attendees; |
|
469 | - } |
|
470 | - |
|
471 | - |
|
472 | - /** |
|
473 | - * @param EE_Event $item |
|
474 | - * @return float |
|
475 | - * @throws EE_Error |
|
476 | - * @throws InvalidArgumentException |
|
477 | - * @throws InvalidDataTypeException |
|
478 | - * @throws InvalidInterfaceException |
|
479 | - */ |
|
480 | - public function column_tkts_sold(EE_Event $item) |
|
481 | - { |
|
482 | - return EEM_Ticket::instance()->sum(array(array('Datetime.EVT_ID' => $item->ID())), 'TKT_sold'); |
|
483 | - } |
|
484 | - |
|
485 | - |
|
486 | - /** |
|
487 | - * @param EE_Event $item |
|
488 | - * @return string |
|
489 | - * @throws EE_Error |
|
490 | - * @throws InvalidArgumentException |
|
491 | - * @throws InvalidDataTypeException |
|
492 | - * @throws InvalidInterfaceException |
|
493 | - */ |
|
494 | - public function column_actions(EE_Event $item) |
|
495 | - { |
|
496 | - // todo: remove when attendees is active |
|
497 | - if (! defined('REG_ADMIN_URL')) { |
|
498 | - define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
499 | - } |
|
500 | - $action_links = array(); |
|
501 | - $view_link = get_permalink($item->ID()); |
|
502 | - $action_links[] = '<a href="' . $view_link . '"' |
|
503 | - . ' title="' . esc_attr__('View Event', 'event_espresso') . '" target="_blank">'; |
|
504 | - $action_links[] = '<div class="dashicons dashicons-search"></div></a>'; |
|
505 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
506 | - 'ee_edit_event', |
|
507 | - 'espresso_events_edit', |
|
508 | - $item->ID() |
|
509 | - )) { |
|
510 | - $edit_query_args = array( |
|
511 | - 'action' => 'edit', |
|
512 | - 'post' => $item->ID(), |
|
513 | - ); |
|
514 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
515 | - $action_links[] = '<a href="' . $edit_link . '"' |
|
516 | - . ' title="' . esc_attr__('Edit Event', 'event_espresso') . '">' |
|
517 | - . '<div class="ee-icon ee-icon-calendar-edit"></div>' |
|
518 | - . '</a>'; |
|
519 | - } |
|
520 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
521 | - 'ee_read_registrations', |
|
522 | - 'espresso_registrations_view_registration' |
|
523 | - ) && EE_Registry::instance()->CAP->current_user_can( |
|
524 | - 'ee_read_event', |
|
525 | - 'espresso_registrations_view_registration', |
|
526 | - $item->ID() |
|
527 | - ) |
|
528 | - ) { |
|
529 | - $attendees_query_args = array( |
|
530 | - 'action' => 'default', |
|
531 | - 'event_id' => $item->ID(), |
|
532 | - ); |
|
533 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
534 | - $action_links[] = '<a href="' . $attendees_link . '"' |
|
535 | - . ' title="' . esc_attr__('View Registrants', 'event_espresso') . '">' |
|
536 | - . '<div class="dashicons dashicons-groups"></div>' |
|
537 | - . '</a>'; |
|
538 | - } |
|
539 | - $action_links = apply_filters( |
|
540 | - 'FHEE__Events_Admin_List_Table__column_actions__action_links', |
|
541 | - $action_links, |
|
542 | - $item |
|
543 | - ); |
|
544 | - return $this->_action_string( |
|
545 | - implode("\n\t", $action_links), |
|
546 | - $item, |
|
547 | - 'div' |
|
548 | - ); |
|
549 | - } |
|
18 | + /** |
|
19 | + * @var EE_Datetime |
|
20 | + */ |
|
21 | + private $_dtt; |
|
22 | + |
|
23 | + |
|
24 | + /** |
|
25 | + * Initial setup of data properties for the list table. |
|
26 | + */ |
|
27 | + protected function _setup_data() |
|
28 | + { |
|
29 | + $this->_data = $this->_admin_page->get_events($this->_per_page, $this->_current_page); |
|
30 | + $this->_all_data_count = $this->_admin_page->get_events(0, 0, true); |
|
31 | + } |
|
32 | + |
|
33 | + |
|
34 | + /** |
|
35 | + * Set up of additional properties for the list table. |
|
36 | + */ |
|
37 | + protected function _set_properties() |
|
38 | + { |
|
39 | + $this->_wp_list_args = array( |
|
40 | + 'singular' => esc_html__('event', 'event_espresso'), |
|
41 | + 'plural' => esc_html__('events', 'event_espresso'), |
|
42 | + 'ajax' => true, // for now |
|
43 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
44 | + ); |
|
45 | + $this->_columns = array( |
|
46 | + 'cb' => '<input type="checkbox" />', |
|
47 | + 'id' => esc_html__('ID', 'event_espresso'), |
|
48 | + 'name' => esc_html__('Name', 'event_espresso'), |
|
49 | + 'author' => esc_html__('Author', 'event_espresso'), |
|
50 | + 'venue' => esc_html__('Venue', 'event_espresso'), |
|
51 | + 'start_date_time' => esc_html__('Event Start', 'event_espresso'), |
|
52 | + 'reg_begins' => esc_html__('On Sale', 'event_espresso'), |
|
53 | + 'attendees' => '<span class="dashicons dashicons-groups ee-icon-color-ee-green ee-icon-size-20">' |
|
54 | + . '<span class="screen-reader-text">' |
|
55 | + . esc_html__('Approved Registrations', 'event_espresso') |
|
56 | + . '</span>' |
|
57 | + . '</span>', |
|
58 | + // 'tkts_sold' => esc_html__('Tickets Sold', 'event_espresso'), |
|
59 | + 'actions' => esc_html__('Actions', 'event_espresso'), |
|
60 | + ); |
|
61 | + $this->_sortable_columns = array( |
|
62 | + 'id' => array('EVT_ID' => true), |
|
63 | + 'name' => array('EVT_name' => false), |
|
64 | + 'author' => array('EVT_wp_user' => false), |
|
65 | + 'venue' => array('Venue.VNU_name' => false), |
|
66 | + 'start_date_time' => array('Datetime.DTT_EVT_start' => false), |
|
67 | + 'reg_begins' => array('Datetime.Ticket.TKT_start_date' => false), |
|
68 | + ); |
|
69 | + $this->_primary_column = 'id'; |
|
70 | + $this->_hidden_columns = array('author'); |
|
71 | + } |
|
72 | + |
|
73 | + |
|
74 | + /** |
|
75 | + * @return array |
|
76 | + */ |
|
77 | + protected function _get_table_filters() |
|
78 | + { |
|
79 | + return array(); // no filters with decaf |
|
80 | + } |
|
81 | + |
|
82 | + |
|
83 | + /** |
|
84 | + * Setup of views properties. |
|
85 | + * |
|
86 | + * @throws InvalidDataTypeException |
|
87 | + * @throws InvalidInterfaceException |
|
88 | + * @throws InvalidArgumentException |
|
89 | + */ |
|
90 | + protected function _add_view_counts() |
|
91 | + { |
|
92 | + $this->_views['all']['count'] = $this->_admin_page->total_events(); |
|
93 | + $this->_views['draft']['count'] = $this->_admin_page->total_events_draft(); |
|
94 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
95 | + 'ee_delete_events', |
|
96 | + 'espresso_events_trash_events' |
|
97 | + )) { |
|
98 | + $this->_views['trash']['count'] = $this->_admin_page->total_trashed_events(); |
|
99 | + } |
|
100 | + } |
|
101 | + |
|
102 | + |
|
103 | + /** |
|
104 | + * @param EE_Event $item |
|
105 | + * @return string |
|
106 | + * @throws EE_Error |
|
107 | + */ |
|
108 | + protected function _get_row_class($item) |
|
109 | + { |
|
110 | + $class = parent::_get_row_class($item); |
|
111 | + // add status class |
|
112 | + $class .= $item instanceof EE_Event |
|
113 | + ? ' ee-status-strip event-status-' . $item->get_active_status() |
|
114 | + : ''; |
|
115 | + if ($this->_has_checkbox_column) { |
|
116 | + $class .= ' has-checkbox-column'; |
|
117 | + } |
|
118 | + return $class; |
|
119 | + } |
|
120 | + |
|
121 | + |
|
122 | + /** |
|
123 | + * @param EE_Event $item |
|
124 | + * @return string |
|
125 | + * @throws EE_Error |
|
126 | + */ |
|
127 | + public function column_status(EE_Event $item) |
|
128 | + { |
|
129 | + return '<span class="ee-status-strip ee-status-strip-td event-status-' |
|
130 | + . $item->get_active_status() |
|
131 | + . '"></span>'; |
|
132 | + } |
|
133 | + |
|
134 | + |
|
135 | + /** |
|
136 | + * @param EE_Event $item |
|
137 | + * @return string |
|
138 | + * @throws EE_Error |
|
139 | + */ |
|
140 | + public function column_cb($item) |
|
141 | + { |
|
142 | + if (! $item instanceof EE_Event) { |
|
143 | + return ''; |
|
144 | + } |
|
145 | + $this->_dtt = $item->primary_datetime(); // set this for use in other columns |
|
146 | + // does event have any attached registrations? |
|
147 | + $regs = $item->count_related('Registration'); |
|
148 | + return $regs > 0 && $this->_view === 'trash' |
|
149 | + ? '<span class="ee-lock-icon"></span>' |
|
150 | + : sprintf( |
|
151 | + '<input type="checkbox" name="EVT_IDs[]" value="%s" />', |
|
152 | + $item->ID() |
|
153 | + ); |
|
154 | + } |
|
155 | + |
|
156 | + |
|
157 | + /** |
|
158 | + * @param EE_Event $item |
|
159 | + * @return mixed|string |
|
160 | + * @throws EE_Error |
|
161 | + */ |
|
162 | + public function column_id(EE_Event $item) |
|
163 | + { |
|
164 | + $content = $item->ID(); |
|
165 | + $content .= ' <span class="show-on-mobile-view-only">' . $item->name() . '</span>'; |
|
166 | + return $content; |
|
167 | + } |
|
168 | + |
|
169 | + |
|
170 | + /** |
|
171 | + * @param EE_Event $item |
|
172 | + * @return string |
|
173 | + * @throws EE_Error |
|
174 | + * @throws InvalidArgumentException |
|
175 | + * @throws InvalidDataTypeException |
|
176 | + * @throws InvalidInterfaceException |
|
177 | + */ |
|
178 | + public function column_name(EE_Event $item) |
|
179 | + { |
|
180 | + $edit_query_args = array( |
|
181 | + 'action' => 'edit', |
|
182 | + 'post' => $item->ID(), |
|
183 | + ); |
|
184 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
185 | + $actions = $this->_column_name_action_setup($item); |
|
186 | + $status = ''; // $item->status() !== 'publish' ? ' (' . $item->status() . ')' : ''; |
|
187 | + $content = '<strong><a class="row-title" href="' |
|
188 | + . $edit_link . '">' |
|
189 | + . $item->name() |
|
190 | + . '</a></strong>' |
|
191 | + . $status; |
|
192 | + $content .= '<br><span class="ee-status-text-small">' |
|
193 | + . EEH_Template::pretty_status( |
|
194 | + $item->get_active_status(), |
|
195 | + false, |
|
196 | + 'sentence' |
|
197 | + ) |
|
198 | + . '</span>'; |
|
199 | + $content .= $this->row_actions($actions); |
|
200 | + return $content; |
|
201 | + } |
|
202 | + |
|
203 | + |
|
204 | + /** |
|
205 | + * Just a method for setting up the actions for the name column |
|
206 | + * |
|
207 | + * @param EE_Event $item |
|
208 | + * @return array array of actions |
|
209 | + * @throws EE_Error |
|
210 | + * @throws InvalidArgumentException |
|
211 | + * @throws InvalidDataTypeException |
|
212 | + * @throws InvalidInterfaceException |
|
213 | + */ |
|
214 | + protected function _column_name_action_setup(EE_Event $item) |
|
215 | + { |
|
216 | + // todo: remove when attendees is active |
|
217 | + if (! defined('REG_ADMIN_URL')) { |
|
218 | + define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
219 | + } |
|
220 | + $actions = array(); |
|
221 | + $restore_event_link = ''; |
|
222 | + $delete_event_link = ''; |
|
223 | + $trash_event_link = ''; |
|
224 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
225 | + 'ee_edit_event', |
|
226 | + 'espresso_events_edit', |
|
227 | + $item->ID() |
|
228 | + )) { |
|
229 | + $edit_query_args = array( |
|
230 | + 'action' => 'edit', |
|
231 | + 'post' => $item->ID(), |
|
232 | + ); |
|
233 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
234 | + $actions['edit'] = '<a href="' . $edit_link . '"' |
|
235 | + . ' aria-label="' |
|
236 | + /* Translators: The name of the event */ |
|
237 | + . sprintf(esc_attr__('Edit Event (%s)', 'event_espresso'), $item->name()) |
|
238 | + . '">' |
|
239 | + . esc_html__('Edit', 'event_espresso') |
|
240 | + . '</a>'; |
|
241 | + } |
|
242 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
243 | + 'ee_read_registrations', |
|
244 | + 'espresso_registrations_view_registration' |
|
245 | + ) |
|
246 | + && EE_Registry::instance()->CAP->current_user_can( |
|
247 | + 'ee_read_event', |
|
248 | + 'espresso_registrations_view_registration', |
|
249 | + $item->ID() |
|
250 | + ) |
|
251 | + ) { |
|
252 | + $attendees_query_args = array( |
|
253 | + 'action' => 'default', |
|
254 | + 'event_id' => $item->ID(), |
|
255 | + ); |
|
256 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
257 | + $actions['attendees'] = '<a href="' . $attendees_link . '"' |
|
258 | + . ' aria-label="' |
|
259 | + . sprintf( |
|
260 | + /* Translators: The name of the event */ |
|
261 | + esc_attr__('View Registrations for the event: %s', 'event_espresso'), |
|
262 | + $item->name() |
|
263 | + ) |
|
264 | + . '">' |
|
265 | + . esc_html__('Registrations', 'event_espresso') |
|
266 | + . '</a>'; |
|
267 | + } |
|
268 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
269 | + 'ee_delete_event', |
|
270 | + 'espresso_events_trash_event', |
|
271 | + $item->ID() |
|
272 | + )) { |
|
273 | + $trash_event_query_args = array( |
|
274 | + 'action' => 'trash_event', |
|
275 | + 'EVT_ID' => $item->ID(), |
|
276 | + ); |
|
277 | + $trash_event_link = EE_Admin_Page::add_query_args_and_nonce( |
|
278 | + $trash_event_query_args, |
|
279 | + EVENTS_ADMIN_URL |
|
280 | + ); |
|
281 | + } |
|
282 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
283 | + 'ee_delete_event', |
|
284 | + 'espresso_events_restore_event', |
|
285 | + $item->ID() |
|
286 | + )) { |
|
287 | + $restore_event_query_args = array( |
|
288 | + 'action' => 'restore_event', |
|
289 | + 'EVT_ID' => $item->ID(), |
|
290 | + ); |
|
291 | + $restore_event_link = EE_Admin_Page::add_query_args_and_nonce( |
|
292 | + $restore_event_query_args, |
|
293 | + EVENTS_ADMIN_URL |
|
294 | + ); |
|
295 | + } |
|
296 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
297 | + 'ee_delete_event', |
|
298 | + 'espresso_events_delete_event', |
|
299 | + $item->ID() |
|
300 | + )) { |
|
301 | + $delete_event_query_args = array( |
|
302 | + 'action' => 'delete_event', |
|
303 | + 'EVT_ID' => $item->ID(), |
|
304 | + ); |
|
305 | + $delete_event_link = EE_Admin_Page::add_query_args_and_nonce( |
|
306 | + $delete_event_query_args, |
|
307 | + EVENTS_ADMIN_URL |
|
308 | + ); |
|
309 | + } |
|
310 | + $view_link = get_permalink($item->ID()); |
|
311 | + $actions['view'] = '<a href="' . $view_link . '"' |
|
312 | + . ' aria-label="' |
|
313 | + /* Translators: The name of the event */ |
|
314 | + . sprintf(esc_attr__('View Event (%s)', 'event_espresso'), $item->name()) |
|
315 | + . '">' |
|
316 | + . esc_html__('View', 'event_espresso') |
|
317 | + . '</a>'; |
|
318 | + if ($item->get('status') === 'trash') { |
|
319 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
320 | + 'ee_delete_event', |
|
321 | + 'espresso_events_restore_event', |
|
322 | + $item->ID() |
|
323 | + )) { |
|
324 | + $actions['restore_from_trash'] = '<a href="' . $restore_event_link . '"' |
|
325 | + . ' aria-label="' |
|
326 | + . sprintf( |
|
327 | + /* Translators: The name of the event */ |
|
328 | + esc_attr__( |
|
329 | + 'Restore from Trash the event: %s', |
|
330 | + 'event_espresso' |
|
331 | + ), |
|
332 | + $item->name() |
|
333 | + ) |
|
334 | + . '">' |
|
335 | + . esc_html__('Restore from Trash', 'event_espresso') |
|
336 | + . '</a>'; |
|
337 | + } |
|
338 | + if ($item->count_related('Registration') === 0 |
|
339 | + && EE_Registry::instance()->CAP->current_user_can( |
|
340 | + 'ee_delete_event', |
|
341 | + 'espresso_events_delete_event', |
|
342 | + $item->ID() |
|
343 | + ) |
|
344 | + ) { |
|
345 | + $actions['delete'] = '<a href="' . $delete_event_link . '"' |
|
346 | + . ' aria-label="' |
|
347 | + . sprintf( |
|
348 | + /* Translators: The name of the event. */ |
|
349 | + esc_attr__('Delete Permanently the event: %s', 'event_espresso'), |
|
350 | + $item->name() |
|
351 | + ) |
|
352 | + . '">' |
|
353 | + . esc_html__('Delete Permanently', 'event_espresso') |
|
354 | + . '</a>'; |
|
355 | + } |
|
356 | + } else { |
|
357 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
358 | + 'ee_delete_event', |
|
359 | + 'espresso_events_trash_event', |
|
360 | + $item->ID() |
|
361 | + )) { |
|
362 | + $actions['move to trash'] = '<a href="' . $trash_event_link . '"' |
|
363 | + . ' aria-label="' |
|
364 | + . sprintf( |
|
365 | + /* Translators: The name of the event */ |
|
366 | + esc_attr__('Move the event %s to the trash.', 'event_espresso'), |
|
367 | + $item->name() |
|
368 | + ) |
|
369 | + . '">' |
|
370 | + . esc_html__('Trash', 'event_espresso') |
|
371 | + . '</a>'; |
|
372 | + } |
|
373 | + } |
|
374 | + return $actions; |
|
375 | + } |
|
376 | + |
|
377 | + |
|
378 | + /** |
|
379 | + * @param EE_Event $item |
|
380 | + * @return string |
|
381 | + * @throws EE_Error |
|
382 | + */ |
|
383 | + public function column_author(EE_Event $item) |
|
384 | + { |
|
385 | + // user author info |
|
386 | + $event_author = get_userdata($item->wp_user()); |
|
387 | + $gravatar = get_avatar($item->wp_user(), '15'); |
|
388 | + // filter link |
|
389 | + $query_args = array( |
|
390 | + 'action' => 'default', |
|
391 | + 'EVT_wp_user' => $item->wp_user(), |
|
392 | + ); |
|
393 | + $filter_url = EE_Admin_Page::add_query_args_and_nonce($query_args, EVENTS_ADMIN_URL); |
|
394 | + return $gravatar . ' <a href="' . $filter_url . '"' |
|
395 | + . ' title="' . esc_attr__('Click to filter events by this author.', 'event_espresso') . '">' |
|
396 | + . $event_author->display_name |
|
397 | + . '</a>'; |
|
398 | + } |
|
399 | + |
|
400 | + |
|
401 | + /** |
|
402 | + * @param EE_Event $item |
|
403 | + * @return string |
|
404 | + * @throws EE_Error |
|
405 | + */ |
|
406 | + public function column_venue(EE_Event $item) |
|
407 | + { |
|
408 | + $venue = $item->get_first_related('Venue'); |
|
409 | + return ! empty($venue) |
|
410 | + ? $venue->name() |
|
411 | + : ''; |
|
412 | + } |
|
413 | + |
|
414 | + |
|
415 | + /** |
|
416 | + * @param EE_Event $item |
|
417 | + * @return string |
|
418 | + * @throws EE_Error |
|
419 | + */ |
|
420 | + public function column_start_date_time(EE_Event $item) |
|
421 | + { |
|
422 | + return $this->_dtt instanceof EE_Datetime |
|
423 | + ? $this->_dtt->get_i18n_datetime('DTT_EVT_start') |
|
424 | + : esc_html__('No Date was saved for this Event', 'event_espresso'); |
|
425 | + } |
|
426 | + |
|
427 | + |
|
428 | + /** |
|
429 | + * @param EE_Event $item |
|
430 | + * @return string |
|
431 | + * @throws EE_Error |
|
432 | + */ |
|
433 | + public function column_reg_begins(EE_Event $item) |
|
434 | + { |
|
435 | + $reg_start = $item->get_ticket_with_earliest_start_time(); |
|
436 | + return $reg_start instanceof EE_Ticket |
|
437 | + ? $reg_start->get_i18n_datetime('TKT_start_date') |
|
438 | + : esc_html__('No Tickets have been setup for this Event', 'event_espresso'); |
|
439 | + } |
|
440 | + |
|
441 | + |
|
442 | + /** |
|
443 | + * @param EE_Event $item |
|
444 | + * @return int|string |
|
445 | + * @throws EE_Error |
|
446 | + * @throws InvalidArgumentException |
|
447 | + * @throws InvalidDataTypeException |
|
448 | + * @throws InvalidInterfaceException |
|
449 | + */ |
|
450 | + public function column_attendees(EE_Event $item) |
|
451 | + { |
|
452 | + $attendees_query_args = array( |
|
453 | + 'action' => 'default', |
|
454 | + 'event_id' => $item->ID(), |
|
455 | + ); |
|
456 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
457 | + $registered_attendees = EEM_Registration::instance()->get_event_registration_count($item->ID()); |
|
458 | + return EE_Registry::instance()->CAP->current_user_can( |
|
459 | + 'ee_read_event', |
|
460 | + 'espresso_registrations_view_registration', |
|
461 | + $item->ID() |
|
462 | + ) |
|
463 | + && EE_Registry::instance()->CAP->current_user_can( |
|
464 | + 'ee_read_registrations', |
|
465 | + 'espresso_registrations_view_registration' |
|
466 | + ) |
|
467 | + ? '<a href="' . $attendees_link . '">' . $registered_attendees . '</a>' |
|
468 | + : $registered_attendees; |
|
469 | + } |
|
470 | + |
|
471 | + |
|
472 | + /** |
|
473 | + * @param EE_Event $item |
|
474 | + * @return float |
|
475 | + * @throws EE_Error |
|
476 | + * @throws InvalidArgumentException |
|
477 | + * @throws InvalidDataTypeException |
|
478 | + * @throws InvalidInterfaceException |
|
479 | + */ |
|
480 | + public function column_tkts_sold(EE_Event $item) |
|
481 | + { |
|
482 | + return EEM_Ticket::instance()->sum(array(array('Datetime.EVT_ID' => $item->ID())), 'TKT_sold'); |
|
483 | + } |
|
484 | + |
|
485 | + |
|
486 | + /** |
|
487 | + * @param EE_Event $item |
|
488 | + * @return string |
|
489 | + * @throws EE_Error |
|
490 | + * @throws InvalidArgumentException |
|
491 | + * @throws InvalidDataTypeException |
|
492 | + * @throws InvalidInterfaceException |
|
493 | + */ |
|
494 | + public function column_actions(EE_Event $item) |
|
495 | + { |
|
496 | + // todo: remove when attendees is active |
|
497 | + if (! defined('REG_ADMIN_URL')) { |
|
498 | + define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
499 | + } |
|
500 | + $action_links = array(); |
|
501 | + $view_link = get_permalink($item->ID()); |
|
502 | + $action_links[] = '<a href="' . $view_link . '"' |
|
503 | + . ' title="' . esc_attr__('View Event', 'event_espresso') . '" target="_blank">'; |
|
504 | + $action_links[] = '<div class="dashicons dashicons-search"></div></a>'; |
|
505 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
506 | + 'ee_edit_event', |
|
507 | + 'espresso_events_edit', |
|
508 | + $item->ID() |
|
509 | + )) { |
|
510 | + $edit_query_args = array( |
|
511 | + 'action' => 'edit', |
|
512 | + 'post' => $item->ID(), |
|
513 | + ); |
|
514 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
515 | + $action_links[] = '<a href="' . $edit_link . '"' |
|
516 | + . ' title="' . esc_attr__('Edit Event', 'event_espresso') . '">' |
|
517 | + . '<div class="ee-icon ee-icon-calendar-edit"></div>' |
|
518 | + . '</a>'; |
|
519 | + } |
|
520 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
521 | + 'ee_read_registrations', |
|
522 | + 'espresso_registrations_view_registration' |
|
523 | + ) && EE_Registry::instance()->CAP->current_user_can( |
|
524 | + 'ee_read_event', |
|
525 | + 'espresso_registrations_view_registration', |
|
526 | + $item->ID() |
|
527 | + ) |
|
528 | + ) { |
|
529 | + $attendees_query_args = array( |
|
530 | + 'action' => 'default', |
|
531 | + 'event_id' => $item->ID(), |
|
532 | + ); |
|
533 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
534 | + $action_links[] = '<a href="' . $attendees_link . '"' |
|
535 | + . ' title="' . esc_attr__('View Registrants', 'event_espresso') . '">' |
|
536 | + . '<div class="dashicons dashicons-groups"></div>' |
|
537 | + . '</a>'; |
|
538 | + } |
|
539 | + $action_links = apply_filters( |
|
540 | + 'FHEE__Events_Admin_List_Table__column_actions__action_links', |
|
541 | + $action_links, |
|
542 | + $item |
|
543 | + ); |
|
544 | + return $this->_action_string( |
|
545 | + implode("\n\t", $action_links), |
|
546 | + $item, |
|
547 | + 'div' |
|
548 | + ); |
|
549 | + } |
|
550 | 550 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $class = parent::_get_row_class($item); |
111 | 111 | // add status class |
112 | 112 | $class .= $item instanceof EE_Event |
113 | - ? ' ee-status-strip event-status-' . $item->get_active_status() |
|
113 | + ? ' ee-status-strip event-status-'.$item->get_active_status() |
|
114 | 114 | : ''; |
115 | 115 | if ($this->_has_checkbox_column) { |
116 | 116 | $class .= ' has-checkbox-column'; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function column_cb($item) |
141 | 141 | { |
142 | - if (! $item instanceof EE_Event) { |
|
142 | + if ( ! $item instanceof EE_Event) { |
|
143 | 143 | return ''; |
144 | 144 | } |
145 | 145 | $this->_dtt = $item->primary_datetime(); // set this for use in other columns |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | public function column_id(EE_Event $item) |
163 | 163 | { |
164 | 164 | $content = $item->ID(); |
165 | - $content .= ' <span class="show-on-mobile-view-only">' . $item->name() . '</span>'; |
|
165 | + $content .= ' <span class="show-on-mobile-view-only">'.$item->name().'</span>'; |
|
166 | 166 | return $content; |
167 | 167 | } |
168 | 168 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $actions = $this->_column_name_action_setup($item); |
186 | 186 | $status = ''; // $item->status() !== 'publish' ? ' (' . $item->status() . ')' : ''; |
187 | 187 | $content = '<strong><a class="row-title" href="' |
188 | - . $edit_link . '">' |
|
188 | + . $edit_link.'">' |
|
189 | 189 | . $item->name() |
190 | 190 | . '</a></strong>' |
191 | 191 | . $status; |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | protected function _column_name_action_setup(EE_Event $item) |
215 | 215 | { |
216 | 216 | // todo: remove when attendees is active |
217 | - if (! defined('REG_ADMIN_URL')) { |
|
217 | + if ( ! defined('REG_ADMIN_URL')) { |
|
218 | 218 | define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
219 | 219 | } |
220 | 220 | $actions = array(); |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | 'post' => $item->ID(), |
232 | 232 | ); |
233 | 233 | $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
234 | - $actions['edit'] = '<a href="' . $edit_link . '"' |
|
234 | + $actions['edit'] = '<a href="'.$edit_link.'"' |
|
235 | 235 | . ' aria-label="' |
236 | 236 | /* Translators: The name of the event */ |
237 | 237 | . sprintf(esc_attr__('Edit Event (%s)', 'event_espresso'), $item->name()) |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | 'event_id' => $item->ID(), |
255 | 255 | ); |
256 | 256 | $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
257 | - $actions['attendees'] = '<a href="' . $attendees_link . '"' |
|
257 | + $actions['attendees'] = '<a href="'.$attendees_link.'"' |
|
258 | 258 | . ' aria-label="' |
259 | 259 | . sprintf( |
260 | 260 | /* Translators: The name of the event */ |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | ); |
309 | 309 | } |
310 | 310 | $view_link = get_permalink($item->ID()); |
311 | - $actions['view'] = '<a href="' . $view_link . '"' |
|
311 | + $actions['view'] = '<a href="'.$view_link.'"' |
|
312 | 312 | . ' aria-label="' |
313 | 313 | /* Translators: The name of the event */ |
314 | 314 | . sprintf(esc_attr__('View Event (%s)', 'event_espresso'), $item->name()) |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | 'espresso_events_restore_event', |
322 | 322 | $item->ID() |
323 | 323 | )) { |
324 | - $actions['restore_from_trash'] = '<a href="' . $restore_event_link . '"' |
|
324 | + $actions['restore_from_trash'] = '<a href="'.$restore_event_link.'"' |
|
325 | 325 | . ' aria-label="' |
326 | 326 | . sprintf( |
327 | 327 | /* Translators: The name of the event */ |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | $item->ID() |
343 | 343 | ) |
344 | 344 | ) { |
345 | - $actions['delete'] = '<a href="' . $delete_event_link . '"' |
|
345 | + $actions['delete'] = '<a href="'.$delete_event_link.'"' |
|
346 | 346 | . ' aria-label="' |
347 | 347 | . sprintf( |
348 | 348 | /* Translators: The name of the event. */ |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | 'espresso_events_trash_event', |
360 | 360 | $item->ID() |
361 | 361 | )) { |
362 | - $actions['move to trash'] = '<a href="' . $trash_event_link . '"' |
|
362 | + $actions['move to trash'] = '<a href="'.$trash_event_link.'"' |
|
363 | 363 | . ' aria-label="' |
364 | 364 | . sprintf( |
365 | 365 | /* Translators: The name of the event */ |
@@ -391,8 +391,8 @@ discard block |
||
391 | 391 | 'EVT_wp_user' => $item->wp_user(), |
392 | 392 | ); |
393 | 393 | $filter_url = EE_Admin_Page::add_query_args_and_nonce($query_args, EVENTS_ADMIN_URL); |
394 | - return $gravatar . ' <a href="' . $filter_url . '"' |
|
395 | - . ' title="' . esc_attr__('Click to filter events by this author.', 'event_espresso') . '">' |
|
394 | + return $gravatar.' <a href="'.$filter_url.'"' |
|
395 | + . ' title="'.esc_attr__('Click to filter events by this author.', 'event_espresso').'">' |
|
396 | 396 | . $event_author->display_name |
397 | 397 | . '</a>'; |
398 | 398 | } |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | 'ee_read_registrations', |
465 | 465 | 'espresso_registrations_view_registration' |
466 | 466 | ) |
467 | - ? '<a href="' . $attendees_link . '">' . $registered_attendees . '</a>' |
|
467 | + ? '<a href="'.$attendees_link.'">'.$registered_attendees.'</a>' |
|
468 | 468 | : $registered_attendees; |
469 | 469 | } |
470 | 470 | |
@@ -494,13 +494,13 @@ discard block |
||
494 | 494 | public function column_actions(EE_Event $item) |
495 | 495 | { |
496 | 496 | // todo: remove when attendees is active |
497 | - if (! defined('REG_ADMIN_URL')) { |
|
497 | + if ( ! defined('REG_ADMIN_URL')) { |
|
498 | 498 | define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
499 | 499 | } |
500 | 500 | $action_links = array(); |
501 | 501 | $view_link = get_permalink($item->ID()); |
502 | - $action_links[] = '<a href="' . $view_link . '"' |
|
503 | - . ' title="' . esc_attr__('View Event', 'event_espresso') . '" target="_blank">'; |
|
502 | + $action_links[] = '<a href="'.$view_link.'"' |
|
503 | + . ' title="'.esc_attr__('View Event', 'event_espresso').'" target="_blank">'; |
|
504 | 504 | $action_links[] = '<div class="dashicons dashicons-search"></div></a>'; |
505 | 505 | if (EE_Registry::instance()->CAP->current_user_can( |
506 | 506 | 'ee_edit_event', |
@@ -512,8 +512,8 @@ discard block |
||
512 | 512 | 'post' => $item->ID(), |
513 | 513 | ); |
514 | 514 | $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
515 | - $action_links[] = '<a href="' . $edit_link . '"' |
|
516 | - . ' title="' . esc_attr__('Edit Event', 'event_espresso') . '">' |
|
515 | + $action_links[] = '<a href="'.$edit_link.'"' |
|
516 | + . ' title="'.esc_attr__('Edit Event', 'event_espresso').'">' |
|
517 | 517 | . '<div class="ee-icon ee-icon-calendar-edit"></div>' |
518 | 518 | . '</a>'; |
519 | 519 | } |
@@ -531,8 +531,8 @@ discard block |
||
531 | 531 | 'event_id' => $item->ID(), |
532 | 532 | ); |
533 | 533 | $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
534 | - $action_links[] = '<a href="' . $attendees_link . '"' |
|
535 | - . ' title="' . esc_attr__('View Registrants', 'event_espresso') . '">' |
|
534 | + $action_links[] = '<a href="'.$attendees_link.'"' |
|
535 | + . ' title="'.esc_attr__('View Registrants', 'event_espresso').'">' |
|
536 | 536 | . '<div class="dashicons dashicons-groups"></div>' |
537 | 537 | . '</a>'; |
538 | 538 | } |