Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like Registrations_Admin_Page often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Registrations_Admin_Page, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
30 | class Registrations_Admin_Page extends EE_Admin_Page_CPT |
||
31 | { |
||
32 | |||
33 | /** |
||
34 | * @var EE_Registration |
||
35 | */ |
||
36 | private $_registration; |
||
37 | |||
38 | /** |
||
39 | * @var EE_Event |
||
40 | */ |
||
41 | private $_reg_event; |
||
42 | |||
43 | /** |
||
44 | * @var EE_Session |
||
45 | */ |
||
46 | private $_session; |
||
47 | |||
48 | private static $_reg_status; |
||
49 | |||
50 | /** |
||
51 | * Form for displaying the custom questions for this registration. |
||
52 | * This gets used a few times throughout the request so its best to cache it |
||
53 | * |
||
54 | * @var EE_Registration_Custom_Questions_Form |
||
55 | */ |
||
56 | protected $_reg_custom_questions_form = null; |
||
57 | |||
58 | |||
59 | /** |
||
60 | * constructor |
||
61 | * |
||
62 | * @Constructor |
||
63 | * @access public |
||
64 | * @param bool $routing |
||
65 | * @return Registrations_Admin_Page |
||
|
|||
66 | */ |
||
67 | public function __construct($routing = true) |
||
68 | { |
||
69 | parent::__construct($routing); |
||
70 | add_action('wp_loaded', array($this, 'wp_loaded')); |
||
71 | } |
||
72 | |||
73 | |||
74 | public function wp_loaded() |
||
75 | { |
||
76 | // when adding a new registration... |
||
77 | if (isset($this->_req_data['action']) && $this->_req_data['action'] === 'new_registration') { |
||
78 | EE_System::do_not_cache(); |
||
79 | if (! isset($this->_req_data['processing_registration']) |
||
80 | || absint($this->_req_data['processing_registration']) !== 1 |
||
81 | ) { |
||
82 | // and it's NOT the attendee information reg step |
||
83 | // force cookie expiration by setting time to last week |
||
84 | setcookie('ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/'); |
||
85 | // and update the global |
||
86 | $_COOKIE['ee_registration_added'] = 0; |
||
87 | } |
||
88 | } |
||
89 | } |
||
90 | |||
91 | |||
92 | protected function _init_page_props() |
||
93 | { |
||
94 | $this->page_slug = REG_PG_SLUG; |
||
95 | $this->_admin_base_url = REG_ADMIN_URL; |
||
96 | $this->_admin_base_path = REG_ADMIN; |
||
97 | $this->page_label = esc_html__('Registrations', 'event_espresso'); |
||
98 | $this->_cpt_routes = array( |
||
99 | 'add_new_attendee' => 'espresso_attendees', |
||
100 | 'edit_attendee' => 'espresso_attendees', |
||
101 | 'insert_attendee' => 'espresso_attendees', |
||
102 | 'update_attendee' => 'espresso_attendees', |
||
103 | ); |
||
104 | $this->_cpt_model_names = array( |
||
105 | 'add_new_attendee' => 'EEM_Attendee', |
||
106 | 'edit_attendee' => 'EEM_Attendee', |
||
107 | ); |
||
108 | $this->_cpt_edit_routes = array( |
||
109 | 'espresso_attendees' => 'edit_attendee', |
||
110 | ); |
||
111 | $this->_pagenow_map = array( |
||
112 | 'add_new_attendee' => 'post-new.php', |
||
113 | 'edit_attendee' => 'post.php', |
||
114 | 'trash' => 'post.php', |
||
115 | ); |
||
116 | add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10); |
||
117 | //add filters so that the comment urls don't take users to a confusing 404 page |
||
118 | add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3); |
||
119 | } |
||
120 | |||
121 | |||
122 | public function clear_comment_link($link, $comment, $args) |
||
123 | { |
||
124 | //gotta make sure this only happens on this route |
||
125 | $post_type = get_post_type($comment->comment_post_ID); |
||
126 | if ($post_type === 'espresso_attendees') { |
||
127 | return '#commentsdiv'; |
||
128 | } |
||
129 | return $link; |
||
130 | } |
||
131 | |||
132 | |||
133 | protected function _ajax_hooks() |
||
134 | { |
||
135 | //todo: all hooks for registrations ajax goes in here |
||
136 | add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status')); |
||
137 | } |
||
138 | |||
139 | |||
140 | protected function _define_page_props() |
||
163 | |||
164 | |||
165 | /** |
||
166 | * grab url requests and route them |
||
167 | * |
||
168 | * @access private |
||
169 | * @return void |
||
170 | */ |
||
171 | public function _set_page_routes() |
||
172 | { |
||
173 | $this->_get_registration_status_array(); |
||
174 | $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) |
||
175 | ? $this->_req_data['_REG_ID'] : 0; |
||
176 | $reg_id = empty($reg_id) && ! empty($this->_req_data['reg_status_change_form']['REG_ID']) |
||
177 | ? $this->_req_data['reg_status_change_form']['REG_ID'] |
||
178 | : $reg_id; |
||
179 | $att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) |
||
180 | ? $this->_req_data['ATT_ID'] : 0; |
||
181 | $att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) |
||
182 | ? $this->_req_data['post'] |
||
183 | : $att_id; |
||
184 | $this->_page_routes = array( |
||
185 | 'default' => array( |
||
186 | 'func' => '_registrations_overview_list_table', |
||
187 | 'capability' => 'ee_read_registrations', |
||
188 | ), |
||
189 | 'view_registration' => array( |
||
190 | 'func' => '_registration_details', |
||
191 | 'capability' => 'ee_read_registration', |
||
192 | 'obj_id' => $reg_id, |
||
193 | ), |
||
194 | 'edit_registration' => array( |
||
195 | 'func' => '_update_attendee_registration_form', |
||
196 | 'noheader' => true, |
||
197 | 'headers_sent_route' => 'view_registration', |
||
198 | 'capability' => 'ee_edit_registration', |
||
199 | 'obj_id' => $reg_id, |
||
200 | '_REG_ID' => $reg_id, |
||
201 | ), |
||
202 | 'trash_registrations' => array( |
||
203 | 'func' => '_trash_or_restore_registrations', |
||
204 | 'args' => array('trash' => true), |
||
205 | 'noheader' => true, |
||
206 | 'capability' => 'ee_delete_registrations', |
||
207 | ), |
||
208 | 'restore_registrations' => array( |
||
209 | 'func' => '_trash_or_restore_registrations', |
||
210 | 'args' => array('trash' => false), |
||
211 | 'noheader' => true, |
||
212 | 'capability' => 'ee_delete_registrations', |
||
213 | ), |
||
214 | 'delete_registrations' => array( |
||
215 | 'func' => '_delete_registrations', |
||
216 | 'noheader' => true, |
||
217 | 'capability' => 'ee_delete_registrations', |
||
218 | ), |
||
219 | 'new_registration' => array( |
||
220 | 'func' => 'new_registration', |
||
221 | 'capability' => 'ee_edit_registrations', |
||
222 | ), |
||
223 | 'process_reg_step' => array( |
||
224 | 'func' => 'process_reg_step', |
||
225 | 'noheader' => true, |
||
226 | 'capability' => 'ee_edit_registrations', |
||
227 | ), |
||
228 | 'redirect_to_txn' => array( |
||
229 | 'func' => 'redirect_to_txn', |
||
230 | 'noheader' => true, |
||
231 | 'capability' => 'ee_edit_registrations', |
||
232 | ), |
||
233 | 'change_reg_status' => array( |
||
234 | 'func' => '_change_reg_status', |
||
235 | 'noheader' => true, |
||
236 | 'capability' => 'ee_edit_registration', |
||
237 | 'obj_id' => $reg_id, |
||
238 | ), |
||
239 | 'approve_registration' => array( |
||
240 | 'func' => 'approve_registration', |
||
241 | 'noheader' => true, |
||
242 | 'capability' => 'ee_edit_registration', |
||
243 | 'obj_id' => $reg_id, |
||
244 | ), |
||
245 | 'approve_and_notify_registration' => array( |
||
246 | 'func' => 'approve_registration', |
||
247 | 'noheader' => true, |
||
248 | 'args' => array(true), |
||
249 | 'capability' => 'ee_edit_registration', |
||
250 | 'obj_id' => $reg_id, |
||
251 | ), |
||
252 | 'approve_registrations' => array( |
||
253 | 'func' => 'bulk_action_on_registrations', |
||
254 | 'noheader' => true, |
||
255 | 'capability' => 'ee_edit_registrations', |
||
256 | 'args' => array('approve') |
||
257 | ), |
||
258 | 'approve_and_notify_registrations' => array( |
||
259 | 'func' => 'bulk_action_on_registrations', |
||
260 | 'noheader' => true, |
||
261 | 'capability' => 'ee_edit_registrations', |
||
262 | 'args' => array('approve', true) |
||
263 | ), |
||
264 | 'decline_registration' => array( |
||
265 | 'func' => 'decline_registration', |
||
266 | 'noheader' => true, |
||
267 | 'capability' => 'ee_edit_registration', |
||
268 | 'obj_id' => $reg_id, |
||
269 | ), |
||
270 | 'decline_and_notify_registration' => array( |
||
271 | 'func' => 'decline_registration', |
||
272 | 'noheader' => true, |
||
273 | 'args' => array(true), |
||
274 | 'capability' => 'ee_edit_registration', |
||
275 | 'obj_id' => $reg_id, |
||
276 | ), |
||
277 | 'decline_registrations' => array( |
||
278 | 'func' => 'bulk_action_on_registrations', |
||
279 | 'noheader' => true, |
||
280 | 'capability' => 'ee_edit_registrations', |
||
281 | 'args' => array('decline') |
||
282 | ), |
||
283 | 'decline_and_notify_registrations' => array( |
||
284 | 'func' => 'bulk_action_on_registrations', |
||
285 | 'noheader' => true, |
||
286 | 'capability' => 'ee_edit_registrations', |
||
287 | 'args' => array('decline', true) |
||
288 | ), |
||
289 | 'pending_registration' => array( |
||
290 | 'func' => 'pending_registration', |
||
291 | 'noheader' => true, |
||
292 | 'capability' => 'ee_edit_registration', |
||
293 | 'obj_id' => $reg_id, |
||
294 | ), |
||
295 | 'pending_and_notify_registration' => array( |
||
296 | 'func' => 'pending_registration', |
||
297 | 'noheader' => true, |
||
298 | 'args' => array(true), |
||
299 | 'capability' => 'ee_edit_registration', |
||
300 | 'obj_id' => $reg_id, |
||
301 | ), |
||
302 | 'pending_registrations' => array( |
||
303 | 'func' => 'bulk_action_on_registrations', |
||
304 | 'noheader' => true, |
||
305 | 'capability' => 'ee_edit_registrations', |
||
306 | 'args' => array('pending') |
||
307 | ), |
||
308 | 'pending_and_notify_registrations' => array( |
||
309 | 'func' => 'bulk_action_on_registrations', |
||
310 | 'noheader' => true, |
||
311 | 'capability' => 'ee_edit_registrations', |
||
312 | 'args' => array('pending', true) |
||
313 | ), |
||
314 | 'no_approve_registration' => array( |
||
315 | 'func' => 'not_approve_registration', |
||
316 | 'noheader' => true, |
||
317 | 'capability' => 'ee_edit_registration', |
||
318 | 'obj_id' => $reg_id, |
||
319 | ), |
||
320 | 'no_approve_and_notify_registration' => array( |
||
321 | 'func' => 'not_approve_registration', |
||
322 | 'noheader' => true, |
||
323 | 'args' => array(true), |
||
324 | 'capability' => 'ee_edit_registration', |
||
325 | 'obj_id' => $reg_id, |
||
326 | ), |
||
327 | 'no_approve_registrations' => array( |
||
328 | 'func' => 'bulk_action_on_registrations', |
||
329 | 'noheader' => true, |
||
330 | 'capability' => 'ee_edit_registrations', |
||
331 | 'args' => array('not_approve') |
||
332 | ), |
||
333 | 'no_approve_and_notify_registrations' => array( |
||
334 | 'func' => 'bulk_action_on_registrations', |
||
335 | 'noheader' => true, |
||
336 | 'capability' => 'ee_edit_registrations', |
||
337 | 'args' => array('not_approve', true) |
||
338 | ), |
||
339 | 'cancel_registration' => array( |
||
340 | 'func' => 'cancel_registration', |
||
341 | 'noheader' => true, |
||
342 | 'capability' => 'ee_edit_registration', |
||
343 | 'obj_id' => $reg_id, |
||
344 | ), |
||
345 | 'cancel_and_notify_registration' => array( |
||
346 | 'func' => 'cancel_registration', |
||
347 | 'noheader' => true, |
||
348 | 'args' => array(true), |
||
349 | 'capability' => 'ee_edit_registration', |
||
350 | 'obj_id' => $reg_id, |
||
351 | ), |
||
352 | 'cancel_registrations' => array( |
||
353 | 'func' => 'bulk_action_on_registrations', |
||
354 | 'noheader' => true, |
||
355 | 'capability' => 'ee_edit_registrations', |
||
356 | 'args' => array('cancel') |
||
357 | ), |
||
358 | 'cancel_and_notify_registrations' => array( |
||
359 | 'func' => 'bulk_action_on_registrations', |
||
360 | 'noheader' => true, |
||
361 | 'capability' => 'ee_edit_registrations', |
||
362 | 'args' => array('cancel', true) |
||
363 | ), |
||
364 | 'wait_list_registration' => array( |
||
365 | 'func' => 'wait_list_registration', |
||
366 | 'noheader' => true, |
||
367 | 'capability' => 'ee_edit_registration', |
||
368 | 'obj_id' => $reg_id, |
||
369 | ), |
||
370 | 'wait_list_and_notify_registration' => array( |
||
371 | 'func' => 'wait_list_registration', |
||
372 | 'noheader' => true, |
||
373 | 'args' => array(true), |
||
374 | 'capability' => 'ee_edit_registration', |
||
375 | 'obj_id' => $reg_id, |
||
376 | ), |
||
377 | 'contact_list' => array( |
||
378 | 'func' => '_attendee_contact_list_table', |
||
379 | 'capability' => 'ee_read_contacts', |
||
380 | ), |
||
381 | 'add_new_attendee' => array( |
||
382 | 'func' => '_create_new_cpt_item', |
||
383 | 'args' => array( |
||
384 | 'new_attendee' => true, |
||
385 | 'capability' => 'ee_edit_contacts', |
||
386 | ), |
||
387 | ), |
||
388 | 'edit_attendee' => array( |
||
389 | 'func' => '_edit_cpt_item', |
||
390 | 'capability' => 'ee_edit_contacts', |
||
391 | 'obj_id' => $att_id, |
||
392 | ), |
||
393 | 'duplicate_attendee' => array( |
||
394 | 'func' => '_duplicate_attendee', |
||
395 | 'noheader' => true, |
||
396 | 'capability' => 'ee_edit_contacts', |
||
397 | 'obj_id' => $att_id, |
||
398 | ), |
||
399 | 'insert_attendee' => array( |
||
400 | 'func' => '_insert_or_update_attendee', |
||
401 | 'args' => array( |
||
402 | 'new_attendee' => true, |
||
403 | ), |
||
404 | 'noheader' => true, |
||
405 | 'capability' => 'ee_edit_contacts', |
||
406 | ), |
||
407 | 'update_attendee' => array( |
||
408 | 'func' => '_insert_or_update_attendee', |
||
409 | 'args' => array( |
||
410 | 'new_attendee' => false, |
||
411 | ), |
||
412 | 'noheader' => true, |
||
413 | 'capability' => 'ee_edit_contacts', |
||
414 | 'obj_id' => $att_id, |
||
415 | ), |
||
416 | 'trash_attendees' => array( |
||
417 | 'func' => '_trash_or_restore_attendees', |
||
418 | 'args' => array( |
||
419 | 'trash' => 'true' |
||
420 | ), |
||
421 | 'noheader' => true, |
||
422 | 'capability' => 'ee_delete_contacts' |
||
423 | ), |
||
424 | 'trash_attendee' => array( |
||
425 | 'func' => '_trash_or_restore_attendees', |
||
426 | 'args' => array( |
||
427 | 'trash' => true, |
||
428 | ), |
||
429 | 'noheader' => true, |
||
430 | 'capability' => 'ee_delete_contacts', |
||
431 | 'obj_id' => $att_id, |
||
432 | ), |
||
433 | 'restore_attendees' => array( |
||
434 | 'func' => '_trash_or_restore_attendees', |
||
435 | 'args' => array( |
||
436 | 'trash' => false, |
||
437 | ), |
||
438 | 'noheader' => true, |
||
439 | 'capability' => 'ee_delete_contacts', |
||
440 | 'obj_id' => $att_id, |
||
441 | ), |
||
442 | 'resend_registration' => array( |
||
443 | 'func' => '_resend_registration', |
||
444 | 'noheader' => true, |
||
445 | 'capability' => 'ee_send_message', |
||
446 | ), |
||
447 | 'registrations_report' => array( |
||
448 | 'func' => '_registrations_report', |
||
449 | 'noheader' => true, |
||
450 | 'capability' => 'ee_read_registrations', |
||
451 | ), |
||
452 | 'contact_list_export' => array( |
||
453 | 'func' => '_contact_list_export', |
||
454 | 'noheader' => true, |
||
455 | 'capability' => 'export', |
||
456 | ), |
||
457 | 'contact_list_report' => array( |
||
458 | 'func' => '_contact_list_report', |
||
459 | 'noheader' => true, |
||
460 | 'capability' => 'ee_read_contacts', |
||
461 | ), |
||
462 | ); |
||
463 | } |
||
464 | |||
465 | |||
466 | protected function _set_page_config() |
||
467 | { |
||
468 | $this->_page_config = array( |
||
469 | 'default' => array( |
||
470 | 'nav' => array( |
||
471 | 'label' => esc_html__('Overview', 'event_espresso'), |
||
472 | 'order' => 5, |
||
473 | ), |
||
474 | 'help_tabs' => array( |
||
475 | 'registrations_overview_help_tab' => array( |
||
476 | 'title' => esc_html__('Registrations Overview', 'event_espresso'), |
||
477 | 'filename' => 'registrations_overview', |
||
478 | ), |
||
479 | 'registrations_overview_table_column_headings_help_tab' => array( |
||
480 | 'title' => esc_html__('Registrations Table Column Headings', 'event_espresso'), |
||
481 | 'filename' => 'registrations_overview_table_column_headings', |
||
482 | ), |
||
483 | 'registrations_overview_filters_help_tab' => array( |
||
484 | 'title' => esc_html__('Registration Filters', 'event_espresso'), |
||
485 | 'filename' => 'registrations_overview_filters', |
||
486 | ), |
||
487 | 'registrations_overview_views_help_tab' => array( |
||
488 | 'title' => esc_html__('Registration Views', 'event_espresso'), |
||
489 | 'filename' => 'registrations_overview_views', |
||
490 | ), |
||
491 | 'registrations_regoverview_other_help_tab' => array( |
||
492 | 'title' => esc_html__('Registrations Other', 'event_espresso'), |
||
493 | 'filename' => 'registrations_overview_other', |
||
494 | ), |
||
495 | ), |
||
496 | 'help_tour' => array('Registration_Overview_Help_Tour'), |
||
497 | 'qtips' => array('Registration_List_Table_Tips'), |
||
498 | 'list_table' => 'EE_Registrations_List_Table', |
||
499 | 'require_nonce' => false, |
||
500 | ), |
||
501 | 'view_registration' => array( |
||
502 | 'nav' => array( |
||
503 | 'label' => esc_html__('REG Details', 'event_espresso'), |
||
504 | 'order' => 15, |
||
505 | 'url' => isset($this->_req_data['_REG_ID']) |
||
506 | ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID']), $this->_current_page_view_url) |
||
507 | : $this->_admin_base_url, |
||
508 | 'persistent' => false, |
||
509 | ), |
||
510 | 'help_tabs' => array( |
||
511 | 'registrations_details_help_tab' => array( |
||
512 | 'title' => esc_html__('Registration Details', 'event_espresso'), |
||
513 | 'filename' => 'registrations_details', |
||
514 | ), |
||
515 | 'registrations_details_table_help_tab' => array( |
||
516 | 'title' => esc_html__('Registration Details Table', 'event_espresso'), |
||
517 | 'filename' => 'registrations_details_table', |
||
518 | ), |
||
519 | 'registrations_details_form_answers_help_tab' => array( |
||
520 | 'title' => esc_html__('Registration Form Answers', 'event_espresso'), |
||
521 | 'filename' => 'registrations_details_form_answers', |
||
522 | ), |
||
523 | 'registrations_details_registrant_details_help_tab' => array( |
||
524 | 'title' => esc_html__('Contact Details', 'event_espresso'), |
||
525 | 'filename' => 'registrations_details_registrant_details', |
||
526 | ), |
||
527 | ), |
||
528 | 'help_tour' => array('Registration_Details_Help_Tour'), |
||
529 | 'metaboxes' => array_merge( |
||
530 | $this->_default_espresso_metaboxes, |
||
531 | array('_registration_details_metaboxes') |
||
532 | ), |
||
533 | 'require_nonce' => false, |
||
534 | ), |
||
535 | 'new_registration' => array( |
||
536 | 'nav' => array( |
||
537 | 'label' => esc_html__('Add New Registration', 'event_espresso'), |
||
538 | 'url' => '#', |
||
539 | 'order' => 15, |
||
540 | 'persistent' => false, |
||
541 | ), |
||
542 | 'metaboxes' => $this->_default_espresso_metaboxes, |
||
543 | 'labels' => array( |
||
544 | 'publishbox' => esc_html__('Save Registration', 'event_espresso'), |
||
545 | ), |
||
546 | 'require_nonce' => false, |
||
547 | ), |
||
548 | 'add_new_attendee' => array( |
||
549 | 'nav' => array( |
||
550 | 'label' => esc_html__('Add Contact', 'event_espresso'), |
||
551 | 'order' => 15, |
||
552 | 'persistent' => false, |
||
553 | ), |
||
554 | 'metaboxes' => array_merge( |
||
555 | $this->_default_espresso_metaboxes, |
||
556 | array('_publish_post_box', 'attendee_editor_metaboxes') |
||
557 | ), |
||
558 | 'require_nonce' => false, |
||
559 | ), |
||
560 | 'edit_attendee' => array( |
||
561 | 'nav' => array( |
||
562 | 'label' => esc_html__('Edit Contact', 'event_espresso'), |
||
563 | 'order' => 15, |
||
564 | 'persistent' => false, |
||
565 | 'url' => isset($this->_req_data['ATT_ID']) |
||
566 | ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID']), $this->_current_page_view_url) |
||
567 | : $this->_admin_base_url, |
||
568 | ), |
||
569 | 'metaboxes' => array('attendee_editor_metaboxes'), |
||
570 | 'require_nonce' => false, |
||
571 | ), |
||
572 | 'contact_list' => array( |
||
573 | 'nav' => array( |
||
574 | 'label' => esc_html__('Contact List', 'event_espresso'), |
||
575 | 'order' => 20, |
||
576 | ), |
||
577 | 'list_table' => 'EE_Attendee_Contact_List_Table', |
||
578 | 'help_tabs' => array( |
||
579 | 'registrations_contact_list_help_tab' => array( |
||
580 | 'title' => esc_html__('Registrations Contact List', 'event_espresso'), |
||
581 | 'filename' => 'registrations_contact_list', |
||
582 | ), |
||
583 | 'registrations_contact-list_table_column_headings_help_tab' => array( |
||
584 | 'title' => esc_html__('Contact List Table Column Headings', 'event_espresso'), |
||
585 | 'filename' => 'registrations_contact_list_table_column_headings', |
||
586 | ), |
||
587 | 'registrations_contact_list_views_help_tab' => array( |
||
588 | 'title' => esc_html__('Contact List Views', 'event_espresso'), |
||
589 | 'filename' => 'registrations_contact_list_views', |
||
590 | ), |
||
591 | 'registrations_contact_list_other_help_tab' => array( |
||
592 | 'title' => esc_html__('Contact List Other', 'event_espresso'), |
||
593 | 'filename' => 'registrations_contact_list_other', |
||
594 | ), |
||
595 | ), |
||
596 | 'help_tour' => array('Contact_List_Help_Tour'), |
||
597 | 'metaboxes' => array(), |
||
598 | 'require_nonce' => false, |
||
599 | ), |
||
600 | //override default cpt routes |
||
601 | 'create_new' => '', |
||
602 | 'edit' => '', |
||
603 | ); |
||
604 | } |
||
605 | |||
606 | |||
607 | /** |
||
608 | * The below methods aren't used by this class currently |
||
609 | */ |
||
610 | protected function _add_screen_options() |
||
611 | { |
||
612 | } |
||
613 | |||
614 | |||
615 | protected function _add_feature_pointers() |
||
616 | { |
||
617 | } |
||
618 | |||
619 | |||
620 | public function admin_init() |
||
621 | { |
||
622 | EE_Registry::$i18n_js_strings['update_att_qstns'] = esc_html__( |
||
623 | 'click "Update Registration Questions" to save your changes', |
||
624 | 'event_espresso' |
||
625 | ); |
||
626 | } |
||
627 | |||
628 | |||
629 | public function admin_notices() |
||
630 | { |
||
631 | } |
||
632 | |||
633 | |||
634 | public function admin_footer_scripts() |
||
635 | { |
||
636 | } |
||
637 | |||
638 | |||
639 | /** |
||
640 | * get list of registration statuses |
||
641 | * |
||
642 | * @access private |
||
643 | * @return void |
||
644 | * @throws EE_Error |
||
645 | */ |
||
646 | private function _get_registration_status_array() |
||
647 | { |
||
648 | self::$_reg_status = EEM_Registration::reg_status_array(array(), true); |
||
649 | } |
||
650 | |||
651 | |||
652 | protected function _add_screen_options_default() |
||
653 | { |
||
654 | $this->_per_page_screen_option(); |
||
655 | } |
||
656 | |||
657 | |||
658 | protected function _add_screen_options_contact_list() |
||
659 | { |
||
660 | $page_title = $this->_admin_page_title; |
||
661 | $this->_admin_page_title = esc_html__("Contacts", 'event_espresso'); |
||
662 | $this->_per_page_screen_option(); |
||
663 | $this->_admin_page_title = $page_title; |
||
664 | } |
||
665 | |||
666 | |||
667 | View Code Duplication | public function load_scripts_styles() |
|
668 | { |
||
669 | //style |
||
670 | wp_register_style( |
||
671 | 'espresso_reg', |
||
672 | REG_ASSETS_URL . 'espresso_registrations_admin.css', |
||
673 | array('ee-admin-css'), |
||
674 | EVENT_ESPRESSO_VERSION |
||
675 | ); |
||
676 | wp_enqueue_style('espresso_reg'); |
||
677 | //script |
||
678 | wp_register_script( |
||
679 | 'espresso_reg', |
||
680 | REG_ASSETS_URL . 'espresso_registrations_admin.js', |
||
681 | array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), |
||
682 | EVENT_ESPRESSO_VERSION, |
||
683 | true |
||
684 | ); |
||
685 | wp_enqueue_script('espresso_reg'); |
||
686 | } |
||
687 | |||
688 | |||
689 | public function load_scripts_styles_edit_attendee() |
||
690 | { |
||
691 | //stuff to only show up on our attendee edit details page. |
||
692 | $attendee_details_translations = array( |
||
693 | 'att_publish_text' => sprintf( |
||
694 | esc_html__('Created on: <b>%1$s</b>', 'event_espresso'), |
||
695 | $this->_cpt_model_obj->get_datetime('ATT_created') |
||
696 | ), |
||
697 | ); |
||
698 | wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations); |
||
699 | wp_enqueue_script('jquery-validate'); |
||
700 | } |
||
701 | |||
702 | |||
703 | public function load_scripts_styles_view_registration() |
||
704 | { |
||
705 | //styles |
||
706 | wp_enqueue_style('espresso-ui-theme'); |
||
707 | //scripts |
||
708 | $this->_get_reg_custom_questions_form($this->_registration->ID()); |
||
709 | $this->_reg_custom_questions_form->wp_enqueue_scripts(true); |
||
710 | } |
||
711 | |||
712 | |||
713 | public function load_scripts_styles_contact_list() |
||
714 | { |
||
715 | wp_deregister_style('espresso_reg'); |
||
716 | wp_register_style( |
||
717 | 'espresso_att', |
||
718 | REG_ASSETS_URL . 'espresso_attendees_admin.css', |
||
719 | array('ee-admin-css'), |
||
720 | EVENT_ESPRESSO_VERSION |
||
721 | ); |
||
722 | wp_enqueue_style('espresso_att'); |
||
723 | } |
||
724 | |||
725 | |||
726 | public function load_scripts_styles_new_registration() |
||
727 | { |
||
728 | wp_register_script( |
||
729 | 'ee-spco-for-admin', |
||
730 | REG_ASSETS_URL . 'spco_for_admin.js', |
||
731 | array('underscore', 'jquery'), |
||
732 | EVENT_ESPRESSO_VERSION, |
||
733 | true |
||
734 | ); |
||
735 | wp_enqueue_script('ee-spco-for-admin'); |
||
736 | add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
||
737 | EE_Form_Section_Proper::wp_enqueue_scripts(); |
||
738 | EED_Ticket_Selector::load_tckt_slctr_assets(); |
||
739 | EE_Datepicker_Input::enqueue_styles_and_scripts(); |
||
740 | } |
||
741 | |||
742 | |||
743 | public function AHEE__EE_Admin_Page__route_admin_request_resend_registration() |
||
744 | { |
||
745 | add_filter('FHEE_load_EE_messages', '__return_true'); |
||
746 | } |
||
747 | |||
748 | |||
749 | public function AHEE__EE_Admin_Page__route_admin_request_approve_registration() |
||
750 | { |
||
751 | add_filter('FHEE_load_EE_messages', '__return_true'); |
||
752 | } |
||
753 | |||
754 | |||
755 | protected function _set_list_table_views_default() |
||
756 | { |
||
757 | //for notification related bulk actions we need to make sure only active messengers have an option. |
||
758 | EED_Messages::set_autoloaders(); |
||
759 | /** @type EE_Message_Resource_Manager $message_resource_manager */ |
||
760 | $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
||
761 | $active_mts = $message_resource_manager->list_of_active_message_types(); |
||
762 | //key= bulk_action_slug, value= message type. |
||
763 | $match_array = array( |
||
764 | 'approve_registrations' => 'registration', |
||
765 | 'decline_registrations' => 'declined_registration', |
||
766 | 'pending_registrations' => 'pending_approval', |
||
767 | 'no_approve_registrations' => 'not_approved_registration', |
||
768 | 'cancel_registrations' => 'cancelled_registration', |
||
769 | ); |
||
770 | $can_send = EE_Registry::instance()->CAP->current_user_can( |
||
771 | 'ee_send_message', |
||
772 | 'batch_send_messages' |
||
773 | ); |
||
774 | /** setup reg status bulk actions **/ |
||
775 | $def_reg_status_actions['approve_registrations'] = esc_html__('Approve Registrations', 'event_espresso'); |
||
776 | if ($can_send && in_array($match_array['approve_registrations'], $active_mts, true)) { |
||
777 | $def_reg_status_actions['approve_and_notify_registrations'] = esc_html__( |
||
778 | 'Approve and Notify Registrations', |
||
779 | 'event_espresso' |
||
780 | ); |
||
781 | } |
||
782 | $def_reg_status_actions['decline_registrations'] = esc_html__('Decline Registrations', 'event_espresso'); |
||
783 | if ($can_send && in_array($match_array['decline_registrations'], $active_mts, true)) { |
||
784 | $def_reg_status_actions['decline_and_notify_registrations'] = esc_html__( |
||
785 | 'Decline and Notify Registrations', |
||
786 | 'event_espresso' |
||
787 | ); |
||
788 | } |
||
789 | $def_reg_status_actions['pending_registrations'] = esc_html__( |
||
790 | 'Set Registrations to Pending Payment', |
||
791 | 'event_espresso' |
||
792 | ); |
||
793 | if ($can_send && in_array($match_array['pending_registrations'], $active_mts, true)) { |
||
794 | $def_reg_status_actions['pending_and_notify_registrations'] = esc_html__( |
||
795 | 'Set Registrations to Pending Payment and Notify', |
||
796 | 'event_espresso' |
||
797 | ); |
||
798 | } |
||
799 | $def_reg_status_actions['no_approve_registrations'] = esc_html__( |
||
800 | 'Set Registrations to Not Approved', |
||
801 | 'event_espresso' |
||
802 | ); |
||
803 | if ($can_send && in_array($match_array['no_approve_registrations'], $active_mts, true)) { |
||
804 | $def_reg_status_actions['no_approve_and_notify_registrations'] = esc_html__( |
||
805 | 'Set Registrations to Not Approved and Notify', |
||
806 | 'event_espresso' |
||
807 | ); |
||
808 | } |
||
809 | $def_reg_status_actions['cancel_registrations'] = esc_html__('Cancel Registrations', 'event_espresso'); |
||
810 | if ($can_send && in_array($match_array['cancel_registrations'], $active_mts, true)) { |
||
811 | $def_reg_status_actions['cancel_and_notify_registrations'] = esc_html__( |
||
812 | 'Cancel Registrations and Notify', |
||
813 | 'event_espresso' |
||
814 | ); |
||
815 | } |
||
816 | $def_reg_status_actions = apply_filters( |
||
817 | 'FHEE__Registrations_Admin_Page___set_list_table_views_default__def_reg_status_actions_array', |
||
818 | $def_reg_status_actions, |
||
819 | $active_mts, |
||
820 | $can_send |
||
821 | ); |
||
822 | |||
823 | $this->_views = array( |
||
824 | 'all' => array( |
||
825 | 'slug' => 'all', |
||
826 | 'label' => esc_html__('View All Registrations', 'event_espresso'), |
||
827 | 'count' => 0, |
||
828 | 'bulk_action' => array_merge($def_reg_status_actions, array( |
||
829 | 'trash_registrations' => esc_html__('Trash Registrations', 'event_espresso'), |
||
830 | )), |
||
831 | ), |
||
832 | 'month' => array( |
||
833 | 'slug' => 'month', |
||
834 | 'label' => esc_html__('This Month', 'event_espresso'), |
||
835 | 'count' => 0, |
||
836 | 'bulk_action' => array_merge($def_reg_status_actions, array( |
||
837 | 'trash_registrations' => esc_html__('Trash Registrations', 'event_espresso'), |
||
838 | )), |
||
839 | ), |
||
840 | 'today' => array( |
||
841 | 'slug' => 'today', |
||
842 | 'label' => sprintf( |
||
843 | esc_html__('Today - %s', 'event_espresso'), |
||
844 | date('M d, Y', current_time('timestamp')) |
||
845 | ), |
||
846 | 'count' => 0, |
||
847 | 'bulk_action' => array_merge($def_reg_status_actions, array( |
||
848 | 'trash_registrations' => esc_html__('Trash Registrations', 'event_espresso'), |
||
849 | )), |
||
850 | ), |
||
851 | ); |
||
852 | if (EE_Registry::instance()->CAP->current_user_can( |
||
853 | 'ee_delete_registrations', |
||
854 | 'espresso_registrations_delete_registration' |
||
855 | )) { |
||
856 | $this->_views['incomplete'] = array( |
||
857 | 'slug' => 'incomplete', |
||
858 | 'label' => esc_html__('Incomplete', 'event_espresso'), |
||
859 | 'count' => 0, |
||
860 | 'bulk_action' => array( |
||
861 | 'trash_registrations' => esc_html__('Trash Registrations', 'event_espresso'), |
||
862 | ), |
||
863 | ); |
||
864 | $this->_views['trash'] = array( |
||
865 | 'slug' => 'trash', |
||
866 | 'label' => esc_html__('Trash', 'event_espresso'), |
||
867 | 'count' => 0, |
||
868 | 'bulk_action' => array( |
||
869 | 'restore_registrations' => esc_html__('Restore Registrations', 'event_espresso'), |
||
870 | 'delete_registrations' => esc_html__('Delete Registrations Permanently', 'event_espresso'), |
||
871 | ), |
||
872 | ); |
||
873 | } |
||
874 | } |
||
875 | |||
876 | |||
877 | protected function _set_list_table_views_contact_list() |
||
878 | { |
||
879 | $this->_views = array( |
||
880 | 'in_use' => array( |
||
881 | 'slug' => 'in_use', |
||
882 | 'label' => esc_html__('In Use', 'event_espresso'), |
||
883 | 'count' => 0, |
||
884 | 'bulk_action' => array( |
||
885 | 'trash_attendees' => esc_html__('Move to Trash', 'event_espresso'), |
||
886 | ), |
||
887 | ), |
||
888 | ); |
||
889 | if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', |
||
890 | 'espresso_registrations_trash_attendees') |
||
891 | ) { |
||
892 | $this->_views['trash'] = array( |
||
893 | 'slug' => 'trash', |
||
894 | 'label' => esc_html__('Trash', 'event_espresso'), |
||
895 | 'count' => 0, |
||
896 | 'bulk_action' => array( |
||
897 | 'restore_attendees' => esc_html__('Restore from Trash', 'event_espresso'), |
||
898 | ), |
||
899 | ); |
||
900 | } |
||
901 | } |
||
902 | |||
903 | |||
904 | protected function _registration_legend_items() |
||
905 | { |
||
906 | $fc_items = array( |
||
907 | 'star-icon' => array( |
||
908 | 'class' => 'dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8', |
||
909 | 'desc' => esc_html__('This is the Primary Registrant', 'event_espresso'), |
||
910 | ), |
||
911 | 'view_details' => array( |
||
912 | 'class' => 'dashicons dashicons-clipboard', |
||
913 | 'desc' => esc_html__('View Registration Details', 'event_espresso'), |
||
914 | ), |
||
915 | 'edit_attendee' => array( |
||
916 | 'class' => 'ee-icon ee-icon-user-edit ee-icon-size-16', |
||
917 | 'desc' => esc_html__('Edit Contact Details', 'event_espresso'), |
||
918 | ), |
||
919 | 'view_transaction' => array( |
||
920 | 'class' => 'dashicons dashicons-cart', |
||
921 | 'desc' => esc_html__('View Transaction Details', 'event_espresso'), |
||
922 | ), |
||
923 | 'view_invoice' => array( |
||
924 | 'class' => 'dashicons dashicons-media-spreadsheet', |
||
925 | 'desc' => esc_html__('View Transaction Invoice', 'event_espresso'), |
||
926 | ), |
||
927 | ); |
||
928 | if (EE_Registry::instance()->CAP->current_user_can( |
||
929 | 'ee_send_message', |
||
930 | 'espresso_registrations_resend_registration' |
||
931 | )) { |
||
932 | $fc_items['resend_registration'] = array( |
||
933 | 'class' => 'dashicons dashicons-email-alt', |
||
934 | 'desc' => esc_html__('Resend Registration Details', 'event_espresso'), |
||
935 | ); |
||
936 | } else { |
||
937 | $fc_items['blank'] = array('class' => 'blank', 'desc' => ''); |
||
938 | } |
||
939 | View Code Duplication | if (EE_Registry::instance()->CAP->current_user_can( |
|
940 | 'ee_read_global_messages', |
||
941 | 'view_filtered_messages' |
||
942 | )) { |
||
943 | $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); |
||
944 | if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) { |
||
945 | $fc_items['view_related_messages'] = array( |
||
946 | 'class' => $related_for_icon['css_class'], |
||
947 | 'desc' => $related_for_icon['label'], |
||
948 | ); |
||
949 | } |
||
950 | } |
||
951 | $sc_items = array( |
||
952 | 'approved_status' => array( |
||
953 | 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
||
954 | 'desc' => EEH_Template::pretty_status( |
||
955 | EEM_Registration::status_id_approved, |
||
956 | false, |
||
957 | 'sentence' |
||
958 | ), |
||
959 | ), |
||
960 | 'pending_status' => array( |
||
961 | 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
||
962 | 'desc' => EEH_Template::pretty_status( |
||
963 | EEM_Registration::status_id_pending_payment, |
||
964 | false, |
||
965 | 'sentence' |
||
966 | ), |
||
967 | ), |
||
968 | 'wait_list' => array( |
||
969 | 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list, |
||
970 | 'desc' => EEH_Template::pretty_status( |
||
971 | EEM_Registration::status_id_wait_list, |
||
972 | false, |
||
973 | 'sentence' |
||
974 | ), |
||
975 | ), |
||
976 | 'incomplete_status' => array( |
||
977 | 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete, |
||
978 | 'desc' => EEH_Template::pretty_status( |
||
979 | EEM_Registration::status_id_incomplete, |
||
980 | false, |
||
981 | 'sentence' |
||
982 | ), |
||
983 | ), |
||
984 | 'not_approved' => array( |
||
985 | 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
||
986 | 'desc' => EEH_Template::pretty_status( |
||
987 | EEM_Registration::status_id_not_approved, |
||
988 | false, |
||
989 | 'sentence' |
||
990 | ), |
||
991 | ), |
||
992 | 'declined_status' => array( |
||
993 | 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
||
994 | 'desc' => EEH_Template::pretty_status( |
||
995 | EEM_Registration::status_id_declined, |
||
996 | false, |
||
997 | 'sentence' |
||
998 | ), |
||
999 | ), |
||
1000 | 'cancelled_status' => array( |
||
1001 | 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
||
1002 | 'desc' => EEH_Template::pretty_status( |
||
1003 | EEM_Registration::status_id_cancelled, |
||
1004 | false, |
||
1005 | 'sentence' |
||
1006 | ), |
||
1007 | ), |
||
1008 | ); |
||
1009 | return array_merge($fc_items, $sc_items); |
||
1010 | } |
||
1011 | |||
1012 | |||
1013 | |||
1014 | /*************************************** REGISTRATION OVERVIEW **************************************/ |
||
1015 | /** |
||
1016 | * @throws \EE_Error |
||
1017 | */ |
||
1018 | protected function _registrations_overview_list_table() |
||
1019 | { |
||
1020 | $this->_template_args['admin_page_header'] = ''; |
||
1021 | $EVT_ID = ! empty($this->_req_data['event_id']) |
||
1022 | ? absint($this->_req_data['event_id']) |
||
1023 | : 0; |
||
1024 | if ($EVT_ID) { |
||
1025 | if (EE_Registry::instance()->CAP->current_user_can( |
||
1026 | 'ee_edit_registrations', |
||
1027 | 'espresso_registrations_new_registration', |
||
1028 | $EVT_ID |
||
1029 | )) { |
||
1030 | $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
||
1031 | 'new_registration', |
||
1032 | 'add-registrant', |
||
1033 | array('event_id' => $EVT_ID), |
||
1034 | 'add-new-h2' |
||
1035 | ); |
||
1036 | } |
||
1037 | $event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
||
1038 | if ($event instanceof EE_Event) { |
||
1039 | $this->_template_args['admin_page_header'] = sprintf( |
||
1040 | esc_html__( |
||
1041 | '%s Viewing registrations for the event: %s%s', |
||
1042 | 'event_espresso' |
||
1043 | ), |
||
1044 | '<h3 style="line-height:1.5em;">', |
||
1045 | '<br /><a href="' |
||
1046 | . EE_Admin_Page::add_query_args_and_nonce( |
||
1047 | array( |
||
1048 | 'action' => 'edit', |
||
1049 | 'post' => $event->ID(), |
||
1050 | ), |
||
1051 | EVENTS_ADMIN_URL |
||
1052 | ) |
||
1053 | . '"> ' |
||
1054 | . $event->get('EVT_name') |
||
1055 | . ' </a> ', |
||
1056 | '</h3>' |
||
1057 | ); |
||
1058 | } |
||
1059 | $DTT_ID = ! empty($this->_req_data['datetime_id']) ? absint($this->_req_data['datetime_id']) : 0; |
||
1060 | $datetime = EEM_Datetime::instance()->get_one_by_ID($DTT_ID); |
||
1061 | View Code Duplication | if ($datetime instanceof EE_Datetime && $this->_template_args['admin_page_header'] !== '') { |
|
1062 | $this->_template_args['admin_page_header'] = substr( |
||
1063 | $this->_template_args['admin_page_header'], |
||
1064 | 0, |
||
1065 | -5 |
||
1066 | ); |
||
1067 | $this->_template_args['admin_page_header'] .= ' <span class="drk-grey-text">'; |
||
1068 | $this->_template_args['admin_page_header'] .= '<span class="dashicons dashicons-calendar"></span>'; |
||
1069 | $this->_template_args['admin_page_header'] .= $datetime->name(); |
||
1070 | $this->_template_args['admin_page_header'] .= ' ( ' . $datetime->start_date() . ' )'; |
||
1071 | $this->_template_args['admin_page_header'] .= '</span></h3>'; |
||
1072 | } |
||
1073 | } |
||
1074 | $this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items()); |
||
1075 | $this->display_admin_list_table_page_with_no_sidebar(); |
||
1076 | } |
||
1077 | |||
1078 | |||
1079 | /** |
||
1080 | * This sets the _registration property for the registration details screen |
||
1081 | * |
||
1082 | * @access private |
||
1083 | * @return bool |
||
1084 | * @throws EE_Error |
||
1085 | * @throws InvalidArgumentException |
||
1086 | * @throws InvalidDataTypeException |
||
1087 | * @throws InvalidInterfaceException |
||
1088 | */ |
||
1089 | private function _set_registration_object() |
||
1112 | |||
1113 | |||
1114 | /** |
||
1115 | * Used to retrieve registrations for the list table. |
||
1116 | * |
||
1117 | * @param int $per_page |
||
1118 | * @param bool $count |
||
1119 | * @param bool $this_month |
||
1120 | * @param bool $today |
||
1121 | * @return EE_Registration[]|int |
||
1122 | * @throws EE_Error |
||
1123 | * @throws InvalidArgumentException |
||
1124 | * @throws InvalidDataTypeException |
||
1125 | * @throws InvalidInterfaceException |
||
1126 | */ |
||
1127 | public function get_registrations( |
||
1128 | $per_page = 10, |
||
1129 | $count = false, |
||
1130 | $this_month = false, |
||
1131 | $today = false |
||
1132 | ) { |
||
1133 | if ($this_month) { |
||
1134 | $this->_req_data['status'] = 'month'; |
||
1135 | } |
||
1136 | if ($today) { |
||
1137 | $this->_req_data['status'] = 'today'; |
||
1152 | |||
1153 | |||
1154 | /** |
||
1155 | * Retrieves the query parameters to be used by the Registration model for getting registrations. |
||
1156 | * Note: this listens to values on the request for some of the query parameters. |
||
1157 | * |
||
1158 | * @param array $request |
||
1159 | * @param int $per_page |
||
1160 | * @param bool $count |
||
1161 | * @return array |
||
1162 | * @throws EE_Error |
||
1163 | */ |
||
1164 | protected function _get_registration_query_parameters( |
||
1187 | |||
1188 | |||
1189 | /** |
||
1190 | * This will add EVT_ID to the provided $where array for EE model query parameters. |
||
1191 | * |
||
1192 | * @param array $request usually the same as $this->_req_data but not necessarily |
||
1193 | * @return array |
||
1194 | */ |
||
1195 | protected function _add_event_id_to_where_conditions(array $request) |
||
1203 | |||
1204 | |||
1205 | /** |
||
1206 | * Adds category ID if it exists in the request to the where conditions for the registrations query. |
||
1207 | * |
||
1208 | * @param array $request usually the same as $this->_req_data but not necessarily |
||
1209 | * @return array |
||
1210 | */ |
||
1211 | protected function _add_category_id_to_where_conditions(array $request) |
||
1219 | |||
1220 | |||
1221 | /** |
||
1222 | * Adds the datetime ID if it exists in the request to the where conditions for the registrations query. |
||
1223 | * |
||
1224 | * @param array $request usually the same as $this->_req_data but not necessarily |
||
1225 | * @return array |
||
1226 | */ |
||
1227 | protected function _add_datetime_id_to_where_conditions(array $request) |
||
1238 | |||
1239 | |||
1240 | /** |
||
1241 | * Adds the correct registration status to the where conditions for the registrations query. |
||
1242 | * |
||
1243 | * @param array $request usually the same as $this->_req_data but not necessarily |
||
1244 | * @return array |
||
1245 | */ |
||
1246 | protected function _add_registration_status_to_where_conditions(array $request) |
||
1273 | |||
1274 | |||
1275 | /** |
||
1276 | * Adds any provided date restraints to the where conditions for the registrations query. |
||
1277 | * |
||
1278 | * @param array $request usually the same as $this->_req_data but not necessarily |
||
1279 | * @return array |
||
1280 | * @throws EE_Error |
||
1281 | * @throws InvalidArgumentException |
||
1282 | * @throws InvalidDataTypeException |
||
1283 | * @throws InvalidInterfaceException |
||
1284 | */ |
||
1285 | protected function _add_date_to_where_conditions(array $request) |
||
1360 | |||
1361 | |||
1362 | /** |
||
1363 | * Adds any provided search restraints to the where conditions for the registrations query |
||
1364 | * |
||
1365 | * @param array $request usually the same as $this->_req_data but not necessarily |
||
1366 | * @return array |
||
1367 | */ |
||
1368 | protected function _add_search_to_where_conditions(array $request) |
||
1396 | |||
1397 | |||
1398 | /** |
||
1399 | * Sets up the where conditions for the registrations query. |
||
1400 | * |
||
1401 | * @param array $request |
||
1402 | * @return array |
||
1403 | * @throws EE_Error |
||
1404 | */ |
||
1405 | protected function _get_where_conditions_for_registrations_query($request) |
||
1420 | |||
1421 | |||
1422 | /** |
||
1423 | * Sets up the orderby for the registrations query. |
||
1424 | * |
||
1425 | * @return array |
||
1426 | */ |
||
1427 | protected function _get_orderby_for_registrations_query() |
||
1472 | |||
1473 | |||
1474 | /** |
||
1475 | * Sets up the limit for the registrations query. |
||
1476 | * |
||
1477 | * @param $per_page |
||
1478 | * @return array |
||
1479 | */ |
||
1480 | protected function _get_limit($per_page) |
||
1497 | |||
1498 | |||
1499 | public function get_registration_status_array() |
||
1503 | |||
1504 | |||
1505 | |||
1506 | |||
1507 | /*************************************** REGISTRATION DETAILS ***************************************/ |
||
1508 | /** |
||
1509 | * generates HTML for the View Registration Details Admin page |
||
1510 | * |
||
1511 | * @access protected |
||
1512 | * @return void |
||
1513 | * @throws DomainException |
||
1514 | * @throws EE_Error |
||
1515 | * @throws InvalidArgumentException |
||
1516 | * @throws InvalidDataTypeException |
||
1517 | * @throws InvalidInterfaceException |
||
1518 | * @throws EntityNotFoundException |
||
1519 | */ |
||
1520 | protected function _registration_details() |
||
1611 | |||
1612 | |||
1613 | protected function _registration_details_metaboxes() |
||
1657 | |||
1658 | |||
1659 | /** |
||
1660 | * set_reg_status_buttons_metabox |
||
1661 | * |
||
1662 | * @access protected |
||
1663 | * @return string |
||
1664 | * @throws \EE_Error |
||
1665 | */ |
||
1666 | public function set_reg_status_buttons_metabox() |
||
1681 | |||
1682 | |||
1683 | /** |
||
1684 | * @return EE_Form_Section_Proper |
||
1685 | * @throws EE_Error |
||
1686 | * @throws InvalidArgumentException |
||
1687 | * @throws InvalidDataTypeException |
||
1688 | * @throws InvalidInterfaceException |
||
1689 | * @throws \EventEspresso\core\exceptions\EntityNotFoundException |
||
1690 | */ |
||
1691 | protected function _generate_reg_status_change_form() |
||
1751 | |||
1752 | |||
1753 | /** |
||
1754 | * Returns an array of all the buttons for the various statuses and switch status actions |
||
1755 | * |
||
1756 | * @return array |
||
1757 | * @throws EE_Error |
||
1758 | * @throws InvalidArgumentException |
||
1759 | * @throws InvalidDataTypeException |
||
1760 | * @throws InvalidInterfaceException |
||
1761 | * @throws EntityNotFoundException |
||
1762 | */ |
||
1763 | protected function _get_reg_statuses() |
||
1778 | |||
1779 | |||
1780 | /** |
||
1781 | * This method is used when using _REG_ID from request which may or may not be an array of reg_ids. |
||
1782 | * |
||
1783 | * @param bool $status REG status given for changing registrations to. |
||
1784 | * @param bool $notify Whether to send messages notifications or not. |
||
1785 | * @return array (array with reg_id(s) updated and whether update was successful. |
||
1786 | * @throws EE_Error |
||
1787 | * @throws InvalidArgumentException |
||
1788 | * @throws InvalidDataTypeException |
||
1789 | * @throws InvalidInterfaceException |
||
1790 | * @throws ReflectionException |
||
1791 | * @throws RuntimeException |
||
1792 | * @throws EntityNotFoundException |
||
1793 | */ |
||
1794 | protected function _set_registration_status_from_request($status = false, $notify = false) |
||
1842 | |||
1843 | |||
1844 | /** |
||
1845 | * Set the registration status for the given reg_id (which may or may not be an array, it gets typecast to an |
||
1846 | * array). Note, this method does NOT take care of possible notifications. That is required by calling code. |
||
1847 | * |
||
1848 | * @param array $REG_IDs |
||
1849 | * @param string $status |
||
1850 | * @param bool $notify Used to indicate whether notification was requested or not. This determines the context |
||
1851 | * slug sent with setting the registration status. |
||
1852 | * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as |
||
1853 | * @throws EE_Error |
||
1854 | * @throws InvalidArgumentException |
||
1855 | * @throws InvalidDataTypeException |
||
1856 | * @throws InvalidInterfaceException |
||
1857 | * @throws ReflectionException |
||
1858 | * @throws RuntimeException |
||
1859 | * @throws EntityNotFoundException |
||
1860 | */ |
||
1861 | protected function _set_registration_status($REG_IDs = array(), $status = '', $notify = false) |
||
1898 | |||
1899 | |||
1900 | /** |
||
1901 | * Common logic for setting up success message and redirecting to appropriate route |
||
1902 | * |
||
1903 | * @param string $STS_ID status id for the registration changed to |
||
1904 | * @param bool $notify indicates whether the _set_registration_status_from_request does notifications or not. |
||
1905 | * @return void |
||
1906 | * @throws EE_Error |
||
1907 | */ |
||
1908 | protected function _reg_status_change_return($STS_ID, $notify = false) |
||
1949 | |||
1950 | |||
1951 | /** |
||
1952 | * incoming reg status change from reg details page. |
||
1953 | * |
||
1954 | * @return void |
||
1955 | */ |
||
1956 | protected function _change_reg_status() |
||
1997 | |||
1998 | |||
1999 | /** |
||
2000 | * Callback for bulk action routes. |
||
2001 | * Note: although we could just register the singular route callbacks for each bulk action route as well, this |
||
2002 | * method was chosen so there is one central place all the registration status bulk actions are going through. |
||
2003 | * Potentially, this provides an easier place to locate logic that is specific to these bulk actions (as opposed to |
||
2004 | * when an action is happening on just a single registration). |
||
2005 | * @param $action |
||
2006 | * @param bool $notify |
||
2007 | */ |
||
2008 | protected function bulk_action_on_registrations($action, $notify = false) { |
||
2020 | |||
2021 | |||
2022 | /** |
||
2023 | * approve_registration |
||
2024 | * |
||
2025 | * @access protected |
||
2026 | * @param bool $notify whether or not to notify the registrant about their approval. |
||
2027 | * @return void |
||
2028 | */ |
||
2029 | protected function approve_registration($notify = false) |
||
2033 | |||
2034 | |||
2035 | /** |
||
2036 | * decline_registration |
||
2037 | * |
||
2038 | * @access protected |
||
2039 | * @param bool $notify whether or not to notify the registrant about their status change. |
||
2040 | * @return void |
||
2041 | */ |
||
2042 | protected function decline_registration($notify = false) |
||
2046 | |||
2047 | |||
2048 | /** |
||
2049 | * cancel_registration |
||
2050 | * |
||
2051 | * @access protected |
||
2052 | * @param bool $notify whether or not to notify the registrant about their status change. |
||
2053 | * @return void |
||
2054 | */ |
||
2055 | protected function cancel_registration($notify = false) |
||
2059 | |||
2060 | |||
2061 | /** |
||
2062 | * not_approve_registration |
||
2063 | * |
||
2064 | * @access protected |
||
2065 | * @param bool $notify whether or not to notify the registrant about their status change. |
||
2066 | * @return void |
||
2067 | */ |
||
2068 | protected function not_approve_registration($notify = false) |
||
2072 | |||
2073 | |||
2074 | /** |
||
2075 | * decline_registration |
||
2076 | * |
||
2077 | * @access protected |
||
2078 | * @param bool $notify whether or not to notify the registrant about their status change. |
||
2079 | * @return void |
||
2080 | */ |
||
2081 | protected function pending_registration($notify = false) |
||
2085 | |||
2086 | |||
2087 | /** |
||
2088 | * waitlist_registration |
||
2089 | * |
||
2090 | * @access protected |
||
2091 | * @param bool $notify whether or not to notify the registrant about their status change. |
||
2092 | * @return void |
||
2093 | */ |
||
2094 | protected function wait_list_registration($notify = false) |
||
2098 | |||
2099 | |||
2100 | /** |
||
2101 | * generates HTML for the Registration main meta box |
||
2102 | * |
||
2103 | * @access public |
||
2104 | * @return void |
||
2105 | * @throws DomainException |
||
2106 | * @throws EE_Error |
||
2107 | * @throws InvalidArgumentException |
||
2108 | * @throws InvalidDataTypeException |
||
2109 | * @throws InvalidInterfaceException |
||
2110 | * @throws ReflectionException |
||
2111 | * @throws EntityNotFoundException |
||
2112 | */ |
||
2113 | public function _reg_details_meta_box() |
||
2243 | |||
2244 | |||
2245 | /** |
||
2246 | * generates HTML for the Registration Questions meta box. |
||
2247 | * If pre-4.8.32.rc.000 hooks are used, uses old methods (with its filters), |
||
2248 | * otherwise uses new forms system |
||
2249 | * |
||
2250 | * @access public |
||
2251 | * @return void |
||
2252 | * @throws DomainException |
||
2253 | * @throws EE_Error |
||
2254 | */ |
||
2255 | public function _reg_questions_meta_box() |
||
2273 | |||
2274 | |||
2275 | /** |
||
2276 | * form_before_question_group |
||
2277 | * |
||
2278 | * @deprecated as of 4.8.32.rc.000 |
||
2279 | * @access public |
||
2280 | * @param string $output |
||
2281 | * @return string |
||
2282 | */ |
||
2283 | public function form_before_question_group($output) |
||
2298 | |||
2299 | |||
2300 | /** |
||
2301 | * form_after_question_group |
||
2302 | * |
||
2303 | * @deprecated as of 4.8.32.rc.000 |
||
2304 | * @access public |
||
2305 | * @param string $output |
||
2306 | * @return string |
||
2307 | */ |
||
2308 | public function form_after_question_group($output) |
||
2336 | |||
2337 | |||
2338 | /** |
||
2339 | * form_form_field_label_wrap |
||
2340 | * |
||
2341 | * @deprecated as of 4.8.32.rc.000 |
||
2342 | * @access public |
||
2343 | * @param string $label |
||
2344 | * @return string |
||
2345 | */ |
||
2346 | View Code Duplication | public function form_form_field_label_wrap($label) |
|
2362 | |||
2363 | |||
2364 | /** |
||
2365 | * form_form_field_input__wrap |
||
2366 | * |
||
2367 | * @deprecated as of 4.8.32.rc.000 |
||
2368 | * @access public |
||
2369 | * @param string $input |
||
2370 | * @return string |
||
2371 | */ |
||
2372 | View Code Duplication | public function form_form_field_input__wrap($input) |
|
2388 | |||
2389 | |||
2390 | /** |
||
2391 | * Updates the registration's custom questions according to the form info, if the form is submitted. |
||
2392 | * If it's not a post, the "view_registrations" route will be called next on the SAME request |
||
2393 | * to display the page |
||
2394 | * |
||
2395 | * @access protected |
||
2396 | * @return void |
||
2397 | * @throws EE_Error |
||
2398 | */ |
||
2399 | protected function _update_attendee_registration_form() |
||
2413 | |||
2414 | |||
2415 | /** |
||
2416 | * Gets the form for saving registrations custom questions (if done |
||
2417 | * previously retrieves the cached form object, which may have validation errors in it) |
||
2418 | * |
||
2419 | * @param int $REG_ID |
||
2420 | * @return EE_Registration_Custom_Questions_Form |
||
2421 | * @throws EE_Error |
||
2422 | * @throws InvalidArgumentException |
||
2423 | * @throws InvalidDataTypeException |
||
2424 | * @throws InvalidInterfaceException |
||
2425 | */ |
||
2426 | protected function _get_reg_custom_questions_form($REG_ID) |
||
2437 | |||
2438 | |||
2439 | /** |
||
2440 | * Saves |
||
2441 | * |
||
2442 | * @access private |
||
2443 | * @param bool $REG_ID |
||
2444 | * @return bool |
||
2445 | * @throws EE_Error |
||
2446 | * @throws InvalidArgumentException |
||
2447 | * @throws InvalidDataTypeException |
||
2448 | * @throws InvalidInterfaceException |
||
2449 | */ |
||
2450 | private function _save_reg_custom_questions_form($REG_ID = false) |
||
2488 | |||
2489 | |||
2490 | /** |
||
2491 | * generates HTML for the Registration main meta box |
||
2492 | * |
||
2493 | * @access public |
||
2494 | * @return void |
||
2495 | * @throws DomainException |
||
2496 | * @throws EE_Error |
||
2497 | * @throws InvalidArgumentException |
||
2498 | * @throws InvalidDataTypeException |
||
2499 | * @throws InvalidInterfaceException |
||
2500 | */ |
||
2501 | public function _reg_attendees_meta_box() |
||
2558 | |||
2559 | |||
2560 | /** |
||
2561 | * generates HTML for the Edit Registration side meta box |
||
2562 | * |
||
2563 | * @access public |
||
2564 | * @return void |
||
2565 | * @throws DomainException |
||
2566 | * @throws EE_Error |
||
2567 | * @throws InvalidArgumentException |
||
2568 | * @throws InvalidDataTypeException |
||
2569 | * @throws InvalidInterfaceException |
||
2570 | */ |
||
2571 | public function _reg_registrant_side_meta_box() |
||
2614 | |||
2615 | |||
2616 | /** |
||
2617 | * trash or restore registrations |
||
2618 | * |
||
2619 | * @param boolean $trash whether to archive or restore |
||
2620 | * @return void |
||
2621 | * @throws EE_Error |
||
2622 | * @throws InvalidArgumentException |
||
2623 | * @throws InvalidDataTypeException |
||
2624 | * @throws InvalidInterfaceException |
||
2625 | * @throws RuntimeException |
||
2626 | * @access protected |
||
2627 | */ |
||
2628 | protected function _trash_or_restore_registrations($trash = true) |
||
2691 | |||
2692 | |||
2693 | /** |
||
2694 | * This is used to permanently delete registrations. Note, this will handle not only deleting permanently the |
||
2695 | * registration but also. |
||
2696 | * 1. Removing relations to EE_Attendee |
||
2697 | * 2. Deleting permanently the related transaction, but ONLY if all related registrations to the transaction are |
||
2698 | * ALSO trashed. |
||
2699 | * 3. Deleting permanently any related Line items but only if the above conditions are met. |
||
2700 | * 4. Removing relationships between all tickets and the related registrations |
||
2701 | * 5. Deleting permanently any related Answers (and the answers for other related registrations that were deleted.) |
||
2702 | * 6. Deleting permanently any related Checkins. |
||
2703 | * |
||
2704 | * @return void |
||
2705 | * @throws EE_Error |
||
2706 | * @throws InvalidArgumentException |
||
2707 | * @throws InvalidDataTypeException |
||
2708 | * @throws InvalidInterfaceException |
||
2709 | */ |
||
2710 | protected function _delete_registrations() |
||
2750 | |||
2751 | |||
2752 | /** |
||
2753 | * handles the permanent deletion of a registration. See comments with _delete_registrations() for details on what |
||
2754 | * models get affected. |
||
2755 | * |
||
2756 | * @param EE_Registration $REG registration to be deleted permenantly |
||
2757 | * @return bool true = successful deletion, false = fail. |
||
2758 | * @throws EE_Error |
||
2759 | */ |
||
2760 | protected function _delete_registration(EE_Registration $REG) |
||
2818 | |||
2819 | |||
2820 | /** |
||
2821 | * generates HTML for the Register New Attendee Admin page |
||
2822 | * |
||
2823 | * @access private |
||
2824 | * @throws DomainException |
||
2825 | * @throws EE_Error |
||
2826 | */ |
||
2827 | public function new_registration() |
||
2877 | |||
2878 | |||
2879 | /** |
||
2880 | * This returns the content for a registration step |
||
2881 | * |
||
2882 | * @access protected |
||
2883 | * @return string html |
||
2884 | * @throws DomainException |
||
2885 | * @throws EE_Error |
||
2886 | * @throws InvalidArgumentException |
||
2887 | * @throws InvalidDataTypeException |
||
2888 | * @throws InvalidInterfaceException |
||
2889 | */ |
||
2890 | protected function _get_registration_step_content() |
||
2981 | |||
2982 | |||
2983 | /** |
||
2984 | * set_reg_event |
||
2985 | * |
||
2986 | * @access private |
||
2987 | * @return bool |
||
2988 | * @throws EE_Error |
||
2989 | * @throws InvalidArgumentException |
||
2990 | * @throws InvalidDataTypeException |
||
2991 | * @throws InvalidInterfaceException |
||
2992 | */ |
||
2993 | private function _set_reg_event() |
||
3005 | |||
3006 | |||
3007 | /** |
||
3008 | * process_reg_step |
||
3009 | * |
||
3010 | * @access public |
||
3011 | * @return string |
||
3012 | * @throws DomainException |
||
3013 | * @throws EE_Error |
||
3014 | * @throws InvalidArgumentException |
||
3015 | * @throws InvalidDataTypeException |
||
3016 | * @throws InvalidInterfaceException |
||
3017 | * @throws ReflectionException |
||
3018 | * @throws RuntimeException |
||
3019 | */ |
||
3020 | public function process_reg_step() |
||
3021 | { |
||
3022 | EE_System::do_not_cache(); |
||
3023 | $this->_set_reg_event(); |
||
3024 | EE_Registry::instance()->REQ->set_espresso_page(true); |
||
3025 | EE_Registry::instance()->REQ->set('uts', time()); |
||
3026 | //what step are we on? |
||
3027 | $cart = EE_Registry::instance()->SSN->cart(); |
||
3028 | $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
||
3029 | //if doing ajax then we need to verify the nonce |
||
3030 | View Code Duplication | if (defined('DOING_AJAX')) { |
|
3031 | $nonce = isset($this->_req_data[$this->_req_nonce]) |
||
3032 | ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
||
3033 | $this->_verify_nonce($nonce, $this->_req_nonce); |
||
3034 | } |
||
3035 | switch ($step) { |
||
3036 | case 'ticket' : |
||
3037 | //process ticket selection |
||
3038 | $success = EED_Ticket_Selector::instance()->process_ticket_selections(); |
||
3039 | if ($success) { |
||
3040 | EE_Error::add_success( |
||
3041 | esc_html__( |
||
3042 | 'Tickets Selected. Now complete the registration.', |
||
3043 | 'event_espresso' |
||
3044 | ) |
||
3045 | ); |
||
3046 | } else { |
||
3047 | $query_args['step_error'] = $this->_req_data['step_error'] = true; |
||
3048 | } |
||
3049 | View Code Duplication | if (defined('DOING_AJAX')) { |
|
3050 | $this->new_registration(); //display next step |
||
3051 | } else { |
||
3052 | $query_args = array( |
||
3053 | 'action' => 'new_registration', |
||
3054 | 'processing_registration' => 1, |
||
3055 | 'event_id' => $this->_reg_event->ID(), |
||
3056 | 'uts' => time(), |
||
3057 | ); |
||
3058 | $this->_redirect_after_action( |
||
3059 | false, |
||
3060 | '', |
||
3061 | '', |
||
3062 | $query_args, |
||
3063 | true |
||
3064 | ); |
||
3065 | } |
||
3066 | break; |
||
3067 | case 'questions' : |
||
3068 | if (! isset( |
||
3069 | $this->_req_data['txn_reg_status_change'], |
||
3070 | $this->_req_data['txn_reg_status_change']['send_notifications']) |
||
3071 | ) { |
||
3072 | add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
||
3073 | } |
||
3074 | //process registration |
||
3075 | $transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin(); |
||
3076 | if ($cart instanceof EE_Cart) { |
||
3077 | $grand_total = $cart->get_cart_grand_total(); |
||
3078 | if ($grand_total instanceof EE_Line_Item) { |
||
3079 | $grand_total->save_this_and_descendants_to_txn(); |
||
3080 | } |
||
3081 | } |
||
3082 | View Code Duplication | if ( ! $transaction instanceof EE_Transaction) { |
|
3083 | $query_args = array( |
||
3084 | 'action' => 'new_registration', |
||
3085 | 'processing_registration' => 2, |
||
3086 | 'event_id' => $this->_reg_event->ID(), |
||
3087 | 'uts' => time(), |
||
3088 | ); |
||
3089 | if (defined('DOING_AJAX')) { |
||
3090 | //display registration form again because there are errors (maybe validation?) |
||
3091 | $this->new_registration(); |
||
3092 | return; |
||
3093 | } else { |
||
3094 | $this->_redirect_after_action( |
||
3095 | false, |
||
3096 | '', |
||
3097 | '', |
||
3098 | $query_args, |
||
3099 | true |
||
3100 | ); |
||
3101 | return; |
||
3102 | } |
||
3103 | } |
||
3104 | // maybe update status, and make sure to save transaction if not done already |
||
3105 | if ( ! $transaction->update_status_based_on_total_paid()) { |
||
3106 | $transaction->save(); |
||
3107 | } |
||
3108 | EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
||
3109 | $this->_req_data = array(); |
||
3110 | $query_args = array( |
||
3111 | 'action' => 'redirect_to_txn', |
||
3112 | 'TXN_ID' => $transaction->ID(), |
||
3113 | 'EVT_ID' => $this->_reg_event->ID(), |
||
3114 | 'event_name' => urlencode($this->_reg_event->name()), |
||
3115 | 'redirect_from' => 'new_registration', |
||
3116 | ); |
||
3117 | $this->_redirect_after_action(false, '', '', $query_args, true); |
||
3118 | break; |
||
3119 | } |
||
3120 | //what are you looking here for? Should be nothing to do at this point. |
||
3121 | } |
||
3122 | |||
3123 | |||
3124 | /** |
||
3125 | * redirect_to_txn |
||
3126 | * |
||
3127 | * @access public |
||
3128 | * @return void |
||
3129 | * @throws EE_Error |
||
3130 | * @throws InvalidArgumentException |
||
3131 | * @throws InvalidDataTypeException |
||
3132 | * @throws InvalidInterfaceException |
||
3133 | */ |
||
3134 | public function redirect_to_txn() |
||
3156 | |||
3157 | |||
3158 | /** |
||
3159 | * generates HTML for the Attendee Contact List |
||
3160 | * |
||
3161 | * @access protected |
||
3162 | * @return void |
||
3163 | */ |
||
3164 | protected function _attendee_contact_list_table() |
||
3170 | |||
3171 | |||
3172 | /** |
||
3173 | * get_attendees |
||
3174 | * |
||
3175 | * @param $per_page |
||
3176 | * @param bool $count whether to return count or data. |
||
3177 | * @param bool $trash |
||
3178 | * @return array |
||
3179 | * @throws EE_Error |
||
3180 | * @throws InvalidArgumentException |
||
3181 | * @throws InvalidDataTypeException |
||
3182 | * @throws InvalidInterfaceException |
||
3183 | * @access public |
||
3184 | */ |
||
3185 | public function get_attendees($per_page, $count = false, $trash = false) |
||
3277 | |||
3278 | |||
3279 | /** |
||
3280 | * This is just taking care of resending the registration confirmation |
||
3281 | * |
||
3282 | * @access protected |
||
3283 | * @return void |
||
3284 | */ |
||
3285 | protected function _resend_registration() |
||
3293 | |||
3294 | /** |
||
3295 | * Creates a registration report, but accepts the name of a method to use for preparing the query parameters |
||
3296 | * to use when selecting registrations |
||
3297 | * @param string $method_name_for_getting_query_params the name of the method (on this class) to use for preparing |
||
3298 | * the query parameters from the request |
||
3299 | * @return void ends the request with a redirect or download |
||
3300 | */ |
||
3301 | public function _registrations_report_base( $method_name_for_getting_query_params ) |
||
3339 | |||
3340 | |||
3341 | |||
3342 | /** |
||
3343 | * Creates a registration report using only query parameters in the request |
||
3344 | * @return void |
||
3345 | */ |
||
3346 | public function _registrations_report() |
||
3350 | |||
3351 | |||
3352 | public function _contact_list_export() |
||
3360 | |||
3361 | |||
3362 | public function _contact_list_report() |
||
3379 | |||
3380 | |||
3381 | |||
3382 | |||
3383 | |||
3384 | /*************************************** ATTENDEE DETAILS ***************************************/ |
||
3385 | /** |
||
3386 | * This duplicates the attendee object for the given incoming registration id and attendee_id. |
||
3387 | * |
||
3388 | * @return void |
||
3389 | * @throws EE_Error |
||
3390 | * @throws InvalidArgumentException |
||
3391 | * @throws InvalidDataTypeException |
||
3392 | * @throws InvalidInterfaceException |
||
3393 | */ |
||
3394 | protected function _duplicate_attendee() |
||
3429 | |||
3430 | |||
3431 | /** |
||
3432 | * Callback invoked by parent EE_Admin_CPT class hooked in on `save_post` wp hook. |
||
3433 | * @param int $post_id |
||
3434 | * @param WP_POST $post |
||
3435 | * @throws DomainException |
||
3436 | * @throws EE_Error |
||
3437 | * @throws InvalidArgumentException |
||
3438 | * @throws InvalidDataTypeException |
||
3439 | * @throws InvalidInterfaceException |
||
3440 | * @throws LogicException |
||
3441 | * @throws InvalidFormSubmissionException |
||
3442 | */ |
||
3443 | protected function _insert_update_cpt_item($post_id, $post) |
||
3500 | |||
3501 | |||
3502 | public function trash_cpt_item($post_id) |
||
3505 | |||
3506 | |||
3507 | public function delete_cpt_item($post_id) |
||
3510 | |||
3511 | |||
3512 | public function restore_cpt_item($post_id) |
||
3515 | |||
3516 | |||
3517 | protected function _restore_cpt_item($post_id, $revision_id) |
||
3520 | |||
3521 | |||
3522 | public function attendee_editor_metaboxes() |
||
3578 | |||
3579 | |||
3580 | /** |
||
3581 | * Metabox for attendee contact info |
||
3582 | * |
||
3583 | * @param WP_Post $post wp post object |
||
3584 | * @return string attendee contact info ( and form ) |
||
3585 | * @throws EE_Error |
||
3586 | * @throws InvalidArgumentException |
||
3587 | * @throws InvalidDataTypeException |
||
3588 | * @throws InvalidInterfaceException |
||
3589 | * @throws LogicException |
||
3590 | * @throws DomainException |
||
3591 | */ |
||
3592 | public function attendee_contact_info($post) |
||
3599 | |||
3600 | |||
3601 | /** |
||
3602 | * Return form handler for the contact details metabox |
||
3603 | * |
||
3604 | * @param EE_Attendee $attendee |
||
3605 | * @return AttendeeContactDetailsMetaboxFormHandler |
||
3606 | * @throws DomainException |
||
3607 | * @throws InvalidArgumentException |
||
3608 | * @throws InvalidDataTypeException |
||
3609 | * @throws InvalidInterfaceException |
||
3610 | */ |
||
3611 | protected function getAttendeeContactDetailsMetaboxFormHandler(EE_Attendee $attendee) |
||
3615 | |||
3616 | |||
3617 | /** |
||
3618 | * Metabox for attendee details |
||
3619 | * |
||
3620 | * @param WP_Post $post wp post object |
||
3621 | * @throws DomainException |
||
3622 | */ |
||
3623 | public function attendee_address_details($post) |
||
3677 | |||
3678 | |||
3679 | /** |
||
3680 | * _attendee_details |
||
3681 | * |
||
3682 | * @access protected |
||
3683 | * @param $post |
||
3684 | * @return void |
||
3685 | * @throws DomainException |
||
3686 | * @throws EE_Error |
||
3687 | */ |
||
3688 | public function attendee_registrations_meta_box($post) |
||
3696 | |||
3697 | |||
3698 | /** |
||
3699 | * add in the form fields for the attendee edit |
||
3700 | * |
||
3701 | * @param WP_Post $post wp post object |
||
3702 | * @return string html for new form. |
||
3703 | * @throws DomainException |
||
3704 | */ |
||
3705 | public function after_title_form_fields($post) |
||
3713 | |||
3714 | |||
3715 | /** |
||
3716 | * _trash_or_restore_attendee |
||
3717 | * |
||
3718 | * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
||
3719 | * @return void |
||
3720 | * @throws EE_Error |
||
3721 | * @throws InvalidArgumentException |
||
3722 | * @throws InvalidDataTypeException |
||
3723 | * @throws InvalidInterfaceException |
||
3724 | * @access protected |
||
3725 | */ |
||
3726 | protected function _trash_or_restore_attendees($trash = true) |
||
3762 | |||
3763 | } |
||
3764 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.