@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | /** |
6 | 6 | * This is the template for the "Number Bubbles" Progress Steps |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | <!-- progress step display --> |
15 | 15 | <div class="ee-progress-step-main-container"> |
16 | 16 | <div class="progress-step-container number-bubbles-container"> |
17 | - <?php foreach ( $progress_steps as $progress_step ) : ?> |
|
18 | - <div data-step-nmbr="<?php echo $progress_step->order();?>" id="progress-step-<?php echo $progress_step->id(); ?>" class="progress-step-number <?php echo $progress_step->htmlClass(); ?>"> |
|
17 | + <?php foreach ($progress_steps as $progress_step) : ?> |
|
18 | + <div data-step-nmbr="<?php echo $progress_step->order(); ?>" id="progress-step-<?php echo $progress_step->id(); ?>" class="progress-step-number <?php echo $progress_step->htmlClass(); ?>"> |
|
19 | 19 | <div class="progress-step-line"></div> |
20 | 20 | <div class="progress-step-bubble"><p><?php echo $progress_step->order(); ?></p></div> |
21 | 21 | <span class="progress-step-text"><?php echo $progress_step->text(); ?></span> |
22 | 22 | </div> |
23 | - <?php endforeach;?> |
|
23 | + <?php endforeach; ?> |
|
24 | 24 | </div> |
25 | 25 | </div> |
26 | 26 |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | |
4 | 4 | use OutOfBoundsException; |
5 | 5 | |
6 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
7 | - exit( 'No direct script access allowed' ); |
|
6 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
7 | + exit('No direct script access allowed'); |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | * @param int $code |
29 | 29 | * @param \Exception $previous |
30 | 30 | */ |
31 | - public function __construct( $form_name, $message = '', $code = 0, \Exception $previous = null ) { |
|
32 | - if ( empty( $message ) ) { |
|
31 | + public function __construct($form_name, $message = '', $code = 0, \Exception $previous = null) { |
|
32 | + if (empty($message)) { |
|
33 | 33 | $message = sprintf( |
34 | 34 | __( |
35 | 35 | 'The data for the "%1$s" form, is either missing or was not submitted properly.', |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $form_name |
39 | 39 | ); |
40 | 40 | } |
41 | - parent::__construct( $message, $code, $previous ); |
|
41 | + parent::__construct($message, $code, $previous); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | } |
@@ -163,9 +163,9 @@ discard block |
||
163 | 163 | |
164 | 164 | /** |
165 | 165 | * grab url requests and route them |
166 | - * @access private |
|
167 | - * @return void |
|
168 | - */ |
|
166 | + * @access private |
|
167 | + * @return void |
|
168 | + */ |
|
169 | 169 | public function _set_page_routes() { |
170 | 170 | |
171 | 171 | $this->_get_registration_status_array(); |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | 'title' => __('Registrations Other', 'event_espresso'), |
438 | 438 | 'filename' => 'registrations_overview_other' |
439 | 439 | ) |
440 | - ), |
|
440 | + ), |
|
441 | 441 | 'help_tour' => array( 'Registration_Overview_Help_Tour' ), |
442 | 442 | 'qtips' => array('Registration_List_Table_Tips'), |
443 | 443 | 'list_table' => 'EE_Registrations_List_Table', |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | : $this->_admin_base_url, |
457 | 457 | 'persistent' => FALSE |
458 | 458 | ), |
459 | - 'help_tabs' => array( |
|
459 | + 'help_tabs' => array( |
|
460 | 460 | 'registrations_details_help_tab' => array( |
461 | 461 | 'title' => __('Registration Details', 'event_espresso'), |
462 | 462 | 'filename' => 'registrations_details' |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | 'order' => 20 |
521 | 521 | ), |
522 | 522 | 'list_table' => 'EE_Attendee_Contact_List_Table', |
523 | - 'help_tabs' => array( |
|
523 | + 'help_tabs' => array( |
|
524 | 524 | 'registrations_contact_list_help_tab' => array( |
525 | 525 | 'title' => __('Registrations Contact List', 'event_espresso'), |
526 | 526 | 'filename' => 'registrations_contact_list' |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | 'title' => __('Contact List Other', 'event_espresso'), |
538 | 538 | 'filename' => 'registrations_contact_list_other' |
539 | 539 | ) |
540 | - ), |
|
540 | + ), |
|
541 | 541 | 'help_tour' => array( 'Contact_List_Help_Tour' ), |
542 | 542 | 'metaboxes' => array(), |
543 | 543 | 'require_nonce' => FALSE |
@@ -571,9 +571,9 @@ discard block |
||
571 | 571 | |
572 | 572 | /** |
573 | 573 | * get list of registration statuses |
574 | - * @access private |
|
575 | - * @return void |
|
576 | - */ |
|
574 | + * @access private |
|
575 | + * @return void |
|
576 | + */ |
|
577 | 577 | private function _get_registration_status_array() { |
578 | 578 | self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE); |
579 | 579 | } |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | return TRUE; |
892 | 892 | } |
893 | 893 | |
894 | - $REG = EEM_Registration::instance(); |
|
894 | + $REG = EEM_Registration::instance(); |
|
895 | 895 | |
896 | 896 | $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
897 | 897 | |
@@ -1112,9 +1112,9 @@ discard block |
||
1112 | 1112 | |
1113 | 1113 | /** |
1114 | 1114 | * generates HTML for the View Registration Details Admin page |
1115 | - * @access protected |
|
1116 | - * @return void |
|
1117 | - */ |
|
1115 | + * @access protected |
|
1116 | + * @return void |
|
1117 | + */ |
|
1118 | 1118 | protected function _registration_details() { |
1119 | 1119 | |
1120 | 1120 | $this->_template_args = array(); |
@@ -1401,10 +1401,10 @@ discard block |
||
1401 | 1401 | |
1402 | 1402 | /** |
1403 | 1403 | * approve_registration |
1404 | - * @access protected |
|
1405 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1406 | - * @return void |
|
1407 | - */ |
|
1404 | + * @access protected |
|
1405 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1406 | + * @return void |
|
1407 | + */ |
|
1408 | 1408 | protected function approve_registration( $notify = false ) { |
1409 | 1409 | $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify ); |
1410 | 1410 | } |
@@ -1414,10 +1414,10 @@ discard block |
||
1414 | 1414 | |
1415 | 1415 | /** |
1416 | 1416 | * decline_registration |
1417 | - * @access protected |
|
1418 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1419 | - * @return void |
|
1420 | - */ |
|
1417 | + * @access protected |
|
1418 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1419 | + * @return void |
|
1420 | + */ |
|
1421 | 1421 | protected function decline_registration( $notify = false ) { |
1422 | 1422 | $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify ); |
1423 | 1423 | } |
@@ -1427,10 +1427,10 @@ discard block |
||
1427 | 1427 | |
1428 | 1428 | /** |
1429 | 1429 | * cancel_registration |
1430 | - * @access protected |
|
1431 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1432 | - * @return void |
|
1433 | - */ |
|
1430 | + * @access protected |
|
1431 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1432 | + * @return void |
|
1433 | + */ |
|
1434 | 1434 | protected function cancel_registration( $notify = false ) { |
1435 | 1435 | $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify ); |
1436 | 1436 | } |
@@ -1441,10 +1441,10 @@ discard block |
||
1441 | 1441 | |
1442 | 1442 | /** |
1443 | 1443 | * not_approve_registration |
1444 | - * @access protected |
|
1445 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1446 | - * @return void |
|
1447 | - */ |
|
1444 | + * @access protected |
|
1445 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1446 | + * @return void |
|
1447 | + */ |
|
1448 | 1448 | protected function not_approve_registration( $notify = false ) { |
1449 | 1449 | $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify ); |
1450 | 1450 | } |
@@ -1453,10 +1453,10 @@ discard block |
||
1453 | 1453 | |
1454 | 1454 | /** |
1455 | 1455 | * decline_registration |
1456 | - * @access protected |
|
1457 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1458 | - * @return void |
|
1459 | - */ |
|
1456 | + * @access protected |
|
1457 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1458 | + * @return void |
|
1459 | + */ |
|
1460 | 1460 | protected function pending_registration( $notify = false ) { |
1461 | 1461 | $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify ); |
1462 | 1462 | } |
@@ -1466,9 +1466,9 @@ discard block |
||
1466 | 1466 | |
1467 | 1467 | /** |
1468 | 1468 | * generates HTML for the Registration main meta box |
1469 | - * @access public |
|
1470 | - * @return void |
|
1471 | - */ |
|
1469 | + * @access public |
|
1470 | + * @return void |
|
1471 | + */ |
|
1472 | 1472 | public function _reg_details_meta_box() { |
1473 | 1473 | EEH_Autoloader::register_line_item_display_autoloaders(); |
1474 | 1474 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
@@ -1505,7 +1505,7 @@ discard block |
||
1505 | 1505 | : ''; |
1506 | 1506 | |
1507 | 1507 | $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee |
1508 | - && EE_Registry::instance()->CAP->current_user_can( |
|
1508 | + && EE_Registry::instance()->CAP->current_user_can( |
|
1509 | 1509 | 'ee_send_message', |
1510 | 1510 | 'espresso_registrations_resend_registration' |
1511 | 1511 | ) |
@@ -1581,7 +1581,7 @@ discard block |
||
1581 | 1581 | * |
1582 | 1582 | * @access public |
1583 | 1583 | * @return void |
1584 | - */ |
|
1584 | + */ |
|
1585 | 1585 | public function _reg_questions_meta_box() { |
1586 | 1586 | //allow someone to override this method entirely |
1587 | 1587 | if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) { |
@@ -1783,12 +1783,12 @@ discard block |
||
1783 | 1783 | |
1784 | 1784 | /** |
1785 | 1785 | * generates HTML for the Registration main meta box |
1786 | - * @access public |
|
1787 | - * @return void |
|
1788 | - */ |
|
1786 | + * @access public |
|
1787 | + * @return void |
|
1788 | + */ |
|
1789 | 1789 | public function _reg_attendees_meta_box() { |
1790 | 1790 | |
1791 | - $REG = EEM_Registration::instance(); |
|
1791 | + $REG = EEM_Registration::instance(); |
|
1792 | 1792 | //get all other registrations on this transaction, and cache |
1793 | 1793 | //the attendees for them so we don't have to run another query using force_join |
1794 | 1794 | $registrations = $REG->get_all(array( |
@@ -1840,9 +1840,9 @@ discard block |
||
1840 | 1840 | |
1841 | 1841 | /** |
1842 | 1842 | * generates HTML for the Edit Registration side meta box |
1843 | - * @access public |
|
1844 | - * @return void |
|
1845 | - */ |
|
1843 | + * @access public |
|
1844 | + * @return void |
|
1845 | + */ |
|
1846 | 1846 | public function _reg_registrant_side_meta_box() { |
1847 | 1847 | |
1848 | 1848 | /*@var $attendee EE_Attendee */ |
@@ -2220,9 +2220,9 @@ discard block |
||
2220 | 2220 | |
2221 | 2221 | /** |
2222 | 2222 | * set_reg_event |
2223 | - * @access private |
|
2224 | - * @return boolean |
|
2225 | - */ |
|
2223 | + * @access private |
|
2224 | + * @return boolean |
|
2225 | + */ |
|
2226 | 2226 | private function _set_reg_event() { |
2227 | 2227 | if ( is_object( $this->_reg_event )) { |
2228 | 2228 | return TRUE; |
@@ -2362,9 +2362,9 @@ discard block |
||
2362 | 2362 | |
2363 | 2363 | /** |
2364 | 2364 | * generates HTML for the Attendee Contact List |
2365 | - * @access protected |
|
2366 | - * @return void |
|
2367 | - */ |
|
2365 | + * @access protected |
|
2366 | + * @return void |
|
2367 | + */ |
|
2368 | 2368 | protected function _attendee_contact_list_table() { |
2369 | 2369 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
2370 | 2370 | $this->_search_btn_label = __('Contacts', 'event_espresso'); |
@@ -2378,9 +2378,9 @@ discard block |
||
2378 | 2378 | /** |
2379 | 2379 | * get_attendees |
2380 | 2380 | * @param bool $count whether to return count or data. |
2381 | - * @access public |
|
2382 | - * @return array |
|
2383 | - */ |
|
2381 | + * @access public |
|
2382 | + * @return array |
|
2383 | + */ |
|
2384 | 2384 | public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { |
2385 | 2385 | |
2386 | 2386 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -2712,9 +2712,9 @@ discard block |
||
2712 | 2712 | |
2713 | 2713 | /** |
2714 | 2714 | * _attendee_details |
2715 | - * @access protected |
|
2716 | - * @return void |
|
2717 | - */ |
|
2715 | + * @access protected |
|
2716 | + * @return void |
|
2717 | + */ |
|
2718 | 2718 | public function attendee_registrations_meta_box( $post ) { |
2719 | 2719 | |
2720 | 2720 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
@@ -2747,10 +2747,10 @@ discard block |
||
2747 | 2747 | |
2748 | 2748 | /** |
2749 | 2749 | * _trash_or_restore_attendee |
2750 | - * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
2751 | - * @access protected |
|
2752 | - * @return void |
|
2753 | - */ |
|
2750 | + * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
2751 | + * @access protected |
|
2752 | + * @return void |
|
2753 | + */ |
|
2754 | 2754 | protected function _trash_or_restore_attendees( $trash = TRUE ) { |
2755 | 2755 | |
2756 | 2756 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -56,26 +56,26 @@ discard block |
||
56 | 56 | * @param bool $routing |
57 | 57 | * @return Registrations_Admin_Page |
58 | 58 | */ |
59 | - public function __construct( $routing = TRUE ) { |
|
60 | - parent::__construct( $routing ); |
|
61 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' )); |
|
59 | + public function __construct($routing = TRUE) { |
|
60 | + parent::__construct($routing); |
|
61 | + add_action('wp_loaded', array($this, 'wp_loaded')); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
65 | 65 | |
66 | 66 | public function wp_loaded() { |
67 | 67 | // when adding a new registration... |
68 | - if ( isset( $this->_req_data[ 'action' ] ) && $this->_req_data[ 'action' ] == 'new_registration' ) { |
|
68 | + if (isset($this->_req_data['action']) && $this->_req_data['action'] == 'new_registration') { |
|
69 | 69 | EE_System::do_not_cache(); |
70 | 70 | if ( |
71 | - ! isset( $this->_req_data[ 'processing_registration' ] ) |
|
72 | - || absint( $this->_req_data[ 'processing_registration' ] ) !== 1 |
|
71 | + ! isset($this->_req_data['processing_registration']) |
|
72 | + || absint($this->_req_data['processing_registration']) !== 1 |
|
73 | 73 | ) { |
74 | 74 | // and it's NOT the attendee information reg step |
75 | 75 | // force cookie expiration by setting time to last week |
76 | - setcookie( 'ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/' ); |
|
76 | + setcookie('ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/'); |
|
77 | 77 | // and update the global |
78 | - $_COOKIE[ 'ee_registration_added' ] = 0; |
|
78 | + $_COOKIE['ee_registration_added'] = 0; |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | } |
@@ -109,16 +109,16 @@ discard block |
||
109 | 109 | 'trash' => 'post.php' |
110 | 110 | ); |
111 | 111 | |
112 | - add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 ); |
|
112 | + add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10); |
|
113 | 113 | //add filters so that the comment urls don't take users to a confusing 404 page |
114 | - add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 ); |
|
114 | + add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
118 | - public function clear_comment_link( $link, $comment, $args ) { |
|
118 | + public function clear_comment_link($link, $comment, $args) { |
|
119 | 119 | //gotta make sure this only happens on this route |
120 | - $post_type = get_post_type( $comment->comment_post_ID); |
|
121 | - if ( $post_type == 'espresso_attendees' ) |
|
120 | + $post_type = get_post_type($comment->comment_post_ID); |
|
121 | + if ($post_type == 'espresso_attendees') |
|
122 | 122 | return '#commentsdiv'; |
123 | 123 | return $link; |
124 | 124 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | protected function _ajax_hooks() { |
128 | 128 | //todo: all hooks for registrations ajax goes in here |
129 | - add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' )); |
|
129 | + add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status')); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | 'add-attendee' => __('Add Contact', 'event_espresso'), |
142 | 142 | 'edit' => __('Edit Contact', 'event_espresso'), |
143 | 143 | 'report'=> __("Event Registrations CSV Report", "event_espresso"), |
144 | - 'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ), |
|
145 | - 'contact_list_report' => __( 'Contact List Report', 'event_espresso' ), |
|
144 | + 'report_all' => __('All Registrations CSV Report', 'event_espresso'), |
|
145 | + 'contact_list_report' => __('Contact List Report', 'event_espresso'), |
|
146 | 146 | 'contact_list_export'=> __("Export Data", "event_espresso"), |
147 | 147 | ), |
148 | 148 | 'publishbox' => array( |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | |
171 | 171 | $this->_get_registration_status_array(); |
172 | 172 | |
173 | - $reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0; |
|
174 | - $att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0; |
|
175 | - $att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id; |
|
173 | + $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0; |
|
174 | + $att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0; |
|
175 | + $att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id; |
|
176 | 176 | |
177 | 177 | $this->_page_routes = array( |
178 | 178 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | 'restore_registrations' => array( |
207 | 207 | 'func' => '_trash_or_restore_registrations', |
208 | - 'args' => array( 'trash' => FALSE ), |
|
208 | + 'args' => array('trash' => FALSE), |
|
209 | 209 | 'noheader' => TRUE, |
210 | 210 | 'capability' => 'ee_delete_registrations' |
211 | 211 | ), |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | 'filename' => 'registrations_overview_other' |
439 | 439 | ) |
440 | 440 | ), |
441 | - 'help_tour' => array( 'Registration_Overview_Help_Tour' ), |
|
441 | + 'help_tour' => array('Registration_Overview_Help_Tour'), |
|
442 | 442 | 'qtips' => array('Registration_List_Table_Tips'), |
443 | 443 | 'list_table' => 'EE_Registrations_List_Table', |
444 | 444 | 'require_nonce' => FALSE |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | 'order' => 15, |
451 | 451 | 'url' => isset($this->_req_data['_REG_ID']) |
452 | 452 | ? add_query_arg( |
453 | - array('_REG_ID' => $this->_req_data['_REG_ID'] ), |
|
453 | + array('_REG_ID' => $this->_req_data['_REG_ID']), |
|
454 | 454 | $this->_current_page_view_url |
455 | 455 | ) |
456 | 456 | : $this->_admin_base_url, |
@@ -474,8 +474,8 @@ discard block |
||
474 | 474 | 'filename' => 'registrations_details_registrant_details' |
475 | 475 | ) |
476 | 476 | ), |
477 | - 'help_tour' => array( 'Registration_Details_Help_Tour' ), |
|
478 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ), |
|
477 | + 'help_tour' => array('Registration_Details_Help_Tour'), |
|
478 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')), |
|
479 | 479 | 'require_nonce' => FALSE |
480 | 480 | ), |
481 | 481 | |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | 'order' => 15, |
500 | 500 | 'persistent' => FALSE |
501 | 501 | ), |
502 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ), |
|
502 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')), |
|
503 | 503 | 'require_nonce' => FALSE |
504 | 504 | ), |
505 | 505 | |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | 'label' => __('Edit Contact', 'event_espresso'), |
509 | 509 | 'order' => 15, |
510 | 510 | 'persistent' => FALSE, |
511 | - 'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
511 | + 'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
512 | 512 | ), |
513 | 513 | 'metaboxes' => array('attendee_editor_metaboxes'), |
514 | 514 | 'require_nonce' => FALSE |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | 'filename' => 'registrations_contact_list_other' |
539 | 539 | ) |
540 | 540 | ), |
541 | - 'help_tour' => array( 'Contact_List_Help_Tour' ), |
|
541 | + 'help_tour' => array('Contact_List_Help_Tour'), |
|
542 | 542 | 'metaboxes' => array(), |
543 | 543 | 'require_nonce' => FALSE |
544 | 544 | ), |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | protected function _add_screen_options() {} |
558 | 558 | protected function _add_feature_pointers() {} |
559 | 559 | public function admin_init() { |
560 | - EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' ); |
|
560 | + EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso'); |
|
561 | 561 | } |
562 | 562 | public function admin_notices() {} |
563 | 563 | public function admin_footer_scripts() {} |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | * @return void |
576 | 576 | */ |
577 | 577 | private function _get_registration_status_array() { |
578 | - self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE); |
|
578 | + self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE); |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | |
@@ -598,11 +598,11 @@ discard block |
||
598 | 598 | public function load_scripts_styles() { |
599 | 599 | //style |
600 | 600 | //wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
601 | - wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
601 | + wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
602 | 602 | wp_enqueue_style('espresso_reg'); |
603 | 603 | |
604 | 604 | //script |
605 | - wp_register_script('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
605 | + wp_register_script('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
606 | 606 | wp_enqueue_script('espresso_reg'); |
607 | 607 | } |
608 | 608 | |
@@ -611,9 +611,9 @@ discard block |
||
611 | 611 | public function load_scripts_styles_edit_attendee() { |
612 | 612 | //stuff to only show up on our attendee edit details page. |
613 | 613 | $attendee_details_translations = array( |
614 | - 'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') ) |
|
614 | + 'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created')) |
|
615 | 615 | ); |
616 | - wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations ); |
|
616 | + wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations); |
|
617 | 617 | wp_enqueue_script('jquery-validate'); |
618 | 618 | } |
619 | 619 | |
@@ -622,8 +622,8 @@ discard block |
||
622 | 622 | //styles |
623 | 623 | wp_enqueue_style('espresso-ui-theme'); |
624 | 624 | //scripts |
625 | - $this->_get_reg_custom_questions_form( $this->_registration->ID() ); |
|
626 | - $this->_reg_custom_questions_form->wp_enqueue_scripts( true ); |
|
625 | + $this->_get_reg_custom_questions_form($this->_registration->ID()); |
|
626 | + $this->_reg_custom_questions_form->wp_enqueue_scripts(true); |
|
627 | 627 | } |
628 | 628 | |
629 | 629 | |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | |
634 | 634 | public function load_scripts_styles_contact_list() { |
635 | 635 | wp_deregister_style('espresso_reg'); |
636 | - wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
636 | + wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
637 | 637 | wp_enqueue_style('espresso_att'); |
638 | 638 | } |
639 | 639 | |
@@ -642,9 +642,9 @@ discard block |
||
642 | 642 | |
643 | 643 | |
644 | 644 | public function load_scripts_styles_new_registration() { |
645 | - wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
645 | + wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
646 | 646 | wp_enqueue_script('ee-spco-for-admin'); |
647 | - add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
647 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
648 | 648 | EE_Form_Section_Proper::wp_enqueue_scripts(); |
649 | 649 | EED_Ticket_Selector::load_tckt_slctr_assets(); |
650 | 650 | EE_Datepicker_Input::enqueue_styles_and_scripts(); |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | //for notification related bulk actions we need to make sure only active messengers have an option. |
672 | 672 | EED_Messages::set_autoloaders(); |
673 | 673 | /** @type EE_Message_Resource_Manager $message_resource_manager */ |
674 | - $message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
674 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
675 | 675 | $active_mts = $message_resource_manager->list_of_active_message_types(); |
676 | 676 | //key= bulk_action_slug, value= message type. |
677 | 677 | $match_array = array( |
@@ -684,23 +684,23 @@ discard block |
||
684 | 684 | |
685 | 685 | /** setup reg status bulk actions **/ |
686 | 686 | $def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso'); |
687 | - if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
687 | + if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
688 | 688 | $def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso'); |
689 | 689 | } |
690 | 690 | $def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso'); |
691 | - if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
691 | + if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
692 | 692 | $def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso'); |
693 | 693 | } |
694 | 694 | $def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso'); |
695 | - if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
695 | + if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
696 | 696 | $def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso'); |
697 | 697 | } |
698 | 698 | $def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso'); |
699 | - if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
699 | + if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
700 | 700 | $def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso'); |
701 | 701 | } |
702 | 702 | $def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso'); |
703 | - if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
703 | + if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
704 | 704 | $def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso'); |
705 | 705 | } |
706 | 706 | |
@@ -709,29 +709,29 @@ discard block |
||
709 | 709 | 'slug' => 'all', |
710 | 710 | 'label' => __('View All Registrations', 'event_espresso'), |
711 | 711 | 'count' => 0, |
712 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
712 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
713 | 713 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
714 | - ) ) |
|
714 | + )) |
|
715 | 715 | ), |
716 | 716 | 'month' => array( |
717 | 717 | 'slug' => 'month', |
718 | 718 | 'label' => __('This Month', 'event_espresso'), |
719 | 719 | 'count' => 0, |
720 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
720 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
721 | 721 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
722 | 722 | )) |
723 | 723 | ), |
724 | 724 | 'today' => array( |
725 | 725 | 'slug' => 'today', |
726 | - 'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ), |
|
726 | + 'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))), |
|
727 | 727 | 'count' => 0, |
728 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
728 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
729 | 729 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
730 | 730 | )) |
731 | 731 | ) |
732 | 732 | ); |
733 | 733 | |
734 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) { |
|
734 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) { |
|
735 | 735 | $this->_views['incomplete'] = array( |
736 | 736 | 'slug' => 'incomplete', |
737 | 737 | 'label' => __('Incomplete', 'event_espresso'), |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | ) |
768 | 768 | ); |
769 | 769 | |
770 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) { |
|
770 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) { |
|
771 | 771 | $this->_views['trash'] = array( |
772 | 772 | 'slug' => 'trash', |
773 | 773 | 'label' => __('Trash', 'event_espresso'), |
@@ -806,18 +806,18 @@ discard block |
||
806 | 806 | 'desc' => __('View Transaction Invoice', 'event_espresso') |
807 | 807 | ), |
808 | 808 | ); |
809 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
809 | + if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
810 | 810 | $fc_items['resend_registration'] = array( |
811 | 811 | 'class' => 'dashicons dashicons-email-alt', |
812 | 812 | 'desc' => __('Resend Registration Details', 'event_espresso') |
813 | 813 | ); |
814 | 814 | } else { |
815 | - $fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' ); |
|
815 | + $fc_items['blank'] = array('class' => 'blank', 'desc' => ''); |
|
816 | 816 | } |
817 | 817 | |
818 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
819 | - $related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' ); |
|
820 | - if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) { |
|
818 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
819 | + $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); |
|
820 | + if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) { |
|
821 | 821 | $fc_items['view_related_messages'] = array( |
822 | 822 | 'class' => $related_for_icon['css_class'], |
823 | 823 | 'desc' => $related_for_icon['label'], |
@@ -827,31 +827,31 @@ discard block |
||
827 | 827 | |
828 | 828 | $sc_items = array( |
829 | 829 | 'approved_status' => array( |
830 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
831 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
|
830 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved, |
|
831 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') |
|
832 | 832 | ), |
833 | 833 | 'pending_status' => array( |
834 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
835 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) |
|
834 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment, |
|
835 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence') |
|
836 | 836 | ), |
837 | 837 | 'incomplete_status' => array( |
838 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete, |
|
839 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' ) |
|
838 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete, |
|
839 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence') |
|
840 | 840 | ), |
841 | 841 | 'not_approved' => array( |
842 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
843 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) |
|
842 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved, |
|
843 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence') |
|
844 | 844 | ), |
845 | 845 | 'declined_status' => array( |
846 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
847 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
|
846 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined, |
|
847 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence') |
|
848 | 848 | ), |
849 | 849 | 'cancelled_status' => array( |
850 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
851 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
|
850 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled, |
|
851 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence') |
|
852 | 852 | ) |
853 | 853 | ); |
854 | - return array_merge( $fc_items, $sc_items ); |
|
854 | + return array_merge($fc_items, $sc_items); |
|
855 | 855 | } |
856 | 856 | |
857 | 857 | |
@@ -864,15 +864,15 @@ discard block |
||
864 | 864 | |
865 | 865 | |
866 | 866 | protected function _registrations_overview_list_table() { |
867 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
868 | - if ( $EVT_ID ) { |
|
869 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID ) ) { |
|
870 | - $this->_admin_page_title .= $this->get_action_link_or_button( 'new_registration', 'add-registrant', array( 'event_id' => $EVT_ID ), 'add-new-h2' ); |
|
867 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
868 | + if ($EVT_ID) { |
|
869 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID)) { |
|
870 | + $this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $EVT_ID), 'add-new-h2'); |
|
871 | 871 | } |
872 | - $event = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
873 | - $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce( array('action' => 'edit', 'post' => $event->ID() ), EVENTS_ADMIN_URL ) . '">' . $event->get('EVT_name') . '</a>', '</h2>' ) : ''; |
|
872 | + $event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
873 | + $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'">'.$event->get('EVT_name').'</a>', '</h2>') : ''; |
|
874 | 874 | } |
875 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() ); |
|
875 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items()); |
|
876 | 876 | $this->display_admin_list_table_page_with_no_sidebar(); |
877 | 877 | } |
878 | 878 | |
@@ -887,19 +887,19 @@ discard block |
||
887 | 887 | */ |
888 | 888 | private function _set_registration_object() { |
889 | 889 | //get out if we've already set the object |
890 | - if ( is_object( $this->_registration )) { |
|
890 | + if (is_object($this->_registration)) { |
|
891 | 891 | return TRUE; |
892 | 892 | } |
893 | 893 | |
894 | 894 | $REG = EEM_Registration::instance(); |
895 | 895 | |
896 | - $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
896 | + $REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
897 | 897 | |
898 | - if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) |
|
898 | + if ($this->_registration = $REG->get_one_by_ID($REG_ID)) |
|
899 | 899 | return TRUE; |
900 | 900 | else { |
901 | - $error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID ); |
|
902 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
901 | + $error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID); |
|
902 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
903 | 903 | $this->_registration = NULL; |
904 | 904 | return FALSE; |
905 | 905 | } |
@@ -917,24 +917,24 @@ discard block |
||
917 | 917 | * @throws \EE_Error |
918 | 918 | * @return mixed (int|array) int = count || array of registration objects |
919 | 919 | */ |
920 | - public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) { |
|
921 | - $EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
922 | - $CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE; |
|
923 | - $reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE; |
|
924 | - $month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april |
|
925 | - $today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'today' ? TRUE : FALSE; |
|
926 | - $this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'month' ? TRUE : FALSE; |
|
920 | + public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) { |
|
921 | + $EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE; |
|
922 | + $CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE; |
|
923 | + $reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE; |
|
924 | + $month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april |
|
925 | + $today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'today' ? TRUE : FALSE; |
|
926 | + $this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'month' ? TRUE : FALSE; |
|
927 | 927 | $start_date = FALSE; |
928 | 928 | $end_date = FALSE; |
929 | 929 | $_where = array(); |
930 | - $trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE; |
|
931 | - $incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE; |
|
930 | + $trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE; |
|
931 | + $incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE; |
|
932 | 932 | |
933 | 933 | //set orderby |
934 | 934 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
935 | 935 | |
936 | 936 | |
937 | - switch ( $this->_req_data['orderby'] ) { |
|
937 | + switch ($this->_req_data['orderby']) { |
|
938 | 938 | case '_REG_ID': |
939 | 939 | $orderby = 'REG_ID'; |
940 | 940 | break; |
@@ -954,26 +954,26 @@ discard block |
||
954 | 954 | $orderby = 'REG_date'; |
955 | 955 | } |
956 | 956 | |
957 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
958 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
959 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
957 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
958 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
959 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
960 | 960 | |
961 | 961 | |
962 | - $offset = ($current_page-1)*$per_page; |
|
963 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
962 | + $offset = ($current_page - 1) * $per_page; |
|
963 | + $limit = $count ? NULL : array($offset, $per_page); |
|
964 | 964 | |
965 | - if($EVT_ID){ |
|
966 | - $_where['EVT_ID']=$EVT_ID; |
|
965 | + if ($EVT_ID) { |
|
966 | + $_where['EVT_ID'] = $EVT_ID; |
|
967 | 967 | } |
968 | - if($CAT_ID){ |
|
968 | + if ($CAT_ID) { |
|
969 | 969 | $_where['Event.Term_Taxonomy.term_id'] = $CAT_ID; |
970 | 970 | } |
971 | - if ( $incomplete ) { |
|
971 | + if ($incomplete) { |
|
972 | 972 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
973 | 973 | } else if ( ! $trash) { |
974 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
974 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
975 | 975 | } |
976 | - if($reg_status){ |
|
976 | + if ($reg_status) { |
|
977 | 977 | $_where['STS_ID'] = $reg_status; |
978 | 978 | } |
979 | 979 | |
@@ -985,105 +985,105 @@ discard block |
||
985 | 985 | $time_start = ' 00:00:00'; |
986 | 986 | $time_end = ' 23:59:59'; |
987 | 987 | |
988 | - if($today_a || $today ){ |
|
988 | + if ($today_a || $today) { |
|
989 | 989 | $curdate = date('Y-m-d', current_time('timestamp')); |
990 | - $_where['REG_date']= array('BETWEEN', |
|
990 | + $_where['REG_date'] = array('BETWEEN', |
|
991 | 991 | array( |
992 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ), |
|
993 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ), |
|
992 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'), |
|
993 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'), |
|
994 | 994 | )); |
995 | - }elseif($this_month_a || $this_month){ |
|
995 | + }elseif ($this_month_a || $this_month) { |
|
996 | 996 | $this_month_r = date('m', current_time('timestamp')); |
997 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
998 | - $_where['REG_date']= array('BETWEEN', |
|
997 | + $days_this_month = date('t', current_time('timestamp')); |
|
998 | + $_where['REG_date'] = array('BETWEEN', |
|
999 | 999 | array( |
1000 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ), |
|
1001 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' ) |
|
1000 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'), |
|
1001 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s') |
|
1002 | 1002 | )); |
1003 | - }elseif($month_range){ |
|
1003 | + }elseif ($month_range) { |
|
1004 | 1004 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
1005 | - $month_r = !empty($pieces[0]) ? date('m', strtotime( $month_range ) ) : ''; |
|
1006 | - $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
|
1007 | - $days_in_month = date('t', strtotime($year_r . '-' . $month_r . '-' . '01') ); |
|
1008 | - $_where['REG_date']= array('BETWEEN', |
|
1009 | - array( EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month . ' 23:59:59', 'Y-m-d H:i:s' ) ) ); |
|
1010 | - }elseif($start_date && $end_date){ |
|
1005 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($month_range)) : ''; |
|
1006 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
1007 | + $days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01')); |
|
1008 | + $_where['REG_date'] = array('BETWEEN', |
|
1009 | + array(EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-'.$days_in_month.' 23:59:59', 'Y-m-d H:i:s'))); |
|
1010 | + }elseif ($start_date && $end_date) { |
|
1011 | 1011 | throw new EE_Error("not yet supported"); |
1012 | - }elseif($start_date){ |
|
1012 | + }elseif ($start_date) { |
|
1013 | 1013 | throw new EE_Error("not yet supported"); |
1014 | - }elseif($end_date){ |
|
1014 | + }elseif ($end_date) { |
|
1015 | 1015 | throw new EE_Error("not yet supported"); |
1016 | 1016 | } |
1017 | 1017 | |
1018 | - if ( ! empty( $this->_req_data['s'] ) ) { |
|
1019 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1018 | + if ( ! empty($this->_req_data['s'])) { |
|
1019 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1020 | 1020 | $_where['OR'] = array( |
1021 | - 'Event.EVT_name' => array( 'LIKE', $sstr), |
|
1022 | - 'Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
1023 | - 'Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
1024 | - 'Attendee.ATT_full_name' => array( 'LIKE', $sstr ), |
|
1025 | - 'Attendee.ATT_fname' => array( 'LIKE', $sstr ), |
|
1026 | - 'Attendee.ATT_lname' => array( 'LIKE', $sstr ), |
|
1027 | - 'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ), |
|
1028 | - 'Attendee.ATT_email' => array('LIKE', $sstr ), |
|
1029 | - 'Attendee.ATT_address' => array( 'LIKE', $sstr ), |
|
1030 | - 'Attendee.ATT_address2' => array( 'LIKE', $sstr ), |
|
1031 | - 'Attendee.ATT_city' => array( 'LIKE', $sstr ), |
|
1032 | - 'REG_final_price' => array( 'LIKE', $sstr ), |
|
1033 | - 'REG_code' => array( 'LIKE', $sstr ), |
|
1034 | - 'REG_count' => array( 'LIKE' , $sstr ), |
|
1035 | - 'REG_group_size' => array( 'LIKE' , $sstr ), |
|
1036 | - 'Ticket.TKT_name' => array( 'LIKE', $sstr ), |
|
1037 | - 'Ticket.TKT_description' => array( 'LIKE', $sstr ), |
|
1038 | - 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr ) |
|
1021 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
1022 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1023 | + 'Event.EVT_short_desc' => array('LIKE', $sstr), |
|
1024 | + 'Attendee.ATT_full_name' => array('LIKE', $sstr), |
|
1025 | + 'Attendee.ATT_fname' => array('LIKE', $sstr), |
|
1026 | + 'Attendee.ATT_lname' => array('LIKE', $sstr), |
|
1027 | + 'Attendee.ATT_short_bio' => array('LIKE', $sstr), |
|
1028 | + 'Attendee.ATT_email' => array('LIKE', $sstr), |
|
1029 | + 'Attendee.ATT_address' => array('LIKE', $sstr), |
|
1030 | + 'Attendee.ATT_address2' => array('LIKE', $sstr), |
|
1031 | + 'Attendee.ATT_city' => array('LIKE', $sstr), |
|
1032 | + 'REG_final_price' => array('LIKE', $sstr), |
|
1033 | + 'REG_code' => array('LIKE', $sstr), |
|
1034 | + 'REG_count' => array('LIKE', $sstr), |
|
1035 | + 'REG_group_size' => array('LIKE', $sstr), |
|
1036 | + 'Ticket.TKT_name' => array('LIKE', $sstr), |
|
1037 | + 'Ticket.TKT_description' => array('LIKE', $sstr), |
|
1038 | + 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr) |
|
1039 | 1039 | ); |
1040 | 1040 | } |
1041 | 1041 | |
1042 | 1042 | //capability checks |
1043 | - if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) { |
|
1043 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) { |
|
1044 | 1044 | $_where['AND'] = array( |
1045 | 1045 | 'Event.EVT_wp_user' => get_current_user_id() |
1046 | 1046 | ); |
1047 | 1047 | } |
1048 | 1048 | |
1049 | 1049 | |
1050 | - if( $count ){ |
|
1051 | - if ( $trash ) { |
|
1052 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
1053 | - } else if ( $incomplete ) { |
|
1054 | - return EEM_Registration::instance()->count( array( $_where )); |
|
1050 | + if ($count) { |
|
1051 | + if ($trash) { |
|
1052 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
1053 | + } else if ($incomplete) { |
|
1054 | + return EEM_Registration::instance()->count(array($_where)); |
|
1055 | 1055 | } else { |
1056 | - return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' )); |
|
1056 | + return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only')); |
|
1057 | 1057 | } |
1058 | 1058 | } else { |
1059 | 1059 | //make sure we remove default where conditions cause all registrations matching query are returned |
1060 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' ); |
|
1061 | - if ( $per_page !== -1 ) { |
|
1060 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only'); |
|
1061 | + if ($per_page !== -1) { |
|
1062 | 1062 | $query_params['limit'] = $limit; |
1063 | 1063 | } |
1064 | - $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1064 | + $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1065 | 1065 | |
1066 | 1066 | |
1067 | - if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1067 | + if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1068 | 1068 | $first_registration = $registrations[0]; |
1069 | 1069 | //EEH_Debug_Tools::printr( $registrations[0], '$registrations <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
1070 | 1070 | $event_name = $first_registration->event_obj()->name(); |
1071 | - $event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1071 | + $event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a'); // isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1072 | 1072 | // edit event link |
1073 | - if ( $event_name != '' ) { |
|
1074 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL ); |
|
1075 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
1076 | - $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
1073 | + if ($event_name != '') { |
|
1074 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL); |
|
1075 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
1076 | + $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
1077 | 1077 | } |
1078 | 1078 | |
1079 | - $back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL ); |
|
1080 | - $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">« ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>'; |
|
1079 | + $back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL); |
|
1080 | + $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">« '.__('Back to All Registrations', 'event_espresso').'</a>'; |
|
1081 | 1081 | |
1082 | 1082 | $this->_template_args['before_admin_page_content'] = ' |
1083 | 1083 | <div id="admin-page-header"> |
1084 | - <h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1> |
|
1085 | - <h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3> |
|
1086 | - <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span> |
|
1084 | + <h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1> |
|
1085 | + <h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3> |
|
1086 | + <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span> |
|
1087 | 1087 | </div> |
1088 | 1088 | '; |
1089 | 1089 | |
@@ -1121,7 +1121,7 @@ discard block |
||
1121 | 1121 | |
1122 | 1122 | $this->_set_registration_object(); |
1123 | 1123 | |
1124 | - if ( is_object( $this->_registration )) { |
|
1124 | + if (is_object($this->_registration)) { |
|
1125 | 1125 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1126 | 1126 | $this->_session = $transaction->session_data(); |
1127 | 1127 | |
@@ -1129,10 +1129,10 @@ discard block |
||
1129 | 1129 | |
1130 | 1130 | |
1131 | 1131 | $this->_template_args['reg_nmbr']['value'] = $this->_registration->ID(); |
1132 | - $this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' ); |
|
1132 | + $this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso'); |
|
1133 | 1133 | |
1134 | - $this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime( 'REG_date' ); |
|
1135 | - $this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' ); |
|
1134 | + $this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime('REG_date'); |
|
1135 | + $this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso'); |
|
1136 | 1136 | |
1137 | 1137 | $this->_template_args['grand_total'] = $transaction->total(); |
1138 | 1138 | |
@@ -1140,19 +1140,19 @@ discard block |
||
1140 | 1140 | // link back to overview |
1141 | 1141 | $this->_template_args['reg_overview_url'] = REG_ADMIN_URL; |
1142 | 1142 | $this->_template_args['registration'] = $this->_registration; |
1143 | - $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL ); |
|
1144 | - $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions' ), admin_url( 'admin.php' ) ); |
|
1145 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id ), admin_url( 'admin.php' ) ); |
|
1143 | + $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL); |
|
1144 | + $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions'), admin_url('admin.php')); |
|
1145 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id), admin_url('admin.php')); |
|
1146 | 1146 | |
1147 | 1147 | //next and previous links |
1148 | - $next_reg = $this->_registration->next(null, array(), 'REG_ID' ); |
|
1149 | - $this->_template_args['next_registration'] = $next_reg ? $this->_next_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-right ee-icon-size-22' ) : ''; |
|
1150 | - $previous_reg = $this->_registration->previous( null, array(), 'REG_ID' ); |
|
1151 | - $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-left ee-icon-size-22' ) : ''; |
|
1148 | + $next_reg = $this->_registration->next(null, array(), 'REG_ID'); |
|
1149 | + $this->_template_args['next_registration'] = $next_reg ? $this->_next_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-right ee-icon-size-22') : ''; |
|
1150 | + $previous_reg = $this->_registration->previous(null, array(), 'REG_ID'); |
|
1151 | + $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-left ee-icon-size-22') : ''; |
|
1152 | 1152 | |
1153 | 1153 | // grab header |
1154 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php'; |
|
1155 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1154 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php'; |
|
1155 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1156 | 1156 | |
1157 | 1157 | } else { |
1158 | 1158 | |
@@ -1171,17 +1171,17 @@ discard block |
||
1171 | 1171 | |
1172 | 1172 | |
1173 | 1173 | protected function _registration_details_metaboxes() { |
1174 | - do_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this ); |
|
1174 | + do_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this); |
|
1175 | 1175 | $this->_set_registration_object(); |
1176 | 1176 | $attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null; |
1177 | - add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1178 | - add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1179 | - if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) { |
|
1180 | - add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1177 | + add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high'); |
|
1178 | + add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1179 | + if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) { |
|
1180 | + add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1181 | 1181 | } |
1182 | - add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' ); |
|
1183 | - if ( $this->_registration->group_size() > 1 ) { |
|
1184 | - add_meta_box( 'edit-reg-attendees-mbox', __( 'Other Registrations in this Transaction', 'event_espresso' ), array( $this, '_reg_attendees_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1182 | + add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high'); |
|
1183 | + if ($this->_registration->group_size() > 1) { |
|
1184 | + add_meta_box('edit-reg-attendees-mbox', __('Other Registrations in this Transaction', 'event_espresso'), array($this, '_reg_attendees_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1185 | 1185 | } |
1186 | 1186 | } |
1187 | 1187 | |
@@ -1200,22 +1200,22 @@ discard block |
||
1200 | 1200 | $is_complete = $this->_registration->transaction()->is_completed(); |
1201 | 1201 | //let's get an array of all possible buttons that we can just reference |
1202 | 1202 | $status_buttons = $this->_get_reg_status_buttons(); |
1203 | - $template_args[ 'reg_status_value' ] = $this->_registration->pretty_status(); |
|
1204 | - $template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID(); |
|
1203 | + $template_args['reg_status_value'] = $this->_registration->pretty_status(); |
|
1204 | + $template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID(); |
|
1205 | 1205 | $template_args['attendee'] = $this->_registration->attendee(); |
1206 | - $template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php'; |
|
1207 | - if ( $this->_set_registration_object() ) { |
|
1206 | + $template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php'; |
|
1207 | + if ($this->_set_registration_object()) { |
|
1208 | 1208 | $current_status = $this->_registration->status_ID(); |
1209 | - unset( $status_buttons[$current_status] ); |
|
1210 | - if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) { |
|
1211 | - unset( $status_buttons[EEM_Registration::status_id_pending_payment] ); |
|
1209 | + unset($status_buttons[$current_status]); |
|
1210 | + if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) { |
|
1211 | + unset($status_buttons[EEM_Registration::status_id_pending_payment]); |
|
1212 | 1212 | } |
1213 | - $template_args['status_buttons'] = implode( "\n", $status_buttons ); |
|
1213 | + $template_args['status_buttons'] = implode("\n", $status_buttons); |
|
1214 | 1214 | } |
1215 | 1215 | $template_args['form_url'] = REG_ADMIN_URL; |
1216 | 1216 | $template_args['REG_ID'] = $this->_registration->ID(); |
1217 | - $template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE ); |
|
1218 | - EEH_Template::display_template( $template, $template_args ); |
|
1217 | + $template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE); |
|
1218 | + EEH_Template::display_template($template, $template_args); |
|
1219 | 1219 | |
1220 | 1220 | } |
1221 | 1221 | |
@@ -1229,11 +1229,11 @@ discard block |
||
1229 | 1229 | private function _get_reg_status_buttons() { |
1230 | 1230 | |
1231 | 1231 | $buttons = array( |
1232 | - EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) . '">', |
|
1233 | - EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_pending_payment . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) . '">', |
|
1234 | - EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_not_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) . '">', |
|
1235 | - EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_declined . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) . '">', |
|
1236 | - EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_cancelled . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) . '">', |
|
1232 | + EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence').'">', |
|
1233 | + EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_pending_payment.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence').'">', |
|
1234 | + EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_not_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence').'">', |
|
1235 | + EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_declined.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence').'">', |
|
1236 | + EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_cancelled.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence').'">', |
|
1237 | 1237 | ); |
1238 | 1238 | return $buttons; |
1239 | 1239 | } |
@@ -1247,13 +1247,13 @@ discard block |
||
1247 | 1247 | * |
1248 | 1248 | * @return array (array with reg_id(s) updated and whether update was successful. |
1249 | 1249 | */ |
1250 | - protected function _set_registration_status_from_request( $status = false, $notify = false ) { |
|
1251 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1250 | + protected function _set_registration_status_from_request($status = false, $notify = false) { |
|
1251 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1252 | 1252 | |
1253 | - $success = $this->_set_registration_status( $REG_ID, $status ); |
|
1253 | + $success = $this->_set_registration_status($REG_ID, $status); |
|
1254 | 1254 | |
1255 | 1255 | //notify? |
1256 | - if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
1256 | + if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
1257 | 1257 | $this->_process_resend_registration(); |
1258 | 1258 | } |
1259 | 1259 | |
@@ -1271,19 +1271,19 @@ discard block |
||
1271 | 1271 | * @param bool $status |
1272 | 1272 | * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations). |
1273 | 1273 | */ |
1274 | - protected function _set_registration_status( $REG_ID, $status = false ) { |
|
1274 | + protected function _set_registration_status($REG_ID, $status = false) { |
|
1275 | 1275 | $success = true; |
1276 | 1276 | // set default status if none is passed |
1277 | 1277 | $status = $status ? $status : EEM_Registration::status_id_pending_payment; |
1278 | 1278 | |
1279 | 1279 | //typecast and sanitize reg_id |
1280 | - $reg_ids = array_filter( (array) $REG_ID, 'absint' ); |
|
1280 | + $reg_ids = array_filter((array) $REG_ID, 'absint'); |
|
1281 | 1281 | |
1282 | 1282 | //loop through REG_ID's and change status |
1283 | - foreach ( $reg_ids as $r_id ) { |
|
1284 | - $registration = EEM_Registration::instance()->get_one_by_ID( $r_id ); |
|
1285 | - if ( $registration instanceof EE_Registration ) { |
|
1286 | - $registration->set_status( $status ); |
|
1283 | + foreach ($reg_ids as $r_id) { |
|
1284 | + $registration = EEM_Registration::instance()->get_one_by_ID($r_id); |
|
1285 | + if ($registration instanceof EE_Registration) { |
|
1286 | + $registration->set_status($status); |
|
1287 | 1287 | $result = $registration->save(); |
1288 | 1288 | |
1289 | 1289 | //verifying explicit fails because update *may* just return 0 for 0 rows affected |
@@ -1295,7 +1295,7 @@ discard block |
||
1295 | 1295 | $this->_req_data['_REG_ID'] = $reg_ids; |
1296 | 1296 | |
1297 | 1297 | //return $success and processed registrations |
1298 | - return array( 'REG_ID' => $reg_ids, 'success' => $success ); |
|
1298 | + return array('REG_ID' => $reg_ids, 'success' => $success); |
|
1299 | 1299 | } |
1300 | 1300 | |
1301 | 1301 | |
@@ -1307,37 +1307,37 @@ discard block |
||
1307 | 1307 | * @param bool $notify indicates whether the _set_registration_status_from_request does notifications or not. |
1308 | 1308 | * @return void |
1309 | 1309 | */ |
1310 | - protected function _reg_status_change_return( $STS_ID, $notify = false ) { |
|
1310 | + protected function _reg_status_change_return($STS_ID, $notify = false) { |
|
1311 | 1311 | |
1312 | - $result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false ); |
|
1312 | + $result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false); |
|
1313 | 1313 | |
1314 | 1314 | |
1315 | - $success = isset( $result['success'] ) && $result['success']; |
|
1315 | + $success = isset($result['success']) && $result['success']; |
|
1316 | 1316 | |
1317 | 1317 | //setup success message |
1318 | - if ( $success ) { |
|
1319 | - $msg = is_array( $result['REG_ID'] ) && count( $result['REG_ID'] ) > 1 ? sprintf( __('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) : sprintf( __('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) ; |
|
1320 | - EE_Error::add_success( $msg ); |
|
1318 | + if ($success) { |
|
1319 | + $msg = is_array($result['REG_ID']) && count($result['REG_ID']) > 1 ? sprintf(__('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')) : sprintf(__('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')); |
|
1320 | + EE_Error::add_success($msg); |
|
1321 | 1321 | } else { |
1322 | - EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ ); |
|
1322 | + EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
1323 | 1323 | } |
1324 | 1324 | |
1325 | - $route = isset( $this->_req_data['return'] ) && $this->_req_data['return'] == 'view_registration' ? array( 'action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0] ) : array( 'action' => 'default' ); |
|
1325 | + $route = isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration' ? array('action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0]) : array('action' => 'default'); |
|
1326 | 1326 | //unset nonces |
1327 | - foreach ( $this->_req_data as $ref => $value ) { |
|
1328 | - if ( strpos( $ref, 'nonce' ) !== false ) { |
|
1329 | - unset( $this->_req_data[$ref] ); |
|
1327 | + foreach ($this->_req_data as $ref => $value) { |
|
1328 | + if (strpos($ref, 'nonce') !== false) { |
|
1329 | + unset($this->_req_data[$ref]); |
|
1330 | 1330 | continue; |
1331 | 1331 | } |
1332 | 1332 | |
1333 | - $value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value ); |
|
1333 | + $value = is_array($value) ? array_map('urlencode', $value) : urlencode($value); |
|
1334 | 1334 | $this->_req_data[$ref] = $value; |
1335 | 1335 | } |
1336 | 1336 | |
1337 | 1337 | //merge request vars so that the reloaded list table contains any existing filter query params |
1338 | - $route = array_merge( $this->_req_data, $route ); |
|
1338 | + $route = array_merge($this->_req_data, $route); |
|
1339 | 1339 | |
1340 | - $this->_redirect_after_action( false, '', '', $route, true ); |
|
1340 | + $this->_redirect_after_action(false, '', '', $route, true); |
|
1341 | 1341 | } |
1342 | 1342 | |
1343 | 1343 | |
@@ -1349,29 +1349,29 @@ discard block |
||
1349 | 1349 | protected function _change_reg_status() { |
1350 | 1350 | $this->_req_data['return'] = 'view_registration'; |
1351 | 1351 | //set notify based on whether the send notifications toggle is set or not |
1352 | - $notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] ); |
|
1353 | - $this->_req_data[ '_reg_status_id' ] = isset( $this->_req_data[ '_reg_status_id' ] ) ? $this->_req_data[ '_reg_status_id' ] : ''; |
|
1352 | + $notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']); |
|
1353 | + $this->_req_data['_reg_status_id'] = isset($this->_req_data['_reg_status_id']) ? $this->_req_data['_reg_status_id'] : ''; |
|
1354 | 1354 | |
1355 | - switch ( $this->_req_data['_reg_status_id'] ) { |
|
1356 | - case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) : |
|
1357 | - $this->approve_registration( $notify ); |
|
1355 | + switch ($this->_req_data['_reg_status_id']) { |
|
1356 | + case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') : |
|
1357 | + $this->approve_registration($notify); |
|
1358 | 1358 | break; |
1359 | - case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) : |
|
1360 | - $this->pending_registration( $notify ); |
|
1359 | + case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') : |
|
1360 | + $this->pending_registration($notify); |
|
1361 | 1361 | break; |
1362 | - case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) : |
|
1363 | - $this->not_approve_registration( $notify ); |
|
1362 | + case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') : |
|
1363 | + $this->not_approve_registration($notify); |
|
1364 | 1364 | break; |
1365 | - case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) : |
|
1366 | - $this->decline_registration( $notify ); |
|
1365 | + case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') : |
|
1366 | + $this->decline_registration($notify); |
|
1367 | 1367 | break; |
1368 | - case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) : |
|
1369 | - $this->cancel_registration( $notify ); |
|
1368 | + case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') : |
|
1369 | + $this->cancel_registration($notify); |
|
1370 | 1370 | break; |
1371 | 1371 | default : |
1372 | 1372 | $result['success'] = false; |
1373 | - unset( $this->_req_data['return'] ); |
|
1374 | - $this->_reg_status_change_return( '', false ); |
|
1373 | + unset($this->_req_data['return']); |
|
1374 | + $this->_reg_status_change_return('', false); |
|
1375 | 1375 | break; |
1376 | 1376 | } |
1377 | 1377 | } |
@@ -1384,8 +1384,8 @@ discard block |
||
1384 | 1384 | * @param bool $notify whether or not to notify the registrant about their approval. |
1385 | 1385 | * @return void |
1386 | 1386 | */ |
1387 | - protected function approve_registration( $notify = false ) { |
|
1388 | - $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify ); |
|
1387 | + protected function approve_registration($notify = false) { |
|
1388 | + $this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify); |
|
1389 | 1389 | } |
1390 | 1390 | |
1391 | 1391 | |
@@ -1397,8 +1397,8 @@ discard block |
||
1397 | 1397 | * @param bool $notify whether or not to notify the registrant about their approval. |
1398 | 1398 | * @return void |
1399 | 1399 | */ |
1400 | - protected function decline_registration( $notify = false ) { |
|
1401 | - $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify ); |
|
1400 | + protected function decline_registration($notify = false) { |
|
1401 | + $this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify); |
|
1402 | 1402 | } |
1403 | 1403 | |
1404 | 1404 | |
@@ -1410,8 +1410,8 @@ discard block |
||
1410 | 1410 | * @param bool $notify whether or not to notify the registrant about their approval. |
1411 | 1411 | * @return void |
1412 | 1412 | */ |
1413 | - protected function cancel_registration( $notify = false ) { |
|
1414 | - $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify ); |
|
1413 | + protected function cancel_registration($notify = false) { |
|
1414 | + $this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify); |
|
1415 | 1415 | } |
1416 | 1416 | |
1417 | 1417 | |
@@ -1424,8 +1424,8 @@ discard block |
||
1424 | 1424 | * @param bool $notify whether or not to notify the registrant about their approval. |
1425 | 1425 | * @return void |
1426 | 1426 | */ |
1427 | - protected function not_approve_registration( $notify = false ) { |
|
1428 | - $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify ); |
|
1427 | + protected function not_approve_registration($notify = false) { |
|
1428 | + $this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify); |
|
1429 | 1429 | } |
1430 | 1430 | |
1431 | 1431 | |
@@ -1436,8 +1436,8 @@ discard block |
||
1436 | 1436 | * @param bool $notify whether or not to notify the registrant about their approval. |
1437 | 1437 | * @return void |
1438 | 1438 | */ |
1439 | - protected function pending_registration( $notify = false ) { |
|
1440 | - $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify ); |
|
1439 | + protected function pending_registration($notify = false) { |
|
1440 | + $this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify); |
|
1441 | 1441 | } |
1442 | 1442 | |
1443 | 1443 | |
@@ -1451,19 +1451,19 @@ discard block |
||
1451 | 1451 | public function _reg_details_meta_box() { |
1452 | 1452 | EEH_Autoloader::register_line_item_display_autoloaders(); |
1453 | 1453 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
1454 | - EE_Registry::instance()->load_helper( 'Line_Item' ); |
|
1454 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
1455 | 1455 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1456 | 1456 | $this->_session = $transaction->session_data(); |
1457 | 1457 | |
1458 | 1458 | $filters = new EE_Line_Item_Filter_Collection(); |
1459 | - $filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) ); |
|
1460 | - $filters->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
1461 | - $line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() ); |
|
1459 | + $filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration)); |
|
1460 | + $filters->add(new EE_Non_Zero_Line_Item_Filter()); |
|
1461 | + $line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item()); |
|
1462 | 1462 | $filtered_line_item_tree = $line_item_filter_processor->process(); |
1463 | 1463 | |
1464 | 1464 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1465 | - $line_item_display = new EE_Line_Item_Display( 'reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' ); |
|
1466 | - $this->_template_args['line_item_table'] = $line_item_display->display_line_item( $filtered_line_item_tree, array( 'EE_Registration' => $this->_registration ) ); |
|
1465 | + $line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy'); |
|
1466 | + $this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration)); |
|
1467 | 1467 | |
1468 | 1468 | |
1469 | 1469 | $attendee = $this->_registration->attendee(); |
@@ -1474,10 +1474,10 @@ discard block |
||
1474 | 1474 | ) |
1475 | 1475 | ? EEH_Template::get_button_or_link( |
1476 | 1476 | EE_Admin_Page::add_query_args_and_nonce( |
1477 | - array( 'action' => 'view_transaction', 'TXN_ID' => $transaction->ID() ), |
|
1477 | + array('action' => 'view_transaction', 'TXN_ID' => $transaction->ID()), |
|
1478 | 1478 | TXN_ADMIN_URL |
1479 | 1479 | ), |
1480 | - esc_html__( ' View Transaction' ), |
|
1480 | + esc_html__(' View Transaction'), |
|
1481 | 1481 | 'button secondary-button right', |
1482 | 1482 | 'dashicons dashicons-cart' |
1483 | 1483 | ) |
@@ -1497,59 +1497,59 @@ discard block |
||
1497 | 1497 | ), |
1498 | 1498 | REG_ADMIN_URL |
1499 | 1499 | ), |
1500 | - esc_html__( ' Resend Registration' ), |
|
1500 | + esc_html__(' Resend Registration'), |
|
1501 | 1501 | 'button secondary-button right', |
1502 | 1502 | 'dashicons dashicons-email-alt' |
1503 | 1503 | ) |
1504 | 1504 | : ''; |
1505 | 1505 | |
1506 | 1506 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
1507 | - $payment = $transaction->get_first_related( 'Payment' ); |
|
1507 | + $payment = $transaction->get_first_related('Payment'); |
|
1508 | 1508 | $payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment; |
1509 | - $payment_method = $payment->get_first_related( 'Payment_Method' ); |
|
1509 | + $payment_method = $payment->get_first_related('Payment_Method'); |
|
1510 | 1510 | $payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method; |
1511 | - $reg_status_class = 'status-' . $this->_registration->status_ID(); |
|
1511 | + $reg_status_class = 'status-'.$this->_registration->status_ID(); |
|
1512 | 1512 | $reg_details = array( |
1513 | 1513 | 'payment_method' => $payment_method->name(), |
1514 | 1514 | 'response_msg' => $payment->gateway_response(), |
1515 | - 'registration_id' => $this->_registration->get( 'REG_code' ), |
|
1515 | + 'registration_id' => $this->_registration->get('REG_code'), |
|
1516 | 1516 | 'registration_session' => $this->_registration->session_ID(), |
1517 | - 'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '', |
|
1518 | - 'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '', |
|
1517 | + 'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '', |
|
1518 | + 'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '', |
|
1519 | 1519 | ); |
1520 | 1520 | |
1521 | 1521 | |
1522 | - if ( isset( $reg_details['registration_id'] )) { |
|
1522 | + if (isset($reg_details['registration_id'])) { |
|
1523 | 1523 | $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id']; |
1524 | - $this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' ); |
|
1524 | + $this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso'); |
|
1525 | 1525 | $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text'; |
1526 | 1526 | } |
1527 | 1527 | |
1528 | - if ( isset( $reg_details['payment_method'] ) ) { |
|
1528 | + if (isset($reg_details['payment_method'])) { |
|
1529 | 1529 | $this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method']; |
1530 | - $this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' ); |
|
1530 | + $this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso'); |
|
1531 | 1531 | $this->_template_args['reg_details']['payment_method']['class'] = 'regular-text'; |
1532 | 1532 | $this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg']; |
1533 | - $this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' ); |
|
1533 | + $this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso'); |
|
1534 | 1534 | $this->_template_args['reg_details']['response_msg']['class'] = 'regular-text'; |
1535 | 1535 | } |
1536 | 1536 | |
1537 | 1537 | $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session']; |
1538 | - $this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' ); |
|
1538 | + $this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); |
|
1539 | 1539 | $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text'; |
1540 | 1540 | |
1541 | 1541 | $this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address']; |
1542 | - $this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' ); |
|
1542 | + $this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso'); |
|
1543 | 1543 | $this->_template_args['reg_details']['ip_address']['class'] = 'regular-text'; |
1544 | 1544 | |
1545 | 1545 | $this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent']; |
1546 | - $this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' ); |
|
1546 | + $this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); |
|
1547 | 1547 | $this->_template_args['reg_details']['user_agent']['class'] = 'large-text'; |
1548 | 1548 | |
1549 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL ); |
|
1549 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL); |
|
1550 | 1550 | |
1551 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1552 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1551 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1552 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1553 | 1553 | |
1554 | 1554 | } |
1555 | 1555 | |
@@ -1563,14 +1563,14 @@ discard block |
||
1563 | 1563 | */ |
1564 | 1564 | public function _reg_questions_meta_box() { |
1565 | 1565 | //allow someone to override this method entirely |
1566 | - if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) { |
|
1567 | - $form = $this->_get_reg_custom_questions_form( $this->_registration->ID() ); |
|
1568 | - $this->_template_args[ 'att_questions' ] = count( $form->subforms() ) > 0 ? $form->get_html_and_js() : ''; |
|
1566 | + if (apply_filters('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration)) { |
|
1567 | + $form = $this->_get_reg_custom_questions_form($this->_registration->ID()); |
|
1568 | + $this->_template_args['att_questions'] = count($form->subforms()) > 0 ? $form->get_html_and_js() : ''; |
|
1569 | 1569 | $this->_template_args['reg_questions_form_action'] = 'edit_registration'; |
1570 | 1570 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1571 | 1571 | |
1572 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1573 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1572 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1573 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1574 | 1574 | } |
1575 | 1575 | } |
1576 | 1576 | |
@@ -1584,12 +1584,12 @@ discard block |
||
1584 | 1584 | * @param string $output |
1585 | 1585 | * @return string |
1586 | 1586 | */ |
1587 | - public function form_before_question_group( $output ) { |
|
1587 | + public function form_before_question_group($output) { |
|
1588 | 1588 | EE_Error::doing_it_wrong( |
1589 | - __CLASS__ . '::' . __FUNCTION__, |
|
1590 | - __( 'This method would have been protected but was used on a filter callback' |
|
1589 | + __CLASS__.'::'.__FUNCTION__, |
|
1590 | + __('This method would have been protected but was used on a filter callback' |
|
1591 | 1591 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1592 | - 'event_espresso' ), |
|
1592 | + 'event_espresso'), |
|
1593 | 1593 | '4.8.32.rc.000' |
1594 | 1594 | ); |
1595 | 1595 | return ' |
@@ -1608,20 +1608,20 @@ discard block |
||
1608 | 1608 | * @param string $output |
1609 | 1609 | * @return string |
1610 | 1610 | */ |
1611 | - public function form_after_question_group( $output ) { |
|
1611 | + public function form_after_question_group($output) { |
|
1612 | 1612 | EE_Error::doing_it_wrong( |
1613 | - __CLASS__ . '::' . __FUNCTION__, |
|
1614 | - __( 'This method would have been protected but was used on a filter callback' |
|
1613 | + __CLASS__.'::'.__FUNCTION__, |
|
1614 | + __('This method would have been protected but was used on a filter callback' |
|
1615 | 1615 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1616 | - 'event_espresso' ), |
|
1616 | + 'event_espresso'), |
|
1617 | 1617 | '4.8.32.rc.000' |
1618 | 1618 | ); |
1619 | 1619 | return ' |
1620 | 1620 | <tr class="hide-if-no-js"> |
1621 | 1621 | <th> </th> |
1622 | 1622 | <td class="reg-admin-edit-attendee-question-td"> |
1623 | - <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '"> |
|
1624 | - <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span> |
|
1623 | + <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'"> |
|
1624 | + <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span> |
|
1625 | 1625 | <div class="dashicons dashicons-edit"></div> |
1626 | 1626 | </a> |
1627 | 1627 | </td> |
@@ -1641,18 +1641,18 @@ discard block |
||
1641 | 1641 | * @param string $label |
1642 | 1642 | * @return string |
1643 | 1643 | */ |
1644 | - public function form_form_field_label_wrap( $label ) { |
|
1644 | + public function form_form_field_label_wrap($label) { |
|
1645 | 1645 | EE_Error::doing_it_wrong( |
1646 | - __CLASS__ . '::' . __FUNCTION__, |
|
1647 | - __( 'This method would have been protected but was used on a filter callback' |
|
1646 | + __CLASS__.'::'.__FUNCTION__, |
|
1647 | + __('This method would have been protected but was used on a filter callback' |
|
1648 | 1648 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1649 | - 'event_espresso' ), |
|
1649 | + 'event_espresso'), |
|
1650 | 1650 | '4.8.32.rc.000' |
1651 | 1651 | ); |
1652 | 1652 | return ' |
1653 | 1653 | <tr> |
1654 | 1654 | <th> |
1655 | - ' . $label . ' |
|
1655 | + ' . $label.' |
|
1656 | 1656 | </th>'; |
1657 | 1657 | } |
1658 | 1658 | |
@@ -1666,17 +1666,17 @@ discard block |
||
1666 | 1666 | * @param string $input |
1667 | 1667 | * @return string |
1668 | 1668 | */ |
1669 | - public function form_form_field_input__wrap( $input ) { |
|
1669 | + public function form_form_field_input__wrap($input) { |
|
1670 | 1670 | EE_Error::doing_it_wrong( |
1671 | - __CLASS__ . '::' . __FUNCTION__, |
|
1672 | - __( 'This method would have been protected but was used on a filter callback' |
|
1671 | + __CLASS__.'::'.__FUNCTION__, |
|
1672 | + __('This method would have been protected but was used on a filter callback' |
|
1673 | 1673 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1674 | - 'event_espresso' ), |
|
1674 | + 'event_espresso'), |
|
1675 | 1675 | '4.8.32.rc.000' |
1676 | 1676 | ); |
1677 | 1677 | return ' |
1678 | 1678 | <td class="reg-admin-attendee-questions-input-td disabled-input"> |
1679 | - ' . $input . ' |
|
1679 | + ' . $input.' |
|
1680 | 1680 | </td> |
1681 | 1681 | </tr>'; |
1682 | 1682 | } |
@@ -1690,14 +1690,14 @@ discard block |
||
1690 | 1690 | * @return void |
1691 | 1691 | */ |
1692 | 1692 | protected function _update_attendee_registration_form() { |
1693 | - do_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this ); |
|
1694 | - if( $_SERVER['REQUEST_METHOD'] == 'POST'){ |
|
1695 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
1696 | - $success = $this->_save_reg_custom_questions_form( $REG_ID ); |
|
1697 | - if( $success ) { |
|
1693 | + do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this); |
|
1694 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
1695 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
1696 | + $success = $this->_save_reg_custom_questions_form($REG_ID); |
|
1697 | + if ($success) { |
|
1698 | 1698 | $what = __('Registration Form', 'event_espresso'); |
1699 | - $route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' ); |
|
1700 | - $this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route ); |
|
1699 | + $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); |
|
1700 | + $this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route); |
|
1701 | 1701 | } |
1702 | 1702 | } |
1703 | 1703 | } |
@@ -1708,11 +1708,11 @@ discard block |
||
1708 | 1708 | * @param int $REG_ID |
1709 | 1709 | * @return EE_Registration_Custom_Questions_Form |
1710 | 1710 | */ |
1711 | - protected function _get_reg_custom_questions_form( $REG_ID ) { |
|
1712 | - if( ! $this->_reg_custom_questions_form ) { |
|
1713 | - require_once( REG_ADMIN . 'form_sections' . DS . 'EE_Registration_Custom_Questions_Form.form.php' ); |
|
1714 | - $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form( EEM_Registration::instance()->get_one_by_ID( $REG_ID ) ); |
|
1715 | - $this->_reg_custom_questions_form->_construct_finalize( null, null ); |
|
1711 | + protected function _get_reg_custom_questions_form($REG_ID) { |
|
1712 | + if ( ! $this->_reg_custom_questions_form) { |
|
1713 | + require_once(REG_ADMIN.'form_sections'.DS.'EE_Registration_Custom_Questions_Form.form.php'); |
|
1714 | + $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form(EEM_Registration::instance()->get_one_by_ID($REG_ID)); |
|
1715 | + $this->_reg_custom_questions_form->_construct_finalize(null, null); |
|
1716 | 1716 | } |
1717 | 1717 | return $this->_reg_custom_questions_form; |
1718 | 1718 | } |
@@ -1725,17 +1725,17 @@ discard block |
||
1725 | 1725 | * @param bool $REG_ID |
1726 | 1726 | * @return bool |
1727 | 1727 | */ |
1728 | - private function _save_reg_custom_questions_form( $REG_ID = FALSE ) { |
|
1728 | + private function _save_reg_custom_questions_form($REG_ID = FALSE) { |
|
1729 | 1729 | |
1730 | 1730 | if ( ! $REG_ID) { |
1731 | - EE_Error::add_error( __('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1731 | + EE_Error::add_error(__('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1732 | 1732 | } |
1733 | - $form = $this->_get_reg_custom_questions_form( $REG_ID ); |
|
1734 | - $form->receive_form_submission( $this->_req_data ); |
|
1733 | + $form = $this->_get_reg_custom_questions_form($REG_ID); |
|
1734 | + $form->receive_form_submission($this->_req_data); |
|
1735 | 1735 | $success = false; |
1736 | - if( $form->is_valid() ) { |
|
1737 | - foreach( $form->subforms() as $question_group_id => $question_group_form ) { |
|
1738 | - foreach( $question_group_form->inputs() as $question_id => $input ) { |
|
1736 | + if ($form->is_valid()) { |
|
1737 | + foreach ($form->subforms() as $question_group_id => $question_group_form) { |
|
1738 | + foreach ($question_group_form->inputs() as $question_id => $input) { |
|
1739 | 1739 | $where_conditions = array( |
1740 | 1740 | 'QST_ID' => $question_id, |
1741 | 1741 | 'REG_ID' => $REG_ID |
@@ -1743,19 +1743,19 @@ discard block |
||
1743 | 1743 | $possibly_new_values = array( |
1744 | 1744 | 'ANS_value' => $input->normalized_value() |
1745 | 1745 | ); |
1746 | - $answer = EEM_Answer::instance()->get_one( array( $where_conditions ) ); |
|
1747 | - if( $answer instanceof EE_Answer ) { |
|
1748 | - $success = $answer->save( $possibly_new_values ); |
|
1746 | + $answer = EEM_Answer::instance()->get_one(array($where_conditions)); |
|
1747 | + if ($answer instanceof EE_Answer) { |
|
1748 | + $success = $answer->save($possibly_new_values); |
|
1749 | 1749 | } else { |
1750 | 1750 | //insert it then |
1751 | - $cols_n_vals = array_merge( $where_conditions, $possibly_new_values ); |
|
1752 | - $answer = EE_Answer::new_instance( $cols_n_vals ); |
|
1751 | + $cols_n_vals = array_merge($where_conditions, $possibly_new_values); |
|
1752 | + $answer = EE_Answer::new_instance($cols_n_vals); |
|
1753 | 1753 | $success = $answer->save(); |
1754 | 1754 | } |
1755 | 1755 | } |
1756 | 1756 | } |
1757 | 1757 | } else { |
1758 | - EE_Error::add_error( $form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1758 | + EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__); |
|
1759 | 1759 | } |
1760 | 1760 | return $success; |
1761 | 1761 | } |
@@ -1773,31 +1773,31 @@ discard block |
||
1773 | 1773 | $registrations = $REG->get_all(array( |
1774 | 1774 | array( |
1775 | 1775 | 'TXN_ID'=>$this->_registration->transaction_ID(), |
1776 | - 'REG_ID'=>array('!=',$this->_registration->ID()) |
|
1776 | + 'REG_ID'=>array('!=', $this->_registration->ID()) |
|
1777 | 1777 | ), |
1778 | 1778 | 'force_join'=>array('Attendee'))); |
1779 | 1779 | |
1780 | 1780 | $this->_template_args['attendees'] = array(); |
1781 | 1781 | $this->_template_args['attendee_notice'] = ''; |
1782 | - if ( empty( $registrations) || ( is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations) ) ) { |
|
1783 | - EE_Error::add_error( __('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1782 | + if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) { |
|
1783 | + EE_Error::add_error(__('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1784 | 1784 | $this->_template_args['attendee_notice'] = EE_Error::get_notices(); |
1785 | 1785 | } else { |
1786 | 1786 | |
1787 | 1787 | $att_nmbr = 1; |
1788 | - foreach ( $registrations as $registration ) { |
|
1788 | + foreach ($registrations as $registration) { |
|
1789 | 1789 | /* @var $registration EE_Registration */ |
1790 | 1790 | $attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object(); |
1791 | - $this->_template_args['attendees'][ $att_nmbr ]['STS_ID'] = $registration->status_ID(); |
|
1792 | - $this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1793 | - $this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1794 | - $this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1795 | - $this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();//( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : ''; |
|
1791 | + $this->_template_args['attendees'][$att_nmbr]['STS_ID'] = $registration->status_ID(); |
|
1792 | + $this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1793 | + $this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1794 | + $this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1795 | + $this->_template_args['attendees'][$att_nmbr]['final_price'] = $registration->final_price(); //( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : ''; |
|
1796 | 1796 | |
1797 | - $this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() ); |
|
1797 | + $this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array()); |
|
1798 | 1798 | |
1799 | - $this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1800 | - $this->_template_args['attendees'][ $att_nmbr ]['event_name'] = $registration->event_obj()->name(); |
|
1799 | + $this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1800 | + $this->_template_args['attendees'][$att_nmbr]['event_name'] = $registration->event_obj()->name(); |
|
1801 | 1801 | |
1802 | 1802 | $att_nmbr++; |
1803 | 1803 | } |
@@ -1807,8 +1807,8 @@ discard block |
||
1807 | 1807 | |
1808 | 1808 | // $this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees' ), REG_ADMIN_URL ); |
1809 | 1809 | } |
1810 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1811 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1810 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1811 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1812 | 1812 | |
1813 | 1813 | } |
1814 | 1814 | |
@@ -1829,14 +1829,14 @@ discard block |
||
1829 | 1829 | $attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object(); |
1830 | 1830 | |
1831 | 1831 | //now let's determine if this is not the primary registration. If it isn't then we set the primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the primary registration object (that way we know if we need to show create button or not) |
1832 | - if ( ! $this->_registration->is_primary_registrant() ) { |
|
1832 | + if ( ! $this->_registration->is_primary_registrant()) { |
|
1833 | 1833 | |
1834 | 1834 | $primary_registration = $this->_registration->get_primary_registration(); |
1835 | 1835 | $primary_attendee = $primary_registration instanceof EE_Registration |
1836 | 1836 | ? $primary_registration->attendee() |
1837 | 1837 | : null; |
1838 | 1838 | |
1839 | - if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) { |
|
1839 | + if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) { |
|
1840 | 1840 | //in here? This means the displayed registration is not the primary registrant but ALREADY HAS its own custom attendee object so let's not worry about the primary reg. |
1841 | 1841 | $primary_registration = NULL; |
1842 | 1842 | } |
@@ -1845,27 +1845,27 @@ discard block |
||
1845 | 1845 | } |
1846 | 1846 | |
1847 | 1847 | $this->_template_args['ATT_ID'] = $attendee->ID(); |
1848 | - $this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname; |
|
1849 | - $this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname; |
|
1850 | - $this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email; |
|
1848 | + $this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname; |
|
1849 | + $this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname; |
|
1850 | + $this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email; |
|
1851 | 1851 | $this->_template_args['phone'] = $attendee->phone(); |
1852 | 1852 | |
1853 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee ); |
|
1853 | + $this->_template_args['formatted_address'] = EEH_Address::format($attendee); |
|
1854 | 1854 | |
1855 | 1855 | |
1856 | 1856 | //edit link |
1857 | - $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1857 | + $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1858 | 1858 | $this->_template_args['att_edit_label'] = __('View/Edit Contact', 'event_espresso'); |
1859 | 1859 | |
1860 | 1860 | //create link |
1861 | - $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID() ), REG_ADMIN_URL ): ''; |
|
1861 | + $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID()), REG_ADMIN_URL) : ''; |
|
1862 | 1862 | $this->_template_args['create_label'] = __('Create Contact', 'event_espresso'); |
1863 | 1863 | |
1864 | 1864 | $this->_template_args['att_check'] = $att_check; |
1865 | 1865 | |
1866 | 1866 | |
1867 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1868 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1867 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1868 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1869 | 1869 | } |
1870 | 1870 | |
1871 | 1871 | |
@@ -1878,7 +1878,7 @@ discard block |
||
1878 | 1878 | * @access protected |
1879 | 1879 | * @return void |
1880 | 1880 | */ |
1881 | - protected function _trash_or_restore_registrations( $trash = TRUE ) { |
|
1881 | + protected function _trash_or_restore_registrations($trash = TRUE) { |
|
1882 | 1882 | $REGM = EEM_Registration::instance(); |
1883 | 1883 | |
1884 | 1884 | $success = 1; |
@@ -1888,26 +1888,26 @@ discard block |
||
1888 | 1888 | $dtts = array(); |
1889 | 1889 | |
1890 | 1890 | //if empty _REG_ID then get out because there's nothing to do |
1891 | - if ( empty( $this->_req_data['_REG_ID'] ) ) { |
|
1891 | + if (empty($this->_req_data['_REG_ID'])) { |
|
1892 | 1892 | $msg = $trash ? __('In order to trash registrations you must select which ones you wish to trash by clicking the checkboxes.', 'event_espresso') : __('In order to restore registrations you must select which ones you wish to restore by clicking the checkboxes.', 'event_espresso'); |
1893 | - EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ ); |
|
1894 | - $this->_redirect_after_action(FALSE, '', '', array(), TRUE ); |
|
1893 | + EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__); |
|
1894 | + $this->_redirect_after_action(FALSE, '', '', array(), TRUE); |
|
1895 | 1895 | } |
1896 | 1896 | |
1897 | 1897 | //Checkboxes |
1898 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1898 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1899 | 1899 | // if array has more than one element than success message should be plural |
1900 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1900 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1901 | 1901 | // cycle thru checkboxes |
1902 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1902 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1903 | 1903 | /** @var EE_Registration $REG */ |
1904 | - $REG = $REGM->get_one_by_ID( $REG_ID); |
|
1904 | + $REG = $REGM->get_one_by_ID($REG_ID); |
|
1905 | 1905 | $payment_count = $REG->get_first_related('Transaction')->count_related('Payment'); |
1906 | - if ( $payment_count > 0 ) { |
|
1907 | - $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' ); |
|
1906 | + if ($payment_count > 0) { |
|
1907 | + $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso'); |
|
1908 | 1908 | $error = 1; |
1909 | 1909 | $success = 0; |
1910 | - EE_Error::add_error( sprintf( __('The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1910 | + EE_Error::add_error(sprintf(__('The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name), __FILE__, __FUNCTION__, __LINE__); |
|
1911 | 1911 | continue; //can't trash this registration because it has payments. |
1912 | 1912 | } |
1913 | 1913 | $ticket = $REG->get_first_related('Ticket'); |
@@ -1916,7 +1916,7 @@ discard block |
||
1916 | 1916 | $dtts = array_merge($dtts, $dtt); |
1917 | 1917 | |
1918 | 1918 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1919 | - if ( !$updated ) { |
|
1919 | + if ( ! $updated) { |
|
1920 | 1920 | $success = 0; |
1921 | 1921 | } else { |
1922 | 1922 | $success = 2; |
@@ -1931,7 +1931,7 @@ discard block |
||
1931 | 1931 | $tickets[$ticket->ID()] = $ticket; |
1932 | 1932 | $dtts = $ticket->get_many_related('Datetime'); |
1933 | 1933 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1934 | - if ( ! $updated ) { |
|
1934 | + if ( ! $updated) { |
|
1935 | 1935 | $success = 0; |
1936 | 1936 | } |
1937 | 1937 | |
@@ -1941,10 +1941,10 @@ discard block |
||
1941 | 1941 | EEM_Ticket::instance()->update_tickets_sold($tickets); |
1942 | 1942 | EEM_Datetime::instance()->update_sold($dtts); |
1943 | 1943 | |
1944 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1945 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
1944 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1945 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
1946 | 1946 | $overwrite_msgs = $error ? TRUE : FALSE; |
1947 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs ); |
|
1947 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs); |
|
1948 | 1948 | } |
1949 | 1949 | |
1950 | 1950 | |
@@ -1968,16 +1968,16 @@ discard block |
||
1968 | 1968 | $success = 1; |
1969 | 1969 | |
1970 | 1970 | //Checkboxes |
1971 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1971 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1972 | 1972 | // if array has more than one element than success message should be plural |
1973 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1973 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1974 | 1974 | // cycle thru checkboxes |
1975 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1975 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1976 | 1976 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1977 | - if ( ! $REG instanceof EE_Registration ) |
|
1977 | + if ( ! $REG instanceof EE_Registration) |
|
1978 | 1978 | continue; |
1979 | 1979 | $deleted = $this->_delete_registration($REG); |
1980 | - if ( !$deleted ) { |
|
1980 | + if ( ! $deleted) { |
|
1981 | 1981 | $success = 0; |
1982 | 1982 | } |
1983 | 1983 | } |
@@ -1987,15 +1987,15 @@ discard block |
||
1987 | 1987 | $REG_ID = $this->_req_data['_REG_ID']; |
1988 | 1988 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1989 | 1989 | $deleted = $this->_delete_registration($REG); |
1990 | - if ( ! $deleted ) { |
|
1990 | + if ( ! $deleted) { |
|
1991 | 1991 | $success = 0; |
1992 | 1992 | } |
1993 | 1993 | |
1994 | 1994 | } |
1995 | 1995 | |
1996 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1997 | - $action_desc = __( 'permanently deleted.', 'event_espresso' ); |
|
1998 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE ); |
|
1996 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1997 | + $action_desc = __('permanently deleted.', 'event_espresso'); |
|
1998 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE); |
|
1999 | 1999 | } |
2000 | 2000 | |
2001 | 2001 | |
@@ -2007,31 +2007,31 @@ discard block |
||
2007 | 2007 | * @param EE_Registration $REG registration to be deleted permenantly |
2008 | 2008 | * @return boolean true = successful deletion, false = fail. |
2009 | 2009 | */ |
2010 | - protected function _delete_registration( EE_Registration $REG ) { |
|
2010 | + protected function _delete_registration(EE_Registration $REG) { |
|
2011 | 2011 | //first we start with the transaction... ultimately, we WILL not delete permanently if there are any related registrations on the transaction that are NOT trashed. |
2012 | 2012 | $TXN = $REG->get_first_related('Transaction'); |
2013 | 2013 | $REGS = $TXN->get_many_related('Registration'); |
2014 | 2014 | |
2015 | 2015 | $all_trashed = TRUE; |
2016 | - foreach ( $REGS as $registration ) { |
|
2017 | - if ( ! $registration->get('REG_deleted') ) |
|
2016 | + foreach ($REGS as $registration) { |
|
2017 | + if ( ! $registration->get('REG_deleted')) |
|
2018 | 2018 | $all_trashed = FALSE; |
2019 | 2019 | } |
2020 | 2020 | |
2021 | - if ( ! $all_trashed ) { |
|
2022 | - EE_Error::add_error( __('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2021 | + if ( ! $all_trashed) { |
|
2022 | + EE_Error::add_error(__('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2023 | 2023 | return false; |
2024 | 2024 | } |
2025 | 2025 | |
2026 | 2026 | //k made it here so that means we can delete all the related transactions and their answers (but let's do them separately from THIS one). |
2027 | - foreach ( $REGS as $registration ) { |
|
2027 | + foreach ($REGS as $registration) { |
|
2028 | 2028 | |
2029 | 2029 | //delete related answers |
2030 | 2030 | $registration->delete_related_permanently('Answer'); |
2031 | 2031 | |
2032 | 2032 | //remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact) |
2033 | 2033 | $attendee = $registration->get_first_related('Attendee'); |
2034 | - if ( $attendee instanceof EE_Attendee ) { |
|
2034 | + if ($attendee instanceof EE_Attendee) { |
|
2035 | 2035 | $registration->_remove_relation_to($attendee, 'Attendee'); |
2036 | 2036 | } |
2037 | 2037 | |
@@ -2041,7 +2041,7 @@ discard block |
||
2041 | 2041 | //now delete permanently the checkins related to this registration. |
2042 | 2042 | $registration->delete_related_permanently('Checkin'); |
2043 | 2043 | |
2044 | - if ( $registration->ID() === $REG->ID() ) |
|
2044 | + if ($registration->ID() === $REG->ID()) |
|
2045 | 2045 | continue; //we don't want to delete permanently the existing registration just yet. |
2046 | 2046 | |
2047 | 2047 | //remove relation to transaction for these registrations if NOT the existing registrations |
@@ -2074,35 +2074,35 @@ discard block |
||
2074 | 2074 | * @return void |
2075 | 2075 | */ |
2076 | 2076 | public function new_registration() { |
2077 | - if ( ! $this->_set_reg_event() ) { |
|
2078 | - throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') ); |
|
2077 | + if ( ! $this->_set_reg_event()) { |
|
2078 | + throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso')); |
|
2079 | 2079 | } |
2080 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2080 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2081 | 2081 | // gotta start with a clean slate if we're not coming here via ajax |
2082 | 2082 | if ( |
2083 | - ! defined('DOING_AJAX' ) |
|
2084 | - && ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ) ) |
|
2083 | + ! defined('DOING_AJAX') |
|
2084 | + && ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error'])) |
|
2085 | 2085 | ) { |
2086 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2086 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2087 | 2087 | } |
2088 | 2088 | |
2089 | - $this->_template_args['event_name'] = '' ; |
|
2089 | + $this->_template_args['event_name'] = ''; |
|
2090 | 2090 | // event name |
2091 | - if ( $this->_reg_event ) { |
|
2091 | + if ($this->_reg_event) { |
|
2092 | 2092 | $this->_template_args['event_name'] = $this->_reg_event->name(); |
2093 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL ); |
|
2094 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
2095 | - $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
2093 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL); |
|
2094 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
2095 | + $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
2096 | 2096 | } |
2097 | 2097 | |
2098 | 2098 | $this->_template_args['step_content'] = $this->_get_registration_step_content(); |
2099 | 2099 | |
2100 | - if ( defined('DOING_AJAX' ) ) { |
|
2100 | + if (defined('DOING_AJAX')) { |
|
2101 | 2101 | $this->_return_json(); |
2102 | 2102 | } |
2103 | 2103 | // grab header |
2104 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php'; |
|
2105 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2104 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php'; |
|
2105 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2106 | 2106 | |
2107 | 2107 | //$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
2108 | 2108 | // the details template wrapper |
@@ -2119,7 +2119,7 @@ discard block |
||
2119 | 2119 | * @return string html |
2120 | 2120 | */ |
2121 | 2121 | protected function _get_registration_step_content() { |
2122 | - if ( isset( $_COOKIE[ 'ee_registration_added' ] ) && $_COOKIE[ 'ee_registration_added' ] ) { |
|
2122 | + if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) { |
|
2123 | 2123 | $warning_msg = sprintf( |
2124 | 2124 | __( |
2125 | 2125 | '%2$sWARNING!!!%3$s%1$sPlease do not use the back button to return to this page for the purpose of adding another registration.%1$sThis can result in lost and/or corrupted data.%1$sIf you wish to add another registration, then please click the%1$s%7$s"Add Another New Registration to Event"%8$s button%1$son the Transaction details page, after you are redirected.%1$s%1$s%4$s redirecting in %5$s seconds %6$s', |
@@ -2135,7 +2135,7 @@ discard block |
||
2135 | 2135 | '</b>' |
2136 | 2136 | ); |
2137 | 2137 | return ' |
2138 | - <div id="ee-add-reg-back-button-dv"><p>' . $warning_msg . '</p></div> |
|
2138 | + <div id="ee-add-reg-back-button-dv"><p>' . $warning_msg.'</p></div> |
|
2139 | 2139 | <script > |
2140 | 2140 | // WHOAH !!! it appears that someone is using the back button from the Transaction admin page |
2141 | 2141 | // after just adding a new registration... we gotta try to put a stop to that !!! |
@@ -2170,16 +2170,16 @@ discard block |
||
2170 | 2170 | $cart = EE_Registry::instance()->SSN->cart(); |
2171 | 2171 | $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
2172 | 2172 | |
2173 | - switch ( $step ) { |
|
2173 | + switch ($step) { |
|
2174 | 2174 | case 'ticket' : |
2175 | 2175 | $hidden_fields['processing_registration']['value'] = 1; |
2176 | 2176 | $template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso'); |
2177 | - $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event ); |
|
2177 | + $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event); |
|
2178 | 2178 | $template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso'); |
2179 | 2179 | $template_args['show_notification_toggle'] = FALSE; |
2180 | 2180 | break; |
2181 | 2181 | case 'questions' : |
2182 | - $hidden_fields[ 'processing_registration' ][ 'value' ] = 2; |
|
2182 | + $hidden_fields['processing_registration']['value'] = 2; |
|
2183 | 2183 | $template_args['title'] = __('Step Two: Add Registrant Details for this Registration', 'event_espresso'); |
2184 | 2184 | //in theory we should be able to run EED_SPCO at this point because the cart should have been setup properly by the first process_reg_step run. |
2185 | 2185 | $template_args['content'] = EED_Single_Page_Checkout::registration_checkout_for_admin(); |
@@ -2188,10 +2188,10 @@ discard block |
||
2188 | 2188 | break; |
2189 | 2189 | } |
2190 | 2190 | |
2191 | - $this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route. |
|
2191 | + $this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route. |
|
2192 | 2192 | |
2193 | 2193 | return EEH_Template::display_template( |
2194 | - REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE |
|
2194 | + REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE |
|
2195 | 2195 | ); |
2196 | 2196 | } |
2197 | 2197 | |
@@ -2206,11 +2206,11 @@ discard block |
||
2206 | 2206 | * @return boolean |
2207 | 2207 | */ |
2208 | 2208 | private function _set_reg_event() { |
2209 | - if ( is_object( $this->_reg_event )) { |
|
2209 | + if (is_object($this->_reg_event)) { |
|
2210 | 2210 | return TRUE; |
2211 | 2211 | } |
2212 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
2213 | - if ( ! $EVT_ID ) { |
|
2212 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
2213 | + if ( ! $EVT_ID) { |
|
2214 | 2214 | return FALSE; |
2215 | 2215 | } |
2216 | 2216 | |
@@ -2231,82 +2231,82 @@ discard block |
||
2231 | 2231 | public function process_reg_step() { |
2232 | 2232 | EE_System::do_not_cache(); |
2233 | 2233 | $this->_set_reg_event(); |
2234 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2234 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2235 | 2235 | |
2236 | 2236 | //what step are we on? |
2237 | 2237 | $cart = EE_Registry::instance()->SSN->cart(); |
2238 | 2238 | $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
2239 | 2239 | |
2240 | 2240 | //if doing ajax then we need to verify the nonce |
2241 | - if ( defined( 'DOING_AJAX' ) ) { |
|
2242 | - $nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : ''; |
|
2243 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
2241 | + if (defined('DOING_AJAX')) { |
|
2242 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
2243 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
2244 | 2244 | } |
2245 | 2245 | |
2246 | - switch ( $step ) { |
|
2246 | + switch ($step) { |
|
2247 | 2247 | |
2248 | 2248 | case 'ticket' : |
2249 | 2249 | //process ticket selection |
2250 | 2250 | $success = EED_Ticket_Selector::instance()->process_ticket_selections(); |
2251 | - if ( $success ) { |
|
2252 | - EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2251 | + if ($success) { |
|
2252 | + EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2253 | 2253 | } else { |
2254 | 2254 | $query_args['step_error'] = $this->_req_data['step_error'] = TRUE; |
2255 | 2255 | } |
2256 | - if ( defined('DOING_AJAX') ) { |
|
2256 | + if (defined('DOING_AJAX')) { |
|
2257 | 2257 | $this->new_registration(); //display next step |
2258 | 2258 | } else { |
2259 | 2259 | $query_args['action'] = 'new_registration'; |
2260 | 2260 | $query_args['processing_registration'] = 1; |
2261 | 2261 | $query_args['event_id'] = $this->_reg_event->ID(); |
2262 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2262 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2263 | 2263 | } |
2264 | 2264 | break; |
2265 | 2265 | |
2266 | 2266 | case 'questions' : |
2267 | - if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) { |
|
2268 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 ); |
|
2267 | + if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) { |
|
2268 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
2269 | 2269 | } |
2270 | 2270 | //process registration |
2271 | 2271 | $transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin(); |
2272 | - if ( $cart instanceof EE_Cart ) { |
|
2272 | + if ($cart instanceof EE_Cart) { |
|
2273 | 2273 | $grand_total = $cart->get_cart_grand_total(); |
2274 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
2274 | + if ($grand_total instanceof EE_Line_Item) { |
|
2275 | 2275 | $grand_total->save_this_and_descendants_to_txn(); |
2276 | 2276 | } |
2277 | 2277 | } |
2278 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
2278 | + if ( ! $transaction instanceof EE_Transaction) { |
|
2279 | 2279 | $query_args = array( |
2280 | 2280 | 'action' => 'new_registration', |
2281 | 2281 | 'processing_registration' => 2, |
2282 | 2282 | 'event_id' => $this->_reg_event->ID() |
2283 | 2283 | ); |
2284 | 2284 | |
2285 | - if ( defined('DOING_AJAX' )) { |
|
2285 | + if (defined('DOING_AJAX')) { |
|
2286 | 2286 | //display registration form again because there are errors (maybe validation?) |
2287 | 2287 | $this->new_registration(); |
2288 | 2288 | return; |
2289 | 2289 | } else { |
2290 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2290 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2291 | 2291 | return; |
2292 | 2292 | } |
2293 | 2293 | } |
2294 | 2294 | /** @type EE_Transaction_Payments $transaction_payments */ |
2295 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
2295 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
2296 | 2296 | // maybe update status, and make sure to save transaction if not done already |
2297 | - if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) { |
|
2297 | + if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) { |
|
2298 | 2298 | $transaction->save(); |
2299 | 2299 | } |
2300 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2300 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2301 | 2301 | $this->_req_data = array(); |
2302 | 2302 | $query_args = array( |
2303 | 2303 | 'action' => 'redirect_to_txn', |
2304 | 2304 | 'TXN_ID' => $transaction->ID(), |
2305 | 2305 | 'EVT_ID' => $this->_reg_event->ID(), |
2306 | - 'event_name' => urlencode( $this->_reg_event->name() ), |
|
2306 | + 'event_name' => urlencode($this->_reg_event->name()), |
|
2307 | 2307 | 'redirect_from' => 'new_registration' |
2308 | 2308 | ); |
2309 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
2309 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
2310 | 2310 | break; |
2311 | 2311 | } |
2312 | 2312 | |
@@ -2323,21 +2323,21 @@ discard block |
||
2323 | 2323 | */ |
2324 | 2324 | public function redirect_to_txn() { |
2325 | 2325 | EE_System::do_not_cache(); |
2326 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2326 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2327 | 2327 | $query_args = array( |
2328 | 2328 | 'action' => 'view_transaction', |
2329 | - 'TXN_ID' => isset( $this->_req_data['TXN_ID'] ) ? absint( $this->_req_data[ 'TXN_ID' ] ) : 0, |
|
2329 | + 'TXN_ID' => isset($this->_req_data['TXN_ID']) ? absint($this->_req_data['TXN_ID']) : 0, |
|
2330 | 2330 | 'page' => 'espresso_transactions' |
2331 | 2331 | ); |
2332 | - if ( isset( $this->_req_data[ 'EVT_ID' ], $this->_req_data[ 'redirect_from' ] ) ) { |
|
2333 | - $query_args['EVT_ID'] = $this->_req_data[ 'EVT_ID' ]; |
|
2334 | - $query_args['event_name'] = urlencode( $this->_req_data[ 'event_name' ] ); |
|
2335 | - $query_args['redirect_from'] = $this->_req_data[ 'redirect_from' ]; |
|
2332 | + if (isset($this->_req_data['EVT_ID'], $this->_req_data['redirect_from'])) { |
|
2333 | + $query_args['EVT_ID'] = $this->_req_data['EVT_ID']; |
|
2334 | + $query_args['event_name'] = urlencode($this->_req_data['event_name']); |
|
2335 | + $query_args['redirect_from'] = $this->_req_data['redirect_from']; |
|
2336 | 2336 | } |
2337 | 2337 | EE_Error::add_success( |
2338 | - __( 'Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso' ) |
|
2338 | + __('Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso') |
|
2339 | 2339 | ); |
2340 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
2340 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
2341 | 2341 | } |
2342 | 2342 | |
2343 | 2343 | |
@@ -2348,7 +2348,7 @@ discard block |
||
2348 | 2348 | * @return void |
2349 | 2349 | */ |
2350 | 2350 | protected function _attendee_contact_list_table() { |
2351 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2351 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2352 | 2352 | $this->_search_btn_label = __('Contacts', 'event_espresso'); |
2353 | 2353 | $this->display_admin_list_table_page_with_no_sidebar(); |
2354 | 2354 | } |
@@ -2363,10 +2363,10 @@ discard block |
||
2363 | 2363 | * @access public |
2364 | 2364 | * @return array |
2365 | 2365 | */ |
2366 | - public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { |
|
2366 | + public function get_attendees($per_page, $count = FALSE, $trash = FALSE) { |
|
2367 | 2367 | |
2368 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2369 | - require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' ); |
|
2368 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2369 | + require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php'); |
|
2370 | 2370 | $ATT_MDL = EEM_Attendee::instance(); |
2371 | 2371 | |
2372 | 2372 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
@@ -2394,47 +2394,47 @@ discard block |
||
2394 | 2394 | $orderby = 'ATT_lname'; |
2395 | 2395 | } |
2396 | 2396 | |
2397 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
2397 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
2398 | 2398 | |
2399 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
2400 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10; |
|
2401 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
2399 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
2400 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
2401 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
2402 | 2402 | |
2403 | 2403 | $_where = array(); |
2404 | 2404 | |
2405 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2406 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2405 | + if (isset($this->_req_data['s'])) { |
|
2406 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2407 | 2407 | $_where['OR'] = array( |
2408 | - 'Registration.Event.EVT_name' => array( 'LIKE', $sstr), |
|
2409 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
2410 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
2411 | - 'ATT_fname' => array( 'LIKE', $sstr ), |
|
2412 | - 'ATT_lname' => array( 'LIKE', $sstr ), |
|
2413 | - 'ATT_short_bio' => array( 'LIKE', $sstr ), |
|
2414 | - 'ATT_email' => array('LIKE', $sstr ), |
|
2415 | - 'ATT_address' => array( 'LIKE', $sstr ), |
|
2416 | - 'ATT_address2' => array( 'LIKE', $sstr ), |
|
2417 | - 'ATT_city' => array( 'LIKE', $sstr ), |
|
2418 | - 'Country.CNT_name' => array( 'LIKE', $sstr ), |
|
2419 | - 'State.STA_name' => array('LIKE', $sstr ), |
|
2420 | - 'ATT_phone' => array( 'LIKE', $sstr ), |
|
2421 | - 'Registration.REG_final_price' => array( 'LIKE', $sstr ), |
|
2422 | - 'Registration.REG_code' => array( 'LIKE', $sstr ), |
|
2423 | - 'Registration.REG_count' => array( 'LIKE' , $sstr ), |
|
2424 | - 'Registration.REG_group_size' => array( 'LIKE' , $sstr ) |
|
2408 | + 'Registration.Event.EVT_name' => array('LIKE', $sstr), |
|
2409 | + 'Registration.Event.EVT_desc' => array('LIKE', $sstr), |
|
2410 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $sstr), |
|
2411 | + 'ATT_fname' => array('LIKE', $sstr), |
|
2412 | + 'ATT_lname' => array('LIKE', $sstr), |
|
2413 | + 'ATT_short_bio' => array('LIKE', $sstr), |
|
2414 | + 'ATT_email' => array('LIKE', $sstr), |
|
2415 | + 'ATT_address' => array('LIKE', $sstr), |
|
2416 | + 'ATT_address2' => array('LIKE', $sstr), |
|
2417 | + 'ATT_city' => array('LIKE', $sstr), |
|
2418 | + 'Country.CNT_name' => array('LIKE', $sstr), |
|
2419 | + 'State.STA_name' => array('LIKE', $sstr), |
|
2420 | + 'ATT_phone' => array('LIKE', $sstr), |
|
2421 | + 'Registration.REG_final_price' => array('LIKE', $sstr), |
|
2422 | + 'Registration.REG_code' => array('LIKE', $sstr), |
|
2423 | + 'Registration.REG_count' => array('LIKE', $sstr), |
|
2424 | + 'Registration.REG_group_size' => array('LIKE', $sstr) |
|
2425 | 2425 | ); |
2426 | 2426 | } |
2427 | 2427 | |
2428 | 2428 | |
2429 | - $offset = ($current_page-1)*$per_page; |
|
2430 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
2429 | + $offset = ($current_page - 1) * $per_page; |
|
2430 | + $limit = $count ? NULL : array($offset, $per_page); |
|
2431 | 2431 | |
2432 | - if ( $trash ) { |
|
2433 | - $_where['status'] = array( '!=', 'publish' ); |
|
2434 | - $all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2432 | + if ($trash) { |
|
2433 | + $_where['status'] = array('!=', 'publish'); |
|
2434 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2435 | 2435 | } else { |
2436 | - $_where['status'] = array( 'IN', array( 'publish' ) ); |
|
2437 | - $all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit)) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) ); |
|
2436 | + $_where['status'] = array('IN', array('publish')); |
|
2437 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2438 | 2438 | } |
2439 | 2439 | |
2440 | 2440 | return $all_attendees; |
@@ -2451,10 +2451,10 @@ discard block |
||
2451 | 2451 | */ |
2452 | 2452 | protected function _resend_registration() { |
2453 | 2453 | $this->_process_resend_registration(); |
2454 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array( |
|
2454 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array( |
|
2455 | 2455 | 'action' => 'default' |
2456 | 2456 | ); |
2457 | - $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE ); |
|
2457 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2458 | 2458 | } |
2459 | 2459 | |
2460 | 2460 | |
@@ -2462,26 +2462,26 @@ discard block |
||
2462 | 2462 | |
2463 | 2463 | |
2464 | 2464 | |
2465 | - public function _registrations_report(){ |
|
2466 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2467 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2465 | + public function _registrations_report() { |
|
2466 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2467 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2468 | 2468 | array( |
2469 | 2469 | 'page' => 'espresso_batch', |
2470 | 2470 | 'batch' => 'file', |
2471 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2472 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ), |
|
2473 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2474 | - )) ); |
|
2471 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2472 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'), |
|
2473 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2474 | + ))); |
|
2475 | 2475 | } else { |
2476 | 2476 | $new_request_args = array( |
2477 | 2477 | 'export' => 'report', |
2478 | 2478 | 'action' => 'registrations_report_for_event', |
2479 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2479 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2480 | 2480 | ); |
2481 | 2481 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
2482 | 2482 | |
2483 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2484 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2483 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2484 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2485 | 2485 | $EE_Export = EE_Export::instance($this->_req_data); |
2486 | 2486 | $EE_Export->export(); |
2487 | 2487 | } |
@@ -2490,26 +2490,26 @@ discard block |
||
2490 | 2490 | |
2491 | 2491 | |
2492 | 2492 | |
2493 | - public function _contact_list_export(){ |
|
2494 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2495 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2493 | + public function _contact_list_export() { |
|
2494 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2495 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2496 | 2496 | $EE_Export = EE_Export::instance($this->_req_data); |
2497 | 2497 | $EE_Export->export_attendees(); |
2498 | 2498 | } |
2499 | 2499 | } |
2500 | 2500 | |
2501 | - public function _contact_list_report(){ |
|
2502 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2503 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2501 | + public function _contact_list_report() { |
|
2502 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2503 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2504 | 2504 | array( |
2505 | 2505 | 'page' => 'espresso_batch', |
2506 | 2506 | 'batch' => 'file', |
2507 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ), |
|
2508 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2509 | - )) ); |
|
2507 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'), |
|
2508 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2509 | + ))); |
|
2510 | 2510 | } else { |
2511 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2512 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2511 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2512 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2513 | 2513 | $EE_Export = EE_Export::instance($this->_req_data); |
2514 | 2514 | $EE_Export->report_attendees(); |
2515 | 2515 | } |
@@ -2528,73 +2528,73 @@ discard block |
||
2528 | 2528 | * @return void |
2529 | 2529 | */ |
2530 | 2530 | protected function _duplicate_attendee() { |
2531 | - $action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default'; |
|
2531 | + $action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default'; |
|
2532 | 2532 | //verify we have necessary info |
2533 | - if ( empty($this->_req_data['_REG_ID'] ) ) { |
|
2534 | - EE_Error::add_error( __('Unable to create the contact for the registration because the required parameters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__ ); |
|
2535 | - $query_args = array( 'action' => $action ); |
|
2533 | + if (empty($this->_req_data['_REG_ID'])) { |
|
2534 | + EE_Error::add_error(__('Unable to create the contact for the registration because the required parameters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
2535 | + $query_args = array('action' => $action); |
|
2536 | 2536 | $this->_redirect_after_action('', '', '', $query_args, TRUE); |
2537 | 2537 | } |
2538 | 2538 | |
2539 | 2539 | //okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration. |
2540 | - $registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] ); |
|
2540 | + $registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']); |
|
2541 | 2541 | $attendee = $registration->attendee(); |
2542 | 2542 | |
2543 | 2543 | //remove relation of existing attendee on registration |
2544 | - $registration->_remove_relation_to($attendee, 'Attendee' ); |
|
2544 | + $registration->_remove_relation_to($attendee, 'Attendee'); |
|
2545 | 2545 | //new attendee |
2546 | 2546 | $new_attendee = clone $attendee; |
2547 | - $new_attendee->set( 'ATT_ID', 0 ); |
|
2547 | + $new_attendee->set('ATT_ID', 0); |
|
2548 | 2548 | $new_attendee->save(); |
2549 | 2549 | |
2550 | 2550 | //add new attendee to reg |
2551 | - $registration->_add_relation_to( $new_attendee, 'Attendee'); |
|
2551 | + $registration->_add_relation_to($new_attendee, 'Attendee'); |
|
2552 | 2552 | |
2553 | - EE_Error::add_success( __('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso') ); |
|
2553 | + EE_Error::add_success(__('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso')); |
|
2554 | 2554 | |
2555 | 2555 | //redirect to edit page for attendee |
2556 | - $query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' ); |
|
2556 | + $query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee'); |
|
2557 | 2557 | |
2558 | - $this->_redirect_after_action( '', '', '', $query_args, TRUE ); |
|
2558 | + $this->_redirect_after_action('', '', '', $query_args, TRUE); |
|
2559 | 2559 | } |
2560 | 2560 | |
2561 | 2561 | |
2562 | 2562 | //related to cpt routes |
2563 | 2563 | protected function _insert_update_cpt_item($post_id, $post) { |
2564 | 2564 | $success = true; |
2565 | - $attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id ); |
|
2565 | + $attendee = EEM_Attendee::instance()->get_one_by_ID($post_id); |
|
2566 | 2566 | //for attendee updates |
2567 | - if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) { |
|
2567 | + if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) { |
|
2568 | 2568 | //note we should only be UPDATING attendees at this point. |
2569 | 2569 | $updated_fields = array( |
2570 | 2570 | 'ATT_fname' => $this->_req_data['ATT_fname'], |
2571 | 2571 | 'ATT_lname' => $this->_req_data['ATT_lname'], |
2572 | - 'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'], |
|
2572 | + 'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'], |
|
2573 | 2573 | 'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '', |
2574 | 2574 | 'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '', |
2575 | - 'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '', |
|
2576 | - 'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '', |
|
2577 | - 'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '', |
|
2578 | - 'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '', |
|
2579 | - 'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '', |
|
2580 | - 'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : '' |
|
2575 | + 'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '', |
|
2576 | + 'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '', |
|
2577 | + 'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '', |
|
2578 | + 'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '', |
|
2579 | + 'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '', |
|
2580 | + 'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : '' |
|
2581 | 2581 | ); |
2582 | - foreach ( $updated_fields as $field => $value ) { |
|
2582 | + foreach ($updated_fields as $field => $value) { |
|
2583 | 2583 | $attendee->set($field, $value); |
2584 | 2584 | } |
2585 | 2585 | |
2586 | 2586 | $success = $attendee->save(); |
2587 | 2587 | |
2588 | - $attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() ); |
|
2589 | - foreach ( $attendee_update_callbacks as $a_callback ) { |
|
2590 | - if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) { |
|
2591 | - throw new EE_Error( sprintf( __('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', 'event_espresso'), $a_callback ) ); |
|
2588 | + $attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array()); |
|
2589 | + foreach ($attendee_update_callbacks as $a_callback) { |
|
2590 | + if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) { |
|
2591 | + throw new EE_Error(sprintf(__('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', 'event_espresso'), $a_callback)); |
|
2592 | 2592 | } |
2593 | 2593 | } |
2594 | 2594 | } |
2595 | 2595 | |
2596 | - if ( $success === FALSE ) |
|
2597 | - EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2596 | + if ($success === FALSE) |
|
2597 | + EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2598 | 2598 | |
2599 | 2599 | } |
2600 | 2600 | |
@@ -2614,17 +2614,17 @@ discard block |
||
2614 | 2614 | remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2615 | 2615 | remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2616 | 2616 | |
2617 | - if ( post_type_supports( 'espresso_attendees', 'excerpt') ) { |
|
2618 | - add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' ); |
|
2617 | + if (post_type_supports('espresso_attendees', 'excerpt')) { |
|
2618 | + add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal'); |
|
2619 | 2619 | } |
2620 | 2620 | |
2621 | - if ( post_type_supports( 'espresso_attendees', 'comments') ) { |
|
2621 | + if (post_type_supports('espresso_attendees', 'comments')) { |
|
2622 | 2622 | add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2623 | 2623 | } |
2624 | 2624 | |
2625 | - add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
2626 | - add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' ); |
|
2627 | - add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array( $this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); |
|
2625 | + add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
2626 | + add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
|
2627 | + add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array($this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); |
|
2628 | 2628 | } |
2629 | 2629 | |
2630 | 2630 | |
@@ -2633,10 +2633,10 @@ discard block |
||
2633 | 2633 | * @param WP_Post $post wp post object |
2634 | 2634 | * @return string attendee contact info ( and form ) |
2635 | 2635 | */ |
2636 | - public function attendee_contact_info( $post ) { |
|
2636 | + public function attendee_contact_info($post) { |
|
2637 | 2637 | //get attendee object ( should already have it ) |
2638 | 2638 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2639 | - $template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php'; |
|
2639 | + $template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php'; |
|
2640 | 2640 | EEH_Template::display_template($template, $this->_template_args); |
2641 | 2641 | } |
2642 | 2642 | |
@@ -2652,12 +2652,12 @@ discard block |
||
2652 | 2652 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2653 | 2653 | $this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input( |
2654 | 2654 | new EE_Question_Form_Input( |
2655 | - EE_Question::new_instance( array( |
|
2655 | + EE_Question::new_instance(array( |
|
2656 | 2656 | 'QST_ID' => 0, |
2657 | 2657 | 'QST_display_text' => __('State/Province', 'event_espresso'), |
2658 | 2658 | 'QST_system' => 'admin-state' |
2659 | 2659 | )), |
2660 | - EE_Answer::new_instance( array( |
|
2660 | + EE_Answer::new_instance(array( |
|
2661 | 2661 | 'ANS_ID' => 0, |
2662 | 2662 | 'ANS_value' => $this->_cpt_model_obj->state_ID() |
2663 | 2663 | )), |
@@ -2670,12 +2670,12 @@ discard block |
||
2670 | 2670 | )); |
2671 | 2671 | $this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input( |
2672 | 2672 | new EE_Question_Form_Input( |
2673 | - EE_Question::new_instance( array( |
|
2673 | + EE_Question::new_instance(array( |
|
2674 | 2674 | 'QST_ID' => 0, |
2675 | 2675 | 'QST_display_text' => __('Country', 'event_espresso'), |
2676 | 2676 | 'QST_system' => 'admin-country' |
2677 | 2677 | )), |
2678 | - EE_Answer::new_instance( array( |
|
2678 | + EE_Answer::new_instance(array( |
|
2679 | 2679 | 'ANS_ID' => 0, |
2680 | 2680 | 'ANS_value' => $this->_cpt_model_obj->country_ID() |
2681 | 2681 | )), |
@@ -2686,8 +2686,8 @@ discard block |
||
2686 | 2686 | 'append_qstn_id' => FALSE |
2687 | 2687 | ) |
2688 | 2688 | )); |
2689 | - $template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php'; |
|
2690 | - EEH_Template::display_template($template, $this->_template_args ); |
|
2689 | + $template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php'; |
|
2690 | + EEH_Template::display_template($template, $this->_template_args); |
|
2691 | 2691 | |
2692 | 2692 | } |
2693 | 2693 | |
@@ -2697,11 +2697,11 @@ discard block |
||
2697 | 2697 | * @access protected |
2698 | 2698 | * @return void |
2699 | 2699 | */ |
2700 | - public function attendee_registrations_meta_box( $post ) { |
|
2700 | + public function attendee_registrations_meta_box($post) { |
|
2701 | 2701 | |
2702 | 2702 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2703 | 2703 | $this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration'); |
2704 | - $template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php'; |
|
2704 | + $template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php'; |
|
2705 | 2705 | EEH_Template::display_template($template, $this->_template_args); |
2706 | 2706 | |
2707 | 2707 | } |
@@ -2715,8 +2715,8 @@ discard block |
||
2715 | 2715 | * @return string html for new form. |
2716 | 2716 | */ |
2717 | 2717 | public function after_title_form_fields($post) { |
2718 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
2719 | - $template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php'; |
|
2718 | + if ($post->post_type == 'espresso_attendees') { |
|
2719 | + $template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php'; |
|
2720 | 2720 | $template_args['attendee'] = $this->_cpt_model_obj; |
2721 | 2721 | EEH_Template::display_template($template, $template_args); |
2722 | 2722 | } |
@@ -2733,21 +2733,21 @@ discard block |
||
2733 | 2733 | * @access protected |
2734 | 2734 | * @return void |
2735 | 2735 | */ |
2736 | - protected function _trash_or_restore_attendees( $trash = TRUE ) { |
|
2736 | + protected function _trash_or_restore_attendees($trash = TRUE) { |
|
2737 | 2737 | |
2738 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2738 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2739 | 2739 | |
2740 | 2740 | $ATT_MDL = EEM_Attendee::instance(); |
2741 | 2741 | |
2742 | 2742 | $success = 1; |
2743 | 2743 | //Checkboxes |
2744 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2744 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2745 | 2745 | // if array has more than one element than success message should be plural |
2746 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2746 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2747 | 2747 | // cycle thru checkboxes |
2748 | - while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
2749 | - $updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID); |
|
2750 | - if ( !$updated ) { |
|
2748 | + while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2749 | + $updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID); |
|
2750 | + if ( ! $updated) { |
|
2751 | 2751 | $success = 0; |
2752 | 2752 | } |
2753 | 2753 | } |
@@ -2756,18 +2756,18 @@ discard block |
||
2756 | 2756 | // grab single id and delete |
2757 | 2757 | $ATT_ID = absint($this->_req_data['ATT_ID']); |
2758 | 2758 | //get attendee |
2759 | - $att = $ATT_MDL->get_one_by_ID( $ATT_ID ); |
|
2759 | + $att = $ATT_MDL->get_one_by_ID($ATT_ID); |
|
2760 | 2760 | $updated = $trash ? $att->set_status('trash') : $att->set_status('publish'); |
2761 | 2761 | $updated = $att->save(); |
2762 | - if ( ! $updated ) { |
|
2762 | + if ( ! $updated) { |
|
2763 | 2763 | $success = 0; |
2764 | 2764 | } |
2765 | 2765 | |
2766 | 2766 | } |
2767 | 2767 | |
2768 | - $what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' ); |
|
2769 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
2770 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) ); |
|
2768 | + $what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso'); |
|
2769 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
2770 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list')); |
|
2771 | 2771 | |
2772 | 2772 | } |
2773 | 2773 |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | /** |
55 | 55 | * @param \Registrations_Admin_Page $admin_page |
56 | 56 | */ |
57 | - public function __construct( Registrations_Admin_Page $admin_page ){ |
|
58 | - if ( ! empty( $_GET['event_id'] ) ) { |
|
57 | + public function __construct(Registrations_Admin_Page $admin_page) { |
|
58 | + if ( ! empty($_GET['event_id'])) { |
|
59 | 59 | $extra_query_args = array(); |
60 | - foreach ( $admin_page->get_views() as $key => $view_details ) { |
|
61 | - $extra_query_args[$view_details['slug']] = array( 'event_id' => $_GET['event_id'] ); |
|
60 | + foreach ($admin_page->get_views() as $key => $view_details) { |
|
61 | + $extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']); |
|
62 | 62 | } |
63 | - $this->_views = $admin_page->get_list_table_view_RLs( $extra_query_args ); |
|
63 | + $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args); |
|
64 | 64 | } |
65 | 65 | parent::__construct($admin_page); |
66 | 66 | $this->_status = $this->_admin_page->get_registration_status_array(); |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | * @return void |
76 | 76 | */ |
77 | 77 | protected function _setup_data() { |
78 | - $this->_data = $this->_admin_page->get_registrations( $this->_per_page ); |
|
79 | - $this->_all_data_count = $this->_admin_page->get_registrations( $this->_per_page, TRUE, FALSE, FALSE ); |
|
78 | + $this->_data = $this->_admin_page->get_registrations($this->_per_page); |
|
79 | + $this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, TRUE, FALSE, FALSE); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -93,30 +93,30 @@ discard block |
||
93 | 93 | 'ajax' => TRUE, |
94 | 94 | 'screen' => $this->_admin_page->get_current_screen()->id |
95 | 95 | ); |
96 | - $ID_column_name = __( 'ID', 'event_espresso' ); |
|
96 | + $ID_column_name = __('ID', 'event_espresso'); |
|
97 | 97 | $ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">'; |
98 | - $ID_column_name .= __( 'Registrant Name', 'event_espresso' ); |
|
98 | + $ID_column_name .= __('Registrant Name', 'event_espresso'); |
|
99 | 99 | $ID_column_name .= '</span> '; |
100 | - if ( isset( $_GET['event_id'] )) { |
|
100 | + if (isset($_GET['event_id'])) { |
|
101 | 101 | $this->_columns = array( |
102 | 102 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
103 | 103 | '_REG_ID' => $ID_column_name, |
104 | - 'ATT_fname' => __( 'Name', 'event_espresso' ), |
|
104 | + 'ATT_fname' => __('Name', 'event_espresso'), |
|
105 | 105 | 'ATT_email' => __('Email', 'event_espresso'), |
106 | - '_REG_date' => __( 'Reg Date', 'event_espresso' ), |
|
107 | - 'PRC_amount' => __( 'TKT Price', 'event_espresso' ), |
|
108 | - '_REG_final_price' => __( 'Final Price', 'event_espresso' ), |
|
109 | - 'TXN_total' => __( 'Total Txn', 'event_espresso' ), |
|
106 | + '_REG_date' => __('Reg Date', 'event_espresso'), |
|
107 | + 'PRC_amount' => __('TKT Price', 'event_espresso'), |
|
108 | + '_REG_final_price' => __('Final Price', 'event_espresso'), |
|
109 | + 'TXN_total' => __('Total Txn', 'event_espresso'), |
|
110 | 110 | 'TXN_paid' => __('Paid', 'event_espresso'), |
111 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
111 | + 'actions' => __('Actions', 'event_espresso') |
|
112 | 112 | ); |
113 | 113 | $this->_bottom_buttons = array( |
114 | 114 | 'report'=> array( |
115 | 115 | 'route' => 'registrations_report', |
116 | 116 | 'extra_request' => |
117 | 117 | array( |
118 | - 'EVT_ID'=> isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null, |
|
119 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) |
|
118 | + 'EVT_ID'=> isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null, |
|
119 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") |
|
120 | 120 | ) |
121 | 121 | ), |
122 | 122 | ); |
@@ -124,19 +124,19 @@ discard block |
||
124 | 124 | $this->_columns = array( |
125 | 125 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
126 | 126 | '_REG_ID' => $ID_column_name, |
127 | - 'ATT_fname' => __( 'Name', 'event_espresso' ), |
|
128 | - '_REG_date' => __( 'TXN Date', 'event_espresso' ), |
|
129 | - 'event_name' => __( 'Event', 'event_espresso' ), |
|
130 | - 'DTT_EVT_start' => __( 'Event Date', 'event_espresso' ), |
|
131 | - '_REG_final_price' => __( 'Price', 'event_espresso' ), |
|
132 | - '_REG_paid' => __( 'Paid', 'event_espresso' ), |
|
133 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
127 | + 'ATT_fname' => __('Name', 'event_espresso'), |
|
128 | + '_REG_date' => __('TXN Date', 'event_espresso'), |
|
129 | + 'event_name' => __('Event', 'event_espresso'), |
|
130 | + 'DTT_EVT_start' => __('Event Date', 'event_espresso'), |
|
131 | + '_REG_final_price' => __('Price', 'event_espresso'), |
|
132 | + '_REG_paid' => __('Paid', 'event_espresso'), |
|
133 | + 'actions' => __('Actions', 'event_espresso') |
|
134 | 134 | ); |
135 | 135 | $this->_bottom_buttons = array( |
136 | 136 | 'report_all'=> array( |
137 | 137 | 'route' => 'registrations_report', |
138 | 138 | 'extra_request' => array( |
139 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) ) |
|
139 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) |
|
140 | 140 | ), |
141 | 141 | ); |
142 | 142 | } |
@@ -144,11 +144,11 @@ discard block |
||
144 | 144 | $this->_primary_column = '_REG_ID'; |
145 | 145 | |
146 | 146 | $this->_sortable_columns = array( |
147 | - '_REG_date' => array( '_REG_date' => TRUE ), //true means its already sorted |
|
148 | - 'ATT_fname' => array( 'ATT_fname' => FALSE ), |
|
149 | - 'event_name' => array( 'event_name' => FALSE ), |
|
150 | - 'DTT_EVT_start' => array( 'DTT_EVT_start' => FALSE ), |
|
151 | - '_REG_ID' => array( '_REG_ID' => FALSE ), |
|
147 | + '_REG_date' => array('_REG_date' => TRUE), //true means its already sorted |
|
148 | + 'ATT_fname' => array('ATT_fname' => FALSE), |
|
149 | + 'event_name' => array('event_name' => FALSE), |
|
150 | + 'DTT_EVT_start' => array('DTT_EVT_start' => FALSE), |
|
151 | + '_REG_ID' => array('_REG_ID' => FALSE), |
|
152 | 152 | ); |
153 | 153 | |
154 | 154 | $this->_hidden_columns = array(); |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | * @param EE_Registration $item the current item |
163 | 163 | * @return string |
164 | 164 | */ |
165 | - protected function _get_row_class( $item ) { |
|
166 | - $class = parent::_get_row_class( $item ); |
|
165 | + protected function _get_row_class($item) { |
|
166 | + $class = parent::_get_row_class($item); |
|
167 | 167 | //add status class |
168 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
169 | - if ( $this->_has_checkbox_column ) { |
|
168 | + $class .= ' ee-status-strip reg-status-'.$item->status_ID(); |
|
169 | + if ($this->_has_checkbox_column) { |
|
170 | 170 | $class .= ' has-checkbox-column'; |
171 | 171 | } |
172 | 172 | return $class; |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | * @param EE_Registration $registration |
181 | 181 | * @throws \EE_Error |
182 | 182 | */ |
183 | - protected function _set_related_details( EE_Registration $registration ) { |
|
183 | + protected function _set_related_details(EE_Registration $registration) { |
|
184 | 184 | |
185 | - $transaction = $registration->get_first_related( 'Transaction' ); |
|
185 | + $transaction = $registration->get_first_related('Transaction'); |
|
186 | 186 | $status = $transaction instanceof EE_Transaction |
187 | 187 | ? $transaction->status_ID() |
188 | 188 | : EEM_Transaction::failed_status_code; |
@@ -191,8 +191,8 @@ discard block |
||
191 | 191 | 'status' => $status, |
192 | 192 | 'id' => $transaction instanceof EE_Transaction ? $transaction->ID() : 0, |
193 | 193 | 'title_attr' => sprintf( |
194 | - __( 'View Transaction Details (%s)', 'event_espresso' ), |
|
195 | - EEH_Template::pretty_status( $status, false, 'sentence' ) |
|
194 | + __('View Transaction Details (%s)', 'event_espresso'), |
|
195 | + EEH_Template::pretty_status($status, false, 'sentence') |
|
196 | 196 | ) |
197 | 197 | ); |
198 | 198 | |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | 'status' => $status, |
204 | 204 | 'id' => $event instanceof EE_Event ? $event->ID() : 0, |
205 | 205 | 'title_attr' => sprintf( |
206 | - __( 'Edit Event (%s)', 'event_espresso' ), |
|
207 | - EEH_Template::pretty_status( $status, false, 'sentence' ) |
|
206 | + __('Edit Event (%s)', 'event_espresso'), |
|
207 | + EEH_Template::pretty_status($status, false, 'sentence') |
|
208 | 208 | ) |
209 | 209 | ); |
210 | 210 | } |
@@ -221,30 +221,30 @@ discard block |
||
221 | 221 | |
222 | 222 | //todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods. |
223 | 223 | |
224 | - $cur_date = isset( $this->_req_data['month_range'] ) ? $this->_req_data['month_range'] : ''; |
|
225 | - $cur_category = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1; |
|
226 | - $reg_status = isset( $this->_req_data['_reg_status'] ) ? $this->_req_data['_reg_status'] : ''; |
|
224 | + $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : ''; |
|
225 | + $cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1; |
|
226 | + $reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : ''; |
|
227 | 227 | |
228 | - $filters[] = EEH_Form_Fields::generate_registration_months_dropdown( $cur_date, $reg_status, $cur_category ); |
|
229 | - $filters[] = EEH_Form_Fields::generate_event_category_dropdown( $cur_category ); |
|
228 | + $filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category); |
|
229 | + $filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category); |
|
230 | 230 | |
231 | 231 | $status = array(); |
232 | - $status[] = array( 'id' => 0, 'text' => __('Select Status', 'event_espresso') ); |
|
233 | - foreach ( $this->_status as $key => $value ) { |
|
234 | - $status[] = array( 'id' => $key, 'text' => $value ); |
|
232 | + $status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso')); |
|
233 | + foreach ($this->_status as $key => $value) { |
|
234 | + $status[] = array('id' => $key, 'text' => $value); |
|
235 | 235 | } |
236 | - if ( $this->_view !== 'incomplete' ) { |
|
236 | + if ($this->_view !== 'incomplete') { |
|
237 | 237 | $filters[] = EEH_Form_Fields::select_input( |
238 | 238 | '_reg_status', |
239 | 239 | $status, |
240 | - isset( $this->_req_data['_reg_status'] ) |
|
241 | - ? strtoupper( sanitize_key( $this->_req_data['_reg_status'] )) |
|
240 | + isset($this->_req_data['_reg_status']) |
|
241 | + ? strtoupper(sanitize_key($this->_req_data['_reg_status'])) |
|
242 | 242 | : '' |
243 | 243 | ); |
244 | 244 | } |
245 | 245 | |
246 | - if ( isset( $this->_req_data['event_id'] ) ) { |
|
247 | - $filters[] = EEH_Form_Fields::hidden_input( 'event_id', $this->_req_data['event_id'], 'reg_event_id' ); |
|
246 | + if (isset($this->_req_data['event_id'])) { |
|
247 | + $filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id'); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | return $filters; |
@@ -263,9 +263,9 @@ discard block |
||
263 | 263 | $this->_views['all']['count'] = $this->_total_registrations(); |
264 | 264 | $this->_views['month']['count'] = $this->_total_registrations_this_month(); |
265 | 265 | $this->_views['today']['count'] = $this->_total_registrations_today(); |
266 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_trash_registrations' ) ) { |
|
267 | - $this->_views['incomplete']['count'] = $this->_total_registrations( 'incomplete' ); |
|
268 | - $this->_views['trash']['count'] = $this->_total_registrations( 'trash' ); |
|
266 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_trash_registrations')) { |
|
267 | + $this->_views['incomplete']['count'] = $this->_total_registrations('incomplete'); |
|
268 | + $this->_views['trash']['count'] = $this->_total_registrations('trash'); |
|
269 | 269 | } |
270 | 270 | } |
271 | 271 | |
@@ -279,23 +279,23 @@ discard block |
||
279 | 279 | * @return int |
280 | 280 | * @throws \EE_Error |
281 | 281 | */ |
282 | - protected function _total_registrations( $view = '' ){ |
|
282 | + protected function _total_registrations($view = '') { |
|
283 | 283 | $_where = array(); |
284 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
285 | - if( $EVT_ID ) { |
|
284 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
285 | + if ($EVT_ID) { |
|
286 | 286 | $_where['EVT_ID'] = $EVT_ID; |
287 | 287 | } |
288 | - switch ( $view ) { |
|
288 | + switch ($view) { |
|
289 | 289 | case 'trash' : |
290 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
290 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
291 | 291 | break; |
292 | 292 | case 'incomplete' : |
293 | 293 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
294 | 294 | break; |
295 | 295 | default : |
296 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
296 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
297 | 297 | } |
298 | - return EEM_Registration::instance()->count( array( $_where )); |
|
298 | + return EEM_Registration::instance()->count(array($_where)); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | |
@@ -307,32 +307,32 @@ discard block |
||
307 | 307 | * @return int |
308 | 308 | * @throws \EE_Error |
309 | 309 | */ |
310 | - protected function _total_registrations_this_month(){ |
|
311 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
312 | - $_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array(); |
|
310 | + protected function _total_registrations_this_month() { |
|
311 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
312 | + $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
313 | 313 | $this_year_r = date('Y', current_time('timestamp')); |
314 | 314 | $time_start = ' 00:00:00'; |
315 | 315 | $time_end = ' 23:59:59'; |
316 | 316 | $this_month_r = date('m', current_time('timestamp')); |
317 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
317 | + $days_this_month = date('t', current_time('timestamp')); |
|
318 | 318 | //setup date query. |
319 | 319 | $beginning_string = EEM_Registration::instance()->convert_datetime_for_query( |
320 | 320 | 'REG_date', |
321 | - $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, |
|
321 | + $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, |
|
322 | 322 | 'Y-m-d H:i:s' |
323 | 323 | ); |
324 | 324 | $end_string = EEM_Registration::instance()->convert_datetime_for_query( |
325 | 325 | 'REG_date', |
326 | - $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, |
|
326 | + $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, |
|
327 | 327 | 'Y-m-d H:i:s' |
328 | 328 | ); |
329 | - $_where['REG_date']= array('BETWEEN', |
|
329 | + $_where['REG_date'] = array('BETWEEN', |
|
330 | 330 | array( |
331 | 331 | $beginning_string, |
332 | 332 | $end_string |
333 | 333 | )); |
334 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
335 | - return EEM_Registration::instance()->count(array( $_where ) ); |
|
334 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
335 | + return EEM_Registration::instance()->count(array($_where)); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | |
@@ -344,20 +344,20 @@ discard block |
||
344 | 344 | * @return int |
345 | 345 | * @throws \EE_Error |
346 | 346 | */ |
347 | - protected function _total_registrations_today(){ |
|
347 | + protected function _total_registrations_today() { |
|
348 | 348 | |
349 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
350 | - $_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array(); |
|
349 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
350 | + $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
351 | 351 | $current_date = date('Y-m-d', current_time('timestamp')); |
352 | 352 | $time_start = ' 00:00:00'; |
353 | 353 | $time_end = ' 23:59:59'; |
354 | - $_where['REG_date']= array('BETWEEN', |
|
354 | + $_where['REG_date'] = array('BETWEEN', |
|
355 | 355 | array( |
356 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_start, 'Y-m-d H:i:s' ), |
|
357 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_end, 'Y-m-d H:i:s' ) |
|
356 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_start, 'Y-m-d H:i:s'), |
|
357 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_end, 'Y-m-d H:i:s') |
|
358 | 358 | )); |
359 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
360 | - return EEM_Registration::instance()->count(array( $_where ) ); |
|
359 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
360 | + return EEM_Registration::instance()->count(array($_where)); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | |
@@ -370,12 +370,12 @@ discard block |
||
370 | 370 | * @return string |
371 | 371 | * @throws \EE_Error |
372 | 372 | */ |
373 | - public function column_cb($item){ |
|
373 | + public function column_cb($item) { |
|
374 | 374 | /** checkbox/lock **/ |
375 | - $transaction = $item->get_first_related( 'Transaction' ); |
|
376 | - $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0; |
|
375 | + $transaction = $item->get_first_related('Transaction'); |
|
376 | + $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related('Payment') : 0; |
|
377 | 377 | return $payment_count > 0 |
378 | - ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) |
|
378 | + ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID()) |
|
379 | 379 | . '<span class="ee-lock-icon"></span>' |
380 | 380 | : sprintf( |
381 | 381 | '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', |
@@ -393,14 +393,14 @@ discard block |
||
393 | 393 | * @return string |
394 | 394 | * @throws \EE_Error |
395 | 395 | */ |
396 | - public function column__REG_ID(EE_Registration $item){ |
|
396 | + public function column__REG_ID(EE_Registration $item) { |
|
397 | 397 | $attendee = $item->attendee(); |
398 | 398 | $content = $item->ID(); |
399 | 399 | $content .= '<div class="show-on-mobile-view-only">'; |
400 | 400 | $content .= '<br>'; |
401 | 401 | $content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
402 | - $content .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
403 | - $content .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
402 | + $content .= ' '.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
403 | + $content .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
404 | 404 | $content .= '</div>'; |
405 | 405 | return $content; |
406 | 406 | } |
@@ -415,12 +415,12 @@ discard block |
||
415 | 415 | * @return string |
416 | 416 | * @throws \EE_Error |
417 | 417 | */ |
418 | - public function column__REG_date(EE_Registration $item){ |
|
418 | + public function column__REG_date(EE_Registration $item) { |
|
419 | 419 | $this->_set_related_details($item); |
420 | 420 | //Build row actions |
421 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
|
422 | - $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' ); |
|
423 | - $view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>'; |
|
421 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id']), TXN_ADMIN_URL); |
|
422 | + $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-'.$this->_transaction_details['status'].'" href="'.$view_lnk_url.'" title="'.esc_attr($this->_transaction_details['title_attr']).'">'.$item->get_i18n_datetime('REG_date').'</a>' : $item->get_i18n_datetime('REG_date'); |
|
423 | + $view_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence').'</span>'; |
|
424 | 424 | return $view_link; |
425 | 425 | } |
426 | 426 | |
@@ -434,18 +434,18 @@ discard block |
||
434 | 434 | * @return string |
435 | 435 | * @throws \EE_Error |
436 | 436 | */ |
437 | - public function column_event_name(EE_Registration $item){ |
|
438 | - $this->_set_related_details( $item ); |
|
437 | + public function column_event_name(EE_Registration $item) { |
|
438 | + $this->_set_related_details($item); |
|
439 | 439 | // page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62 |
440 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$item->event_ID() ), EVENTS_ADMIN_URL ); |
|
440 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$item->event_ID()), EVENTS_ADMIN_URL); |
|
441 | 441 | $event_name = $item->event_name(); |
442 | 442 | $event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso'); |
443 | - $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID() ) ? '<a class="ee-status-color-' . $this->_event_details['status'] . '" href="' . $edit_event_url . '" title="' . esc_attr( $this->_event_details['title_attr'] ) .'">' . wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ) ; |
|
443 | + $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID()) ? '<a class="ee-status-color-'.$this->_event_details['status'].'" href="'.$edit_event_url.'" title="'.esc_attr($this->_event_details['title_attr']).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...'); |
|
444 | 444 | |
445 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'event_id'=>$item->event_ID() ), REG_ADMIN_URL ); |
|
446 | - $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Filter this list to only show registrations for %s', 'event_espresso' ), $event_name ) .'">' . __( 'View Registrations', 'event_espresso' ) . '</a>'; |
|
445 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id'=>$item->event_ID()), REG_ADMIN_URL); |
|
446 | + $actions['event_filter'] = '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), $event_name).'">'.__('View Registrations', 'event_espresso').'</a>'; |
|
447 | 447 | |
448 | - return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions) ); |
|
448 | + return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions)); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | |
@@ -458,18 +458,18 @@ discard block |
||
458 | 458 | * @return string |
459 | 459 | * @throws \EE_Error |
460 | 460 | */ |
461 | - public function column_DTT_EVT_start(EE_Registration $item){ |
|
461 | + public function column_DTT_EVT_start(EE_Registration $item) { |
|
462 | 462 | $datetime_strings = array(); |
463 | - $ticket = $item->ticket( TRUE ); |
|
464 | - if ( $ticket instanceof EE_Ticket ) { |
|
463 | + $ticket = $item->ticket(TRUE); |
|
464 | + if ($ticket instanceof EE_Ticket) { |
|
465 | 465 | $remove_defaults = array('default_where_conditions' => 'none'); |
466 | 466 | $datetimes = $ticket->datetimes($remove_defaults); |
467 | - foreach($datetimes as $datetime){ |
|
468 | - $datetime_strings[] = $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
467 | + foreach ($datetimes as $datetime) { |
|
468 | + $datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
469 | 469 | } |
470 | - return implode("<br />",$datetime_strings); |
|
470 | + return implode("<br />", $datetime_strings); |
|
471 | 471 | } else { |
472 | - return __( 'There is no ticket on this registration', 'event_espresso' ); |
|
472 | + return __('There is no ticket on this registration', 'event_espresso'); |
|
473 | 473 | } |
474 | 474 | } |
475 | 475 | |
@@ -483,45 +483,45 @@ discard block |
||
483 | 483 | * @return string |
484 | 484 | * @throws \EE_Error |
485 | 485 | */ |
486 | - public function column_ATT_fname(EE_Registration $item){ |
|
486 | + public function column_ATT_fname(EE_Registration $item) { |
|
487 | 487 | $attendee = $item->attendee(); |
488 | 488 | |
489 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
489 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
490 | 490 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
491 | - $link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee_name . '</a>' : $attendee_name; |
|
491 | + $link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee_name.'</a>' : $attendee_name; |
|
492 | 492 | $link .= $item->count() === 1 ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : ''; |
493 | 493 | |
494 | 494 | $t = $item->get_first_related('Transaction'); |
495 | 495 | $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; |
496 | 496 | |
497 | 497 | //append group count to name |
498 | - $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
498 | + $link .= ' '.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
499 | 499 | |
500 | 500 | //append reg_code |
501 | - $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
501 | + $link .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
502 | 502 | |
503 | 503 | //reg status text for accessibility |
504 | - $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
504 | + $link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>'; |
|
505 | 505 | |
506 | 506 | //trash/restore/delete actions |
507 | 507 | $actions = array(); |
508 | - if ( $this->_view !== 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID() ) ) { |
|
509 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
510 | - $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Trash Registration', 'event_espresso' ) . '">' . __( 'Trash', 'event_espresso' ) . '</a>'; |
|
511 | - } elseif ( $this->_view === 'trash' ) { |
|
508 | + if ($this->_view !== 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID())) { |
|
509 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
510 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Trash Registration', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>'; |
|
511 | + } elseif ($this->_view === 'trash') { |
|
512 | 512 | // restore registration link |
513 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID() ) ) { |
|
514 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
515 | - $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Registration', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>'; |
|
513 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID())) { |
|
514 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
515 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Registration', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>'; |
|
516 | 516 | } |
517 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID() ) ) { |
|
518 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
517 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID())) { |
|
518 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
519 | 519 | |
520 | - $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Registration Permanently', 'event_espresso' ). '">' . __( 'Delete', 'event_espresso' ) . '</a>'; |
|
520 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Registration Permanently', 'event_espresso').'">'.__('Delete', 'event_espresso').'</a>'; |
|
521 | 521 | } |
522 | 522 | } |
523 | 523 | |
524 | - return sprintf('%1$s %2$s', $link, $this->row_actions($actions) ); |
|
524 | + return sprintf('%1$s %2$s', $link, $this->row_actions($actions)); |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | * @return string |
535 | 535 | * @throws \EE_Error |
536 | 536 | */ |
537 | - public function column_ATT_email( EE_Registration $item ) { |
|
537 | + public function column_ATT_email(EE_Registration $item) { |
|
538 | 538 | $attendee = $item->get_first_related('Attendee'); |
539 | 539 | return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso') : $attendee->email(); |
540 | 540 | } |
@@ -548,8 +548,8 @@ discard block |
||
548 | 548 | * @param \EE_Registration $item |
549 | 549 | * @return string |
550 | 550 | */ |
551 | - public function column__REG_count(EE_Registration $item){ |
|
552 | - return sprintf(__( '%1$s / %2$s', 'event_espresso' ), $item->count(), $item->group_size()); |
|
551 | + public function column__REG_count(EE_Registration $item) { |
|
552 | + return sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size()); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | |
@@ -561,16 +561,16 @@ discard block |
||
561 | 561 | * @param \EE_Registration $item |
562 | 562 | * @return string |
563 | 563 | */ |
564 | - public function column_PRC_amount(EE_Registration $item){ |
|
564 | + public function column_PRC_amount(EE_Registration $item) { |
|
565 | 565 | $ticket = $item->ticket(); |
566 | 566 | |
567 | - $content = isset( $_GET['event_id'] ) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">' . $ticket->name() . '</span><br />' : ''; |
|
567 | + $content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">'.$ticket->name().'</span><br />' : ''; |
|
568 | 568 | |
569 | - if ( $item->final_price() > 0 ) { |
|
570 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
569 | + if ($item->final_price() > 0) { |
|
570 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>'; |
|
571 | 571 | } else { |
572 | 572 | // free event |
573 | - $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' . __( 'free', 'event_espresso' ) . '</span>'; |
|
573 | + $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'.__('free', 'event_espresso').'</span>'; |
|
574 | 574 | } |
575 | 575 | |
576 | 576 | return $content; |
@@ -586,11 +586,11 @@ discard block |
||
586 | 586 | * @param \EE_Registration $item |
587 | 587 | * @return string |
588 | 588 | */ |
589 | - public function column__REG_final_price(EE_Registration $item){ |
|
589 | + public function column__REG_final_price(EE_Registration $item) { |
|
590 | 590 | $ticket = $item->ticket(); |
591 | - $content = isset( $_GET['event_id'] ) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">' . $ticket->name() . '</span><br />'; |
|
591 | + $content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">'.$ticket->name().'</span><br />'; |
|
592 | 592 | |
593 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
593 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>'; |
|
594 | 594 | return $content; |
595 | 595 | |
596 | 596 | } |
@@ -604,13 +604,13 @@ discard block |
||
604 | 604 | * @param \EE_Registration $item |
605 | 605 | * @return string |
606 | 606 | */ |
607 | - public function column__REG_paid(EE_Registration $item){ |
|
607 | + public function column__REG_paid(EE_Registration $item) { |
|
608 | 608 | $payment_method = $item->payment_method(); |
609 | - $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' ); |
|
609 | + $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso'); |
|
610 | 610 | |
611 | - $content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>'; |
|
612 | - if ( $item->paid() > 0 ) { |
|
613 | - $content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>'; |
|
611 | + $content = '<span class="reg-pad-rght">'.$item->pretty_paid().'</span>'; |
|
612 | + if ($item->paid() > 0) { |
|
613 | + $content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>'; |
|
614 | 614 | } |
615 | 615 | return $content; |
616 | 616 | } |
@@ -625,11 +625,11 @@ discard block |
||
625 | 625 | * @return string |
626 | 626 | * @throws \EE_Error |
627 | 627 | */ |
628 | - public function column_TXN_total(EE_Registration $item){ |
|
629 | - if($item->transaction()){ |
|
630 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
|
631 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_total() . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>'; |
|
632 | - }else{ |
|
628 | + public function column_TXN_total(EE_Registration $item) { |
|
629 | + if ($item->transaction()) { |
|
630 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); |
|
631 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_total().'</a></span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_total().'</span>'; |
|
632 | + } else { |
|
633 | 633 | return __("None", "event_espresso"); |
634 | 634 | } |
635 | 635 | } |
@@ -644,15 +644,15 @@ discard block |
||
644 | 644 | * @return string |
645 | 645 | * @throws \EE_Error |
646 | 646 | */ |
647 | - public function column_TXN_paid(EE_Registration $item){ |
|
647 | + public function column_TXN_paid(EE_Registration $item) { |
|
648 | 648 | |
649 | - if ( $item->count() === 1 ) { |
|
649 | + if ($item->count() === 1) { |
|
650 | 650 | $transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance(); |
651 | - if ( $transaction->paid() >= $transaction->total() ) { |
|
651 | + if ($transaction->paid() >= $transaction->total()) { |
|
652 | 652 | return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
653 | 653 | } else { |
654 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
|
655 | - return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $transaction->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_paid() . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
654 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); |
|
655 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$transaction->status_ID().'" href="'.$view_txn_lnk_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_paid().'</a><span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>'; |
|
656 | 656 | } |
657 | 657 | } |
658 | 658 | |
@@ -673,42 +673,42 @@ discard block |
||
673 | 673 | public function column_actions(EE_Registration $item) { |
674 | 674 | $actions = array(); |
675 | 675 | $attendee = $item->attendee(); |
676 | - $this->_set_related_details( $item ); |
|
676 | + $this->_set_related_details($item); |
|
677 | 677 | |
678 | 678 | //Build row actions |
679 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
680 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$item->attendee_ID() ), REG_ADMIN_URL ); |
|
679 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
680 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$item->attendee_ID()), REG_ADMIN_URL); |
|
681 | 681 | |
682 | 682 | // page=attendees&event_admin_reports=resend_email®istration_id=43653465634&event_id=2&form_action=resend_email |
683 | 683 | //$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID ); |
684 | - $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL, true ); |
|
684 | + $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL, true); |
|
685 | 685 | |
686 | 686 | |
687 | 687 | //Build row actions |
688 | - $actions['view_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? ' |
|
688 | + $actions['view_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? ' |
|
689 | 689 | <li> |
690 | - <a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
690 | + <a href="'.$view_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text"> |
|
691 | 691 | <div class="dashicons dashicons-clipboard"></div> |
692 | 692 | </a> |
693 | 693 | </li>' : ''; |
694 | - $actions['edit_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee' ) && $attendee instanceof EE_Attendee ?' |
|
694 | + $actions['edit_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') && $attendee instanceof EE_Attendee ? ' |
|
695 | 695 | <li> |
696 | - <a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact Details', 'event_espresso' ) . '" class="tiny-text"> |
|
696 | + <a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact Details', 'event_espresso').'" class="tiny-text"> |
|
697 | 697 | <div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div> |
698 | 698 | </a> |
699 | 699 | </li>' : ''; |
700 | - $actions['resend_reg_lnk'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration', $item->ID() ) ? ' |
|
700 | + $actions['resend_reg_lnk'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration', $item->ID()) ? ' |
|
701 | 701 | <li> |
702 | - <a href="'.$resend_reg_lnk_url.'" title="' . esc_attr__( 'Resend Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
702 | + <a href="'.$resend_reg_lnk_url.'" title="'.esc_attr__('Resend Registration Details', 'event_espresso').'" class="tiny-text"> |
|
703 | 703 | <div class="dashicons dashicons-email-alt"></div> |
704 | 704 | </a> |
705 | 705 | </li>' : ''; |
706 | 706 | |
707 | 707 | // page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb |
708 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
|
709 | - $actions['view_txn_lnk'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id'] ) ? ' |
|
708 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id']), TXN_ADMIN_URL); |
|
709 | + $actions['view_txn_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id']) ? ' |
|
710 | 710 | <li> |
711 | - <a class="ee-status-color-' . $this->_transaction_details['status'] . ' tiny-text" href="'.$view_txn_lnk_url.'" title="' . $this->_transaction_details['title_attr'] . '"> |
|
711 | + <a class="ee-status-color-' . $this->_transaction_details['status'].' tiny-text" href="'.$view_txn_lnk_url.'" title="'.$this->_transaction_details['title_attr'].'"> |
|
712 | 712 | <div class="dashicons dashicons-cart"></div> |
713 | 713 | </a> |
714 | 714 | </li>' : ''; |
@@ -717,17 +717,17 @@ discard block |
||
717 | 717 | $actions['dl_invoice_lnk'] = ''; |
718 | 718 | $dl_invoice_lnk_url = $item->invoice_url(); |
719 | 719 | //only show invoice link if message type is active. |
720 | - if ( $attendee instanceof EE_Attendee && $item->is_primary_registrant() && EEH_MSG_Template::is_mt_active( 'invoice' ) ) { |
|
720 | + if ($attendee instanceof EE_Attendee && $item->is_primary_registrant() && EEH_MSG_Template::is_mt_active('invoice')) { |
|
721 | 721 | $actions['dl_invoice_lnk'] = ' |
722 | 722 | <li> |
723 | - <a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
723 | + <a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
724 | 724 | <span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span> |
725 | 725 | </a> |
726 | 726 | </li>'; |
727 | 727 | } |
728 | 728 | $actions['filtered_messages_link'] = ''; |
729 | 729 | //message list table link (filtered by REG_ID |
730 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
730 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
731 | 731 | $actions['filtered_messages_link'] = '<li>' |
732 | 732 | . EEH_MSG_Template::get_message_action_link( |
733 | 733 | 'see_notifications_for', |
@@ -738,9 +738,9 @@ discard block |
||
738 | 738 | ) |
739 | 739 | . '</li>'; |
740 | 740 | } |
741 | - $actions = apply_filters( 'FHEE__EE_Registrations_List_Table__column_actions__actions', $actions, $item, $this ); |
|
741 | + $actions = apply_filters('FHEE__EE_Registrations_List_Table__column_actions__actions', $actions, $item, $this); |
|
742 | 742 | return $this->_action_string( |
743 | - implode( '', $actions ), |
|
743 | + implode('', $actions), |
|
744 | 744 | $item, |
745 | 745 | 'ul', |
746 | 746 | 'reg-overview-actions-ul' |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION')){ |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | 3 | exit('No direct script access allowed'); |
4 | 4 | } |
5 | 5 | /** |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * |
35 | 35 | * ------------------------------------------------------------------------ |
36 | 36 | */ |
37 | -abstract class EE_Form_Section_Validatable extends EE_Form_Section_Base{ |
|
37 | +abstract class EE_Form_Section_Validatable extends EE_Form_Section_Base { |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Array of validation errors in this section. Does not contain validation errors in subsections, however. |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * called get_validation_errors_accumulated |
50 | 50 | * @return EE_Validation_Error[] |
51 | 51 | */ |
52 | - public function get_validation_errors(){ |
|
52 | + public function get_validation_errors() { |
|
53 | 53 | return $this->_validation_errors; |
54 | 54 | } |
55 | 55 | /** |
@@ -57,16 +57,16 @@ discard block |
||
57 | 57 | * If we want this to be customizable, we may decide to create a strategy for displaying it. |
58 | 58 | * @return string |
59 | 59 | */ |
60 | - public function get_validation_error_string(){ |
|
60 | + public function get_validation_error_string() { |
|
61 | 61 | $validation_error_messages = array(); |
62 | - if($this->get_validation_errors()){ |
|
63 | - foreach($this->get_validation_errors() as $validation_error){ |
|
64 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
65 | - $validation_error_messages[] =$validation_error->getMessage(); |
|
62 | + if ($this->get_validation_errors()) { |
|
63 | + foreach ($this->get_validation_errors() as $validation_error) { |
|
64 | + if ($validation_error instanceof EE_Validation_Error) { |
|
65 | + $validation_error_messages[] = $validation_error->getMessage(); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | } |
69 | - return implode(", ",$validation_error_messages); |
|
69 | + return implode(", ", $validation_error_messages); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | * @return boolean |
83 | 83 | */ |
84 | 84 | public function is_valid() { |
85 | - if(count($this->_validation_errors)){ |
|
85 | + if (count($this->_validation_errors)) { |
|
86 | 86 | return false; |
87 | - }else{ |
|
87 | + } else { |
|
88 | 88 | return true; |
89 | 89 | } |
90 | 90 | } |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | * @param Exception $previous_exception if there was an exception that caused the error, that exception |
110 | 110 | * @return void |
111 | 111 | */ |
112 | - public function add_validation_error( $message_or_object, $error_code = NULL, $previous_exception = NULL ){ |
|
113 | - if($message_or_object instanceof EE_Validation_Error){ |
|
114 | - $validation_error= $message_or_object; |
|
112 | + public function add_validation_error($message_or_object, $error_code = NULL, $previous_exception = NULL) { |
|
113 | + if ($message_or_object instanceof EE_Validation_Error) { |
|
114 | + $validation_error = $message_or_object; |
|
115 | 115 | $validation_error->set_form_section($this); |
116 | - }else{ |
|
116 | + } else { |
|
117 | 117 | $validation_error = new EE_Validation_Error($message_or_object, $error_code, $this, $previous_exception); |
118 | 118 | } |
119 | 119 | $this->_validation_errors[] = $validation_error; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $validation_error_message = $default_validation_strategy->get_validation_error_message(); |
43 | 43 | } |
44 | 44 | throw new EE_Validation_Error( $validation_error_message, 'float_only' ); |
45 | - }else{ |
|
45 | + } else{ |
|
46 | 46 | return floatval($normalized_value); |
47 | 47 | } |
48 | 48 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | public function unnormalize($normalized_value) { |
56 | 56 | if( empty( $normalized_value ) ){ |
57 | 57 | return '0.00'; |
58 | - }else{ |
|
58 | + } else{ |
|
59 | 59 | return "$normalized_value"; |
60 | 60 | } |
61 | 61 | } |
@@ -6,20 +6,20 @@ |
||
6 | 6 | * @subpackage |
7 | 7 | * @author Mike Nelson |
8 | 8 | */ |
9 | -class EE_Hidden_Input extends EE_Form_Input_Base{ |
|
9 | +class EE_Hidden_Input extends EE_Form_Input_Base { |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * @param array $input_settings |
13 | 13 | */ |
14 | - public function __construct($input_settings = array()){ |
|
14 | + public function __construct($input_settings = array()) { |
|
15 | 15 | //require_once('strategies/display_strategies/EE_Text_Input_Display_Strategy.strategy.php'); |
16 | 16 | $this->_set_display_strategy(new EE_Hidden_Display_Strategy()); |
17 | - if ( isset( $input_settings['normalization_strategy'] ) && $input_settings['normalization_strategy'] instanceof EE_Normalization_Strategy_Base ) { |
|
18 | - $this->_set_normalization_strategy( $input_settings['normalization_strategy'] ); |
|
17 | + if (isset($input_settings['normalization_strategy']) && $input_settings['normalization_strategy'] instanceof EE_Normalization_Strategy_Base) { |
|
18 | + $this->_set_normalization_strategy($input_settings['normalization_strategy']); |
|
19 | 19 | } else { |
20 | - $this->_set_normalization_strategy( new EE_Text_Normalization() ); |
|
20 | + $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
21 | 21 | } |
22 | - parent::__construct( $input_settings ); |
|
22 | + parent::__construct($input_settings); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 |
@@ -8,15 +8,15 @@ |
||
8 | 8 | * |
9 | 9 | * This input has a default validation strategy of plaintext (which can be removed after construction) |
10 | 10 | */ |
11 | -class EE_Submit_Input extends EE_Form_Input_Base{ |
|
11 | +class EE_Submit_Input extends EE_Form_Input_Base { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @param array $options |
15 | 15 | */ |
16 | - public function __construct($options = array()){ |
|
16 | + public function __construct($options = array()) { |
|
17 | 17 | $this->_set_display_strategy(new EE_Submit_Input_Display_Strategy()); |
18 | 18 | $this->_set_normalization_strategy(new EE_Text_Normalization()); |
19 | - $this->_add_validation_strategy( new EE_Plaintext_Validation_Strategy() ); |
|
19 | + $this->_add_validation_strategy(new EE_Plaintext_Validation_Strategy()); |
|
20 | 20 | parent::__construct($options); |
21 | 21 | } |
22 | 22 | } |
23 | 23 | \ No newline at end of file |
@@ -9,18 +9,18 @@ |
||
9 | 9 | * @package Event Espresso |
10 | 10 | * @author Mike Nelson |
11 | 11 | */ |
12 | -class EE_Submit_Input_Display_Strategy extends EE_Display_Strategy_Base{ |
|
12 | +class EE_Submit_Input_Display_Strategy extends EE_Display_Strategy_Base { |
|
13 | 13 | /** |
14 | 14 | * |
15 | 15 | * @return string of html to display the input |
16 | 16 | */ |
17 | - public function display(){ |
|
17 | + public function display() { |
|
18 | 18 | $html = '<input type="submit" '; |
19 | - $html .= 'name="' . $this->_input->html_name() . '" '; |
|
20 | - $html .= 'value="' . $this->_input->raw_value_in_form() . '" '; |
|
21 | - $html .= 'id="' . $this->_input->html_id() . '-submit" '; |
|
22 | - $html .= 'class="' . $this->_input->html_class() . ' ' . $this->_input->button_css_attributes() . '" '; |
|
23 | - $html .= 'style="' . $this->_input->html_style() . '" '; |
|
19 | + $html .= 'name="'.$this->_input->html_name().'" '; |
|
20 | + $html .= 'value="'.$this->_input->raw_value_in_form().'" '; |
|
21 | + $html .= 'id="'.$this->_input->html_id().'-submit" '; |
|
22 | + $html .= 'class="'.$this->_input->html_class().' '.$this->_input->button_css_attributes().'" '; |
|
23 | + $html .= 'style="'.$this->_input->html_style().'" '; |
|
24 | 24 | $html .= $this->_input->other_html_attributes(); |
25 | 25 | $html .= '/>'; |
26 | 26 | return $html; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | -require_once( EE_MODELS . 'EEM_CPT_Base.model.php'); |
|
2 | +require_once(EE_MODELS.'EEM_CPT_Base.model.php'); |
|
3 | 3 | /** |
4 | 4 | * |
5 | 5 | * EEM_Event Model |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @author Michael Nelson, Brent Christensen |
12 | 12 | * |
13 | 13 | */ |
14 | -class EEM_Event extends EEM_CPT_Base{ |
|
14 | +class EEM_Event extends EEM_CPT_Base { |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * constant used by status(), indicating that no more tickets can be purchased for any of the datetimes for the event |
@@ -51,15 +51,15 @@ discard block |
||
51 | 51 | * @param string $timezone |
52 | 52 | * @return EEM_Event |
53 | 53 | */ |
54 | - public static function instance( $timezone = NULL ){ |
|
54 | + public static function instance($timezone = NULL) { |
|
55 | 55 | |
56 | 56 | // check if instance of EEM_Event already exists |
57 | - if ( ! self::$_instance instanceof EEM_Event ) { |
|
57 | + if ( ! self::$_instance instanceof EEM_Event) { |
|
58 | 58 | // instantiate Espresso_model |
59 | - self::$_instance = new self( $timezone ); |
|
59 | + self::$_instance = new self($timezone); |
|
60 | 60 | } |
61 | 61 | //we might have a timezone set, let set_timezone decide what to do with it |
62 | - self::$_instance->set_timezone( $timezone ); |
|
62 | + self::$_instance->set_timezone($timezone); |
|
63 | 63 | // EEM_Event object |
64 | 64 | return self::$_instance; |
65 | 65 | } |
@@ -70,12 +70,12 @@ discard block |
||
70 | 70 | * @param string $timezone |
71 | 71 | * @return EEM_Event |
72 | 72 | */ |
73 | - protected function __construct($timezone = null){ |
|
73 | + protected function __construct($timezone = null) { |
|
74 | 74 | |
75 | - EE_Registry::instance()->load_model( 'Registration' ); |
|
75 | + EE_Registry::instance()->load_model('Registration'); |
|
76 | 76 | |
77 | - $this->singular_item = __('Event','event_espresso'); |
|
78 | - $this->plural_item = __('Events','event_espresso'); |
|
77 | + $this->singular_item = __('Event', 'event_espresso'); |
|
78 | + $this->plural_item = __('Events', 'event_espresso'); |
|
79 | 79 | |
80 | 80 | // to remove Cancelled events from the frontend, copy the following filter to your functions.php file |
81 | 81 | // add_filter( 'AFEE__EEM_Event__construct___custom_stati__cancelled__Public', '__return_false' ); |
@@ -89,57 +89,57 @@ discard block |
||
89 | 89 | array( |
90 | 90 | EEM_Event::cancelled => array( |
91 | 91 | 'label' => __('Cancelled', 'event_espresso'), |
92 | - 'public' => apply_filters( 'AFEE__EEM_Event__construct___custom_stati__cancelled__Public', TRUE ) |
|
92 | + 'public' => apply_filters('AFEE__EEM_Event__construct___custom_stati__cancelled__Public', TRUE) |
|
93 | 93 | ), |
94 | 94 | EEM_Event::postponed => array( |
95 | 95 | 'label' => __('Postponed', 'event_espresso'), |
96 | - 'public' => apply_filters( 'AFEE__EEM_Event__construct___custom_stati__postponed__Public', TRUE ) |
|
96 | + 'public' => apply_filters('AFEE__EEM_Event__construct___custom_stati__postponed__Public', TRUE) |
|
97 | 97 | ), |
98 | 98 | EEM_Event::sold_out => array( |
99 | 99 | 'label' => __('Sold Out', 'event_espresso'), |
100 | - 'public' => apply_filters( 'AFEE__EEM_Event__construct___custom_stati__sold_out__Public', TRUE ) |
|
100 | + 'public' => apply_filters('AFEE__EEM_Event__construct___custom_stati__sold_out__Public', TRUE) |
|
101 | 101 | ) |
102 | 102 | ) |
103 | 103 | ); |
104 | 104 | |
105 | - self::$_default_reg_status = empty( self::$_default_reg_status ) ? EEM_Registration::status_id_pending_payment : self::$_default_reg_status; |
|
105 | + self::$_default_reg_status = empty(self::$_default_reg_status) ? EEM_Registration::status_id_pending_payment : self::$_default_reg_status; |
|
106 | 106 | |
107 | 107 | $this->_tables = array( |
108 | - 'Event_CPT'=>new EE_Primary_Table( 'posts','ID' ), |
|
109 | - 'Event_Meta'=> new EE_Secondary_Table( 'esp_event_meta', 'EVTM_ID', 'EVT_ID' ) |
|
108 | + 'Event_CPT'=>new EE_Primary_Table('posts', 'ID'), |
|
109 | + 'Event_Meta'=> new EE_Secondary_Table('esp_event_meta', 'EVTM_ID', 'EVT_ID') |
|
110 | 110 | ); |
111 | 111 | |
112 | 112 | $this->_fields = array( |
113 | 113 | 'Event_CPT'=>array( |
114 | - 'EVT_ID'=>new EE_Primary_Key_Int_Field( 'ID', __( 'Post ID for Event','event_espresso' )), |
|
115 | - 'EVT_name'=>new EE_Plain_Text_Field( 'post_title', __( 'Event Name','event_espresso' ), FALSE, '' ), |
|
116 | - 'EVT_desc'=>new EE_Post_Content_Field( 'post_content', __( 'Event Description', 'event_espresso' ), FALSE, '' ), |
|
117 | - 'EVT_slug'=>new EE_Slug_Field( 'post_name', __( 'Event Slug', 'event_espresso' ), FALSE, '' ), |
|
118 | - 'EVT_created'=>new EE_Datetime_Field( 'post_date', __( 'Date/Time Event Created', 'event_espresso' ), FALSE, time()), |
|
119 | - 'EVT_short_desc'=>new EE_Simple_HTML_Field( 'post_excerpt', __( 'Event Short Description', 'event_espresso' ), FALSE,'' ), |
|
120 | - 'EVT_modified'=>new EE_Datetime_Field( 'post_modified', __( 'Date/Time Event Modified', 'event_espresso' ), FALSE, time()), |
|
121 | - 'EVT_wp_user'=>new EE_WP_User_Field( 'post_author', __( 'Event Creator ID', 'event_espresso'), FALSE), |
|
122 | - 'parent'=>new EE_Integer_Field( 'post_parent', __( 'Event Parent ID', 'event_espresso' ), FALSE, 0 ), |
|
123 | - 'EVT_order'=>new EE_Integer_Field( 'menu_order', __( 'Event Menu Order', 'event_espresso' ), FALSE, 1 ), |
|
124 | - 'post_type'=>new EE_WP_Post_Type_Field('espresso_events'),// EE_Plain_Text_Field( 'post_type', __( 'Event Post Type', 'event_espresso' ), FALSE, 'espresso_events' ), |
|
125 | - 'status' => new EE_WP_Post_Status_Field( 'post_status', __( 'Event Status', 'event_espresso' ), FALSE, 'draft', $this->_custom_stati ) |
|
114 | + 'EVT_ID'=>new EE_Primary_Key_Int_Field('ID', __('Post ID for Event', 'event_espresso')), |
|
115 | + 'EVT_name'=>new EE_Plain_Text_Field('post_title', __('Event Name', 'event_espresso'), FALSE, ''), |
|
116 | + 'EVT_desc'=>new EE_Post_Content_Field('post_content', __('Event Description', 'event_espresso'), FALSE, ''), |
|
117 | + 'EVT_slug'=>new EE_Slug_Field('post_name', __('Event Slug', 'event_espresso'), FALSE, ''), |
|
118 | + 'EVT_created'=>new EE_Datetime_Field('post_date', __('Date/Time Event Created', 'event_espresso'), FALSE, time()), |
|
119 | + 'EVT_short_desc'=>new EE_Simple_HTML_Field('post_excerpt', __('Event Short Description', 'event_espresso'), FALSE, ''), |
|
120 | + 'EVT_modified'=>new EE_Datetime_Field('post_modified', __('Date/Time Event Modified', 'event_espresso'), FALSE, time()), |
|
121 | + 'EVT_wp_user'=>new EE_WP_User_Field('post_author', __('Event Creator ID', 'event_espresso'), FALSE), |
|
122 | + 'parent'=>new EE_Integer_Field('post_parent', __('Event Parent ID', 'event_espresso'), FALSE, 0), |
|
123 | + 'EVT_order'=>new EE_Integer_Field('menu_order', __('Event Menu Order', 'event_espresso'), FALSE, 1), |
|
124 | + 'post_type'=>new EE_WP_Post_Type_Field('espresso_events'), // EE_Plain_Text_Field( 'post_type', __( 'Event Post Type', 'event_espresso' ), FALSE, 'espresso_events' ), |
|
125 | + 'status' => new EE_WP_Post_Status_Field('post_status', __('Event Status', 'event_espresso'), FALSE, 'draft', $this->_custom_stati) |
|
126 | 126 | ), |
127 | 127 | 'Event_Meta'=>array( |
128 | - 'EVTM_ID'=> new EE_DB_Only_Float_Field( 'EVTM_ID', __( 'Event Meta Row ID','event_espresso' ), FALSE ), |
|
129 | - 'EVT_ID_fk'=>new EE_DB_Only_Int_Field( 'EVT_ID', __( 'Foreign key to Event ID from Event Meta table', 'event_espresso' ), FALSE ), |
|
130 | - 'EVT_display_desc'=>new EE_Boolean_Field( 'EVT_display_desc', __( 'Display Description Flag', 'event_espresso' ), FALSE, 1 ), |
|
131 | - 'EVT_display_ticket_selector'=>new EE_Boolean_Field( 'EVT_display_ticket_selector', __( 'Display Ticket Selector Flag', 'event_espresso' ), FALSE, 1 ), |
|
132 | - 'EVT_visible_on'=>new EE_Datetime_Field( 'EVT_visible_on', __( 'Event Visible Date', 'event_espresso' ), TRUE, time()), |
|
133 | - 'EVT_additional_limit'=>new EE_Integer_Field( 'EVT_additional_limit', __( 'Limit of Additional Registrations on Same Transaction', 'event_espresso' ), TRUE, 10 ), |
|
128 | + 'EVTM_ID'=> new EE_DB_Only_Float_Field('EVTM_ID', __('Event Meta Row ID', 'event_espresso'), FALSE), |
|
129 | + 'EVT_ID_fk'=>new EE_DB_Only_Int_Field('EVT_ID', __('Foreign key to Event ID from Event Meta table', 'event_espresso'), FALSE), |
|
130 | + 'EVT_display_desc'=>new EE_Boolean_Field('EVT_display_desc', __('Display Description Flag', 'event_espresso'), FALSE, 1), |
|
131 | + 'EVT_display_ticket_selector'=>new EE_Boolean_Field('EVT_display_ticket_selector', __('Display Ticket Selector Flag', 'event_espresso'), FALSE, 1), |
|
132 | + 'EVT_visible_on'=>new EE_Datetime_Field('EVT_visible_on', __('Event Visible Date', 'event_espresso'), TRUE, time()), |
|
133 | + 'EVT_additional_limit'=>new EE_Integer_Field('EVT_additional_limit', __('Limit of Additional Registrations on Same Transaction', 'event_espresso'), TRUE, 10), |
|
134 | 134 | 'EVT_default_registration_status'=>new EE_Enum_Text_Field( |
135 | - 'EVT_default_registration_status', __( 'Default Registration Status on this Event', 'event_espresso' ), FALSE, EEM_Event::$_default_reg_status, EEM_Registration::reg_status_array() |
|
135 | + 'EVT_default_registration_status', __('Default Registration Status on this Event', 'event_espresso'), FALSE, EEM_Event::$_default_reg_status, EEM_Registration::reg_status_array() |
|
136 | 136 | ), |
137 | - 'EVT_member_only'=>new EE_Boolean_Field( 'EVT_member_only', __( 'Member-Only Event Flag', 'event_espresso' ), FALSE, FALSE ), |
|
138 | - 'EVT_phone'=> new EE_Plain_Text_Field('EVT_phone', __( 'Event Phone Number', 'event_espresso' ), FALSE ), |
|
139 | - 'EVT_allow_overflow'=>new EE_Boolean_Field( 'EVT_allow_overflow', __( 'Allow Overflow on Event', 'event_espresso' ), FALSE, FALSE ), |
|
140 | - 'EVT_timezone_string'=>new EE_Plain_Text_Field( 'EVT_timezone_string', __( 'Timezone (name) for Event times', 'event_espresso' ), FALSE ), |
|
141 | - 'EVT_external_URL'=>new EE_Plain_Text_Field( 'EVT_external_URL', __( 'URL of Event Page if hosted elsewhere', 'event_espresso' ), TRUE ), |
|
142 | - 'EVT_donations'=>new EE_Boolean_Field( 'EVT_donations', __( 'Accept Donations?', 'event_espresso' ), FALSE, FALSE ) |
|
137 | + 'EVT_member_only'=>new EE_Boolean_Field('EVT_member_only', __('Member-Only Event Flag', 'event_espresso'), FALSE, FALSE), |
|
138 | + 'EVT_phone'=> new EE_Plain_Text_Field('EVT_phone', __('Event Phone Number', 'event_espresso'), FALSE), |
|
139 | + 'EVT_allow_overflow'=>new EE_Boolean_Field('EVT_allow_overflow', __('Allow Overflow on Event', 'event_espresso'), FALSE, FALSE), |
|
140 | + 'EVT_timezone_string'=>new EE_Plain_Text_Field('EVT_timezone_string', __('Timezone (name) for Event times', 'event_espresso'), FALSE), |
|
141 | + 'EVT_external_URL'=>new EE_Plain_Text_Field('EVT_external_URL', __('URL of Event Page if hosted elsewhere', 'event_espresso'), TRUE), |
|
142 | + 'EVT_donations'=>new EE_Boolean_Field('EVT_donations', __('Accept Donations?', 'event_espresso'), FALSE, FALSE) |
|
143 | 143 | |
144 | 144 | )); |
145 | 145 | |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | 'WP_User' => new EE_Belongs_To_Relation(), |
155 | 155 | ); |
156 | 156 | //this model is generally available for reading |
157 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
158 | - parent::__construct( $timezone ); |
|
157 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
158 | + parent::__construct($timezone); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | |
@@ -163,14 +163,14 @@ discard block |
||
163 | 163 | /** |
164 | 164 | * @param string $default_reg_status |
165 | 165 | */ |
166 | - public static function set_default_reg_status( $default_reg_status ) { |
|
166 | + public static function set_default_reg_status($default_reg_status) { |
|
167 | 167 | self::$_default_reg_status = $default_reg_status; |
168 | 168 | //if EEM_Event has already been instantiated, then we need to reset the `EVT_default_reg_status` field to use the new default. |
169 | - if ( self::$_instance instanceof EEM_Event ) { |
|
169 | + if (self::$_instance instanceof EEM_Event) { |
|
170 | 170 | self::$_instance->_fields['Event_Meta']['EVT_default_registration_status'] = new EE_Enum_Text_Field( |
171 | - 'EVT_default_registration_status', __( 'Default Registration Status on this Event', 'event_espresso' ), false, $default_reg_status, EEM_Registration::reg_status_array() |
|
171 | + 'EVT_default_registration_status', __('Default Registration Status on this Event', 'event_espresso'), false, $default_reg_status, EEM_Registration::reg_status_array() |
|
172 | 172 | ); |
173 | - self::$_instance->_fields['Event_Meta']['EVT_default_registration_status']->_construct_finalize( 'Event_Meta', 'EVT_default_registration_status', 'EEM_Event' ); |
|
173 | + self::$_instance->_fields['Event_Meta']['EVT_default_registration_status']->_construct_finalize('Event_Meta', 'EVT_default_registration_status', 'EEM_Event'); |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
@@ -183,9 +183,9 @@ discard block |
||
183 | 183 | * @return array |
184 | 184 | */ |
185 | 185 | public function get_all_question_groups() { |
186 | - return EE_Registry::instance()->load_model( 'Question_Group' )->get_all( array( |
|
187 | - array( 'QSG_deleted' => FALSE ), |
|
188 | - 'order_by' => array( 'QSG_order' => 'ASC' ) |
|
186 | + return EE_Registry::instance()->load_model('Question_Group')->get_all(array( |
|
187 | + array('QSG_deleted' => FALSE), |
|
188 | + 'order_by' => array('QSG_order' => 'ASC') |
|
189 | 189 | )); |
190 | 190 | } |
191 | 191 | |
@@ -201,13 +201,13 @@ discard block |
||
201 | 201 | * @param int $EVT_ID |
202 | 202 | * @return array |
203 | 203 | */ |
204 | - public function get_all_event_question_groups( $EVT_ID = 0 ) { |
|
205 | - if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) { |
|
206 | - EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
204 | + public function get_all_event_question_groups($EVT_ID = 0) { |
|
205 | + if ( ! isset($EVT_ID) || ! absint($EVT_ID)) { |
|
206 | + EE_Error::add_error(__('An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
207 | 207 | return FALSE; |
208 | 208 | } |
209 | - return EE_Registry::instance()->load_model( 'Event_Question_Group' )->get_all( array( |
|
210 | - array( 'EVT_ID' => $EVT_ID ) |
|
209 | + return EE_Registry::instance()->load_model('Event_Question_Group')->get_all(array( |
|
210 | + array('EVT_ID' => $EVT_ID) |
|
211 | 211 | )); |
212 | 212 | } |
213 | 213 | |
@@ -223,13 +223,13 @@ discard block |
||
223 | 223 | * @param boolean $for_primary_attendee |
224 | 224 | * @return array |
225 | 225 | */ |
226 | - public function get_event_question_groups( $EVT_ID = 0, $for_primary_attendee = TRUE ) { |
|
227 | - if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) { |
|
228 | - EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
226 | + public function get_event_question_groups($EVT_ID = 0, $for_primary_attendee = TRUE) { |
|
227 | + if ( ! isset($EVT_ID) || ! absint($EVT_ID)) { |
|
228 | + EE_Error::add_error(__('An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
229 | 229 | return FALSE; |
230 | 230 | } |
231 | - return EE_Registry::instance()->load_model( 'Event_Question_Group' )->get_all( array( |
|
232 | - array( 'EVT_ID' => $EVT_ID, 'EQG_primary' => $for_primary_attendee ) |
|
231 | + return EE_Registry::instance()->load_model('Event_Question_Group')->get_all(array( |
|
232 | + array('EVT_ID' => $EVT_ID, 'EQG_primary' => $for_primary_attendee) |
|
233 | 233 | )); |
234 | 234 | } |
235 | 235 | |
@@ -246,10 +246,10 @@ discard block |
||
246 | 246 | * @param EE_Registration $registration |
247 | 247 | * @return array |
248 | 248 | */ |
249 | - public function get_question_groups_for_event( $EVT_ID = 0, EE_Registration $registration ) { |
|
249 | + public function get_question_groups_for_event($EVT_ID = 0, EE_Registration $registration) { |
|
250 | 250 | |
251 | - if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) { |
|
252 | - EE_Error::add_error( __( 'An error occurred. No Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
251 | + if ( ! isset($EVT_ID) || ! absint($EVT_ID)) { |
|
252 | + EE_Error::add_error(__('An error occurred. No Question Groups could be retrieved because an Event ID was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
253 | 253 | return FALSE; |
254 | 254 | } |
255 | 255 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | 'QSG_deleted' => FALSE |
260 | 260 | ); |
261 | 261 | |
262 | - return EE_Registry::instance()->load_model( 'Question_Group' )->get_all( array( |
|
262 | + return EE_Registry::instance()->load_model('Question_Group')->get_all(array( |
|
263 | 263 | $where_params, |
264 | 264 | 'order_by' => array('QSG_order' => 'ASC') |
265 | 265 | )); |
@@ -279,16 +279,16 @@ discard block |
||
279 | 279 | * @param string $QSG_IDs csv list of $QSG IDs |
280 | 280 | * @return array |
281 | 281 | */ |
282 | - public function get_questions_in_groups( $QSG_IDs = '' ) { |
|
282 | + public function get_questions_in_groups($QSG_IDs = '') { |
|
283 | 283 | |
284 | - if ( empty( $QSG_IDs )) { |
|
285 | - EE_Error::add_error( __( 'An error occurred. No Question Group IDs were received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
284 | + if (empty($QSG_IDs)) { |
|
285 | + EE_Error::add_error(__('An error occurred. No Question Group IDs were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
286 | 286 | return FALSE; |
287 | 287 | } |
288 | 288 | |
289 | - return EE_Registry::instance()->load_model( 'Question' )->get_all( array( |
|
289 | + return EE_Registry::instance()->load_model('Question')->get_all(array( |
|
290 | 290 | array( |
291 | - 'Question_Group.QSG_ID' => array( 'IN', $QSG_IDs ), |
|
291 | + 'Question_Group.QSG_ID' => array('IN', $QSG_IDs), |
|
292 | 292 | 'QST_deleted' => FALSE, |
293 | 293 | 'QST_admin_only' => is_admin() |
294 | 294 | ), |
@@ -310,16 +310,16 @@ discard block |
||
310 | 310 | * @param string $QST_IDs csv list of $QST IDs |
311 | 311 | * @return array |
312 | 312 | */ |
313 | - public function get_options_for_question( $QST_IDs ) { |
|
313 | + public function get_options_for_question($QST_IDs) { |
|
314 | 314 | |
315 | - if ( empty( $QST_IDs )) { |
|
316 | - EE_Error::add_error( __( 'An error occurred. No Question IDs were received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
315 | + if (empty($QST_IDs)) { |
|
316 | + EE_Error::add_error(__('An error occurred. No Question IDs were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
317 | 317 | return FALSE; |
318 | 318 | } |
319 | 319 | |
320 | - return EE_Registry::instance()->load_model( 'Question_Option' )->get_all( array( |
|
320 | + return EE_Registry::instance()->load_model('Question_Option')->get_all(array( |
|
321 | 321 | array( |
322 | - 'Question.QST_ID' => array( 'IN', $QST_IDs ), |
|
322 | + 'Question.QST_ID' => array('IN', $QST_IDs), |
|
323 | 323 | 'QSO_deleted' => FALSE |
324 | 324 | ), |
325 | 325 | 'order_by' => 'QSO_ID' |
@@ -339,46 +339,46 @@ discard block |
||
339 | 339 | * @throws EE_Error |
340 | 340 | * @return array |
341 | 341 | */ |
342 | - public function assemble_array_of_groups_questions_and_options( EE_Registration $registration, $EVT_ID = 0 ) { |
|
342 | + public function assemble_array_of_groups_questions_and_options(EE_Registration $registration, $EVT_ID = 0) { |
|
343 | 343 | |
344 | - if ( empty( $EVT_ID ) ) { |
|
345 | - throw new EE_Error( __( 'An error occurred. No EVT_ID is included. Needed to know which question groups to retrieve.', 'event_espresso' ) ); |
|
344 | + if (empty($EVT_ID)) { |
|
345 | + throw new EE_Error(__('An error occurred. No EVT_ID is included. Needed to know which question groups to retrieve.', 'event_espresso')); |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | $questions = array(); |
349 | 349 | |
350 | 350 | // get all question groups for event |
351 | - $qgs = $this->get_question_groups_for_event( $EVT_ID, $registration ); |
|
352 | - if ( !empty( $qgs ) ) { |
|
353 | - foreach ( $qgs as $qg ) { |
|
351 | + $qgs = $this->get_question_groups_for_event($EVT_ID, $registration); |
|
352 | + if ( ! empty($qgs)) { |
|
353 | + foreach ($qgs as $qg) { |
|
354 | 354 | $qsts = $qg->questions(); |
355 | - $questions[ $qg->ID() ] = $qg->model_field_array(); |
|
356 | - $questions[ $qg->ID() ]['QSG_questions'] = array(); |
|
357 | - foreach ( $qsts as $qst ) { |
|
358 | - if ( $qst->is_system_question() ) |
|
355 | + $questions[$qg->ID()] = $qg->model_field_array(); |
|
356 | + $questions[$qg->ID()]['QSG_questions'] = array(); |
|
357 | + foreach ($qsts as $qst) { |
|
358 | + if ($qst->is_system_question()) |
|
359 | 359 | continue; |
360 | - $answer = EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $qst->ID(), 'REG_ID' => $registration->ID() ) ) ); |
|
360 | + $answer = EEM_Answer::instance()->get_one(array(array('QST_ID' => $qst->ID(), 'REG_ID' => $registration->ID()))); |
|
361 | 361 | $answer = $answer instanceof EE_Answer ? $answer : EEM_Answer::instance()->create_default_object(); |
362 | 362 | $qst_name = $qstn_id = $qst->ID(); |
363 | 363 | $ans_id = $answer->ID(); |
364 | - $qst_name = !empty( $ans_id ) ? '[' . $qst_name . '][' . $ans_id . ']' : '[' . $qst_name . ']'; |
|
364 | + $qst_name = ! empty($ans_id) ? '['.$qst_name.']['.$ans_id.']' : '['.$qst_name.']'; |
|
365 | 365 | $input_name = ''; |
366 | - $input_id = sanitize_key( $qst->display_text() ); |
|
366 | + $input_id = sanitize_key($qst->display_text()); |
|
367 | 367 | $input_class = ''; |
368 | 368 | $questions[$qg->ID()]['QSG_questions'][$qst->ID()] = $qst->model_field_array(); |
369 | - $questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_input_name'] = 'qstn' . $input_name . $qst_name; |
|
370 | - $questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_input_id'] = $input_id . '-' . $qstn_id; |
|
371 | - $questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_input_class'] = $input_class; |
|
372 | - $questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_options'] = array(); |
|
373 | - $questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['qst_obj'] = $qst; |
|
374 | - $questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['ans_obj'] = $answer; |
|
369 | + $questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_input_name'] = 'qstn'.$input_name.$qst_name; |
|
370 | + $questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_input_id'] = $input_id.'-'.$qstn_id; |
|
371 | + $questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_input_class'] = $input_class; |
|
372 | + $questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_options'] = array(); |
|
373 | + $questions[$qg->ID()]['QSG_questions'][$qst->ID()]['qst_obj'] = $qst; |
|
374 | + $questions[$qg->ID()]['QSG_questions'][$qst->ID()]['ans_obj'] = $answer; |
|
375 | 375 | //leave responses as-is, don't convert stuff into html entities please! |
376 | - $questions[ $qg->ID() ][ 'QSG_questions'][ $qst->ID() ][ 'htmlentities' ] = false; |
|
377 | - if ( $qst->type() == 'RADIO_BTN' || $qst->type() == 'CHECKBOX' || $qst->type() == 'DROPDOWN' ) { |
|
378 | - $QSOs = $qst->options(TRUE,$answer->value()); |
|
379 | - if ( is_array( $QSOs ) ) { |
|
380 | - foreach ( $QSOs as $QSO_ID => $QSO ) { |
|
381 | - $questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_options'][ $QSO_ID ] = $QSO->model_field_array(); |
|
376 | + $questions[$qg->ID()]['QSG_questions'][$qst->ID()]['htmlentities'] = false; |
|
377 | + if ($qst->type() == 'RADIO_BTN' || $qst->type() == 'CHECKBOX' || $qst->type() == 'DROPDOWN') { |
|
378 | + $QSOs = $qst->options(TRUE, $answer->value()); |
|
379 | + if (is_array($QSOs)) { |
|
380 | + foreach ($QSOs as $QSO_ID => $QSO) { |
|
381 | + $questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_options'][$QSO_ID] = $QSO->model_field_array(); |
|
382 | 382 | } |
383 | 383 | } |
384 | 384 | } |
@@ -402,9 +402,9 @@ discard block |
||
402 | 402 | * @param $QST |
403 | 403 | * @return string string |
404 | 404 | */ |
405 | - private function _generate_question_input_name( $QST ) { |
|
405 | + private function _generate_question_input_name($QST) { |
|
406 | 406 | |
407 | - if ( $QST->QST_system ) { |
|
407 | + if ($QST->QST_system) { |
|
408 | 408 | $qst_name = $QST->QST_system; |
409 | 409 | /* switch( $QST->QST_system ) { |
410 | 410 | |
@@ -471,36 +471,36 @@ discard block |
||
471 | 471 | * @param bool $count whether to return the count or not (default FALSE) |
472 | 472 | * @return array EE_Event objects |
473 | 473 | */ |
474 | - public function get_active_events( $query_params, $count = FALSE ) { |
|
475 | - if ( array_key_exists( 0, $query_params ) ) { |
|
474 | + public function get_active_events($query_params, $count = FALSE) { |
|
475 | + if (array_key_exists(0, $query_params)) { |
|
476 | 476 | $where_params = $query_params[0]; |
477 | - unset( $query_params[0] ); |
|
477 | + unset($query_params[0]); |
|
478 | 478 | } else { |
479 | 479 | $where_params = array(); |
480 | 480 | } |
481 | 481 | |
482 | 482 | //if we have count make sure we don't include group by |
483 | - if ( $count && isset( $query_params['group_by'] ) ) { |
|
484 | - unset( $query_params['group_by'] ); |
|
483 | + if ($count && isset($query_params['group_by'])) { |
|
484 | + unset($query_params['group_by']); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | //let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries. |
488 | 488 | $where_params['status'] = 'publish'; |
489 | 489 | //if already have where params for DTT_EVT_start or DTT_EVT_end then append these conditions |
490 | - if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) { |
|
491 | - $where_params['Datetime.DTT_EVT_start******'] = array('<', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) ); |
|
490 | + if (isset($where_params['Datetime.DTT_EVT_start'])) { |
|
491 | + $where_params['Datetime.DTT_EVT_start******'] = array('<', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start')); |
|
492 | 492 | } else { |
493 | - $where_params['Datetime.DTT_EVT_start'] = array('<', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) ); |
|
493 | + $where_params['Datetime.DTT_EVT_start'] = array('<', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start')); |
|
494 | 494 | } |
495 | 495 | |
496 | - if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) { |
|
497 | - $where_params['Datetime.DTT_EVT_end*****'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ); |
|
496 | + if (isset($where_params['Datetime.DTT_EVT_end'])) { |
|
497 | + $where_params['Datetime.DTT_EVT_end*****'] = array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end')); |
|
498 | 498 | } else { |
499 | - $where_params['Datetime.DTT_EVT_end'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ); |
|
499 | + $where_params['Datetime.DTT_EVT_end'] = array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end')); |
|
500 | 500 | } |
501 | 501 | $query_params[0] = $where_params; |
502 | 502 | // don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY" |
503 | - return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params ); |
|
503 | + return $count ? $this->count(array($where_params), 'EVT_ID', true) : $this->get_all($query_params); |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | |
@@ -515,30 +515,30 @@ discard block |
||
515 | 515 | * @param bool $count whether to return the count or not (default FALSE) |
516 | 516 | * @return array EE_Event objects |
517 | 517 | */ |
518 | - public function get_upcoming_events( $query_params, $count = FALSE ) { |
|
519 | - if ( array_key_exists( 0, $query_params ) ) { |
|
518 | + public function get_upcoming_events($query_params, $count = FALSE) { |
|
519 | + if (array_key_exists(0, $query_params)) { |
|
520 | 520 | $where_params = $query_params[0]; |
521 | - unset( $query_params[0] ); |
|
521 | + unset($query_params[0]); |
|
522 | 522 | } else { |
523 | 523 | $where_params = array(); |
524 | 524 | } |
525 | 525 | |
526 | 526 | //if we have count make sure we don't include group by |
527 | - if ( $count && isset( $query_params['group_by'] ) ) { |
|
528 | - unset( $query_params['group_by'] ); |
|
527 | + if ($count && isset($query_params['group_by'])) { |
|
528 | + unset($query_params['group_by']); |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | //let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries. |
532 | 532 | $where_params['status'] = 'publish'; |
533 | 533 | //if there are already query_params matching DTT_EVT_start then we need to modify that to add them. |
534 | - if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) { |
|
535 | - $where_params['Datetime.DTT_EVT_start*****'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) ); |
|
534 | + if (isset($where_params['Datetime.DTT_EVT_start'])) { |
|
535 | + $where_params['Datetime.DTT_EVT_start*****'] = array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start')); |
|
536 | 536 | } else { |
537 | - $where_params['Datetime.DTT_EVT_start'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) ); |
|
537 | + $where_params['Datetime.DTT_EVT_start'] = array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start')); |
|
538 | 538 | } |
539 | 539 | $query_params[0] = $where_params; |
540 | 540 | // don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY" |
541 | - return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params ); |
|
541 | + return $count ? $this->count(array($where_params), 'EVT_ID', true) : $this->get_all($query_params); |
|
542 | 542 | } |
543 | 543 | |
544 | 544 | |
@@ -550,54 +550,54 @@ discard block |
||
550 | 550 | * @param bool $count whether to return the count or not (default FALSE) |
551 | 551 | * @return array EE_Event objects |
552 | 552 | */ |
553 | - public function get_expired_events( $query_params, $count = FALSE ) { |
|
553 | + public function get_expired_events($query_params, $count = FALSE) { |
|
554 | 554 | |
555 | - $where_params = isset( $query_params[0] ) ? $query_params[0] : array(); |
|
555 | + $where_params = isset($query_params[0]) ? $query_params[0] : array(); |
|
556 | 556 | |
557 | 557 | //if we have count make sure we don't include group by |
558 | - if ( $count && isset( $query_params['group_by'] ) ) { |
|
559 | - unset( $query_params['group_by'] ); |
|
558 | + if ($count && isset($query_params['group_by'])) { |
|
559 | + unset($query_params['group_by']); |
|
560 | 560 | } |
561 | 561 | |
562 | 562 | //let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries. |
563 | - if ( isset( $where_params['status'] ) ) { |
|
564 | - unset( $where_params['status'] ); |
|
563 | + if (isset($where_params['status'])) { |
|
564 | + unset($where_params['status']); |
|
565 | 565 | } |
566 | 566 | $exclude_query = $query_params; |
567 | - if ( isset( $exclude_query[0] ) ) { |
|
568 | - unset( $exclude_query[0] ); |
|
567 | + if (isset($exclude_query[0])) { |
|
568 | + unset($exclude_query[0]); |
|
569 | 569 | } |
570 | - $exclude_query[0] = array( 'Datetime.DTT_EVT_end' => array( '>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) ); |
|
570 | + $exclude_query[0] = array('Datetime.DTT_EVT_end' => array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'))); |
|
571 | 571 | //first get all events that have datetimes where its not expired. |
572 | - $event_ids = $this->_get_all_wpdb_results( $exclude_query, OBJECT_K, 'Event_CPT.ID' ); |
|
573 | - $event_ids = array_keys( $event_ids ); |
|
572 | + $event_ids = $this->_get_all_wpdb_results($exclude_query, OBJECT_K, 'Event_CPT.ID'); |
|
573 | + $event_ids = array_keys($event_ids); |
|
574 | 574 | |
575 | 575 | //if we have any additional query_params, let's add them to the 'AND' condition |
576 | 576 | $and_condition = array( |
577 | - 'Datetime.DTT_EVT_end' => array( '<', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ), |
|
578 | - 'EVT_ID' => array( 'NOT IN', $event_ids ) |
|
577 | + 'Datetime.DTT_EVT_end' => array('<', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end')), |
|
578 | + 'EVT_ID' => array('NOT IN', $event_ids) |
|
579 | 579 | ); |
580 | 580 | |
581 | - if ( isset( $where_params['OR'] ) ) { |
|
581 | + if (isset($where_params['OR'])) { |
|
582 | 582 | $and_condition['OR'] = $where_params['OR']; |
583 | - unset( $where_params['OR'] ); |
|
583 | + unset($where_params['OR']); |
|
584 | 584 | } |
585 | 585 | |
586 | - if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) { |
|
586 | + if (isset($where_params['Datetime.DTT_EVT_end'])) { |
|
587 | 587 | $and_condition['Datetime.DTT_EVT_end****'] = $where_params['Datetime.DTT_EVT_end']; |
588 | - unset( $where_params['Datetime.DTT_EVT_end'] ); |
|
588 | + unset($where_params['Datetime.DTT_EVT_end']); |
|
589 | 589 | } |
590 | 590 | |
591 | - if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) { |
|
591 | + if (isset($where_params['Datetime.DTT_EVT_start'])) { |
|
592 | 592 | $and_condition['Datetime.DTT_EVT_start'] = $where_params['Datetime.DTT_EVT_start']; |
593 | - unset( $where_params['Datetime.DTT_EVT_start'] ); |
|
593 | + unset($where_params['Datetime.DTT_EVT_start']); |
|
594 | 594 | } |
595 | 595 | |
596 | 596 | //merge remaining $where params with the and conditions. |
597 | - $where_params['AND'] = array_merge( $and_condition, $where_params ); |
|
597 | + $where_params['AND'] = array_merge($and_condition, $where_params); |
|
598 | 598 | $query_params[0] = $where_params; |
599 | 599 | // don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY" |
600 | - return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params ); |
|
600 | + return $count ? $this->count(array($where_params), 'EVT_ID', true) : $this->get_all($query_params); |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | |
@@ -608,40 +608,40 @@ discard block |
||
608 | 608 | * @param boolean $count whether to return the count or not (default FALSE) |
609 | 609 | * @return EE_Event[] array of EE_Event objects |
610 | 610 | */ |
611 | - public function get_inactive_events( $query_params, $count = FALSE ) { |
|
612 | - $where_params = isset( $query_params[0] ) ? $query_params[0] : array(); |
|
611 | + public function get_inactive_events($query_params, $count = FALSE) { |
|
612 | + $where_params = isset($query_params[0]) ? $query_params[0] : array(); |
|
613 | 613 | |
614 | 614 | //let's add in specific query_params for inactive events. |
615 | - if ( isset( $where_params['status'] ) ) { |
|
616 | - unset( $where_params['status'] ); |
|
615 | + if (isset($where_params['status'])) { |
|
616 | + unset($where_params['status']); |
|
617 | 617 | } |
618 | 618 | |
619 | 619 | //if we have count make sure we don't include group by |
620 | - if ( $count && isset( $query_params['group_by'] ) ) { |
|
621 | - unset( $query_params['group_by'] ); |
|
620 | + if ($count && isset($query_params['group_by'])) { |
|
621 | + unset($query_params['group_by']); |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | //if we have any additional query_params, let's add them to the 'AND' condition |
625 | - $where_params['AND']['status'] = array( '!=', 'publish' ); |
|
625 | + $where_params['AND']['status'] = array('!=', 'publish'); |
|
626 | 626 | |
627 | - if ( isset( $where_params['OR'] ) ) { |
|
627 | + if (isset($where_params['OR'])) { |
|
628 | 628 | $where_params['AND']['OR'] = $where_params['OR']; |
629 | - unset( $where_params['OR'] ); |
|
629 | + unset($where_params['OR']); |
|
630 | 630 | } |
631 | 631 | |
632 | - if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) { |
|
632 | + if (isset($where_params['Datetime.DTT_EVT_end'])) { |
|
633 | 633 | $where_params['AND']['Datetime.DTT_EVT_end****'] = $where_params['Datetime.DTT_EVT_end']; |
634 | - unset( $where_params['Datetime.DTT_EVT_end'] ); |
|
634 | + unset($where_params['Datetime.DTT_EVT_end']); |
|
635 | 635 | } |
636 | 636 | |
637 | - if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) { |
|
637 | + if (isset($where_params['Datetime.DTT_EVT_start'])) { |
|
638 | 638 | $where_params['AND']['Datetime.DTT_EVT_start'] = $where_params['Datetime.DTT_EVT_start']; |
639 | - unset( $where_params['Datetime.DTT_EVT_start'] ); |
|
639 | + unset($where_params['Datetime.DTT_EVT_start']); |
|
640 | 640 | } |
641 | 641 | |
642 | 642 | $query_params[0] = $where_params; |
643 | 643 | // don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY" |
644 | - return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params ); |
|
644 | + return $count ? $this->count(array($where_params), 'EVT_ID', true) : $this->get_all($query_params); |
|
645 | 645 | } |
646 | 646 | |
647 | 647 | |
@@ -649,13 +649,13 @@ discard block |
||
649 | 649 | * This is just injecting into the parent add_relationship_to so we do special handling on price relationships because we don't want to override any existing global default prices but instead insert NEW prices that get attached to the event. |
650 | 650 | * See parent for param descriptions |
651 | 651 | */ |
652 | - public function add_relationship_to($id_or_obj,$other_model_id_or_obj, $relationName, $where_query = array()){ |
|
652 | + public function add_relationship_to($id_or_obj, $other_model_id_or_obj, $relationName, $where_query = array()) { |
|
653 | 653 | |
654 | - if ( $relationName == 'Price' ) { |
|
654 | + if ($relationName == 'Price') { |
|
655 | 655 | //let's get the PRC object for the given ID to make sure that we aren't dealing with a default |
656 | 656 | $prc_chk = $this->get_related_model_obj($relationName)->ensure_is_obj($other_model_id_or_obj); |
657 | 657 | //if EVT_ID = 0, then this is a default |
658 | - if ( $prc_chk->get('EVT_ID') == 0 ) { |
|
658 | + if ($prc_chk->get('EVT_ID') == 0) { |
|
659 | 659 | //let's set the prc_id as 0 so we force an insert on the add_relation_to carried out by relation |
660 | 660 | $prc_chk->set('PRC_ID', 0); |
661 | 661 | } |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | } |
666 | 666 | |
667 | 667 | //otherwise carry on as normal |
668 | - return parent::add_relationship_to($id_or_obj,$other_model_id_or_obj, $relationName, $where_query); |
|
668 | + return parent::add_relationship_to($id_or_obj, $other_model_id_or_obj, $relationName, $where_query); |
|
669 | 669 | } |
670 | 670 | |
671 | 671 |