@@ -17,166 +17,166 @@ |
||
17 | 17 | { |
18 | 18 | |
19 | 19 | |
20 | - public function __construct($admin_page) |
|
21 | - { |
|
22 | - parent::__construct($admin_page); |
|
23 | - } |
|
24 | - |
|
25 | - |
|
26 | - protected function _setup_data() |
|
27 | - { |
|
28 | - if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'trash') { |
|
29 | - $this->_data = $this->_admin_page->get_trashed_questions($this->_per_page, $this->_current_page, false); |
|
30 | - } else { |
|
31 | - $this->_data = $this->_admin_page->get_questions($this->_per_page, $this->_current_page, false); |
|
32 | - } |
|
33 | - $this->_all_data_count = $this->_admin_page->get_questions($this->_per_page, $this->_current_page, true); |
|
34 | - } |
|
35 | - |
|
36 | - |
|
37 | - protected function _set_properties() |
|
38 | - { |
|
39 | - $this->_wp_list_args = array( |
|
40 | - 'singular' => esc_html__('question', 'event_espresso'), |
|
41 | - 'plural' => esc_html__('questions', 'event_espresso'), |
|
42 | - 'ajax' => true, // for now, |
|
43 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
44 | - ); |
|
45 | - |
|
46 | - $this->_columns = array( |
|
47 | - 'cb' => '<input type="checkbox" />', |
|
48 | - 'id' => esc_html__('ID', 'event_espresso'), |
|
49 | - 'display_text' => esc_html__('Question', 'event_espresso'), |
|
50 | - 'admin_label' => esc_html__('Admin Label', 'event_espresso'), |
|
51 | - 'type' => esc_html__('Type', 'event_espresso'), |
|
52 | - 'values' => esc_html__('Values', 'event_espresso'), |
|
53 | - 'required' => esc_html__('Req', 'event_espresso'), |
|
54 | - ); |
|
55 | - |
|
56 | - $this->_sortable_columns = array( |
|
57 | - 'id' => array('QST_ID' => false), |
|
58 | - 'display_text' => array('QST_display_text' => false), |
|
59 | - ); |
|
60 | - |
|
61 | - $this->_hidden_columns = array(); |
|
62 | - } |
|
63 | - |
|
64 | - |
|
65 | - // not needed |
|
66 | - protected function _get_table_filters() |
|
67 | - { |
|
68 | - return array(); |
|
69 | - } |
|
70 | - |
|
71 | - |
|
72 | - protected function _add_view_counts() |
|
73 | - { |
|
74 | - $this->_views['all']['count'] = $this->_admin_page->get_questions($this->_per_page, $this->_current_page, true); |
|
75 | - if ( |
|
76 | - EE_Registry::instance()->CAP->current_user_can( |
|
77 | - 'ee_delete_questions', |
|
78 | - 'espresso_registration_form_trash_question' |
|
79 | - ) |
|
80 | - ) { |
|
81 | - $this->_views['trash']['count'] = $this->_admin_page->get_trashed_questions(-1, $this->_current_page, true); |
|
82 | - } |
|
83 | - } |
|
84 | - |
|
85 | - |
|
86 | - public function column_cb($item) |
|
87 | - { |
|
88 | - $system_question = $item->is_system_question(); |
|
89 | - $related_answer_count = $item->count_related('Answer'); |
|
90 | - $lock_icon = (! $system_question && $related_answer_count > 0 && $this->_view == 'trash') |
|
91 | - ? 'ee-lock-icon ee-alternate-color' : 'ee-lock-icon ee-system-lock'; |
|
92 | - return $system_question || (! $system_question && $related_answer_count > 0 && $this->_view == 'trash') |
|
93 | - ? '<span class="' . $lock_icon . '"></span>' . sprintf( |
|
94 | - '<input type="hidden" name="hdnchk[%1$d]" value="%1$d" />', |
|
95 | - $item->ID() |
|
96 | - ) : sprintf('<input type="checkbox" class="QST_ID" name="checkbox[%1$d]" value="%1$d" />', $item->ID()); |
|
97 | - } |
|
98 | - |
|
99 | - |
|
100 | - public function column_id(EE_Question $item) |
|
101 | - { |
|
102 | - $content = $item->ID(); |
|
103 | - $content .= ' <span class="show-on-mobile-view-only">' . $item->display_text() . '</span>'; |
|
104 | - return $content; |
|
105 | - } |
|
106 | - |
|
107 | - |
|
108 | - public function column_display_text(EE_Question $item) |
|
109 | - { |
|
110 | - $system_question = $item->is_system_question(); |
|
111 | - |
|
112 | - if (! defined('REG_ADMIN_URL')) { |
|
113 | - define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
114 | - } |
|
115 | - |
|
116 | - $edit_query_args = array( |
|
117 | - 'action' => 'edit_question', |
|
118 | - 'QST_ID' => $item->ID(), |
|
119 | - ); |
|
120 | - |
|
121 | - if ( |
|
122 | - EE_Registry::instance()->CAP->current_user_can( |
|
123 | - 'ee_edit_question', |
|
124 | - 'espresso_registration_form_edit_question', |
|
125 | - $item->ID() |
|
126 | - ) |
|
127 | - ) { |
|
128 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL); |
|
129 | - |
|
130 | - $actions = array( |
|
131 | - 'edit' => '<a href="' . $edit_link . '" title="' . esc_attr__( |
|
132 | - 'Edit Event', |
|
133 | - 'event_espresso' |
|
134 | - ) . '">' . esc_html__('Edit', 'event_espresso') . '</a>', |
|
135 | - ); |
|
136 | - } |
|
137 | - |
|
138 | - |
|
139 | - $content = EE_Registry::instance()->CAP->current_user_can( |
|
140 | - 'ee_edit_question', |
|
141 | - 'espresso_registration_form_edit_question', |
|
142 | - $item->ID() |
|
143 | - ) ? '<strong><a class="row-title" href="' . $edit_link . '">' . $item->display_text() . '</a></strong>' |
|
144 | - : $item->display_text(); |
|
145 | - $content .= $this->row_actions($actions); |
|
146 | - return $content; |
|
147 | - } |
|
148 | - |
|
149 | - |
|
150 | - public function column_admin_label(EE_Question $item) |
|
151 | - { |
|
152 | - return $item->admin_label(); |
|
153 | - } |
|
154 | - |
|
155 | - |
|
156 | - public function column_values(EE_Question $item) |
|
157 | - { |
|
158 | - $optionNames = array(); |
|
159 | - $options = $item->options(); |
|
160 | - if (empty($options)) { |
|
161 | - return "N/A"; |
|
162 | - } else { |
|
163 | - foreach ($options as $optionID => $option) { |
|
164 | - /* @var $option EE_Question_Option */ |
|
165 | - $optionNames[] = $option->value(); |
|
166 | - } |
|
167 | - return implode(', ', $optionNames); |
|
168 | - } |
|
169 | - } |
|
170 | - |
|
171 | - |
|
172 | - public function column_type(EE_Question $item) |
|
173 | - { |
|
174 | - return $item->type(); |
|
175 | - } |
|
176 | - |
|
177 | - |
|
178 | - public function column_required(EE_Question $item) |
|
179 | - { |
|
180 | - return $item->required() ? 'Yes' : ''; |
|
181 | - } |
|
20 | + public function __construct($admin_page) |
|
21 | + { |
|
22 | + parent::__construct($admin_page); |
|
23 | + } |
|
24 | + |
|
25 | + |
|
26 | + protected function _setup_data() |
|
27 | + { |
|
28 | + if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'trash') { |
|
29 | + $this->_data = $this->_admin_page->get_trashed_questions($this->_per_page, $this->_current_page, false); |
|
30 | + } else { |
|
31 | + $this->_data = $this->_admin_page->get_questions($this->_per_page, $this->_current_page, false); |
|
32 | + } |
|
33 | + $this->_all_data_count = $this->_admin_page->get_questions($this->_per_page, $this->_current_page, true); |
|
34 | + } |
|
35 | + |
|
36 | + |
|
37 | + protected function _set_properties() |
|
38 | + { |
|
39 | + $this->_wp_list_args = array( |
|
40 | + 'singular' => esc_html__('question', 'event_espresso'), |
|
41 | + 'plural' => esc_html__('questions', 'event_espresso'), |
|
42 | + 'ajax' => true, // for now, |
|
43 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
44 | + ); |
|
45 | + |
|
46 | + $this->_columns = array( |
|
47 | + 'cb' => '<input type="checkbox" />', |
|
48 | + 'id' => esc_html__('ID', 'event_espresso'), |
|
49 | + 'display_text' => esc_html__('Question', 'event_espresso'), |
|
50 | + 'admin_label' => esc_html__('Admin Label', 'event_espresso'), |
|
51 | + 'type' => esc_html__('Type', 'event_espresso'), |
|
52 | + 'values' => esc_html__('Values', 'event_espresso'), |
|
53 | + 'required' => esc_html__('Req', 'event_espresso'), |
|
54 | + ); |
|
55 | + |
|
56 | + $this->_sortable_columns = array( |
|
57 | + 'id' => array('QST_ID' => false), |
|
58 | + 'display_text' => array('QST_display_text' => false), |
|
59 | + ); |
|
60 | + |
|
61 | + $this->_hidden_columns = array(); |
|
62 | + } |
|
63 | + |
|
64 | + |
|
65 | + // not needed |
|
66 | + protected function _get_table_filters() |
|
67 | + { |
|
68 | + return array(); |
|
69 | + } |
|
70 | + |
|
71 | + |
|
72 | + protected function _add_view_counts() |
|
73 | + { |
|
74 | + $this->_views['all']['count'] = $this->_admin_page->get_questions($this->_per_page, $this->_current_page, true); |
|
75 | + if ( |
|
76 | + EE_Registry::instance()->CAP->current_user_can( |
|
77 | + 'ee_delete_questions', |
|
78 | + 'espresso_registration_form_trash_question' |
|
79 | + ) |
|
80 | + ) { |
|
81 | + $this->_views['trash']['count'] = $this->_admin_page->get_trashed_questions(-1, $this->_current_page, true); |
|
82 | + } |
|
83 | + } |
|
84 | + |
|
85 | + |
|
86 | + public function column_cb($item) |
|
87 | + { |
|
88 | + $system_question = $item->is_system_question(); |
|
89 | + $related_answer_count = $item->count_related('Answer'); |
|
90 | + $lock_icon = (! $system_question && $related_answer_count > 0 && $this->_view == 'trash') |
|
91 | + ? 'ee-lock-icon ee-alternate-color' : 'ee-lock-icon ee-system-lock'; |
|
92 | + return $system_question || (! $system_question && $related_answer_count > 0 && $this->_view == 'trash') |
|
93 | + ? '<span class="' . $lock_icon . '"></span>' . sprintf( |
|
94 | + '<input type="hidden" name="hdnchk[%1$d]" value="%1$d" />', |
|
95 | + $item->ID() |
|
96 | + ) : sprintf('<input type="checkbox" class="QST_ID" name="checkbox[%1$d]" value="%1$d" />', $item->ID()); |
|
97 | + } |
|
98 | + |
|
99 | + |
|
100 | + public function column_id(EE_Question $item) |
|
101 | + { |
|
102 | + $content = $item->ID(); |
|
103 | + $content .= ' <span class="show-on-mobile-view-only">' . $item->display_text() . '</span>'; |
|
104 | + return $content; |
|
105 | + } |
|
106 | + |
|
107 | + |
|
108 | + public function column_display_text(EE_Question $item) |
|
109 | + { |
|
110 | + $system_question = $item->is_system_question(); |
|
111 | + |
|
112 | + if (! defined('REG_ADMIN_URL')) { |
|
113 | + define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
114 | + } |
|
115 | + |
|
116 | + $edit_query_args = array( |
|
117 | + 'action' => 'edit_question', |
|
118 | + 'QST_ID' => $item->ID(), |
|
119 | + ); |
|
120 | + |
|
121 | + if ( |
|
122 | + EE_Registry::instance()->CAP->current_user_can( |
|
123 | + 'ee_edit_question', |
|
124 | + 'espresso_registration_form_edit_question', |
|
125 | + $item->ID() |
|
126 | + ) |
|
127 | + ) { |
|
128 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL); |
|
129 | + |
|
130 | + $actions = array( |
|
131 | + 'edit' => '<a href="' . $edit_link . '" title="' . esc_attr__( |
|
132 | + 'Edit Event', |
|
133 | + 'event_espresso' |
|
134 | + ) . '">' . esc_html__('Edit', 'event_espresso') . '</a>', |
|
135 | + ); |
|
136 | + } |
|
137 | + |
|
138 | + |
|
139 | + $content = EE_Registry::instance()->CAP->current_user_can( |
|
140 | + 'ee_edit_question', |
|
141 | + 'espresso_registration_form_edit_question', |
|
142 | + $item->ID() |
|
143 | + ) ? '<strong><a class="row-title" href="' . $edit_link . '">' . $item->display_text() . '</a></strong>' |
|
144 | + : $item->display_text(); |
|
145 | + $content .= $this->row_actions($actions); |
|
146 | + return $content; |
|
147 | + } |
|
148 | + |
|
149 | + |
|
150 | + public function column_admin_label(EE_Question $item) |
|
151 | + { |
|
152 | + return $item->admin_label(); |
|
153 | + } |
|
154 | + |
|
155 | + |
|
156 | + public function column_values(EE_Question $item) |
|
157 | + { |
|
158 | + $optionNames = array(); |
|
159 | + $options = $item->options(); |
|
160 | + if (empty($options)) { |
|
161 | + return "N/A"; |
|
162 | + } else { |
|
163 | + foreach ($options as $optionID => $option) { |
|
164 | + /* @var $option EE_Question_Option */ |
|
165 | + $optionNames[] = $option->value(); |
|
166 | + } |
|
167 | + return implode(', ', $optionNames); |
|
168 | + } |
|
169 | + } |
|
170 | + |
|
171 | + |
|
172 | + public function column_type(EE_Question $item) |
|
173 | + { |
|
174 | + return $item->type(); |
|
175 | + } |
|
176 | + |
|
177 | + |
|
178 | + public function column_required(EE_Question $item) |
|
179 | + { |
|
180 | + return $item->required() ? 'Yes' : ''; |
|
181 | + } |
|
182 | 182 | } |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | { |
88 | 88 | $system_question = $item->is_system_question(); |
89 | 89 | $related_answer_count = $item->count_related('Answer'); |
90 | - $lock_icon = (! $system_question && $related_answer_count > 0 && $this->_view == 'trash') |
|
90 | + $lock_icon = ( ! $system_question && $related_answer_count > 0 && $this->_view == 'trash') |
|
91 | 91 | ? 'ee-lock-icon ee-alternate-color' : 'ee-lock-icon ee-system-lock'; |
92 | - return $system_question || (! $system_question && $related_answer_count > 0 && $this->_view == 'trash') |
|
93 | - ? '<span class="' . $lock_icon . '"></span>' . sprintf( |
|
92 | + return $system_question || ( ! $system_question && $related_answer_count > 0 && $this->_view == 'trash') |
|
93 | + ? '<span class="'.$lock_icon.'"></span>'.sprintf( |
|
94 | 94 | '<input type="hidden" name="hdnchk[%1$d]" value="%1$d" />', |
95 | 95 | $item->ID() |
96 | 96 | ) : sprintf('<input type="checkbox" class="QST_ID" name="checkbox[%1$d]" value="%1$d" />', $item->ID()); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | public function column_id(EE_Question $item) |
101 | 101 | { |
102 | 102 | $content = $item->ID(); |
103 | - $content .= ' <span class="show-on-mobile-view-only">' . $item->display_text() . '</span>'; |
|
103 | + $content .= ' <span class="show-on-mobile-view-only">'.$item->display_text().'</span>'; |
|
104 | 104 | return $content; |
105 | 105 | } |
106 | 106 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | { |
110 | 110 | $system_question = $item->is_system_question(); |
111 | 111 | |
112 | - if (! defined('REG_ADMIN_URL')) { |
|
112 | + if ( ! defined('REG_ADMIN_URL')) { |
|
113 | 113 | define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
114 | 114 | } |
115 | 115 | |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL); |
129 | 129 | |
130 | 130 | $actions = array( |
131 | - 'edit' => '<a href="' . $edit_link . '" title="' . esc_attr__( |
|
131 | + 'edit' => '<a href="'.$edit_link.'" title="'.esc_attr__( |
|
132 | 132 | 'Edit Event', |
133 | 133 | 'event_espresso' |
134 | - ) . '">' . esc_html__('Edit', 'event_espresso') . '</a>', |
|
134 | + ).'">'.esc_html__('Edit', 'event_espresso').'</a>', |
|
135 | 135 | ); |
136 | 136 | } |
137 | 137 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | 'ee_edit_question', |
141 | 141 | 'espresso_registration_form_edit_question', |
142 | 142 | $item->ID() |
143 | - ) ? '<strong><a class="row-title" href="' . $edit_link . '">' . $item->display_text() . '</a></strong>' |
|
143 | + ) ? '<strong><a class="row-title" href="'.$edit_link.'">'.$item->display_text().'</a></strong>' |
|
144 | 144 | : $item->display_text(); |
145 | 145 | $content .= $this->row_actions($actions); |
146 | 146 | return $content; |
@@ -18,41 +18,41 @@ |
||
18 | 18 | class Registration_Form_Admin_Page_Init extends EE_Admin_Page_Init |
19 | 19 | { |
20 | 20 | |
21 | - public function __construct() |
|
22 | - { |
|
23 | - // define some constants |
|
24 | - define('REGISTRATION_FORM_PG_SLUG', 'espresso_registration_form'); |
|
25 | - define('REGISTRATION_FORM_LABEL', esc_html__('Registration Form', 'event_espresso')); |
|
26 | - define('REGISTRATION_FORM_PG_NAME', REGISTRATION_FORM_LABEL); |
|
27 | - define('REGISTRATION_FORM_ADMIN', EE_ADMIN_PAGES . 'registration_form/'); |
|
28 | - define('REGISTRATION_FORM_ADMIN_URL', admin_url('admin.php?page=' . REGISTRATION_FORM_PG_SLUG)); |
|
29 | - define('EE_FORMS_ADMIN_URL', admin_url('admin.php?page=' . REGISTRATION_FORM_PG_SLUG)); |
|
30 | - define('REGISTRATION_FORM_ASSETS_PATH', REGISTRATION_FORM_ADMIN . 'assets/'); |
|
31 | - define('REGISTRATION_FORM_ASSETS_URL', EE_ADMIN_PAGES_URL . 'registration_form/assets/'); |
|
32 | - define('REGISTRATION_FORM_TEMPLATE_PATH', REGISTRATION_FORM_ADMIN . 'templates/'); |
|
33 | - define('REGISTRATION_FORM_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'registration_form/templates/'); |
|
34 | - parent::__construct(); |
|
35 | - } |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | + // define some constants |
|
24 | + define('REGISTRATION_FORM_PG_SLUG', 'espresso_registration_form'); |
|
25 | + define('REGISTRATION_FORM_LABEL', esc_html__('Registration Form', 'event_espresso')); |
|
26 | + define('REGISTRATION_FORM_PG_NAME', REGISTRATION_FORM_LABEL); |
|
27 | + define('REGISTRATION_FORM_ADMIN', EE_ADMIN_PAGES . 'registration_form/'); |
|
28 | + define('REGISTRATION_FORM_ADMIN_URL', admin_url('admin.php?page=' . REGISTRATION_FORM_PG_SLUG)); |
|
29 | + define('EE_FORMS_ADMIN_URL', admin_url('admin.php?page=' . REGISTRATION_FORM_PG_SLUG)); |
|
30 | + define('REGISTRATION_FORM_ASSETS_PATH', REGISTRATION_FORM_ADMIN . 'assets/'); |
|
31 | + define('REGISTRATION_FORM_ASSETS_URL', EE_ADMIN_PAGES_URL . 'registration_form/assets/'); |
|
32 | + define('REGISTRATION_FORM_TEMPLATE_PATH', REGISTRATION_FORM_ADMIN . 'templates/'); |
|
33 | + define('REGISTRATION_FORM_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'registration_form/templates/'); |
|
34 | + parent::__construct(); |
|
35 | + } |
|
36 | 36 | |
37 | - protected function _set_init_properties() |
|
38 | - { |
|
39 | - $this->label = esc_html__('Registration Form Overview', 'event_espresso'); |
|
40 | - } |
|
37 | + protected function _set_init_properties() |
|
38 | + { |
|
39 | + $this->label = esc_html__('Registration Form Overview', 'event_espresso'); |
|
40 | + } |
|
41 | 41 | |
42 | 42 | |
43 | - protected function _set_menu_map() |
|
44 | - { |
|
45 | - $this->_menu_map = new EE_Admin_Page_Sub_Menu( |
|
46 | - array( |
|
47 | - 'menu_group' => 'management', |
|
48 | - 'menu_order' => 30, |
|
49 | - 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
|
50 | - 'parent_slug' => 'espresso_events', |
|
51 | - 'menu_slug' => REGISTRATION_FORM_PG_SLUG, |
|
52 | - 'menu_label' => esc_html__('Registration Form', 'event_espresso'), |
|
53 | - 'capability' => 'ee_read_questions', |
|
54 | - 'admin_init_page' => $this, |
|
55 | - ) |
|
56 | - ); |
|
57 | - } |
|
43 | + protected function _set_menu_map() |
|
44 | + { |
|
45 | + $this->_menu_map = new EE_Admin_Page_Sub_Menu( |
|
46 | + array( |
|
47 | + 'menu_group' => 'management', |
|
48 | + 'menu_order' => 30, |
|
49 | + 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
|
50 | + 'parent_slug' => 'espresso_events', |
|
51 | + 'menu_slug' => REGISTRATION_FORM_PG_SLUG, |
|
52 | + 'menu_label' => esc_html__('Registration Form', 'event_espresso'), |
|
53 | + 'capability' => 'ee_read_questions', |
|
54 | + 'admin_init_page' => $this, |
|
55 | + ) |
|
56 | + ); |
|
57 | + } |
|
58 | 58 | } |
@@ -24,13 +24,13 @@ |
||
24 | 24 | define('REGISTRATION_FORM_PG_SLUG', 'espresso_registration_form'); |
25 | 25 | define('REGISTRATION_FORM_LABEL', esc_html__('Registration Form', 'event_espresso')); |
26 | 26 | define('REGISTRATION_FORM_PG_NAME', REGISTRATION_FORM_LABEL); |
27 | - define('REGISTRATION_FORM_ADMIN', EE_ADMIN_PAGES . 'registration_form/'); |
|
28 | - define('REGISTRATION_FORM_ADMIN_URL', admin_url('admin.php?page=' . REGISTRATION_FORM_PG_SLUG)); |
|
29 | - define('EE_FORMS_ADMIN_URL', admin_url('admin.php?page=' . REGISTRATION_FORM_PG_SLUG)); |
|
30 | - define('REGISTRATION_FORM_ASSETS_PATH', REGISTRATION_FORM_ADMIN . 'assets/'); |
|
31 | - define('REGISTRATION_FORM_ASSETS_URL', EE_ADMIN_PAGES_URL . 'registration_form/assets/'); |
|
32 | - define('REGISTRATION_FORM_TEMPLATE_PATH', REGISTRATION_FORM_ADMIN . 'templates/'); |
|
33 | - define('REGISTRATION_FORM_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'registration_form/templates/'); |
|
27 | + define('REGISTRATION_FORM_ADMIN', EE_ADMIN_PAGES.'registration_form/'); |
|
28 | + define('REGISTRATION_FORM_ADMIN_URL', admin_url('admin.php?page='.REGISTRATION_FORM_PG_SLUG)); |
|
29 | + define('EE_FORMS_ADMIN_URL', admin_url('admin.php?page='.REGISTRATION_FORM_PG_SLUG)); |
|
30 | + define('REGISTRATION_FORM_ASSETS_PATH', REGISTRATION_FORM_ADMIN.'assets/'); |
|
31 | + define('REGISTRATION_FORM_ASSETS_URL', EE_ADMIN_PAGES_URL.'registration_form/assets/'); |
|
32 | + define('REGISTRATION_FORM_TEMPLATE_PATH', REGISTRATION_FORM_ADMIN.'templates/'); |
|
33 | + define('REGISTRATION_FORM_TEMPLATE_URL', EE_ADMIN_PAGES_URL.'registration_form/templates/'); |
|
34 | 34 | parent::__construct(); |
35 | 35 | } |
36 | 36 |
@@ -15,39 +15,39 @@ |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | |
18 | - protected function _set_tips_array() |
|
19 | - { |
|
20 | - $this->_qtipsa = array( |
|
21 | - 0 => array( |
|
22 | - 'content_id' => 'about-system-lock-icon', |
|
23 | - 'target' => '.questions .ee-system-lock', |
|
24 | - 'content' => esc_html__('This question is a system question and cannot be trashed', 'event_espresso'), |
|
25 | - 'options' => array(), // defaults |
|
26 | - ), |
|
27 | - 1 => array( |
|
28 | - 'content_id' => 'about-non-system-lock-icon', |
|
29 | - 'target' => '.questions .ee-alternate-color', |
|
30 | - 'content' => esc_html__( |
|
31 | - 'This question has answers attached to it from registrations that have the question. It cannot be permanently deleted.', |
|
32 | - 'event_espresso' |
|
33 | - ), |
|
34 | - 'options' => array(), |
|
35 | - ), |
|
36 | - 2 => array( |
|
37 | - 'content_id' => 'about-question-group-lock-icon', |
|
38 | - 'target' => '.questiongroups .ee-system-lock', |
|
39 | - 'content' => esc_html__('This question group is a system group and cannot be trashed', 'event_espresso'), |
|
40 | - 'options' => array(), |
|
41 | - ), |
|
42 | - 3 => array( |
|
43 | - 'content_id' => 'about-non-system-qg-lock-icon', |
|
44 | - 'target' => '.questiongroups .ee-alternate-color', |
|
45 | - 'content' => esc_html__( |
|
46 | - 'This question group has questions that have answers attached to it from registrations that have the question. It cannot be permanently deleted.', |
|
47 | - 'event_espresso' |
|
48 | - ), |
|
49 | - 'options' => array(), |
|
50 | - ), |
|
51 | - ); |
|
52 | - } |
|
18 | + protected function _set_tips_array() |
|
19 | + { |
|
20 | + $this->_qtipsa = array( |
|
21 | + 0 => array( |
|
22 | + 'content_id' => 'about-system-lock-icon', |
|
23 | + 'target' => '.questions .ee-system-lock', |
|
24 | + 'content' => esc_html__('This question is a system question and cannot be trashed', 'event_espresso'), |
|
25 | + 'options' => array(), // defaults |
|
26 | + ), |
|
27 | + 1 => array( |
|
28 | + 'content_id' => 'about-non-system-lock-icon', |
|
29 | + 'target' => '.questions .ee-alternate-color', |
|
30 | + 'content' => esc_html__( |
|
31 | + 'This question has answers attached to it from registrations that have the question. It cannot be permanently deleted.', |
|
32 | + 'event_espresso' |
|
33 | + ), |
|
34 | + 'options' => array(), |
|
35 | + ), |
|
36 | + 2 => array( |
|
37 | + 'content_id' => 'about-question-group-lock-icon', |
|
38 | + 'target' => '.questiongroups .ee-system-lock', |
|
39 | + 'content' => esc_html__('This question group is a system group and cannot be trashed', 'event_espresso'), |
|
40 | + 'options' => array(), |
|
41 | + ), |
|
42 | + 3 => array( |
|
43 | + 'content_id' => 'about-non-system-qg-lock-icon', |
|
44 | + 'target' => '.questiongroups .ee-alternate-color', |
|
45 | + 'content' => esc_html__( |
|
46 | + 'This question group has questions that have answers attached to it from registrations that have the question. It cannot be permanently deleted.', |
|
47 | + 'event_espresso' |
|
48 | + ), |
|
49 | + 'options' => array(), |
|
50 | + ), |
|
51 | + ); |
|
52 | + } |
|
53 | 53 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | protected function _extend_properties() |
55 | 55 | { |
56 | - define('EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/assets/'); |
|
56 | + define('EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'messages/assets/'); |
|
57 | 57 | $this->_ajax_func = array( |
58 | 58 | 'ee_msgs_create_new_custom' => 'create_new_custom', |
59 | 59 | ); |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | $this->_scripts_styles = array( |
71 | 71 | 'registers' => array( |
72 | 72 | 'events_msg_admin' => array( |
73 | - 'url' => EE_MSGS_EXTEND_ASSETS_URL . 'events_messages_admin.js', |
|
73 | + 'url' => EE_MSGS_EXTEND_ASSETS_URL.'events_messages_admin.js', |
|
74 | 74 | 'depends' => array('ee-dialog', 'ee-parse-uri', 'ee-serialize-full-array'), |
75 | 75 | ), |
76 | 76 | 'events_msg_admin_css' => array( |
77 | - 'url' => EE_MSGS_EXTEND_ASSETS_URL . 'ee_msg_events_admin.css', |
|
77 | + 'url' => EE_MSGS_EXTEND_ASSETS_URL.'ee_msg_events_admin.css', |
|
78 | 78 | 'type' => 'css', |
79 | 79 | ), |
80 | 80 | ), |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | ), |
155 | 155 | '<strong>', |
156 | 156 | '</strong>', |
157 | - '<a href="' . $msg_activate_url . '">', |
|
157 | + '<a href="'.$msg_activate_url.'">', |
|
158 | 158 | '</a>' |
159 | 159 | ); |
160 | - $error_content = '<div class="error"><p>' . $error_msg . '</p></div>'; |
|
161 | - $internal_content = '<div id="messages-error"><p>' . $error_msg . '</p></div>'; |
|
160 | + $error_content = '<div class="error"><p>'.$error_msg.'</p></div>'; |
|
161 | + $internal_content = '<div id="messages-error"><p>'.$error_msg.'</p></div>'; |
|
162 | 162 | |
163 | 163 | echo $error_content; |
164 | 164 | echo $internal_content; |
@@ -180,8 +180,8 @@ discard block |
||
180 | 180 | array('event' => $event_id) |
181 | 181 | ); |
182 | 182 | |
183 | - if (! empty($tab_content)) { |
|
184 | - $tabs[ $name ] = $tab_content; |
|
183 | + if ( ! empty($tab_content)) { |
|
184 | + $tabs[$name] = $tab_content; |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | } |
206 | 206 | |
207 | 207 | do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content'); |
208 | - echo $notices . '<div class="messages-tabs-content">' . $tabbed_content . '</div>'; |
|
208 | + echo $notices.'<div class="messages-tabs-content">'.$tabbed_content.'</div>'; |
|
209 | 209 | do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content'); |
210 | 210 | } |
211 | 211 | |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | */ |
222 | 222 | public function create_new_custom() |
223 | 223 | { |
224 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'create_new_custom_ajax')) { |
|
224 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'create_new_custom_ajax')) { |
|
225 | 225 | wp_die(esc_html__('You don\'t have privileges to do this action', 'event_espresso')); |
226 | 226 | } |
227 | 227 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | public function edit_admin_footer() |
265 | 265 | { |
266 | 266 | EEH_Template::display_template( |
267 | - EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/create_custom_template_form.template.php' |
|
267 | + EE_CORE_CAF_ADMIN_EXTEND.'messages/templates/create_custom_template_form.template.php' |
|
268 | 268 | ); |
269 | 269 | } |
270 | 270 |
@@ -15,284 +15,284 @@ |
||
15 | 15 | */ |
16 | 16 | class espresso_events_Messages_Hooks_Extend extends espresso_events_Messages_Hooks |
17 | 17 | { |
18 | - /** |
|
19 | - * espresso_events_Messages_Hooks_Extend constructor. |
|
20 | - * |
|
21 | - * @param \EE_Admin_Page $admin_page |
|
22 | - */ |
|
23 | - public function __construct(EE_Admin_Page $admin_page) |
|
24 | - { |
|
25 | - /** |
|
26 | - * Add cap restriction ... metaboxes should not show if user does not have the ability to edit_custom_messages |
|
27 | - */ |
|
28 | - if ( |
|
29 | - ! EE_Registry::instance()->CAP->current_user_can( |
|
30 | - 'ee_edit_messages', |
|
31 | - 'messages_events_editor_metabox' |
|
32 | - ) |
|
33 | - ) { |
|
34 | - return; |
|
35 | - } |
|
36 | - add_filter( |
|
37 | - 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', |
|
38 | - array($this, 'caf_updates'), |
|
39 | - 10 |
|
40 | - ); |
|
41 | - add_action( |
|
42 | - 'AHEE__Extend_Events_Admin_Page___duplicate_event__after', |
|
43 | - array($this, 'duplicate_custom_message_settings'), |
|
44 | - 10, |
|
45 | - 2 |
|
46 | - ); |
|
47 | - parent::__construct($admin_page); |
|
48 | - } |
|
49 | - |
|
50 | - |
|
51 | - /** |
|
52 | - * extending the properties set in espresso_events_Messages_Hooks |
|
53 | - * |
|
54 | - * @access protected |
|
55 | - * @return void |
|
56 | - */ |
|
57 | - protected function _extend_properties() |
|
58 | - { |
|
59 | - define('EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/assets/'); |
|
60 | - $this->_ajax_func = array( |
|
61 | - 'ee_msgs_create_new_custom' => 'create_new_custom', |
|
62 | - ); |
|
63 | - $this->_metaboxes = array( |
|
64 | - 0 => array( |
|
65 | - 'page_route' => array('edit', 'create_new'), |
|
66 | - 'func' => 'messages_metabox', |
|
67 | - 'label' => esc_html__('Notifications', 'event_espresso'), |
|
68 | - 'priority' => 'high', |
|
69 | - ), |
|
70 | - ); |
|
71 | - |
|
72 | - // see explanation for layout in EE_Admin_Hooks |
|
73 | - $this->_scripts_styles = array( |
|
74 | - 'registers' => array( |
|
75 | - 'events_msg_admin' => array( |
|
76 | - 'url' => EE_MSGS_EXTEND_ASSETS_URL . 'events_messages_admin.js', |
|
77 | - 'depends' => array('ee-dialog', 'ee-parse-uri', 'ee-serialize-full-array'), |
|
78 | - ), |
|
79 | - 'events_msg_admin_css' => array( |
|
80 | - 'url' => EE_MSGS_EXTEND_ASSETS_URL . 'ee_msg_events_admin.css', |
|
81 | - 'type' => 'css', |
|
82 | - ), |
|
83 | - ), |
|
84 | - 'enqueues' => array( |
|
85 | - 'events_msg_admin' => array('edit', 'create_new'), |
|
86 | - 'events_msg_admin_css' => array('edit', 'create_new'), |
|
87 | - ), |
|
88 | - ); |
|
89 | - } |
|
90 | - |
|
91 | - |
|
92 | - public function caf_updates($update_callbacks) |
|
93 | - { |
|
94 | - $update_callbacks[] = array($this, 'attach_evt_message_templates'); |
|
95 | - return $update_callbacks; |
|
96 | - } |
|
97 | - |
|
98 | - |
|
99 | - /** |
|
100 | - * Handles attaching Message Templates to the Event on save. |
|
101 | - * |
|
102 | - * @param EE_Event $event EE event object |
|
103 | - * @param array $data The request data from the form |
|
104 | - * @return bool success or fail |
|
105 | - * @throws EE_Error |
|
106 | - */ |
|
107 | - public function attach_evt_message_templates($event, $data) |
|
108 | - { |
|
109 | - // first we remove all existing relations on the Event for message types. |
|
110 | - $event->_remove_relations('Message_Template_Group'); |
|
111 | - // now let's just loop through the selected templates and add relations! |
|
112 | - if (isset($data['event_message_templates_relation'])) { |
|
113 | - foreach ($data['event_message_templates_relation'] as $grp_ID) { |
|
114 | - $event->_add_relation_to($grp_ID, 'Message_Template_Group'); |
|
115 | - } |
|
116 | - } |
|
117 | - // now save |
|
118 | - return $event->save(); |
|
119 | - } |
|
120 | - |
|
121 | - |
|
122 | - /** |
|
123 | - * @param $event |
|
124 | - * @param $callback_args |
|
125 | - * @return string |
|
126 | - * @throws \EE_Error |
|
127 | - */ |
|
128 | - public function messages_metabox($event, $callback_args) |
|
129 | - { |
|
130 | - // let's get the active messengers (b/c messenger objects have the active message templates) |
|
131 | - // convert 'evt_id' to 'EVT_ID' |
|
132 | - $this->_req_data['EVT_ID'] = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : null; |
|
133 | - $this->_req_data['EVT_ID'] = isset($this->_req_data['post']) && empty($this->_req_data['EVT_ID']) |
|
134 | - ? $this->_req_data['post'] |
|
135 | - : $this->_req_data['EVT_ID']; |
|
136 | - |
|
137 | - $this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID']) && isset($this->_req_data['evt_id']) |
|
138 | - ? $this->_req_data['evt_id'] |
|
139 | - : $this->_req_data['EVT_ID']; |
|
140 | - /** @type EE_Message_Resource_Manager $message_resource_manager */ |
|
141 | - $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
142 | - $active_messengers = $message_resource_manager->active_messengers(); |
|
143 | - $tabs = array(); |
|
144 | - |
|
145 | - // empty messengers? |
|
146 | - // Note message types will always have at least one available because every messenger has a default message type |
|
147 | - // associated with it (payment) if no other message types are selected. |
|
148 | - if (empty($active_messengers)) { |
|
149 | - $msg_activate_url = EE_Admin_Page::add_query_args_and_nonce( |
|
150 | - array('action' => 'settings'), |
|
151 | - EE_MSG_ADMIN_URL |
|
152 | - ); |
|
153 | - $error_msg = sprintf( |
|
154 | - esc_html__( |
|
155 | - 'There are no active messengers. So no notifications will go out for %1$sany%2$s events. You will want to %3$sActivate a Messenger%4$s.', |
|
156 | - 'event_espresso' |
|
157 | - ), |
|
158 | - '<strong>', |
|
159 | - '</strong>', |
|
160 | - '<a href="' . $msg_activate_url . '">', |
|
161 | - '</a>' |
|
162 | - ); |
|
163 | - $error_content = '<div class="error"><p>' . $error_msg . '</p></div>'; |
|
164 | - $internal_content = '<div id="messages-error"><p>' . $error_msg . '</p></div>'; |
|
165 | - |
|
166 | - echo $error_content; |
|
167 | - echo $internal_content; |
|
168 | - return ''; |
|
169 | - } |
|
170 | - |
|
171 | - $event_id = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : null; |
|
172 | - // get content for active messengers |
|
173 | - foreach ($active_messengers as $name => $messenger) { |
|
174 | - // first check if there are any active message types for this messenger. |
|
175 | - $active_mts = $message_resource_manager->get_active_message_types_for_messenger($name); |
|
176 | - if (empty($active_mts)) { |
|
177 | - continue; |
|
178 | - } |
|
179 | - |
|
180 | - $tab_content = $messenger->get_messenger_admin_page_content( |
|
181 | - 'events', |
|
182 | - 'edit', |
|
183 | - array('event' => $event_id) |
|
184 | - ); |
|
185 | - |
|
186 | - if (! empty($tab_content)) { |
|
187 | - $tabs[ $name ] = $tab_content; |
|
188 | - } |
|
189 | - } |
|
190 | - |
|
191 | - |
|
192 | - // we want this to be tabbed content so let's use the EEH_Tabbed_Content::display helper. |
|
193 | - $tabbed_content = EEH_Tabbed_Content::display($tabs); |
|
194 | - if ($tabbed_content instanceof WP_Error) { |
|
195 | - $tabbed_content = $tabbed_content->get_error_message(); |
|
196 | - } |
|
197 | - |
|
198 | - $notices = ' |
|
18 | + /** |
|
19 | + * espresso_events_Messages_Hooks_Extend constructor. |
|
20 | + * |
|
21 | + * @param \EE_Admin_Page $admin_page |
|
22 | + */ |
|
23 | + public function __construct(EE_Admin_Page $admin_page) |
|
24 | + { |
|
25 | + /** |
|
26 | + * Add cap restriction ... metaboxes should not show if user does not have the ability to edit_custom_messages |
|
27 | + */ |
|
28 | + if ( |
|
29 | + ! EE_Registry::instance()->CAP->current_user_can( |
|
30 | + 'ee_edit_messages', |
|
31 | + 'messages_events_editor_metabox' |
|
32 | + ) |
|
33 | + ) { |
|
34 | + return; |
|
35 | + } |
|
36 | + add_filter( |
|
37 | + 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', |
|
38 | + array($this, 'caf_updates'), |
|
39 | + 10 |
|
40 | + ); |
|
41 | + add_action( |
|
42 | + 'AHEE__Extend_Events_Admin_Page___duplicate_event__after', |
|
43 | + array($this, 'duplicate_custom_message_settings'), |
|
44 | + 10, |
|
45 | + 2 |
|
46 | + ); |
|
47 | + parent::__construct($admin_page); |
|
48 | + } |
|
49 | + |
|
50 | + |
|
51 | + /** |
|
52 | + * extending the properties set in espresso_events_Messages_Hooks |
|
53 | + * |
|
54 | + * @access protected |
|
55 | + * @return void |
|
56 | + */ |
|
57 | + protected function _extend_properties() |
|
58 | + { |
|
59 | + define('EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/assets/'); |
|
60 | + $this->_ajax_func = array( |
|
61 | + 'ee_msgs_create_new_custom' => 'create_new_custom', |
|
62 | + ); |
|
63 | + $this->_metaboxes = array( |
|
64 | + 0 => array( |
|
65 | + 'page_route' => array('edit', 'create_new'), |
|
66 | + 'func' => 'messages_metabox', |
|
67 | + 'label' => esc_html__('Notifications', 'event_espresso'), |
|
68 | + 'priority' => 'high', |
|
69 | + ), |
|
70 | + ); |
|
71 | + |
|
72 | + // see explanation for layout in EE_Admin_Hooks |
|
73 | + $this->_scripts_styles = array( |
|
74 | + 'registers' => array( |
|
75 | + 'events_msg_admin' => array( |
|
76 | + 'url' => EE_MSGS_EXTEND_ASSETS_URL . 'events_messages_admin.js', |
|
77 | + 'depends' => array('ee-dialog', 'ee-parse-uri', 'ee-serialize-full-array'), |
|
78 | + ), |
|
79 | + 'events_msg_admin_css' => array( |
|
80 | + 'url' => EE_MSGS_EXTEND_ASSETS_URL . 'ee_msg_events_admin.css', |
|
81 | + 'type' => 'css', |
|
82 | + ), |
|
83 | + ), |
|
84 | + 'enqueues' => array( |
|
85 | + 'events_msg_admin' => array('edit', 'create_new'), |
|
86 | + 'events_msg_admin_css' => array('edit', 'create_new'), |
|
87 | + ), |
|
88 | + ); |
|
89 | + } |
|
90 | + |
|
91 | + |
|
92 | + public function caf_updates($update_callbacks) |
|
93 | + { |
|
94 | + $update_callbacks[] = array($this, 'attach_evt_message_templates'); |
|
95 | + return $update_callbacks; |
|
96 | + } |
|
97 | + |
|
98 | + |
|
99 | + /** |
|
100 | + * Handles attaching Message Templates to the Event on save. |
|
101 | + * |
|
102 | + * @param EE_Event $event EE event object |
|
103 | + * @param array $data The request data from the form |
|
104 | + * @return bool success or fail |
|
105 | + * @throws EE_Error |
|
106 | + */ |
|
107 | + public function attach_evt_message_templates($event, $data) |
|
108 | + { |
|
109 | + // first we remove all existing relations on the Event for message types. |
|
110 | + $event->_remove_relations('Message_Template_Group'); |
|
111 | + // now let's just loop through the selected templates and add relations! |
|
112 | + if (isset($data['event_message_templates_relation'])) { |
|
113 | + foreach ($data['event_message_templates_relation'] as $grp_ID) { |
|
114 | + $event->_add_relation_to($grp_ID, 'Message_Template_Group'); |
|
115 | + } |
|
116 | + } |
|
117 | + // now save |
|
118 | + return $event->save(); |
|
119 | + } |
|
120 | + |
|
121 | + |
|
122 | + /** |
|
123 | + * @param $event |
|
124 | + * @param $callback_args |
|
125 | + * @return string |
|
126 | + * @throws \EE_Error |
|
127 | + */ |
|
128 | + public function messages_metabox($event, $callback_args) |
|
129 | + { |
|
130 | + // let's get the active messengers (b/c messenger objects have the active message templates) |
|
131 | + // convert 'evt_id' to 'EVT_ID' |
|
132 | + $this->_req_data['EVT_ID'] = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : null; |
|
133 | + $this->_req_data['EVT_ID'] = isset($this->_req_data['post']) && empty($this->_req_data['EVT_ID']) |
|
134 | + ? $this->_req_data['post'] |
|
135 | + : $this->_req_data['EVT_ID']; |
|
136 | + |
|
137 | + $this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID']) && isset($this->_req_data['evt_id']) |
|
138 | + ? $this->_req_data['evt_id'] |
|
139 | + : $this->_req_data['EVT_ID']; |
|
140 | + /** @type EE_Message_Resource_Manager $message_resource_manager */ |
|
141 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
142 | + $active_messengers = $message_resource_manager->active_messengers(); |
|
143 | + $tabs = array(); |
|
144 | + |
|
145 | + // empty messengers? |
|
146 | + // Note message types will always have at least one available because every messenger has a default message type |
|
147 | + // associated with it (payment) if no other message types are selected. |
|
148 | + if (empty($active_messengers)) { |
|
149 | + $msg_activate_url = EE_Admin_Page::add_query_args_and_nonce( |
|
150 | + array('action' => 'settings'), |
|
151 | + EE_MSG_ADMIN_URL |
|
152 | + ); |
|
153 | + $error_msg = sprintf( |
|
154 | + esc_html__( |
|
155 | + 'There are no active messengers. So no notifications will go out for %1$sany%2$s events. You will want to %3$sActivate a Messenger%4$s.', |
|
156 | + 'event_espresso' |
|
157 | + ), |
|
158 | + '<strong>', |
|
159 | + '</strong>', |
|
160 | + '<a href="' . $msg_activate_url . '">', |
|
161 | + '</a>' |
|
162 | + ); |
|
163 | + $error_content = '<div class="error"><p>' . $error_msg . '</p></div>'; |
|
164 | + $internal_content = '<div id="messages-error"><p>' . $error_msg . '</p></div>'; |
|
165 | + |
|
166 | + echo $error_content; |
|
167 | + echo $internal_content; |
|
168 | + return ''; |
|
169 | + } |
|
170 | + |
|
171 | + $event_id = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : null; |
|
172 | + // get content for active messengers |
|
173 | + foreach ($active_messengers as $name => $messenger) { |
|
174 | + // first check if there are any active message types for this messenger. |
|
175 | + $active_mts = $message_resource_manager->get_active_message_types_for_messenger($name); |
|
176 | + if (empty($active_mts)) { |
|
177 | + continue; |
|
178 | + } |
|
179 | + |
|
180 | + $tab_content = $messenger->get_messenger_admin_page_content( |
|
181 | + 'events', |
|
182 | + 'edit', |
|
183 | + array('event' => $event_id) |
|
184 | + ); |
|
185 | + |
|
186 | + if (! empty($tab_content)) { |
|
187 | + $tabs[ $name ] = $tab_content; |
|
188 | + } |
|
189 | + } |
|
190 | + |
|
191 | + |
|
192 | + // we want this to be tabbed content so let's use the EEH_Tabbed_Content::display helper. |
|
193 | + $tabbed_content = EEH_Tabbed_Content::display($tabs); |
|
194 | + if ($tabbed_content instanceof WP_Error) { |
|
195 | + $tabbed_content = $tabbed_content->get_error_message(); |
|
196 | + } |
|
197 | + |
|
198 | + $notices = ' |
|
199 | 199 | <div id="espresso-ajax-loading" class="ajax-loader-grey"> |
200 | 200 | <span class="ee-spinner ee-spin"></span><span class="hidden">' |
201 | - . esc_html__('loading...', 'event_espresso') |
|
202 | - . '</span> |
|
201 | + . esc_html__('loading...', 'event_espresso') |
|
202 | + . '</span> |
|
203 | 203 | </div> |
204 | 204 | <div class="ee-notices"></div>'; |
205 | 205 | |
206 | - if (defined('DOING_AJAX')) { |
|
207 | - return $tabbed_content; |
|
208 | - } |
|
209 | - |
|
210 | - do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content'); |
|
211 | - echo $notices . '<div class="messages-tabs-content">' . $tabbed_content . '</div>'; |
|
212 | - do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content'); |
|
213 | - } |
|
214 | - |
|
215 | - |
|
216 | - /** |
|
217 | - * Ajax callback for ee_msgs_create_new_custom ajax request. |
|
218 | - * Takes incoming GRP_ID and name and description values from ajax request |
|
219 | - * to create a new custom template based off of the incoming GRP_ID. |
|
220 | - * |
|
221 | - * @access public |
|
222 | - * @return string either an html string will be returned or a success message |
|
223 | - * @throws EE_Error |
|
224 | - */ |
|
225 | - public function create_new_custom() |
|
226 | - { |
|
227 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'create_new_custom_ajax')) { |
|
228 | - wp_die(esc_html__('You don\'t have privileges to do this action', 'event_espresso')); |
|
229 | - } |
|
230 | - |
|
231 | - /** @var RequestInterface $request */ |
|
232 | - $request = LoaderFactory::getLoader()->getShared(RequestInterface::class); |
|
233 | - |
|
234 | - // let's clean up the request data a bit for downstream usage of name and description. |
|
235 | - $templateName = ! empty($this->_req_data['custom_template_args']['MTP_name']) |
|
236 | - ? $this->_req_data['custom_template_args']['MTP_name'] |
|
237 | - : ''; |
|
238 | - $request->setRequestParam('templateName', $templateName); |
|
239 | - |
|
240 | - $templateDescription = ! empty($this->_req_data['custom_template_args']['MTP_description']) |
|
241 | - ? $this->_req_data['custom_template_args']['MTP_description'] |
|
242 | - : ''; |
|
243 | - $request->setRequestParam('templateDescription', $templateDescription); |
|
244 | - |
|
245 | - |
|
246 | - // set EE_Admin_Page object (see method details in EE_Admin_Hooks parent |
|
247 | - $this->_set_page_object(); |
|
248 | - |
|
249 | - // is this a template switch if so EE_Admin_Page child needs this object |
|
250 | - $this->_page_object->set_hook_object($this); |
|
251 | - |
|
252 | - $this->_page_object->add_message_template( |
|
253 | - $this->_req_data['messageType'], |
|
254 | - $this->_req_data['messenger'], |
|
255 | - $this->_req_data['group_ID'] |
|
256 | - ); |
|
257 | - } |
|
258 | - |
|
259 | - |
|
260 | - public function create_new_admin_footer() |
|
261 | - { |
|
262 | - $this->edit_admin_footer(); |
|
263 | - } |
|
264 | - |
|
265 | - |
|
266 | - /** |
|
267 | - * This is the dynamic method for this class |
|
268 | - * that will end up hooking into the 'admin_footer' hook on the 'edit_event' route in the events page. |
|
269 | - * |
|
270 | - * @return string |
|
271 | - * @throws DomainException |
|
272 | - */ |
|
273 | - public function edit_admin_footer() |
|
274 | - { |
|
275 | - EEH_Template::display_template( |
|
276 | - EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/create_custom_template_form.template.php' |
|
277 | - ); |
|
278 | - } |
|
279 | - |
|
280 | - |
|
281 | - /** |
|
282 | - * Callback for AHEE__Extend_Events_Admin_Page___duplicate_event__after hook used to ensure new events duplicate |
|
283 | - * the assigned custom message templates. |
|
284 | - * |
|
285 | - * @param EE_Event $new_event |
|
286 | - * @param EE_Event $original_event |
|
287 | - * @throws EE_Error |
|
288 | - */ |
|
289 | - public function duplicate_custom_message_settings(EE_Event $new_event, EE_Event $original_event) |
|
290 | - { |
|
291 | - $message_template_groups = $original_event->get_many_related('Message_Template_Group'); |
|
292 | - foreach ($message_template_groups as $message_template_group) { |
|
293 | - $new_event->_add_relation_to($message_template_group, 'Message_Template_Group'); |
|
294 | - } |
|
295 | - // save new event |
|
296 | - $new_event->save(); |
|
297 | - } |
|
206 | + if (defined('DOING_AJAX')) { |
|
207 | + return $tabbed_content; |
|
208 | + } |
|
209 | + |
|
210 | + do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content'); |
|
211 | + echo $notices . '<div class="messages-tabs-content">' . $tabbed_content . '</div>'; |
|
212 | + do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content'); |
|
213 | + } |
|
214 | + |
|
215 | + |
|
216 | + /** |
|
217 | + * Ajax callback for ee_msgs_create_new_custom ajax request. |
|
218 | + * Takes incoming GRP_ID and name and description values from ajax request |
|
219 | + * to create a new custom template based off of the incoming GRP_ID. |
|
220 | + * |
|
221 | + * @access public |
|
222 | + * @return string either an html string will be returned or a success message |
|
223 | + * @throws EE_Error |
|
224 | + */ |
|
225 | + public function create_new_custom() |
|
226 | + { |
|
227 | + if (! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'create_new_custom_ajax')) { |
|
228 | + wp_die(esc_html__('You don\'t have privileges to do this action', 'event_espresso')); |
|
229 | + } |
|
230 | + |
|
231 | + /** @var RequestInterface $request */ |
|
232 | + $request = LoaderFactory::getLoader()->getShared(RequestInterface::class); |
|
233 | + |
|
234 | + // let's clean up the request data a bit for downstream usage of name and description. |
|
235 | + $templateName = ! empty($this->_req_data['custom_template_args']['MTP_name']) |
|
236 | + ? $this->_req_data['custom_template_args']['MTP_name'] |
|
237 | + : ''; |
|
238 | + $request->setRequestParam('templateName', $templateName); |
|
239 | + |
|
240 | + $templateDescription = ! empty($this->_req_data['custom_template_args']['MTP_description']) |
|
241 | + ? $this->_req_data['custom_template_args']['MTP_description'] |
|
242 | + : ''; |
|
243 | + $request->setRequestParam('templateDescription', $templateDescription); |
|
244 | + |
|
245 | + |
|
246 | + // set EE_Admin_Page object (see method details in EE_Admin_Hooks parent |
|
247 | + $this->_set_page_object(); |
|
248 | + |
|
249 | + // is this a template switch if so EE_Admin_Page child needs this object |
|
250 | + $this->_page_object->set_hook_object($this); |
|
251 | + |
|
252 | + $this->_page_object->add_message_template( |
|
253 | + $this->_req_data['messageType'], |
|
254 | + $this->_req_data['messenger'], |
|
255 | + $this->_req_data['group_ID'] |
|
256 | + ); |
|
257 | + } |
|
258 | + |
|
259 | + |
|
260 | + public function create_new_admin_footer() |
|
261 | + { |
|
262 | + $this->edit_admin_footer(); |
|
263 | + } |
|
264 | + |
|
265 | + |
|
266 | + /** |
|
267 | + * This is the dynamic method for this class |
|
268 | + * that will end up hooking into the 'admin_footer' hook on the 'edit_event' route in the events page. |
|
269 | + * |
|
270 | + * @return string |
|
271 | + * @throws DomainException |
|
272 | + */ |
|
273 | + public function edit_admin_footer() |
|
274 | + { |
|
275 | + EEH_Template::display_template( |
|
276 | + EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/create_custom_template_form.template.php' |
|
277 | + ); |
|
278 | + } |
|
279 | + |
|
280 | + |
|
281 | + /** |
|
282 | + * Callback for AHEE__Extend_Events_Admin_Page___duplicate_event__after hook used to ensure new events duplicate |
|
283 | + * the assigned custom message templates. |
|
284 | + * |
|
285 | + * @param EE_Event $new_event |
|
286 | + * @param EE_Event $original_event |
|
287 | + * @throws EE_Error |
|
288 | + */ |
|
289 | + public function duplicate_custom_message_settings(EE_Event $new_event, EE_Event $original_event) |
|
290 | + { |
|
291 | + $message_template_groups = $original_event->get_many_related('Message_Template_Group'); |
|
292 | + foreach ($message_template_groups as $message_template_group) { |
|
293 | + $new_event->_add_relation_to($message_template_group, 'Message_Template_Group'); |
|
294 | + } |
|
295 | + // save new event |
|
296 | + $new_event->save(); |
|
297 | + } |
|
298 | 298 | } |
@@ -16,1278 +16,1278 @@ |
||
16 | 16 | { |
17 | 17 | |
18 | 18 | |
19 | - /** |
|
20 | - * This is used to hold the reports template data which is setup early in the request. |
|
21 | - * |
|
22 | - * @type array |
|
23 | - */ |
|
24 | - protected $_reports_template_data = array(); |
|
19 | + /** |
|
20 | + * This is used to hold the reports template data which is setup early in the request. |
|
21 | + * |
|
22 | + * @type array |
|
23 | + */ |
|
24 | + protected $_reports_template_data = array(); |
|
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * Extend_Registrations_Admin_Page constructor. |
|
29 | - * |
|
30 | - * @param bool $routing |
|
31 | - */ |
|
32 | - public function __construct($routing = true) |
|
33 | - { |
|
34 | - parent::__construct($routing); |
|
35 | - if (! defined('REG_CAF_TEMPLATE_PATH')) { |
|
36 | - define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/templates/'); |
|
37 | - define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/assets/'); |
|
38 | - define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registrations/assets/'); |
|
39 | - } |
|
40 | - } |
|
27 | + /** |
|
28 | + * Extend_Registrations_Admin_Page constructor. |
|
29 | + * |
|
30 | + * @param bool $routing |
|
31 | + */ |
|
32 | + public function __construct($routing = true) |
|
33 | + { |
|
34 | + parent::__construct($routing); |
|
35 | + if (! defined('REG_CAF_TEMPLATE_PATH')) { |
|
36 | + define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/templates/'); |
|
37 | + define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/assets/'); |
|
38 | + define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registrations/assets/'); |
|
39 | + } |
|
40 | + } |
|
41 | 41 | |
42 | 42 | |
43 | - /** |
|
44 | - * Extending page configuration. |
|
45 | - */ |
|
46 | - protected function _extend_page_config() |
|
47 | - { |
|
48 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations'; |
|
49 | - $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) |
|
50 | - ? $this->_req_data['_REG_ID'] |
|
51 | - : 0; |
|
52 | - $new_page_routes = array( |
|
53 | - 'reports' => array( |
|
54 | - 'func' => '_registration_reports', |
|
55 | - 'capability' => 'ee_read_registrations', |
|
56 | - ), |
|
57 | - 'registration_checkins' => array( |
|
58 | - 'func' => '_registration_checkin_list_table', |
|
59 | - 'capability' => 'ee_read_checkins', |
|
60 | - ), |
|
61 | - 'newsletter_selected_send' => array( |
|
62 | - 'func' => '_newsletter_selected_send', |
|
63 | - 'noheader' => true, |
|
64 | - 'capability' => 'ee_send_message', |
|
65 | - ), |
|
66 | - 'delete_checkin_rows' => array( |
|
67 | - 'func' => '_delete_checkin_rows', |
|
68 | - 'noheader' => true, |
|
69 | - 'capability' => 'ee_delete_checkins', |
|
70 | - ), |
|
71 | - 'delete_checkin_row' => array( |
|
72 | - 'func' => '_delete_checkin_row', |
|
73 | - 'noheader' => true, |
|
74 | - 'capability' => 'ee_delete_checkin', |
|
75 | - 'obj_id' => $reg_id, |
|
76 | - ), |
|
77 | - 'toggle_checkin_status' => array( |
|
78 | - 'func' => '_toggle_checkin_status', |
|
79 | - 'noheader' => true, |
|
80 | - 'capability' => 'ee_edit_checkin', |
|
81 | - 'obj_id' => $reg_id, |
|
82 | - ), |
|
83 | - 'toggle_checkin_status_bulk' => array( |
|
84 | - 'func' => '_toggle_checkin_status', |
|
85 | - 'noheader' => true, |
|
86 | - 'capability' => 'ee_edit_checkins', |
|
87 | - ), |
|
88 | - 'event_registrations' => array( |
|
89 | - 'func' => '_event_registrations_list_table', |
|
90 | - 'capability' => 'ee_read_checkins', |
|
91 | - ), |
|
92 | - 'registrations_checkin_report' => array( |
|
93 | - 'func' => '_registrations_checkin_report', |
|
94 | - 'noheader' => true, |
|
95 | - 'capability' => 'ee_read_registrations', |
|
96 | - ), |
|
97 | - ); |
|
98 | - $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
99 | - $new_page_config = array( |
|
100 | - 'reports' => array( |
|
101 | - 'nav' => array( |
|
102 | - 'label' => esc_html__('Reports', 'event_espresso'), |
|
103 | - 'order' => 30, |
|
104 | - ), |
|
105 | - 'help_tabs' => array( |
|
106 | - 'registrations_reports_help_tab' => array( |
|
107 | - 'title' => esc_html__('Registration Reports', 'event_espresso'), |
|
108 | - 'filename' => 'registrations_reports', |
|
109 | - ), |
|
110 | - ), |
|
111 | - /*'help_tour' => array( 'Registration_Reports_Help_Tour' ),*/ |
|
112 | - 'require_nonce' => false, |
|
113 | - ), |
|
114 | - 'event_registrations' => array( |
|
115 | - 'nav' => array( |
|
116 | - 'label' => esc_html__('Event Check-In', 'event_espresso'), |
|
117 | - 'order' => 10, |
|
118 | - 'persistent' => true, |
|
119 | - ), |
|
120 | - 'help_tabs' => array( |
|
121 | - 'registrations_event_checkin_help_tab' => array( |
|
122 | - 'title' => esc_html__('Registrations Event Check-In', 'event_espresso'), |
|
123 | - 'filename' => 'registrations_event_checkin', |
|
124 | - ), |
|
125 | - 'registrations_event_checkin_table_column_headings_help_tab' => array( |
|
126 | - 'title' => esc_html__('Event Check-In Table Column Headings', 'event_espresso'), |
|
127 | - 'filename' => 'registrations_event_checkin_table_column_headings', |
|
128 | - ), |
|
129 | - 'registrations_event_checkin_filters_help_tab' => array( |
|
130 | - 'title' => esc_html__('Event Check-In Filters', 'event_espresso'), |
|
131 | - 'filename' => 'registrations_event_checkin_filters', |
|
132 | - ), |
|
133 | - 'registrations_event_checkin_views_help_tab' => array( |
|
134 | - 'title' => esc_html__('Event Check-In Views', 'event_espresso'), |
|
135 | - 'filename' => 'registrations_event_checkin_views', |
|
136 | - ), |
|
137 | - 'registrations_event_checkin_other_help_tab' => array( |
|
138 | - 'title' => esc_html__('Event Check-In Other', 'event_espresso'), |
|
139 | - 'filename' => 'registrations_event_checkin_other', |
|
140 | - ), |
|
141 | - ), |
|
142 | - // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836 |
|
143 | - // 'help_tour' => array('Event_Checkin_Help_Tour'), |
|
144 | - 'qtips' => array('Registration_List_Table_Tips'), |
|
145 | - 'list_table' => 'EE_Event_Registrations_List_Table', |
|
146 | - 'metaboxes' => array(), |
|
147 | - 'require_nonce' => false, |
|
148 | - ), |
|
149 | - 'registration_checkins' => array( |
|
150 | - 'nav' => array( |
|
151 | - 'label' => esc_html__('Check-In Records', 'event_espresso'), |
|
152 | - 'order' => 15, |
|
153 | - 'persistent' => false, |
|
154 | - 'url' => '', |
|
155 | - ), |
|
156 | - 'list_table' => 'EE_Registration_CheckIn_List_Table', |
|
157 | - // 'help_tour' => array( 'Checkin_Toggle_View_Help_Tour' ), |
|
158 | - 'metaboxes' => array(), |
|
159 | - 'require_nonce' => false, |
|
160 | - ), |
|
161 | - ); |
|
162 | - $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
163 | - $this->_page_config['contact_list']['list_table'] = 'Extend_EE_Attendee_Contact_List_Table'; |
|
164 | - $this->_page_config['default']['list_table'] = 'Extend_EE_Registrations_List_Table'; |
|
165 | - } |
|
43 | + /** |
|
44 | + * Extending page configuration. |
|
45 | + */ |
|
46 | + protected function _extend_page_config() |
|
47 | + { |
|
48 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations'; |
|
49 | + $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) |
|
50 | + ? $this->_req_data['_REG_ID'] |
|
51 | + : 0; |
|
52 | + $new_page_routes = array( |
|
53 | + 'reports' => array( |
|
54 | + 'func' => '_registration_reports', |
|
55 | + 'capability' => 'ee_read_registrations', |
|
56 | + ), |
|
57 | + 'registration_checkins' => array( |
|
58 | + 'func' => '_registration_checkin_list_table', |
|
59 | + 'capability' => 'ee_read_checkins', |
|
60 | + ), |
|
61 | + 'newsletter_selected_send' => array( |
|
62 | + 'func' => '_newsletter_selected_send', |
|
63 | + 'noheader' => true, |
|
64 | + 'capability' => 'ee_send_message', |
|
65 | + ), |
|
66 | + 'delete_checkin_rows' => array( |
|
67 | + 'func' => '_delete_checkin_rows', |
|
68 | + 'noheader' => true, |
|
69 | + 'capability' => 'ee_delete_checkins', |
|
70 | + ), |
|
71 | + 'delete_checkin_row' => array( |
|
72 | + 'func' => '_delete_checkin_row', |
|
73 | + 'noheader' => true, |
|
74 | + 'capability' => 'ee_delete_checkin', |
|
75 | + 'obj_id' => $reg_id, |
|
76 | + ), |
|
77 | + 'toggle_checkin_status' => array( |
|
78 | + 'func' => '_toggle_checkin_status', |
|
79 | + 'noheader' => true, |
|
80 | + 'capability' => 'ee_edit_checkin', |
|
81 | + 'obj_id' => $reg_id, |
|
82 | + ), |
|
83 | + 'toggle_checkin_status_bulk' => array( |
|
84 | + 'func' => '_toggle_checkin_status', |
|
85 | + 'noheader' => true, |
|
86 | + 'capability' => 'ee_edit_checkins', |
|
87 | + ), |
|
88 | + 'event_registrations' => array( |
|
89 | + 'func' => '_event_registrations_list_table', |
|
90 | + 'capability' => 'ee_read_checkins', |
|
91 | + ), |
|
92 | + 'registrations_checkin_report' => array( |
|
93 | + 'func' => '_registrations_checkin_report', |
|
94 | + 'noheader' => true, |
|
95 | + 'capability' => 'ee_read_registrations', |
|
96 | + ), |
|
97 | + ); |
|
98 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
99 | + $new_page_config = array( |
|
100 | + 'reports' => array( |
|
101 | + 'nav' => array( |
|
102 | + 'label' => esc_html__('Reports', 'event_espresso'), |
|
103 | + 'order' => 30, |
|
104 | + ), |
|
105 | + 'help_tabs' => array( |
|
106 | + 'registrations_reports_help_tab' => array( |
|
107 | + 'title' => esc_html__('Registration Reports', 'event_espresso'), |
|
108 | + 'filename' => 'registrations_reports', |
|
109 | + ), |
|
110 | + ), |
|
111 | + /*'help_tour' => array( 'Registration_Reports_Help_Tour' ),*/ |
|
112 | + 'require_nonce' => false, |
|
113 | + ), |
|
114 | + 'event_registrations' => array( |
|
115 | + 'nav' => array( |
|
116 | + 'label' => esc_html__('Event Check-In', 'event_espresso'), |
|
117 | + 'order' => 10, |
|
118 | + 'persistent' => true, |
|
119 | + ), |
|
120 | + 'help_tabs' => array( |
|
121 | + 'registrations_event_checkin_help_tab' => array( |
|
122 | + 'title' => esc_html__('Registrations Event Check-In', 'event_espresso'), |
|
123 | + 'filename' => 'registrations_event_checkin', |
|
124 | + ), |
|
125 | + 'registrations_event_checkin_table_column_headings_help_tab' => array( |
|
126 | + 'title' => esc_html__('Event Check-In Table Column Headings', 'event_espresso'), |
|
127 | + 'filename' => 'registrations_event_checkin_table_column_headings', |
|
128 | + ), |
|
129 | + 'registrations_event_checkin_filters_help_tab' => array( |
|
130 | + 'title' => esc_html__('Event Check-In Filters', 'event_espresso'), |
|
131 | + 'filename' => 'registrations_event_checkin_filters', |
|
132 | + ), |
|
133 | + 'registrations_event_checkin_views_help_tab' => array( |
|
134 | + 'title' => esc_html__('Event Check-In Views', 'event_espresso'), |
|
135 | + 'filename' => 'registrations_event_checkin_views', |
|
136 | + ), |
|
137 | + 'registrations_event_checkin_other_help_tab' => array( |
|
138 | + 'title' => esc_html__('Event Check-In Other', 'event_espresso'), |
|
139 | + 'filename' => 'registrations_event_checkin_other', |
|
140 | + ), |
|
141 | + ), |
|
142 | + // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836 |
|
143 | + // 'help_tour' => array('Event_Checkin_Help_Tour'), |
|
144 | + 'qtips' => array('Registration_List_Table_Tips'), |
|
145 | + 'list_table' => 'EE_Event_Registrations_List_Table', |
|
146 | + 'metaboxes' => array(), |
|
147 | + 'require_nonce' => false, |
|
148 | + ), |
|
149 | + 'registration_checkins' => array( |
|
150 | + 'nav' => array( |
|
151 | + 'label' => esc_html__('Check-In Records', 'event_espresso'), |
|
152 | + 'order' => 15, |
|
153 | + 'persistent' => false, |
|
154 | + 'url' => '', |
|
155 | + ), |
|
156 | + 'list_table' => 'EE_Registration_CheckIn_List_Table', |
|
157 | + // 'help_tour' => array( 'Checkin_Toggle_View_Help_Tour' ), |
|
158 | + 'metaboxes' => array(), |
|
159 | + 'require_nonce' => false, |
|
160 | + ), |
|
161 | + ); |
|
162 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
163 | + $this->_page_config['contact_list']['list_table'] = 'Extend_EE_Attendee_Contact_List_Table'; |
|
164 | + $this->_page_config['default']['list_table'] = 'Extend_EE_Registrations_List_Table'; |
|
165 | + } |
|
166 | 166 | |
167 | 167 | |
168 | - /** |
|
169 | - * Ajax hooks for all routes in this page. |
|
170 | - */ |
|
171 | - protected function _ajax_hooks() |
|
172 | - { |
|
173 | - parent::_ajax_hooks(); |
|
174 | - add_action('wp_ajax_get_newsletter_form_content', array($this, 'get_newsletter_form_content')); |
|
175 | - } |
|
168 | + /** |
|
169 | + * Ajax hooks for all routes in this page. |
|
170 | + */ |
|
171 | + protected function _ajax_hooks() |
|
172 | + { |
|
173 | + parent::_ajax_hooks(); |
|
174 | + add_action('wp_ajax_get_newsletter_form_content', array($this, 'get_newsletter_form_content')); |
|
175 | + } |
|
176 | 176 | |
177 | 177 | |
178 | - /** |
|
179 | - * Global scripts for all routes in this page. |
|
180 | - */ |
|
181 | - public function load_scripts_styles() |
|
182 | - { |
|
183 | - parent::load_scripts_styles(); |
|
184 | - // if newsletter message type is active then let's add filter and load js for it. |
|
185 | - if (EEH_MSG_Template::is_mt_active('newsletter')) { |
|
186 | - // enqueue newsletter js |
|
187 | - wp_enqueue_script( |
|
188 | - 'ee-newsletter-trigger', |
|
189 | - REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js', |
|
190 | - array('ee-dialog'), |
|
191 | - EVENT_ESPRESSO_VERSION, |
|
192 | - true |
|
193 | - ); |
|
194 | - wp_enqueue_style( |
|
195 | - 'ee-newsletter-trigger-css', |
|
196 | - REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css', |
|
197 | - array(), |
|
198 | - EVENT_ESPRESSO_VERSION |
|
199 | - ); |
|
200 | - // hook in buttons for newsletter message type trigger. |
|
201 | - add_action( |
|
202 | - 'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', |
|
203 | - array($this, 'add_newsletter_action_buttons'), |
|
204 | - 10 |
|
205 | - ); |
|
206 | - } |
|
207 | - } |
|
178 | + /** |
|
179 | + * Global scripts for all routes in this page. |
|
180 | + */ |
|
181 | + public function load_scripts_styles() |
|
182 | + { |
|
183 | + parent::load_scripts_styles(); |
|
184 | + // if newsletter message type is active then let's add filter and load js for it. |
|
185 | + if (EEH_MSG_Template::is_mt_active('newsletter')) { |
|
186 | + // enqueue newsletter js |
|
187 | + wp_enqueue_script( |
|
188 | + 'ee-newsletter-trigger', |
|
189 | + REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js', |
|
190 | + array('ee-dialog'), |
|
191 | + EVENT_ESPRESSO_VERSION, |
|
192 | + true |
|
193 | + ); |
|
194 | + wp_enqueue_style( |
|
195 | + 'ee-newsletter-trigger-css', |
|
196 | + REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css', |
|
197 | + array(), |
|
198 | + EVENT_ESPRESSO_VERSION |
|
199 | + ); |
|
200 | + // hook in buttons for newsletter message type trigger. |
|
201 | + add_action( |
|
202 | + 'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', |
|
203 | + array($this, 'add_newsletter_action_buttons'), |
|
204 | + 10 |
|
205 | + ); |
|
206 | + } |
|
207 | + } |
|
208 | 208 | |
209 | 209 | |
210 | - /** |
|
211 | - * Scripts and styles for just the reports route. |
|
212 | - */ |
|
213 | - public function load_scripts_styles_reports() |
|
214 | - { |
|
215 | - wp_register_script( |
|
216 | - 'ee-reg-reports-js', |
|
217 | - REG_CAF_ASSETS_URL . 'ee-registration-admin-reports.js', |
|
218 | - array('google-charts'), |
|
219 | - EVENT_ESPRESSO_VERSION, |
|
220 | - true |
|
221 | - ); |
|
222 | - wp_enqueue_script('ee-reg-reports-js'); |
|
223 | - $this->_registration_reports_js_setup(); |
|
224 | - } |
|
210 | + /** |
|
211 | + * Scripts and styles for just the reports route. |
|
212 | + */ |
|
213 | + public function load_scripts_styles_reports() |
|
214 | + { |
|
215 | + wp_register_script( |
|
216 | + 'ee-reg-reports-js', |
|
217 | + REG_CAF_ASSETS_URL . 'ee-registration-admin-reports.js', |
|
218 | + array('google-charts'), |
|
219 | + EVENT_ESPRESSO_VERSION, |
|
220 | + true |
|
221 | + ); |
|
222 | + wp_enqueue_script('ee-reg-reports-js'); |
|
223 | + $this->_registration_reports_js_setup(); |
|
224 | + } |
|
225 | 225 | |
226 | 226 | |
227 | - /** |
|
228 | - * Register screen options for event_registrations route. |
|
229 | - */ |
|
230 | - protected function _add_screen_options_event_registrations() |
|
231 | - { |
|
232 | - $this->_per_page_screen_option(); |
|
233 | - } |
|
227 | + /** |
|
228 | + * Register screen options for event_registrations route. |
|
229 | + */ |
|
230 | + protected function _add_screen_options_event_registrations() |
|
231 | + { |
|
232 | + $this->_per_page_screen_option(); |
|
233 | + } |
|
234 | 234 | |
235 | 235 | |
236 | - /** |
|
237 | - * Register screen options for registration_checkins route |
|
238 | - */ |
|
239 | - protected function _add_screen_options_registration_checkins() |
|
240 | - { |
|
241 | - $page_title = $this->_admin_page_title; |
|
242 | - $this->_admin_page_title = esc_html__('Check-In Records', 'event_espresso'); |
|
243 | - $this->_per_page_screen_option(); |
|
244 | - $this->_admin_page_title = $page_title; |
|
245 | - } |
|
236 | + /** |
|
237 | + * Register screen options for registration_checkins route |
|
238 | + */ |
|
239 | + protected function _add_screen_options_registration_checkins() |
|
240 | + { |
|
241 | + $page_title = $this->_admin_page_title; |
|
242 | + $this->_admin_page_title = esc_html__('Check-In Records', 'event_espresso'); |
|
243 | + $this->_per_page_screen_option(); |
|
244 | + $this->_admin_page_title = $page_title; |
|
245 | + } |
|
246 | 246 | |
247 | 247 | |
248 | - /** |
|
249 | - * Set views property for event_registrations route. |
|
250 | - */ |
|
251 | - protected function _set_list_table_views_event_registrations() |
|
252 | - { |
|
253 | - $this->_views = array( |
|
254 | - 'all' => array( |
|
255 | - 'slug' => 'all', |
|
256 | - 'label' => esc_html__('All', 'event_espresso'), |
|
257 | - 'count' => 0, |
|
258 | - 'bulk_action' => ! isset($this->_req_data['event_id']) |
|
259 | - ? array() |
|
260 | - : array( |
|
261 | - 'toggle_checkin_status_bulk' => esc_html__('Toggle Check-In', 'event_espresso'), |
|
262 | - ), |
|
263 | - ), |
|
264 | - ); |
|
265 | - } |
|
248 | + /** |
|
249 | + * Set views property for event_registrations route. |
|
250 | + */ |
|
251 | + protected function _set_list_table_views_event_registrations() |
|
252 | + { |
|
253 | + $this->_views = array( |
|
254 | + 'all' => array( |
|
255 | + 'slug' => 'all', |
|
256 | + 'label' => esc_html__('All', 'event_espresso'), |
|
257 | + 'count' => 0, |
|
258 | + 'bulk_action' => ! isset($this->_req_data['event_id']) |
|
259 | + ? array() |
|
260 | + : array( |
|
261 | + 'toggle_checkin_status_bulk' => esc_html__('Toggle Check-In', 'event_espresso'), |
|
262 | + ), |
|
263 | + ), |
|
264 | + ); |
|
265 | + } |
|
266 | 266 | |
267 | 267 | |
268 | - /** |
|
269 | - * Set views property for registration_checkins route. |
|
270 | - */ |
|
271 | - protected function _set_list_table_views_registration_checkins() |
|
272 | - { |
|
273 | - $this->_views = array( |
|
274 | - 'all' => array( |
|
275 | - 'slug' => 'all', |
|
276 | - 'label' => esc_html__('All', 'event_espresso'), |
|
277 | - 'count' => 0, |
|
278 | - 'bulk_action' => array('delete_checkin_rows' => esc_html__('Delete Check-In Rows', 'event_espresso')), |
|
279 | - ), |
|
280 | - ); |
|
281 | - } |
|
268 | + /** |
|
269 | + * Set views property for registration_checkins route. |
|
270 | + */ |
|
271 | + protected function _set_list_table_views_registration_checkins() |
|
272 | + { |
|
273 | + $this->_views = array( |
|
274 | + 'all' => array( |
|
275 | + 'slug' => 'all', |
|
276 | + 'label' => esc_html__('All', 'event_espresso'), |
|
277 | + 'count' => 0, |
|
278 | + 'bulk_action' => array('delete_checkin_rows' => esc_html__('Delete Check-In Rows', 'event_espresso')), |
|
279 | + ), |
|
280 | + ); |
|
281 | + } |
|
282 | 282 | |
283 | 283 | |
284 | - /** |
|
285 | - * callback for ajax action. |
|
286 | - * |
|
287 | - * @since 4.3.0 |
|
288 | - * @return void (JSON) |
|
289 | - * @throws EE_Error |
|
290 | - * @throws InvalidArgumentException |
|
291 | - * @throws InvalidDataTypeException |
|
292 | - * @throws InvalidInterfaceException |
|
293 | - */ |
|
294 | - public function get_newsletter_form_content() |
|
295 | - { |
|
296 | - // do a nonce check cause we're not coming in from an normal route here. |
|
297 | - $nonce = isset($this->_req_data['get_newsletter_form_content_nonce']) ? sanitize_text_field( |
|
298 | - $this->_req_data['get_newsletter_form_content_nonce'] |
|
299 | - ) : ''; |
|
300 | - $nonce_ref = 'get_newsletter_form_content_nonce'; |
|
301 | - $this->_verify_nonce($nonce, $nonce_ref); |
|
302 | - // let's get the mtp for the incoming MTP_ ID |
|
303 | - if (! isset($this->_req_data['GRP_ID'])) { |
|
304 | - EE_Error::add_error( |
|
305 | - esc_html__( |
|
306 | - 'There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', |
|
307 | - 'event_espresso' |
|
308 | - ), |
|
309 | - __FILE__, |
|
310 | - __FUNCTION__, |
|
311 | - __LINE__ |
|
312 | - ); |
|
313 | - $this->_template_args['success'] = false; |
|
314 | - $this->_template_args['error'] = true; |
|
315 | - $this->_return_json(); |
|
316 | - } |
|
317 | - $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']); |
|
318 | - if (! $MTPG instanceof EE_Message_Template_Group) { |
|
319 | - EE_Error::add_error( |
|
320 | - sprintf( |
|
321 | - esc_html__( |
|
322 | - 'The GRP_ID given (%d) does not appear to have a corresponding row in the database.', |
|
323 | - 'event_espresso' |
|
324 | - ), |
|
325 | - $this->_req_data['GRP_ID'] |
|
326 | - ), |
|
327 | - __FILE__, |
|
328 | - __FUNCTION__, |
|
329 | - __LINE__ |
|
330 | - ); |
|
331 | - $this->_template_args['success'] = false; |
|
332 | - $this->_template_args['error'] = true; |
|
333 | - $this->_return_json(); |
|
334 | - } |
|
335 | - $MTPs = $MTPG->context_templates(); |
|
336 | - $MTPs = $MTPs['attendee']; |
|
337 | - $template_fields = array(); |
|
338 | - /** @var EE_Message_Template $MTP */ |
|
339 | - foreach ($MTPs as $MTP) { |
|
340 | - $field = $MTP->get('MTP_template_field'); |
|
341 | - if ($field === 'content') { |
|
342 | - $content = $MTP->get('MTP_content'); |
|
343 | - if (! empty($content['newsletter_content'])) { |
|
344 | - $template_fields['newsletter_content'] = $content['newsletter_content']; |
|
345 | - } |
|
346 | - continue; |
|
347 | - } |
|
348 | - $template_fields[ $MTP->get('MTP_template_field') ] = $MTP->get('MTP_content'); |
|
349 | - } |
|
350 | - $this->_template_args['success'] = true; |
|
351 | - $this->_template_args['error'] = false; |
|
352 | - $this->_template_args['data'] = array( |
|
353 | - 'batch_message_from' => isset($template_fields['from']) |
|
354 | - ? $template_fields['from'] |
|
355 | - : '', |
|
356 | - 'batch_message_subject' => isset($template_fields['subject']) |
|
357 | - ? $template_fields['subject'] |
|
358 | - : '', |
|
359 | - 'batch_message_content' => isset($template_fields['newsletter_content']) |
|
360 | - ? $template_fields['newsletter_content'] |
|
361 | - : '', |
|
362 | - ); |
|
363 | - $this->_return_json(); |
|
364 | - } |
|
284 | + /** |
|
285 | + * callback for ajax action. |
|
286 | + * |
|
287 | + * @since 4.3.0 |
|
288 | + * @return void (JSON) |
|
289 | + * @throws EE_Error |
|
290 | + * @throws InvalidArgumentException |
|
291 | + * @throws InvalidDataTypeException |
|
292 | + * @throws InvalidInterfaceException |
|
293 | + */ |
|
294 | + public function get_newsletter_form_content() |
|
295 | + { |
|
296 | + // do a nonce check cause we're not coming in from an normal route here. |
|
297 | + $nonce = isset($this->_req_data['get_newsletter_form_content_nonce']) ? sanitize_text_field( |
|
298 | + $this->_req_data['get_newsletter_form_content_nonce'] |
|
299 | + ) : ''; |
|
300 | + $nonce_ref = 'get_newsletter_form_content_nonce'; |
|
301 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
302 | + // let's get the mtp for the incoming MTP_ ID |
|
303 | + if (! isset($this->_req_data['GRP_ID'])) { |
|
304 | + EE_Error::add_error( |
|
305 | + esc_html__( |
|
306 | + 'There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', |
|
307 | + 'event_espresso' |
|
308 | + ), |
|
309 | + __FILE__, |
|
310 | + __FUNCTION__, |
|
311 | + __LINE__ |
|
312 | + ); |
|
313 | + $this->_template_args['success'] = false; |
|
314 | + $this->_template_args['error'] = true; |
|
315 | + $this->_return_json(); |
|
316 | + } |
|
317 | + $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']); |
|
318 | + if (! $MTPG instanceof EE_Message_Template_Group) { |
|
319 | + EE_Error::add_error( |
|
320 | + sprintf( |
|
321 | + esc_html__( |
|
322 | + 'The GRP_ID given (%d) does not appear to have a corresponding row in the database.', |
|
323 | + 'event_espresso' |
|
324 | + ), |
|
325 | + $this->_req_data['GRP_ID'] |
|
326 | + ), |
|
327 | + __FILE__, |
|
328 | + __FUNCTION__, |
|
329 | + __LINE__ |
|
330 | + ); |
|
331 | + $this->_template_args['success'] = false; |
|
332 | + $this->_template_args['error'] = true; |
|
333 | + $this->_return_json(); |
|
334 | + } |
|
335 | + $MTPs = $MTPG->context_templates(); |
|
336 | + $MTPs = $MTPs['attendee']; |
|
337 | + $template_fields = array(); |
|
338 | + /** @var EE_Message_Template $MTP */ |
|
339 | + foreach ($MTPs as $MTP) { |
|
340 | + $field = $MTP->get('MTP_template_field'); |
|
341 | + if ($field === 'content') { |
|
342 | + $content = $MTP->get('MTP_content'); |
|
343 | + if (! empty($content['newsletter_content'])) { |
|
344 | + $template_fields['newsletter_content'] = $content['newsletter_content']; |
|
345 | + } |
|
346 | + continue; |
|
347 | + } |
|
348 | + $template_fields[ $MTP->get('MTP_template_field') ] = $MTP->get('MTP_content'); |
|
349 | + } |
|
350 | + $this->_template_args['success'] = true; |
|
351 | + $this->_template_args['error'] = false; |
|
352 | + $this->_template_args['data'] = array( |
|
353 | + 'batch_message_from' => isset($template_fields['from']) |
|
354 | + ? $template_fields['from'] |
|
355 | + : '', |
|
356 | + 'batch_message_subject' => isset($template_fields['subject']) |
|
357 | + ? $template_fields['subject'] |
|
358 | + : '', |
|
359 | + 'batch_message_content' => isset($template_fields['newsletter_content']) |
|
360 | + ? $template_fields['newsletter_content'] |
|
361 | + : '', |
|
362 | + ); |
|
363 | + $this->_return_json(); |
|
364 | + } |
|
365 | 365 | |
366 | 366 | |
367 | - /** |
|
368 | - * callback for AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons action |
|
369 | - * |
|
370 | - * @since 4.3.0 |
|
371 | - * @param EE_Admin_List_Table $list_table |
|
372 | - * @return void |
|
373 | - * @throws InvalidArgumentException |
|
374 | - * @throws InvalidDataTypeException |
|
375 | - * @throws InvalidInterfaceException |
|
376 | - */ |
|
377 | - public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table) |
|
378 | - { |
|
379 | - if ( |
|
380 | - ! EE_Registry::instance()->CAP->current_user_can( |
|
381 | - 'ee_send_message', |
|
382 | - 'espresso_registrations_newsletter_selected_send' |
|
383 | - ) |
|
384 | - ) { |
|
385 | - return; |
|
386 | - } |
|
387 | - $routes_to_add_to = array( |
|
388 | - 'contact_list', |
|
389 | - 'event_registrations', |
|
390 | - 'default', |
|
391 | - ); |
|
392 | - if ($this->_current_page === 'espresso_registrations' && in_array($this->_req_action, $routes_to_add_to)) { |
|
393 | - if ( |
|
394 | - ($this->_req_action === 'event_registrations' && empty($this->_req_data['event_id'])) |
|
395 | - || (isset($this->_req_data['status']) && $this->_req_data['status'] === 'trash') |
|
396 | - ) { |
|
397 | - echo ''; |
|
398 | - } else { |
|
399 | - $button_text = sprintf( |
|
400 | - esc_html__('Send Batch Message (%s selected)', 'event_espresso'), |
|
401 | - '<span class="send-selected-newsletter-count">0</span>' |
|
402 | - ); |
|
403 | - echo '<button id="selected-batch-send-trigger" class="button secondary-button">' |
|
404 | - . '<span class="dashicons dashicons-email "></span>' |
|
405 | - . $button_text |
|
406 | - . '</button>'; |
|
407 | - add_action('admin_footer', array($this, 'newsletter_send_form_skeleton')); |
|
408 | - } |
|
409 | - } |
|
410 | - } |
|
367 | + /** |
|
368 | + * callback for AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons action |
|
369 | + * |
|
370 | + * @since 4.3.0 |
|
371 | + * @param EE_Admin_List_Table $list_table |
|
372 | + * @return void |
|
373 | + * @throws InvalidArgumentException |
|
374 | + * @throws InvalidDataTypeException |
|
375 | + * @throws InvalidInterfaceException |
|
376 | + */ |
|
377 | + public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table) |
|
378 | + { |
|
379 | + if ( |
|
380 | + ! EE_Registry::instance()->CAP->current_user_can( |
|
381 | + 'ee_send_message', |
|
382 | + 'espresso_registrations_newsletter_selected_send' |
|
383 | + ) |
|
384 | + ) { |
|
385 | + return; |
|
386 | + } |
|
387 | + $routes_to_add_to = array( |
|
388 | + 'contact_list', |
|
389 | + 'event_registrations', |
|
390 | + 'default', |
|
391 | + ); |
|
392 | + if ($this->_current_page === 'espresso_registrations' && in_array($this->_req_action, $routes_to_add_to)) { |
|
393 | + if ( |
|
394 | + ($this->_req_action === 'event_registrations' && empty($this->_req_data['event_id'])) |
|
395 | + || (isset($this->_req_data['status']) && $this->_req_data['status'] === 'trash') |
|
396 | + ) { |
|
397 | + echo ''; |
|
398 | + } else { |
|
399 | + $button_text = sprintf( |
|
400 | + esc_html__('Send Batch Message (%s selected)', 'event_espresso'), |
|
401 | + '<span class="send-selected-newsletter-count">0</span>' |
|
402 | + ); |
|
403 | + echo '<button id="selected-batch-send-trigger" class="button secondary-button">' |
|
404 | + . '<span class="dashicons dashicons-email "></span>' |
|
405 | + . $button_text |
|
406 | + . '</button>'; |
|
407 | + add_action('admin_footer', array($this, 'newsletter_send_form_skeleton')); |
|
408 | + } |
|
409 | + } |
|
410 | + } |
|
411 | 411 | |
412 | 412 | |
413 | - /** |
|
414 | - * @throws DomainException |
|
415 | - * @throws EE_Error |
|
416 | - * @throws InvalidArgumentException |
|
417 | - * @throws InvalidDataTypeException |
|
418 | - * @throws InvalidInterfaceException |
|
419 | - */ |
|
420 | - public function newsletter_send_form_skeleton() |
|
421 | - { |
|
422 | - $list_table = $this->_list_table_object; |
|
423 | - $codes = array(); |
|
424 | - // need to templates for the newsletter message type for the template selector. |
|
425 | - $values[] = array('text' => esc_html__('Select Template to Use', 'event_espresso'), 'id' => 0); |
|
426 | - $mtps = EEM_Message_Template_Group::instance()->get_all( |
|
427 | - array(array('MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email')) |
|
428 | - ); |
|
429 | - foreach ($mtps as $mtp) { |
|
430 | - $name = $mtp->name(); |
|
431 | - $values[] = array( |
|
432 | - 'text' => empty($name) ? esc_html__('Global', 'event_espresso') : $name, |
|
433 | - 'id' => $mtp->ID(), |
|
434 | - ); |
|
435 | - } |
|
436 | - // need to get a list of shortcodes that are available for the newsletter message type. |
|
437 | - $shortcodes = EEH_MSG_Template::get_shortcodes( |
|
438 | - 'newsletter', |
|
439 | - 'email', |
|
440 | - array(), |
|
441 | - 'attendee', |
|
442 | - false |
|
443 | - ); |
|
444 | - foreach ($shortcodes as $field => $shortcode_array) { |
|
445 | - $available_shortcodes = array(); |
|
446 | - foreach ($shortcode_array as $shortcode => $shortcode_details) { |
|
447 | - $field_id = $field === '[NEWSLETTER_CONTENT]' |
|
448 | - ? 'content' |
|
449 | - : $field; |
|
450 | - $field_id = 'batch-message-' . strtolower($field_id); |
|
451 | - $available_shortcodes[] = '<span class="js-shortcode-selection" data-value="' |
|
452 | - . $shortcode |
|
453 | - . '" data-linked-input-id="' . $field_id . '">' |
|
454 | - . $shortcode |
|
455 | - . '</span>'; |
|
456 | - } |
|
457 | - $codes[ $field ] = implode(', ', $available_shortcodes); |
|
458 | - } |
|
459 | - $shortcodes = $codes; |
|
460 | - $form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php'; |
|
461 | - $form_template_args = array( |
|
462 | - 'form_action' => admin_url('admin.php?page=espresso_registrations'), |
|
463 | - 'form_route' => 'newsletter_selected_send', |
|
464 | - 'form_nonce_name' => 'newsletter_selected_send_nonce', |
|
465 | - 'form_nonce' => wp_create_nonce('newsletter_selected_send_nonce'), |
|
466 | - 'redirect_back_to' => $this->_req_action, |
|
467 | - 'ajax_nonce' => wp_create_nonce('get_newsletter_form_content_nonce'), |
|
468 | - 'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values), |
|
469 | - 'shortcodes' => $shortcodes, |
|
470 | - 'id_type' => $list_table instanceof EE_Attendee_Contact_List_Table ? 'contact' : 'registration', |
|
471 | - ); |
|
472 | - EEH_Template::display_template($form_template, $form_template_args); |
|
473 | - } |
|
413 | + /** |
|
414 | + * @throws DomainException |
|
415 | + * @throws EE_Error |
|
416 | + * @throws InvalidArgumentException |
|
417 | + * @throws InvalidDataTypeException |
|
418 | + * @throws InvalidInterfaceException |
|
419 | + */ |
|
420 | + public function newsletter_send_form_skeleton() |
|
421 | + { |
|
422 | + $list_table = $this->_list_table_object; |
|
423 | + $codes = array(); |
|
424 | + // need to templates for the newsletter message type for the template selector. |
|
425 | + $values[] = array('text' => esc_html__('Select Template to Use', 'event_espresso'), 'id' => 0); |
|
426 | + $mtps = EEM_Message_Template_Group::instance()->get_all( |
|
427 | + array(array('MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email')) |
|
428 | + ); |
|
429 | + foreach ($mtps as $mtp) { |
|
430 | + $name = $mtp->name(); |
|
431 | + $values[] = array( |
|
432 | + 'text' => empty($name) ? esc_html__('Global', 'event_espresso') : $name, |
|
433 | + 'id' => $mtp->ID(), |
|
434 | + ); |
|
435 | + } |
|
436 | + // need to get a list of shortcodes that are available for the newsletter message type. |
|
437 | + $shortcodes = EEH_MSG_Template::get_shortcodes( |
|
438 | + 'newsletter', |
|
439 | + 'email', |
|
440 | + array(), |
|
441 | + 'attendee', |
|
442 | + false |
|
443 | + ); |
|
444 | + foreach ($shortcodes as $field => $shortcode_array) { |
|
445 | + $available_shortcodes = array(); |
|
446 | + foreach ($shortcode_array as $shortcode => $shortcode_details) { |
|
447 | + $field_id = $field === '[NEWSLETTER_CONTENT]' |
|
448 | + ? 'content' |
|
449 | + : $field; |
|
450 | + $field_id = 'batch-message-' . strtolower($field_id); |
|
451 | + $available_shortcodes[] = '<span class="js-shortcode-selection" data-value="' |
|
452 | + . $shortcode |
|
453 | + . '" data-linked-input-id="' . $field_id . '">' |
|
454 | + . $shortcode |
|
455 | + . '</span>'; |
|
456 | + } |
|
457 | + $codes[ $field ] = implode(', ', $available_shortcodes); |
|
458 | + } |
|
459 | + $shortcodes = $codes; |
|
460 | + $form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php'; |
|
461 | + $form_template_args = array( |
|
462 | + 'form_action' => admin_url('admin.php?page=espresso_registrations'), |
|
463 | + 'form_route' => 'newsletter_selected_send', |
|
464 | + 'form_nonce_name' => 'newsletter_selected_send_nonce', |
|
465 | + 'form_nonce' => wp_create_nonce('newsletter_selected_send_nonce'), |
|
466 | + 'redirect_back_to' => $this->_req_action, |
|
467 | + 'ajax_nonce' => wp_create_nonce('get_newsletter_form_content_nonce'), |
|
468 | + 'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values), |
|
469 | + 'shortcodes' => $shortcodes, |
|
470 | + 'id_type' => $list_table instanceof EE_Attendee_Contact_List_Table ? 'contact' : 'registration', |
|
471 | + ); |
|
472 | + EEH_Template::display_template($form_template, $form_template_args); |
|
473 | + } |
|
474 | 474 | |
475 | 475 | |
476 | - /** |
|
477 | - * Handles sending selected registrations/contacts a newsletter. |
|
478 | - * |
|
479 | - * @since 4.3.0 |
|
480 | - * @return void |
|
481 | - * @throws EE_Error |
|
482 | - * @throws InvalidArgumentException |
|
483 | - * @throws InvalidDataTypeException |
|
484 | - * @throws InvalidInterfaceException |
|
485 | - */ |
|
486 | - protected function _newsletter_selected_send() |
|
487 | - { |
|
488 | - $success = true; |
|
489 | - // first we need to make sure we have a GRP_ID so we know what template we're sending and updating! |
|
490 | - if (empty($this->_req_data['newsletter_mtp_selected'])) { |
|
491 | - EE_Error::add_error( |
|
492 | - esc_html__( |
|
493 | - 'In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.', |
|
494 | - 'event_espresso' |
|
495 | - ), |
|
496 | - __FILE__, |
|
497 | - __FUNCTION__, |
|
498 | - __LINE__ |
|
499 | - ); |
|
500 | - $success = false; |
|
501 | - } |
|
502 | - if ($success) { |
|
503 | - // update Message template in case there are any changes |
|
504 | - $Message_Template_Group = EEM_Message_Template_Group::instance()->get_one_by_ID( |
|
505 | - $this->_req_data['newsletter_mtp_selected'] |
|
506 | - ); |
|
507 | - $Message_Templates = $Message_Template_Group instanceof EE_Message_Template_Group |
|
508 | - ? $Message_Template_Group->context_templates() |
|
509 | - : array(); |
|
510 | - if (empty($Message_Templates)) { |
|
511 | - EE_Error::add_error( |
|
512 | - esc_html__( |
|
513 | - 'Unable to retrieve message template fields from the db. Messages not sent.', |
|
514 | - 'event_espresso' |
|
515 | - ), |
|
516 | - __FILE__, |
|
517 | - __FUNCTION__, |
|
518 | - __LINE__ |
|
519 | - ); |
|
520 | - } |
|
521 | - // let's just update the specific fields |
|
522 | - foreach ($Message_Templates['attendee'] as $Message_Template) { |
|
523 | - if ($Message_Template instanceof EE_Message_Template) { |
|
524 | - $field = $Message_Template->get('MTP_template_field'); |
|
525 | - $content = $Message_Template->get('MTP_content'); |
|
526 | - $new_content = $content; |
|
527 | - switch ($field) { |
|
528 | - case 'from': |
|
529 | - $new_content = ! empty($this->_req_data['batch_message']['from']) |
|
530 | - ? $this->_req_data['batch_message']['from'] |
|
531 | - : $content; |
|
532 | - break; |
|
533 | - case 'subject': |
|
534 | - $new_content = ! empty($this->_req_data['batch_message']['subject']) |
|
535 | - ? $this->_req_data['batch_message']['subject'] |
|
536 | - : $content; |
|
537 | - break; |
|
538 | - case 'content': |
|
539 | - $new_content = $content; |
|
540 | - $new_content['newsletter_content'] = ! empty($this->_req_data['batch_message']['content']) |
|
541 | - ? $this->_req_data['batch_message']['content'] |
|
542 | - : $content['newsletter_content']; |
|
543 | - break; |
|
544 | - default: |
|
545 | - // continue the foreach loop, we don't want to set $new_content nor save. |
|
546 | - continue 2; |
|
547 | - } |
|
548 | - $Message_Template->set('MTP_content', $new_content); |
|
549 | - $Message_Template->save(); |
|
550 | - } |
|
551 | - } |
|
552 | - // great fields are updated! now let's make sure we just have contact objects (EE_Attendee). |
|
553 | - $id_type = ! empty($this->_req_data['batch_message']['id_type']) |
|
554 | - ? $this->_req_data['batch_message']['id_type'] |
|
555 | - : 'registration'; |
|
556 | - // id_type will affect how we assemble the ids. |
|
557 | - $ids = ! empty($this->_req_data['batch_message']['ids']) |
|
558 | - ? json_decode(stripslashes($this->_req_data['batch_message']['ids'])) |
|
559 | - : array(); |
|
560 | - $registrations_used_for_contact_data = array(); |
|
561 | - // using switch because eventually we'll have other contexts that will be used for generating messages. |
|
562 | - switch ($id_type) { |
|
563 | - case 'registration': |
|
564 | - $registrations_used_for_contact_data = EEM_Registration::instance()->get_all( |
|
565 | - array( |
|
566 | - array( |
|
567 | - 'REG_ID' => array('IN', $ids), |
|
568 | - ), |
|
569 | - ) |
|
570 | - ); |
|
571 | - break; |
|
572 | - case 'contact': |
|
573 | - $registrations_used_for_contact_data = EEM_Registration::instance() |
|
574 | - ->get_latest_registration_for_each_of_given_contacts( |
|
575 | - $ids |
|
576 | - ); |
|
577 | - break; |
|
578 | - } |
|
579 | - do_action_ref_array( |
|
580 | - 'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send__with_registrations', |
|
581 | - array( |
|
582 | - $registrations_used_for_contact_data, |
|
583 | - $Message_Template_Group->ID(), |
|
584 | - ) |
|
585 | - ); |
|
586 | - // kept for backward compat, internally we no longer use this action. |
|
587 | - // @deprecated 4.8.36.rc.002 |
|
588 | - $contacts = $id_type === 'registration' |
|
589 | - ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids($ids) |
|
590 | - : EEM_Attendee::instance()->get_all(array(array('ATT_ID' => array('in', $ids)))); |
|
591 | - do_action_ref_array( |
|
592 | - 'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', |
|
593 | - array( |
|
594 | - $contacts, |
|
595 | - $Message_Template_Group->ID(), |
|
596 | - ) |
|
597 | - ); |
|
598 | - } |
|
599 | - $query_args = array( |
|
600 | - 'action' => ! empty($this->_req_data['redirect_back_to']) |
|
601 | - ? $this->_req_data['redirect_back_to'] |
|
602 | - : 'default', |
|
603 | - ); |
|
604 | - $this->_redirect_after_action(false, '', '', $query_args, true); |
|
605 | - } |
|
476 | + /** |
|
477 | + * Handles sending selected registrations/contacts a newsletter. |
|
478 | + * |
|
479 | + * @since 4.3.0 |
|
480 | + * @return void |
|
481 | + * @throws EE_Error |
|
482 | + * @throws InvalidArgumentException |
|
483 | + * @throws InvalidDataTypeException |
|
484 | + * @throws InvalidInterfaceException |
|
485 | + */ |
|
486 | + protected function _newsletter_selected_send() |
|
487 | + { |
|
488 | + $success = true; |
|
489 | + // first we need to make sure we have a GRP_ID so we know what template we're sending and updating! |
|
490 | + if (empty($this->_req_data['newsletter_mtp_selected'])) { |
|
491 | + EE_Error::add_error( |
|
492 | + esc_html__( |
|
493 | + 'In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.', |
|
494 | + 'event_espresso' |
|
495 | + ), |
|
496 | + __FILE__, |
|
497 | + __FUNCTION__, |
|
498 | + __LINE__ |
|
499 | + ); |
|
500 | + $success = false; |
|
501 | + } |
|
502 | + if ($success) { |
|
503 | + // update Message template in case there are any changes |
|
504 | + $Message_Template_Group = EEM_Message_Template_Group::instance()->get_one_by_ID( |
|
505 | + $this->_req_data['newsletter_mtp_selected'] |
|
506 | + ); |
|
507 | + $Message_Templates = $Message_Template_Group instanceof EE_Message_Template_Group |
|
508 | + ? $Message_Template_Group->context_templates() |
|
509 | + : array(); |
|
510 | + if (empty($Message_Templates)) { |
|
511 | + EE_Error::add_error( |
|
512 | + esc_html__( |
|
513 | + 'Unable to retrieve message template fields from the db. Messages not sent.', |
|
514 | + 'event_espresso' |
|
515 | + ), |
|
516 | + __FILE__, |
|
517 | + __FUNCTION__, |
|
518 | + __LINE__ |
|
519 | + ); |
|
520 | + } |
|
521 | + // let's just update the specific fields |
|
522 | + foreach ($Message_Templates['attendee'] as $Message_Template) { |
|
523 | + if ($Message_Template instanceof EE_Message_Template) { |
|
524 | + $field = $Message_Template->get('MTP_template_field'); |
|
525 | + $content = $Message_Template->get('MTP_content'); |
|
526 | + $new_content = $content; |
|
527 | + switch ($field) { |
|
528 | + case 'from': |
|
529 | + $new_content = ! empty($this->_req_data['batch_message']['from']) |
|
530 | + ? $this->_req_data['batch_message']['from'] |
|
531 | + : $content; |
|
532 | + break; |
|
533 | + case 'subject': |
|
534 | + $new_content = ! empty($this->_req_data['batch_message']['subject']) |
|
535 | + ? $this->_req_data['batch_message']['subject'] |
|
536 | + : $content; |
|
537 | + break; |
|
538 | + case 'content': |
|
539 | + $new_content = $content; |
|
540 | + $new_content['newsletter_content'] = ! empty($this->_req_data['batch_message']['content']) |
|
541 | + ? $this->_req_data['batch_message']['content'] |
|
542 | + : $content['newsletter_content']; |
|
543 | + break; |
|
544 | + default: |
|
545 | + // continue the foreach loop, we don't want to set $new_content nor save. |
|
546 | + continue 2; |
|
547 | + } |
|
548 | + $Message_Template->set('MTP_content', $new_content); |
|
549 | + $Message_Template->save(); |
|
550 | + } |
|
551 | + } |
|
552 | + // great fields are updated! now let's make sure we just have contact objects (EE_Attendee). |
|
553 | + $id_type = ! empty($this->_req_data['batch_message']['id_type']) |
|
554 | + ? $this->_req_data['batch_message']['id_type'] |
|
555 | + : 'registration'; |
|
556 | + // id_type will affect how we assemble the ids. |
|
557 | + $ids = ! empty($this->_req_data['batch_message']['ids']) |
|
558 | + ? json_decode(stripslashes($this->_req_data['batch_message']['ids'])) |
|
559 | + : array(); |
|
560 | + $registrations_used_for_contact_data = array(); |
|
561 | + // using switch because eventually we'll have other contexts that will be used for generating messages. |
|
562 | + switch ($id_type) { |
|
563 | + case 'registration': |
|
564 | + $registrations_used_for_contact_data = EEM_Registration::instance()->get_all( |
|
565 | + array( |
|
566 | + array( |
|
567 | + 'REG_ID' => array('IN', $ids), |
|
568 | + ), |
|
569 | + ) |
|
570 | + ); |
|
571 | + break; |
|
572 | + case 'contact': |
|
573 | + $registrations_used_for_contact_data = EEM_Registration::instance() |
|
574 | + ->get_latest_registration_for_each_of_given_contacts( |
|
575 | + $ids |
|
576 | + ); |
|
577 | + break; |
|
578 | + } |
|
579 | + do_action_ref_array( |
|
580 | + 'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send__with_registrations', |
|
581 | + array( |
|
582 | + $registrations_used_for_contact_data, |
|
583 | + $Message_Template_Group->ID(), |
|
584 | + ) |
|
585 | + ); |
|
586 | + // kept for backward compat, internally we no longer use this action. |
|
587 | + // @deprecated 4.8.36.rc.002 |
|
588 | + $contacts = $id_type === 'registration' |
|
589 | + ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids($ids) |
|
590 | + : EEM_Attendee::instance()->get_all(array(array('ATT_ID' => array('in', $ids)))); |
|
591 | + do_action_ref_array( |
|
592 | + 'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', |
|
593 | + array( |
|
594 | + $contacts, |
|
595 | + $Message_Template_Group->ID(), |
|
596 | + ) |
|
597 | + ); |
|
598 | + } |
|
599 | + $query_args = array( |
|
600 | + 'action' => ! empty($this->_req_data['redirect_back_to']) |
|
601 | + ? $this->_req_data['redirect_back_to'] |
|
602 | + : 'default', |
|
603 | + ); |
|
604 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
605 | + } |
|
606 | 606 | |
607 | 607 | |
608 | - /** |
|
609 | - * This is called when javascript is being enqueued to setup the various data needed for the reports js. |
|
610 | - * Also $this->{$_reports_template_data} property is set for later usage by the _registration_reports method. |
|
611 | - */ |
|
612 | - protected function _registration_reports_js_setup() |
|
613 | - { |
|
614 | - $this->_reports_template_data['admin_reports'][] = $this->_registrations_per_day_report(); |
|
615 | - $this->_reports_template_data['admin_reports'][] = $this->_registrations_per_event_report(); |
|
616 | - } |
|
608 | + /** |
|
609 | + * This is called when javascript is being enqueued to setup the various data needed for the reports js. |
|
610 | + * Also $this->{$_reports_template_data} property is set for later usage by the _registration_reports method. |
|
611 | + */ |
|
612 | + protected function _registration_reports_js_setup() |
|
613 | + { |
|
614 | + $this->_reports_template_data['admin_reports'][] = $this->_registrations_per_day_report(); |
|
615 | + $this->_reports_template_data['admin_reports'][] = $this->_registrations_per_event_report(); |
|
616 | + } |
|
617 | 617 | |
618 | 618 | |
619 | - /** |
|
620 | - * generates Business Reports regarding Registrations |
|
621 | - * |
|
622 | - * @access protected |
|
623 | - * @return void |
|
624 | - * @throws DomainException |
|
625 | - */ |
|
626 | - protected function _registration_reports() |
|
627 | - { |
|
628 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php'; |
|
629 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
630 | - $template_path, |
|
631 | - $this->_reports_template_data, |
|
632 | - true |
|
633 | - ); |
|
634 | - // the final template wrapper |
|
635 | - $this->display_admin_page_with_no_sidebar(); |
|
636 | - } |
|
619 | + /** |
|
620 | + * generates Business Reports regarding Registrations |
|
621 | + * |
|
622 | + * @access protected |
|
623 | + * @return void |
|
624 | + * @throws DomainException |
|
625 | + */ |
|
626 | + protected function _registration_reports() |
|
627 | + { |
|
628 | + $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php'; |
|
629 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
630 | + $template_path, |
|
631 | + $this->_reports_template_data, |
|
632 | + true |
|
633 | + ); |
|
634 | + // the final template wrapper |
|
635 | + $this->display_admin_page_with_no_sidebar(); |
|
636 | + } |
|
637 | 637 | |
638 | 638 | |
639 | - /** |
|
640 | - * Generates Business Report showing total registrations per day. |
|
641 | - * |
|
642 | - * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated. |
|
643 | - * @return string |
|
644 | - * @throws EE_Error |
|
645 | - * @throws InvalidArgumentException |
|
646 | - * @throws InvalidDataTypeException |
|
647 | - * @throws InvalidInterfaceException |
|
648 | - */ |
|
649 | - private function _registrations_per_day_report($period = '-1 month') |
|
650 | - { |
|
651 | - $report_ID = 'reg-admin-registrations-per-day-report-dv'; |
|
652 | - $results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report($period); |
|
653 | - $results = (array) $results; |
|
654 | - $regs = array(); |
|
655 | - $subtitle = ''; |
|
656 | - if ($results) { |
|
657 | - $column_titles = array(); |
|
658 | - $tracker = 0; |
|
659 | - foreach ($results as $result) { |
|
660 | - $report_column_values = array(); |
|
661 | - foreach ($result as $property_name => $property_value) { |
|
662 | - $property_value = $property_name === 'Registration_REG_date' ? $property_value |
|
663 | - : (int) $property_value; |
|
664 | - $report_column_values[] = $property_value; |
|
665 | - if ($tracker === 0) { |
|
666 | - if ($property_name === 'Registration_REG_date') { |
|
667 | - $column_titles[] = esc_html__( |
|
668 | - 'Date (only days with registrations are shown)', |
|
669 | - 'event_espresso' |
|
670 | - ); |
|
671 | - } else { |
|
672 | - $column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence'); |
|
673 | - } |
|
674 | - } |
|
675 | - } |
|
676 | - $tracker++; |
|
677 | - $regs[] = $report_column_values; |
|
678 | - } |
|
679 | - // make sure the column_titles is pushed to the beginning of the array |
|
680 | - array_unshift($regs, $column_titles); |
|
681 | - // setup the date range. |
|
682 | - $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone()); |
|
683 | - $beginning_date = new DateTime("now " . $period, $DateTimeZone); |
|
684 | - $ending_date = new DateTime("now", $DateTimeZone); |
|
685 | - $subtitle = sprintf( |
|
686 | - wp_strip_all_tags( |
|
687 | - _x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso') |
|
688 | - ), |
|
689 | - $beginning_date->format('Y-m-d'), |
|
690 | - $ending_date->format('Y-m-d') |
|
691 | - ); |
|
692 | - } |
|
693 | - $report_title = wp_strip_all_tags(__('Total Registrations per Day', 'event_espresso')); |
|
694 | - $report_params = array( |
|
695 | - 'title' => $report_title, |
|
696 | - 'subtitle' => $subtitle, |
|
697 | - 'id' => $report_ID, |
|
698 | - 'regs' => $regs, |
|
699 | - 'noResults' => empty($regs), |
|
700 | - 'noRegsMsg' => sprintf( |
|
701 | - wp_strip_all_tags( |
|
702 | - __( |
|
703 | - '%sThere are currently no registration records in the last month for this report.%s', |
|
704 | - 'event_espresso' |
|
705 | - ) |
|
706 | - ), |
|
707 | - '<h2>' . $report_title . '</h2><p>', |
|
708 | - '</p>' |
|
709 | - ), |
|
710 | - ); |
|
711 | - wp_localize_script('ee-reg-reports-js', 'regPerDay', $report_params); |
|
712 | - return $report_ID; |
|
713 | - } |
|
639 | + /** |
|
640 | + * Generates Business Report showing total registrations per day. |
|
641 | + * |
|
642 | + * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated. |
|
643 | + * @return string |
|
644 | + * @throws EE_Error |
|
645 | + * @throws InvalidArgumentException |
|
646 | + * @throws InvalidDataTypeException |
|
647 | + * @throws InvalidInterfaceException |
|
648 | + */ |
|
649 | + private function _registrations_per_day_report($period = '-1 month') |
|
650 | + { |
|
651 | + $report_ID = 'reg-admin-registrations-per-day-report-dv'; |
|
652 | + $results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report($period); |
|
653 | + $results = (array) $results; |
|
654 | + $regs = array(); |
|
655 | + $subtitle = ''; |
|
656 | + if ($results) { |
|
657 | + $column_titles = array(); |
|
658 | + $tracker = 0; |
|
659 | + foreach ($results as $result) { |
|
660 | + $report_column_values = array(); |
|
661 | + foreach ($result as $property_name => $property_value) { |
|
662 | + $property_value = $property_name === 'Registration_REG_date' ? $property_value |
|
663 | + : (int) $property_value; |
|
664 | + $report_column_values[] = $property_value; |
|
665 | + if ($tracker === 0) { |
|
666 | + if ($property_name === 'Registration_REG_date') { |
|
667 | + $column_titles[] = esc_html__( |
|
668 | + 'Date (only days with registrations are shown)', |
|
669 | + 'event_espresso' |
|
670 | + ); |
|
671 | + } else { |
|
672 | + $column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence'); |
|
673 | + } |
|
674 | + } |
|
675 | + } |
|
676 | + $tracker++; |
|
677 | + $regs[] = $report_column_values; |
|
678 | + } |
|
679 | + // make sure the column_titles is pushed to the beginning of the array |
|
680 | + array_unshift($regs, $column_titles); |
|
681 | + // setup the date range. |
|
682 | + $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone()); |
|
683 | + $beginning_date = new DateTime("now " . $period, $DateTimeZone); |
|
684 | + $ending_date = new DateTime("now", $DateTimeZone); |
|
685 | + $subtitle = sprintf( |
|
686 | + wp_strip_all_tags( |
|
687 | + _x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso') |
|
688 | + ), |
|
689 | + $beginning_date->format('Y-m-d'), |
|
690 | + $ending_date->format('Y-m-d') |
|
691 | + ); |
|
692 | + } |
|
693 | + $report_title = wp_strip_all_tags(__('Total Registrations per Day', 'event_espresso')); |
|
694 | + $report_params = array( |
|
695 | + 'title' => $report_title, |
|
696 | + 'subtitle' => $subtitle, |
|
697 | + 'id' => $report_ID, |
|
698 | + 'regs' => $regs, |
|
699 | + 'noResults' => empty($regs), |
|
700 | + 'noRegsMsg' => sprintf( |
|
701 | + wp_strip_all_tags( |
|
702 | + __( |
|
703 | + '%sThere are currently no registration records in the last month for this report.%s', |
|
704 | + 'event_espresso' |
|
705 | + ) |
|
706 | + ), |
|
707 | + '<h2>' . $report_title . '</h2><p>', |
|
708 | + '</p>' |
|
709 | + ), |
|
710 | + ); |
|
711 | + wp_localize_script('ee-reg-reports-js', 'regPerDay', $report_params); |
|
712 | + return $report_ID; |
|
713 | + } |
|
714 | 714 | |
715 | 715 | |
716 | - /** |
|
717 | - * Generates Business Report showing total registrations per event. |
|
718 | - * |
|
719 | - * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated. |
|
720 | - * @return string |
|
721 | - * @throws EE_Error |
|
722 | - * @throws InvalidArgumentException |
|
723 | - * @throws InvalidDataTypeException |
|
724 | - * @throws InvalidInterfaceException |
|
725 | - */ |
|
726 | - private function _registrations_per_event_report($period = '-1 month') |
|
727 | - { |
|
728 | - $report_ID = 'reg-admin-registrations-per-event-report-dv'; |
|
729 | - $results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report($period); |
|
730 | - $results = (array) $results; |
|
731 | - $regs = array(); |
|
732 | - $subtitle = ''; |
|
733 | - if ($results) { |
|
734 | - $column_titles = array(); |
|
735 | - $tracker = 0; |
|
736 | - foreach ($results as $result) { |
|
737 | - $report_column_values = array(); |
|
738 | - foreach ($result as $property_name => $property_value) { |
|
739 | - $property_value = $property_name === 'Registration_Event' ? wp_trim_words( |
|
740 | - $property_value, |
|
741 | - 4, |
|
742 | - '...' |
|
743 | - ) : (int) $property_value; |
|
744 | - $report_column_values[] = $property_value; |
|
745 | - if ($tracker === 0) { |
|
746 | - if ($property_name === 'Registration_Event') { |
|
747 | - $column_titles[] = esc_html__('Event', 'event_espresso'); |
|
748 | - } else { |
|
749 | - $column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence'); |
|
750 | - } |
|
751 | - } |
|
752 | - } |
|
753 | - $tracker++; |
|
754 | - $regs[] = $report_column_values; |
|
755 | - } |
|
756 | - // make sure the column_titles is pushed to the beginning of the array |
|
757 | - array_unshift($regs, $column_titles); |
|
758 | - // setup the date range. |
|
759 | - $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone()); |
|
760 | - $beginning_date = new DateTime("now " . $period, $DateTimeZone); |
|
761 | - $ending_date = new DateTime("now", $DateTimeZone); |
|
762 | - $subtitle = sprintf( |
|
763 | - wp_strip_all_tags( |
|
764 | - _x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso') |
|
765 | - ), |
|
766 | - $beginning_date->format('Y-m-d'), |
|
767 | - $ending_date->format('Y-m-d') |
|
768 | - ); |
|
769 | - } |
|
770 | - $report_title = wp_strip_all_tags(__('Total Registrations per Event', 'event_espresso')); |
|
771 | - $report_params = array( |
|
772 | - 'title' => $report_title, |
|
773 | - 'subtitle' => $subtitle, |
|
774 | - 'id' => $report_ID, |
|
775 | - 'regs' => $regs, |
|
776 | - 'noResults' => empty($regs), |
|
777 | - 'noRegsMsg' => sprintf( |
|
778 | - wp_strip_all_tags( |
|
779 | - __( |
|
780 | - '%sThere are currently no registration records in the last month for this report.%s', |
|
781 | - 'event_espresso' |
|
782 | - ) |
|
783 | - ), |
|
784 | - '<h2>' . $report_title . '</h2><p>', |
|
785 | - '</p>' |
|
786 | - ), |
|
787 | - ); |
|
788 | - wp_localize_script('ee-reg-reports-js', 'regPerEvent', $report_params); |
|
789 | - return $report_ID; |
|
790 | - } |
|
716 | + /** |
|
717 | + * Generates Business Report showing total registrations per event. |
|
718 | + * |
|
719 | + * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated. |
|
720 | + * @return string |
|
721 | + * @throws EE_Error |
|
722 | + * @throws InvalidArgumentException |
|
723 | + * @throws InvalidDataTypeException |
|
724 | + * @throws InvalidInterfaceException |
|
725 | + */ |
|
726 | + private function _registrations_per_event_report($period = '-1 month') |
|
727 | + { |
|
728 | + $report_ID = 'reg-admin-registrations-per-event-report-dv'; |
|
729 | + $results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report($period); |
|
730 | + $results = (array) $results; |
|
731 | + $regs = array(); |
|
732 | + $subtitle = ''; |
|
733 | + if ($results) { |
|
734 | + $column_titles = array(); |
|
735 | + $tracker = 0; |
|
736 | + foreach ($results as $result) { |
|
737 | + $report_column_values = array(); |
|
738 | + foreach ($result as $property_name => $property_value) { |
|
739 | + $property_value = $property_name === 'Registration_Event' ? wp_trim_words( |
|
740 | + $property_value, |
|
741 | + 4, |
|
742 | + '...' |
|
743 | + ) : (int) $property_value; |
|
744 | + $report_column_values[] = $property_value; |
|
745 | + if ($tracker === 0) { |
|
746 | + if ($property_name === 'Registration_Event') { |
|
747 | + $column_titles[] = esc_html__('Event', 'event_espresso'); |
|
748 | + } else { |
|
749 | + $column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence'); |
|
750 | + } |
|
751 | + } |
|
752 | + } |
|
753 | + $tracker++; |
|
754 | + $regs[] = $report_column_values; |
|
755 | + } |
|
756 | + // make sure the column_titles is pushed to the beginning of the array |
|
757 | + array_unshift($regs, $column_titles); |
|
758 | + // setup the date range. |
|
759 | + $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone()); |
|
760 | + $beginning_date = new DateTime("now " . $period, $DateTimeZone); |
|
761 | + $ending_date = new DateTime("now", $DateTimeZone); |
|
762 | + $subtitle = sprintf( |
|
763 | + wp_strip_all_tags( |
|
764 | + _x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso') |
|
765 | + ), |
|
766 | + $beginning_date->format('Y-m-d'), |
|
767 | + $ending_date->format('Y-m-d') |
|
768 | + ); |
|
769 | + } |
|
770 | + $report_title = wp_strip_all_tags(__('Total Registrations per Event', 'event_espresso')); |
|
771 | + $report_params = array( |
|
772 | + 'title' => $report_title, |
|
773 | + 'subtitle' => $subtitle, |
|
774 | + 'id' => $report_ID, |
|
775 | + 'regs' => $regs, |
|
776 | + 'noResults' => empty($regs), |
|
777 | + 'noRegsMsg' => sprintf( |
|
778 | + wp_strip_all_tags( |
|
779 | + __( |
|
780 | + '%sThere are currently no registration records in the last month for this report.%s', |
|
781 | + 'event_espresso' |
|
782 | + ) |
|
783 | + ), |
|
784 | + '<h2>' . $report_title . '</h2><p>', |
|
785 | + '</p>' |
|
786 | + ), |
|
787 | + ); |
|
788 | + wp_localize_script('ee-reg-reports-js', 'regPerEvent', $report_params); |
|
789 | + return $report_ID; |
|
790 | + } |
|
791 | 791 | |
792 | 792 | |
793 | - /** |
|
794 | - * generates HTML for the Registration Check-in list table (showing all Check-ins for a specific registration) |
|
795 | - * |
|
796 | - * @access protected |
|
797 | - * @return void |
|
798 | - * @throws EE_Error |
|
799 | - * @throws InvalidArgumentException |
|
800 | - * @throws InvalidDataTypeException |
|
801 | - * @throws InvalidInterfaceException |
|
802 | - * @throws \EventEspresso\core\exceptions\EntityNotFoundException |
|
803 | - */ |
|
804 | - protected function _registration_checkin_list_table() |
|
805 | - { |
|
806 | - do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
807 | - $reg_id = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : null; |
|
808 | - /** @var EE_Registration $registration */ |
|
809 | - $registration = EEM_Registration::instance()->get_one_by_ID($reg_id); |
|
810 | - if (! $registration instanceof EE_Registration) { |
|
811 | - throw new EE_Error( |
|
812 | - sprintf( |
|
813 | - esc_html__('An error occurred. There is no registration with ID (%d)', 'event_espresso'), |
|
814 | - $reg_id |
|
815 | - ) |
|
816 | - ); |
|
817 | - } |
|
818 | - $attendee = $registration->attendee(); |
|
819 | - $this->_admin_page_title .= $this->get_action_link_or_button( |
|
820 | - 'new_registration', |
|
821 | - 'add-registrant', |
|
822 | - array('event_id' => $registration->event_ID()), |
|
823 | - 'add-new-h2' |
|
824 | - ); |
|
825 | - $checked_in = new CheckinStatusDashicon(EE_Checkin::status_checked_in); |
|
826 | - $checked_out = new CheckinStatusDashicon(EE_Checkin::status_checked_out); |
|
827 | - $legend_items = array( |
|
828 | - 'checkin' => array( |
|
829 | - 'class' => $checked_in->cssClasses(), |
|
830 | - 'desc' => $checked_in->legendLabel(), |
|
831 | - ), |
|
832 | - 'checkout' => array( |
|
833 | - 'class' => $checked_out->cssClasses(), |
|
834 | - 'desc' => $checked_out->legendLabel(), |
|
835 | - ), |
|
836 | - ); |
|
837 | - $this->_template_args['after_list_table'] = $this->_display_legend($legend_items); |
|
838 | - $dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null; |
|
839 | - /** @var EE_Datetime $datetime */ |
|
840 | - $datetime = EEM_Datetime::instance()->get_one_by_ID($dtt_id); |
|
841 | - $datetime_label = ''; |
|
842 | - if ($datetime instanceof EE_Datetime) { |
|
843 | - $datetime_label = $datetime->get_dtt_display_name(true); |
|
844 | - $datetime_label .= ! empty($datetime_label) |
|
845 | - ? ' (' . $datetime->get_dtt_display_name() . ')' |
|
846 | - : $datetime->get_dtt_display_name(); |
|
847 | - } |
|
848 | - $datetime_link = ! empty($dtt_id) && $registration instanceof EE_Registration |
|
849 | - ? EE_Admin_Page::add_query_args_and_nonce( |
|
850 | - array( |
|
851 | - 'action' => 'event_registrations', |
|
852 | - 'event_id' => $registration->event_ID(), |
|
853 | - 'DTT_ID' => $dtt_id, |
|
854 | - ), |
|
855 | - $this->_admin_base_url |
|
856 | - ) |
|
857 | - : ''; |
|
858 | - $datetime_link = ! empty($datetime_link) |
|
859 | - ? '<a href="' . $datetime_link . '">' |
|
860 | - . '<span id="checkin-dtt">' |
|
861 | - . $datetime_label |
|
862 | - . '</span></a>' |
|
863 | - : $datetime_label; |
|
864 | - $attendee_name = $attendee instanceof EE_Attendee |
|
865 | - ? $attendee->full_name() |
|
866 | - : ''; |
|
867 | - $attendee_link = $attendee instanceof EE_Attendee |
|
868 | - ? $attendee->get_admin_details_link() |
|
869 | - : ''; |
|
870 | - $attendee_link = ! empty($attendee_link) |
|
871 | - ? '<a href="' . $attendee->get_admin_details_link() . '"' |
|
872 | - . ' title="' . esc_html__('Click for attendee details', 'event_espresso') . '">' |
|
873 | - . '<span id="checkin-attendee-name">' |
|
874 | - . $attendee_name |
|
875 | - . '</span></a>' |
|
876 | - : ''; |
|
877 | - $event_link = $registration->event() instanceof EE_Event |
|
878 | - ? $registration->event()->get_admin_details_link() |
|
879 | - : ''; |
|
880 | - $event_link = ! empty($event_link) |
|
881 | - ? '<a href="' . $event_link . '"' |
|
882 | - . ' title="' . esc_html__('Click here to edit event.', 'event_espresso') . '">' |
|
883 | - . '<span id="checkin-event-name">' |
|
884 | - . $registration->event_name() |
|
885 | - . '</span>' |
|
886 | - . '</a>' |
|
887 | - : ''; |
|
888 | - $this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id) |
|
889 | - ? '<h2>' . sprintf( |
|
890 | - esc_html__('Displaying check in records for %1$s for %2$s at the event, %3$s', 'event_espresso'), |
|
891 | - $attendee_link, |
|
892 | - $datetime_link, |
|
893 | - $event_link |
|
894 | - ) . '</h2>' |
|
895 | - : ''; |
|
896 | - $this->_template_args['list_table_hidden_fields'] = ! empty($reg_id) |
|
897 | - ? '<input type="hidden" name="_REG_ID" value="' . $reg_id . '">' : ''; |
|
898 | - $this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id) |
|
899 | - ? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : ''; |
|
900 | - $this->display_admin_list_table_page_with_no_sidebar(); |
|
901 | - } |
|
793 | + /** |
|
794 | + * generates HTML for the Registration Check-in list table (showing all Check-ins for a specific registration) |
|
795 | + * |
|
796 | + * @access protected |
|
797 | + * @return void |
|
798 | + * @throws EE_Error |
|
799 | + * @throws InvalidArgumentException |
|
800 | + * @throws InvalidDataTypeException |
|
801 | + * @throws InvalidInterfaceException |
|
802 | + * @throws \EventEspresso\core\exceptions\EntityNotFoundException |
|
803 | + */ |
|
804 | + protected function _registration_checkin_list_table() |
|
805 | + { |
|
806 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
807 | + $reg_id = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : null; |
|
808 | + /** @var EE_Registration $registration */ |
|
809 | + $registration = EEM_Registration::instance()->get_one_by_ID($reg_id); |
|
810 | + if (! $registration instanceof EE_Registration) { |
|
811 | + throw new EE_Error( |
|
812 | + sprintf( |
|
813 | + esc_html__('An error occurred. There is no registration with ID (%d)', 'event_espresso'), |
|
814 | + $reg_id |
|
815 | + ) |
|
816 | + ); |
|
817 | + } |
|
818 | + $attendee = $registration->attendee(); |
|
819 | + $this->_admin_page_title .= $this->get_action_link_or_button( |
|
820 | + 'new_registration', |
|
821 | + 'add-registrant', |
|
822 | + array('event_id' => $registration->event_ID()), |
|
823 | + 'add-new-h2' |
|
824 | + ); |
|
825 | + $checked_in = new CheckinStatusDashicon(EE_Checkin::status_checked_in); |
|
826 | + $checked_out = new CheckinStatusDashicon(EE_Checkin::status_checked_out); |
|
827 | + $legend_items = array( |
|
828 | + 'checkin' => array( |
|
829 | + 'class' => $checked_in->cssClasses(), |
|
830 | + 'desc' => $checked_in->legendLabel(), |
|
831 | + ), |
|
832 | + 'checkout' => array( |
|
833 | + 'class' => $checked_out->cssClasses(), |
|
834 | + 'desc' => $checked_out->legendLabel(), |
|
835 | + ), |
|
836 | + ); |
|
837 | + $this->_template_args['after_list_table'] = $this->_display_legend($legend_items); |
|
838 | + $dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null; |
|
839 | + /** @var EE_Datetime $datetime */ |
|
840 | + $datetime = EEM_Datetime::instance()->get_one_by_ID($dtt_id); |
|
841 | + $datetime_label = ''; |
|
842 | + if ($datetime instanceof EE_Datetime) { |
|
843 | + $datetime_label = $datetime->get_dtt_display_name(true); |
|
844 | + $datetime_label .= ! empty($datetime_label) |
|
845 | + ? ' (' . $datetime->get_dtt_display_name() . ')' |
|
846 | + : $datetime->get_dtt_display_name(); |
|
847 | + } |
|
848 | + $datetime_link = ! empty($dtt_id) && $registration instanceof EE_Registration |
|
849 | + ? EE_Admin_Page::add_query_args_and_nonce( |
|
850 | + array( |
|
851 | + 'action' => 'event_registrations', |
|
852 | + 'event_id' => $registration->event_ID(), |
|
853 | + 'DTT_ID' => $dtt_id, |
|
854 | + ), |
|
855 | + $this->_admin_base_url |
|
856 | + ) |
|
857 | + : ''; |
|
858 | + $datetime_link = ! empty($datetime_link) |
|
859 | + ? '<a href="' . $datetime_link . '">' |
|
860 | + . '<span id="checkin-dtt">' |
|
861 | + . $datetime_label |
|
862 | + . '</span></a>' |
|
863 | + : $datetime_label; |
|
864 | + $attendee_name = $attendee instanceof EE_Attendee |
|
865 | + ? $attendee->full_name() |
|
866 | + : ''; |
|
867 | + $attendee_link = $attendee instanceof EE_Attendee |
|
868 | + ? $attendee->get_admin_details_link() |
|
869 | + : ''; |
|
870 | + $attendee_link = ! empty($attendee_link) |
|
871 | + ? '<a href="' . $attendee->get_admin_details_link() . '"' |
|
872 | + . ' title="' . esc_html__('Click for attendee details', 'event_espresso') . '">' |
|
873 | + . '<span id="checkin-attendee-name">' |
|
874 | + . $attendee_name |
|
875 | + . '</span></a>' |
|
876 | + : ''; |
|
877 | + $event_link = $registration->event() instanceof EE_Event |
|
878 | + ? $registration->event()->get_admin_details_link() |
|
879 | + : ''; |
|
880 | + $event_link = ! empty($event_link) |
|
881 | + ? '<a href="' . $event_link . '"' |
|
882 | + . ' title="' . esc_html__('Click here to edit event.', 'event_espresso') . '">' |
|
883 | + . '<span id="checkin-event-name">' |
|
884 | + . $registration->event_name() |
|
885 | + . '</span>' |
|
886 | + . '</a>' |
|
887 | + : ''; |
|
888 | + $this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id) |
|
889 | + ? '<h2>' . sprintf( |
|
890 | + esc_html__('Displaying check in records for %1$s for %2$s at the event, %3$s', 'event_espresso'), |
|
891 | + $attendee_link, |
|
892 | + $datetime_link, |
|
893 | + $event_link |
|
894 | + ) . '</h2>' |
|
895 | + : ''; |
|
896 | + $this->_template_args['list_table_hidden_fields'] = ! empty($reg_id) |
|
897 | + ? '<input type="hidden" name="_REG_ID" value="' . $reg_id . '">' : ''; |
|
898 | + $this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id) |
|
899 | + ? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : ''; |
|
900 | + $this->display_admin_list_table_page_with_no_sidebar(); |
|
901 | + } |
|
902 | 902 | |
903 | 903 | |
904 | - /** |
|
905 | - * toggle the Check-in status for the given registration (coming from ajax) |
|
906 | - * |
|
907 | - * @return void (JSON) |
|
908 | - * @throws EE_Error |
|
909 | - * @throws InvalidArgumentException |
|
910 | - * @throws InvalidDataTypeException |
|
911 | - * @throws InvalidInterfaceException |
|
912 | - */ |
|
913 | - public function toggle_checkin_status() |
|
914 | - { |
|
915 | - // first make sure we have the necessary data |
|
916 | - if (! isset($this->_req_data['_regid'])) { |
|
917 | - EE_Error::add_error( |
|
918 | - esc_html__( |
|
919 | - 'There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', |
|
920 | - 'event_espresso' |
|
921 | - ), |
|
922 | - __FILE__, |
|
923 | - __FUNCTION__, |
|
924 | - __LINE__ |
|
925 | - ); |
|
926 | - $this->_template_args['success'] = false; |
|
927 | - $this->_template_args['error'] = true; |
|
928 | - $this->_return_json(); |
|
929 | - }; |
|
930 | - // do a nonce check cause we're not coming in from an normal route here. |
|
931 | - $nonce = isset($this->_req_data['checkinnonce']) ? sanitize_text_field($this->_req_data['checkinnonce']) |
|
932 | - : ''; |
|
933 | - $nonce_ref = 'checkin_nonce'; |
|
934 | - $this->_verify_nonce($nonce, $nonce_ref); |
|
935 | - // beautiful! Made it this far so let's get the status. |
|
936 | - $new_status = new CheckinStatusDashicon($this->_toggle_checkin_status()); |
|
937 | - // setup new class to return via ajax |
|
938 | - $this->_template_args['admin_page_content'] = 'clickable trigger-checkin ' . $new_status->cssClasses(); |
|
939 | - $this->_template_args['success'] = true; |
|
940 | - $this->_return_json(); |
|
941 | - } |
|
904 | + /** |
|
905 | + * toggle the Check-in status for the given registration (coming from ajax) |
|
906 | + * |
|
907 | + * @return void (JSON) |
|
908 | + * @throws EE_Error |
|
909 | + * @throws InvalidArgumentException |
|
910 | + * @throws InvalidDataTypeException |
|
911 | + * @throws InvalidInterfaceException |
|
912 | + */ |
|
913 | + public function toggle_checkin_status() |
|
914 | + { |
|
915 | + // first make sure we have the necessary data |
|
916 | + if (! isset($this->_req_data['_regid'])) { |
|
917 | + EE_Error::add_error( |
|
918 | + esc_html__( |
|
919 | + 'There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', |
|
920 | + 'event_espresso' |
|
921 | + ), |
|
922 | + __FILE__, |
|
923 | + __FUNCTION__, |
|
924 | + __LINE__ |
|
925 | + ); |
|
926 | + $this->_template_args['success'] = false; |
|
927 | + $this->_template_args['error'] = true; |
|
928 | + $this->_return_json(); |
|
929 | + }; |
|
930 | + // do a nonce check cause we're not coming in from an normal route here. |
|
931 | + $nonce = isset($this->_req_data['checkinnonce']) ? sanitize_text_field($this->_req_data['checkinnonce']) |
|
932 | + : ''; |
|
933 | + $nonce_ref = 'checkin_nonce'; |
|
934 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
935 | + // beautiful! Made it this far so let's get the status. |
|
936 | + $new_status = new CheckinStatusDashicon($this->_toggle_checkin_status()); |
|
937 | + // setup new class to return via ajax |
|
938 | + $this->_template_args['admin_page_content'] = 'clickable trigger-checkin ' . $new_status->cssClasses(); |
|
939 | + $this->_template_args['success'] = true; |
|
940 | + $this->_return_json(); |
|
941 | + } |
|
942 | 942 | |
943 | 943 | |
944 | - /** |
|
945 | - * handles toggling the checkin status for the registration, |
|
946 | - * |
|
947 | - * @access protected |
|
948 | - * @return int|void |
|
949 | - * @throws EE_Error |
|
950 | - * @throws InvalidArgumentException |
|
951 | - * @throws InvalidDataTypeException |
|
952 | - * @throws InvalidInterfaceException |
|
953 | - */ |
|
954 | - protected function _toggle_checkin_status() |
|
955 | - { |
|
956 | - // first let's get the query args out of the way for the redirect |
|
957 | - $query_args = array( |
|
958 | - 'action' => 'event_registrations', |
|
959 | - 'event_id' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null, |
|
960 | - 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null, |
|
961 | - ); |
|
962 | - $new_status = false; |
|
963 | - // bulk action check in toggle |
|
964 | - if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
965 | - // cycle thru checkboxes |
|
966 | - while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) { |
|
967 | - $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null; |
|
968 | - $new_status = $this->_toggle_checkin($REG_ID, $DTT_ID); |
|
969 | - } |
|
970 | - } elseif (isset($this->_req_data['_regid'])) { |
|
971 | - // coming from ajax request |
|
972 | - $DTT_ID = isset($this->_req_data['dttid']) ? $this->_req_data['dttid'] : null; |
|
973 | - $query_args['DTT_ID'] = $DTT_ID; |
|
974 | - $new_status = $this->_toggle_checkin($this->_req_data['_regid'], $DTT_ID); |
|
975 | - } else { |
|
976 | - EE_Error::add_error( |
|
977 | - esc_html__('Missing some required data to toggle the Check-in', 'event_espresso'), |
|
978 | - __FILE__, |
|
979 | - __FUNCTION__, |
|
980 | - __LINE__ |
|
981 | - ); |
|
982 | - } |
|
983 | - if (defined('DOING_AJAX')) { |
|
984 | - return $new_status; |
|
985 | - } |
|
986 | - $this->_redirect_after_action(false, '', '', $query_args, true); |
|
987 | - } |
|
944 | + /** |
|
945 | + * handles toggling the checkin status for the registration, |
|
946 | + * |
|
947 | + * @access protected |
|
948 | + * @return int|void |
|
949 | + * @throws EE_Error |
|
950 | + * @throws InvalidArgumentException |
|
951 | + * @throws InvalidDataTypeException |
|
952 | + * @throws InvalidInterfaceException |
|
953 | + */ |
|
954 | + protected function _toggle_checkin_status() |
|
955 | + { |
|
956 | + // first let's get the query args out of the way for the redirect |
|
957 | + $query_args = array( |
|
958 | + 'action' => 'event_registrations', |
|
959 | + 'event_id' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null, |
|
960 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null, |
|
961 | + ); |
|
962 | + $new_status = false; |
|
963 | + // bulk action check in toggle |
|
964 | + if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
965 | + // cycle thru checkboxes |
|
966 | + while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) { |
|
967 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null; |
|
968 | + $new_status = $this->_toggle_checkin($REG_ID, $DTT_ID); |
|
969 | + } |
|
970 | + } elseif (isset($this->_req_data['_regid'])) { |
|
971 | + // coming from ajax request |
|
972 | + $DTT_ID = isset($this->_req_data['dttid']) ? $this->_req_data['dttid'] : null; |
|
973 | + $query_args['DTT_ID'] = $DTT_ID; |
|
974 | + $new_status = $this->_toggle_checkin($this->_req_data['_regid'], $DTT_ID); |
|
975 | + } else { |
|
976 | + EE_Error::add_error( |
|
977 | + esc_html__('Missing some required data to toggle the Check-in', 'event_espresso'), |
|
978 | + __FILE__, |
|
979 | + __FUNCTION__, |
|
980 | + __LINE__ |
|
981 | + ); |
|
982 | + } |
|
983 | + if (defined('DOING_AJAX')) { |
|
984 | + return $new_status; |
|
985 | + } |
|
986 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
987 | + } |
|
988 | 988 | |
989 | 989 | |
990 | - /** |
|
991 | - * This is toggles a single Check-in for the given registration and datetime. |
|
992 | - * |
|
993 | - * @param int $REG_ID The registration we're toggling |
|
994 | - * @param int $DTT_ID The datetime we're toggling |
|
995 | - * @return int The new status toggled to. |
|
996 | - * @throws EE_Error |
|
997 | - * @throws InvalidArgumentException |
|
998 | - * @throws InvalidDataTypeException |
|
999 | - * @throws InvalidInterfaceException |
|
1000 | - */ |
|
1001 | - private function _toggle_checkin($REG_ID, $DTT_ID) |
|
1002 | - { |
|
1003 | - /** @var EE_Registration $REG */ |
|
1004 | - $REG = EEM_Registration::instance()->get_one_by_ID($REG_ID); |
|
1005 | - $new_status = $REG->toggle_checkin_status($DTT_ID); |
|
1006 | - if ($new_status !== false) { |
|
1007 | - EE_Error::add_success($REG->get_checkin_msg($DTT_ID)); |
|
1008 | - } else { |
|
1009 | - EE_Error::add_error($REG->get_checkin_msg($DTT_ID, true), __FILE__, __FUNCTION__, __LINE__); |
|
1010 | - $new_status = false; |
|
1011 | - } |
|
1012 | - return $new_status; |
|
1013 | - } |
|
990 | + /** |
|
991 | + * This is toggles a single Check-in for the given registration and datetime. |
|
992 | + * |
|
993 | + * @param int $REG_ID The registration we're toggling |
|
994 | + * @param int $DTT_ID The datetime we're toggling |
|
995 | + * @return int The new status toggled to. |
|
996 | + * @throws EE_Error |
|
997 | + * @throws InvalidArgumentException |
|
998 | + * @throws InvalidDataTypeException |
|
999 | + * @throws InvalidInterfaceException |
|
1000 | + */ |
|
1001 | + private function _toggle_checkin($REG_ID, $DTT_ID) |
|
1002 | + { |
|
1003 | + /** @var EE_Registration $REG */ |
|
1004 | + $REG = EEM_Registration::instance()->get_one_by_ID($REG_ID); |
|
1005 | + $new_status = $REG->toggle_checkin_status($DTT_ID); |
|
1006 | + if ($new_status !== false) { |
|
1007 | + EE_Error::add_success($REG->get_checkin_msg($DTT_ID)); |
|
1008 | + } else { |
|
1009 | + EE_Error::add_error($REG->get_checkin_msg($DTT_ID, true), __FILE__, __FUNCTION__, __LINE__); |
|
1010 | + $new_status = false; |
|
1011 | + } |
|
1012 | + return $new_status; |
|
1013 | + } |
|
1014 | 1014 | |
1015 | 1015 | |
1016 | - /** |
|
1017 | - * Takes care of deleting multiple EE_Checkin table rows |
|
1018 | - * |
|
1019 | - * @access protected |
|
1020 | - * @return void |
|
1021 | - * @throws EE_Error |
|
1022 | - * @throws InvalidArgumentException |
|
1023 | - * @throws InvalidDataTypeException |
|
1024 | - * @throws InvalidInterfaceException |
|
1025 | - */ |
|
1026 | - protected function _delete_checkin_rows() |
|
1027 | - { |
|
1028 | - $query_args = array( |
|
1029 | - 'action' => 'registration_checkins', |
|
1030 | - 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0, |
|
1031 | - '_REG_ID' => isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0, |
|
1032 | - ); |
|
1033 | - $errors = 0; |
|
1034 | - if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1035 | - while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1036 | - if (! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) { |
|
1037 | - $errors++; |
|
1038 | - } |
|
1039 | - } |
|
1040 | - } else { |
|
1041 | - EE_Error::add_error( |
|
1042 | - esc_html__( |
|
1043 | - 'So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', |
|
1044 | - 'event_espresso' |
|
1045 | - ), |
|
1046 | - __FILE__, |
|
1047 | - __FUNCTION__, |
|
1048 | - __LINE__ |
|
1049 | - ); |
|
1050 | - $this->_redirect_after_action(false, '', '', $query_args, true); |
|
1051 | - } |
|
1052 | - if ($errors > 0) { |
|
1053 | - EE_Error::add_error( |
|
1054 | - sprintf(esc_html__('There were %d records that did not delete successfully', 'event_espresso'), $errors), |
|
1055 | - __FILE__, |
|
1056 | - __FUNCTION__, |
|
1057 | - __LINE__ |
|
1058 | - ); |
|
1059 | - } else { |
|
1060 | - EE_Error::add_success(esc_html__('Records were successfully deleted', 'event_espresso')); |
|
1061 | - } |
|
1062 | - $this->_redirect_after_action(false, '', '', $query_args, true); |
|
1063 | - } |
|
1016 | + /** |
|
1017 | + * Takes care of deleting multiple EE_Checkin table rows |
|
1018 | + * |
|
1019 | + * @access protected |
|
1020 | + * @return void |
|
1021 | + * @throws EE_Error |
|
1022 | + * @throws InvalidArgumentException |
|
1023 | + * @throws InvalidDataTypeException |
|
1024 | + * @throws InvalidInterfaceException |
|
1025 | + */ |
|
1026 | + protected function _delete_checkin_rows() |
|
1027 | + { |
|
1028 | + $query_args = array( |
|
1029 | + 'action' => 'registration_checkins', |
|
1030 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0, |
|
1031 | + '_REG_ID' => isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0, |
|
1032 | + ); |
|
1033 | + $errors = 0; |
|
1034 | + if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1035 | + while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1036 | + if (! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) { |
|
1037 | + $errors++; |
|
1038 | + } |
|
1039 | + } |
|
1040 | + } else { |
|
1041 | + EE_Error::add_error( |
|
1042 | + esc_html__( |
|
1043 | + 'So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', |
|
1044 | + 'event_espresso' |
|
1045 | + ), |
|
1046 | + __FILE__, |
|
1047 | + __FUNCTION__, |
|
1048 | + __LINE__ |
|
1049 | + ); |
|
1050 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
1051 | + } |
|
1052 | + if ($errors > 0) { |
|
1053 | + EE_Error::add_error( |
|
1054 | + sprintf(esc_html__('There were %d records that did not delete successfully', 'event_espresso'), $errors), |
|
1055 | + __FILE__, |
|
1056 | + __FUNCTION__, |
|
1057 | + __LINE__ |
|
1058 | + ); |
|
1059 | + } else { |
|
1060 | + EE_Error::add_success(esc_html__('Records were successfully deleted', 'event_espresso')); |
|
1061 | + } |
|
1062 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
1063 | + } |
|
1064 | 1064 | |
1065 | 1065 | |
1066 | - /** |
|
1067 | - * Deletes a single EE_Checkin row |
|
1068 | - * |
|
1069 | - * @return void |
|
1070 | - * @throws EE_Error |
|
1071 | - * @throws InvalidArgumentException |
|
1072 | - * @throws InvalidDataTypeException |
|
1073 | - * @throws InvalidInterfaceException |
|
1074 | - */ |
|
1075 | - protected function _delete_checkin_row() |
|
1076 | - { |
|
1077 | - $query_args = array( |
|
1078 | - 'action' => 'registration_checkins', |
|
1079 | - 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0, |
|
1080 | - '_REG_ID' => isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0, |
|
1081 | - ); |
|
1082 | - if (! empty($this->_req_data['CHK_ID'])) { |
|
1083 | - if (! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) { |
|
1084 | - EE_Error::add_error( |
|
1085 | - esc_html__('Something went wrong and this check-in record was not deleted', 'event_espresso'), |
|
1086 | - __FILE__, |
|
1087 | - __FUNCTION__, |
|
1088 | - __LINE__ |
|
1089 | - ); |
|
1090 | - } else { |
|
1091 | - EE_Error::add_success(esc_html__('Check-In record successfully deleted', 'event_espresso')); |
|
1092 | - } |
|
1093 | - } else { |
|
1094 | - EE_Error::add_error( |
|
1095 | - esc_html__( |
|
1096 | - 'In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', |
|
1097 | - 'event_espresso' |
|
1098 | - ), |
|
1099 | - __FILE__, |
|
1100 | - __FUNCTION__, |
|
1101 | - __LINE__ |
|
1102 | - ); |
|
1103 | - } |
|
1104 | - $this->_redirect_after_action(false, '', '', $query_args, true); |
|
1105 | - } |
|
1066 | + /** |
|
1067 | + * Deletes a single EE_Checkin row |
|
1068 | + * |
|
1069 | + * @return void |
|
1070 | + * @throws EE_Error |
|
1071 | + * @throws InvalidArgumentException |
|
1072 | + * @throws InvalidDataTypeException |
|
1073 | + * @throws InvalidInterfaceException |
|
1074 | + */ |
|
1075 | + protected function _delete_checkin_row() |
|
1076 | + { |
|
1077 | + $query_args = array( |
|
1078 | + 'action' => 'registration_checkins', |
|
1079 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0, |
|
1080 | + '_REG_ID' => isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0, |
|
1081 | + ); |
|
1082 | + if (! empty($this->_req_data['CHK_ID'])) { |
|
1083 | + if (! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) { |
|
1084 | + EE_Error::add_error( |
|
1085 | + esc_html__('Something went wrong and this check-in record was not deleted', 'event_espresso'), |
|
1086 | + __FILE__, |
|
1087 | + __FUNCTION__, |
|
1088 | + __LINE__ |
|
1089 | + ); |
|
1090 | + } else { |
|
1091 | + EE_Error::add_success(esc_html__('Check-In record successfully deleted', 'event_espresso')); |
|
1092 | + } |
|
1093 | + } else { |
|
1094 | + EE_Error::add_error( |
|
1095 | + esc_html__( |
|
1096 | + 'In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', |
|
1097 | + 'event_espresso' |
|
1098 | + ), |
|
1099 | + __FILE__, |
|
1100 | + __FUNCTION__, |
|
1101 | + __LINE__ |
|
1102 | + ); |
|
1103 | + } |
|
1104 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
1105 | + } |
|
1106 | 1106 | |
1107 | 1107 | |
1108 | - /** |
|
1109 | - * generates HTML for the Event Registrations List Table |
|
1110 | - * |
|
1111 | - * @access protected |
|
1112 | - * @return void |
|
1113 | - * @throws EE_Error |
|
1114 | - * @throws InvalidArgumentException |
|
1115 | - * @throws InvalidDataTypeException |
|
1116 | - * @throws InvalidInterfaceException |
|
1117 | - */ |
|
1118 | - protected function _event_registrations_list_table() |
|
1119 | - { |
|
1120 | - do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1121 | - $this->_admin_page_title .= isset($this->_req_data['event_id']) |
|
1122 | - ? $this->get_action_link_or_button( |
|
1123 | - 'new_registration', |
|
1124 | - 'add-registrant', |
|
1125 | - array('event_id' => $this->_req_data['event_id']), |
|
1126 | - 'add-new-h2', |
|
1127 | - '', |
|
1128 | - false |
|
1129 | - ) |
|
1130 | - : ''; |
|
1131 | - $checked_in = new CheckinStatusDashicon(EE_Checkin::status_checked_in); |
|
1132 | - $checked_out = new CheckinStatusDashicon(EE_Checkin::status_checked_out); |
|
1133 | - $checked_never = new CheckinStatusDashicon(EE_Checkin::status_checked_never); |
|
1134 | - $legend_items = array( |
|
1135 | - 'star-icon' => array( |
|
1136 | - 'class' => 'dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8', |
|
1137 | - 'desc' => esc_html__('This Registrant is the Primary Registrant', 'event_espresso'), |
|
1138 | - ), |
|
1139 | - 'checkin' => array( |
|
1140 | - 'class' => $checked_in->cssClasses(), |
|
1141 | - 'desc' => $checked_in->legendLabel(), |
|
1142 | - ), |
|
1143 | - 'checkout' => array( |
|
1144 | - 'class' => $checked_out->cssClasses(), |
|
1145 | - 'desc' => $checked_out->legendLabel(), |
|
1146 | - ), |
|
1147 | - 'nocheckinrecord' => array( |
|
1148 | - 'class' => $checked_never->cssClasses(), |
|
1149 | - 'desc' => $checked_never->legendLabel(), |
|
1150 | - ), |
|
1151 | - 'approved_status' => array( |
|
1152 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
1153 | - 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence'), |
|
1154 | - ), |
|
1155 | - 'cancelled_status' => array( |
|
1156 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
1157 | - 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence'), |
|
1158 | - ), |
|
1159 | - 'declined_status' => array( |
|
1160 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
1161 | - 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence'), |
|
1162 | - ), |
|
1163 | - 'not_approved' => array( |
|
1164 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
1165 | - 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence'), |
|
1166 | - ), |
|
1167 | - 'pending_status' => array( |
|
1168 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
1169 | - 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence'), |
|
1170 | - ), |
|
1171 | - 'wait_list' => array( |
|
1172 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list, |
|
1173 | - 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence'), |
|
1174 | - ), |
|
1175 | - ); |
|
1176 | - $this->_template_args['after_list_table'] = $this->_display_legend($legend_items); |
|
1177 | - $event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null; |
|
1178 | - /** @var EE_Event $event */ |
|
1179 | - $event = EEM_Event::instance()->get_one_by_ID($event_id); |
|
1180 | - $this->_template_args['before_list_table'] = $event instanceof EE_Event |
|
1181 | - ? '<h2>' . sprintf( |
|
1182 | - esc_html__('Viewing Registrations for Event: %s', 'event_espresso'), |
|
1183 | - EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name') |
|
1184 | - ) . '</h2>' |
|
1185 | - : ''; |
|
1186 | - // need to get the number of datetimes on the event and set default datetime_id if there is only one datetime on |
|
1187 | - // the event. |
|
1188 | - $DTT_ID = ! empty($this->_req_data['DTT_ID']) ? absint($this->_req_data['DTT_ID']) : 0; |
|
1189 | - $datetime = null; |
|
1190 | - if ($event instanceof EE_Event) { |
|
1191 | - $datetimes_on_event = $event->datetimes(); |
|
1192 | - if (count($datetimes_on_event) === 1) { |
|
1193 | - $datetime = reset($datetimes_on_event); |
|
1194 | - } |
|
1195 | - } |
|
1196 | - $datetime = $datetime instanceof EE_Datetime ? $datetime : EEM_Datetime::instance()->get_one_by_ID($DTT_ID); |
|
1197 | - if ($datetime instanceof EE_Datetime && $this->_template_args['before_list_table'] !== '') { |
|
1198 | - $this->_template_args['before_list_table'] = substr($this->_template_args['before_list_table'], 0, -5); |
|
1199 | - $this->_template_args['before_list_table'] .= ' <span class="drk-grey-text">'; |
|
1200 | - $this->_template_args['before_list_table'] .= '<span class="dashicons dashicons-calendar"></span>'; |
|
1201 | - $this->_template_args['before_list_table'] .= $datetime->name(); |
|
1202 | - $this->_template_args['before_list_table'] .= ' ( ' . $datetime->date_and_time_range() . ' )'; |
|
1203 | - $this->_template_args['before_list_table'] .= '</span></h2>'; |
|
1204 | - } |
|
1205 | - // if no datetime, then we're on the initial view, so let's give some helpful instructions on what the status |
|
1206 | - // column represents |
|
1207 | - if (! $datetime instanceof EE_Datetime) { |
|
1208 | - $this->_template_args['before_list_table'] .= '<br><p class="description">' |
|
1209 | - . esc_html__( |
|
1210 | - 'In this view, the check-in status represents the latest check-in record for the registration in that row.', |
|
1211 | - 'event_espresso' |
|
1212 | - ) |
|
1213 | - . '</p>'; |
|
1214 | - } |
|
1215 | - $this->display_admin_list_table_page_with_no_sidebar(); |
|
1216 | - } |
|
1108 | + /** |
|
1109 | + * generates HTML for the Event Registrations List Table |
|
1110 | + * |
|
1111 | + * @access protected |
|
1112 | + * @return void |
|
1113 | + * @throws EE_Error |
|
1114 | + * @throws InvalidArgumentException |
|
1115 | + * @throws InvalidDataTypeException |
|
1116 | + * @throws InvalidInterfaceException |
|
1117 | + */ |
|
1118 | + protected function _event_registrations_list_table() |
|
1119 | + { |
|
1120 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1121 | + $this->_admin_page_title .= isset($this->_req_data['event_id']) |
|
1122 | + ? $this->get_action_link_or_button( |
|
1123 | + 'new_registration', |
|
1124 | + 'add-registrant', |
|
1125 | + array('event_id' => $this->_req_data['event_id']), |
|
1126 | + 'add-new-h2', |
|
1127 | + '', |
|
1128 | + false |
|
1129 | + ) |
|
1130 | + : ''; |
|
1131 | + $checked_in = new CheckinStatusDashicon(EE_Checkin::status_checked_in); |
|
1132 | + $checked_out = new CheckinStatusDashicon(EE_Checkin::status_checked_out); |
|
1133 | + $checked_never = new CheckinStatusDashicon(EE_Checkin::status_checked_never); |
|
1134 | + $legend_items = array( |
|
1135 | + 'star-icon' => array( |
|
1136 | + 'class' => 'dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8', |
|
1137 | + 'desc' => esc_html__('This Registrant is the Primary Registrant', 'event_espresso'), |
|
1138 | + ), |
|
1139 | + 'checkin' => array( |
|
1140 | + 'class' => $checked_in->cssClasses(), |
|
1141 | + 'desc' => $checked_in->legendLabel(), |
|
1142 | + ), |
|
1143 | + 'checkout' => array( |
|
1144 | + 'class' => $checked_out->cssClasses(), |
|
1145 | + 'desc' => $checked_out->legendLabel(), |
|
1146 | + ), |
|
1147 | + 'nocheckinrecord' => array( |
|
1148 | + 'class' => $checked_never->cssClasses(), |
|
1149 | + 'desc' => $checked_never->legendLabel(), |
|
1150 | + ), |
|
1151 | + 'approved_status' => array( |
|
1152 | + 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
1153 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence'), |
|
1154 | + ), |
|
1155 | + 'cancelled_status' => array( |
|
1156 | + 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
1157 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence'), |
|
1158 | + ), |
|
1159 | + 'declined_status' => array( |
|
1160 | + 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
1161 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence'), |
|
1162 | + ), |
|
1163 | + 'not_approved' => array( |
|
1164 | + 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
1165 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence'), |
|
1166 | + ), |
|
1167 | + 'pending_status' => array( |
|
1168 | + 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
1169 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence'), |
|
1170 | + ), |
|
1171 | + 'wait_list' => array( |
|
1172 | + 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list, |
|
1173 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence'), |
|
1174 | + ), |
|
1175 | + ); |
|
1176 | + $this->_template_args['after_list_table'] = $this->_display_legend($legend_items); |
|
1177 | + $event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null; |
|
1178 | + /** @var EE_Event $event */ |
|
1179 | + $event = EEM_Event::instance()->get_one_by_ID($event_id); |
|
1180 | + $this->_template_args['before_list_table'] = $event instanceof EE_Event |
|
1181 | + ? '<h2>' . sprintf( |
|
1182 | + esc_html__('Viewing Registrations for Event: %s', 'event_espresso'), |
|
1183 | + EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name') |
|
1184 | + ) . '</h2>' |
|
1185 | + : ''; |
|
1186 | + // need to get the number of datetimes on the event and set default datetime_id if there is only one datetime on |
|
1187 | + // the event. |
|
1188 | + $DTT_ID = ! empty($this->_req_data['DTT_ID']) ? absint($this->_req_data['DTT_ID']) : 0; |
|
1189 | + $datetime = null; |
|
1190 | + if ($event instanceof EE_Event) { |
|
1191 | + $datetimes_on_event = $event->datetimes(); |
|
1192 | + if (count($datetimes_on_event) === 1) { |
|
1193 | + $datetime = reset($datetimes_on_event); |
|
1194 | + } |
|
1195 | + } |
|
1196 | + $datetime = $datetime instanceof EE_Datetime ? $datetime : EEM_Datetime::instance()->get_one_by_ID($DTT_ID); |
|
1197 | + if ($datetime instanceof EE_Datetime && $this->_template_args['before_list_table'] !== '') { |
|
1198 | + $this->_template_args['before_list_table'] = substr($this->_template_args['before_list_table'], 0, -5); |
|
1199 | + $this->_template_args['before_list_table'] .= ' <span class="drk-grey-text">'; |
|
1200 | + $this->_template_args['before_list_table'] .= '<span class="dashicons dashicons-calendar"></span>'; |
|
1201 | + $this->_template_args['before_list_table'] .= $datetime->name(); |
|
1202 | + $this->_template_args['before_list_table'] .= ' ( ' . $datetime->date_and_time_range() . ' )'; |
|
1203 | + $this->_template_args['before_list_table'] .= '</span></h2>'; |
|
1204 | + } |
|
1205 | + // if no datetime, then we're on the initial view, so let's give some helpful instructions on what the status |
|
1206 | + // column represents |
|
1207 | + if (! $datetime instanceof EE_Datetime) { |
|
1208 | + $this->_template_args['before_list_table'] .= '<br><p class="description">' |
|
1209 | + . esc_html__( |
|
1210 | + 'In this view, the check-in status represents the latest check-in record for the registration in that row.', |
|
1211 | + 'event_espresso' |
|
1212 | + ) |
|
1213 | + . '</p>'; |
|
1214 | + } |
|
1215 | + $this->display_admin_list_table_page_with_no_sidebar(); |
|
1216 | + } |
|
1217 | 1217 | |
1218 | - /** |
|
1219 | - * Download the registrations check-in report (same as the normal registration report, but with different where |
|
1220 | - * conditions) |
|
1221 | - * |
|
1222 | - * @return void ends the request by a redirect or download |
|
1223 | - */ |
|
1224 | - public function _registrations_checkin_report() |
|
1225 | - { |
|
1226 | - $this->_registrations_report_base('_get_checkin_query_params_from_request'); |
|
1227 | - } |
|
1218 | + /** |
|
1219 | + * Download the registrations check-in report (same as the normal registration report, but with different where |
|
1220 | + * conditions) |
|
1221 | + * |
|
1222 | + * @return void ends the request by a redirect or download |
|
1223 | + */ |
|
1224 | + public function _registrations_checkin_report() |
|
1225 | + { |
|
1226 | + $this->_registrations_report_base('_get_checkin_query_params_from_request'); |
|
1227 | + } |
|
1228 | 1228 | |
1229 | - /** |
|
1230 | - * Gets the query params from the request, plus adds a where condition for the registration status, |
|
1231 | - * because on the checkin page we only ever want to see approved and pending-approval registrations |
|
1232 | - * |
|
1233 | - * @param array $request |
|
1234 | - * @param int $per_page |
|
1235 | - * @param bool $count |
|
1236 | - * @return array |
|
1237 | - * @throws EE_Error |
|
1238 | - */ |
|
1239 | - protected function _get_checkin_query_params_from_request( |
|
1240 | - $request, |
|
1241 | - $per_page = 10, |
|
1242 | - $count = false |
|
1243 | - ) { |
|
1244 | - $query_params = $this->_get_registration_query_parameters($request, $per_page, $count); |
|
1245 | - // unlike the regular registrations list table, |
|
1246 | - $status_ids_array = apply_filters( |
|
1247 | - 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', |
|
1248 | - array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved) |
|
1249 | - ); |
|
1250 | - $query_params[0]['STS_ID'] = array('IN', $status_ids_array); |
|
1251 | - return $query_params; |
|
1252 | - } |
|
1229 | + /** |
|
1230 | + * Gets the query params from the request, plus adds a where condition for the registration status, |
|
1231 | + * because on the checkin page we only ever want to see approved and pending-approval registrations |
|
1232 | + * |
|
1233 | + * @param array $request |
|
1234 | + * @param int $per_page |
|
1235 | + * @param bool $count |
|
1236 | + * @return array |
|
1237 | + * @throws EE_Error |
|
1238 | + */ |
|
1239 | + protected function _get_checkin_query_params_from_request( |
|
1240 | + $request, |
|
1241 | + $per_page = 10, |
|
1242 | + $count = false |
|
1243 | + ) { |
|
1244 | + $query_params = $this->_get_registration_query_parameters($request, $per_page, $count); |
|
1245 | + // unlike the regular registrations list table, |
|
1246 | + $status_ids_array = apply_filters( |
|
1247 | + 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', |
|
1248 | + array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved) |
|
1249 | + ); |
|
1250 | + $query_params[0]['STS_ID'] = array('IN', $status_ids_array); |
|
1251 | + return $query_params; |
|
1252 | + } |
|
1253 | 1253 | |
1254 | 1254 | |
1255 | - /** |
|
1256 | - * Gets registrations for an event |
|
1257 | - * |
|
1258 | - * @param int $per_page |
|
1259 | - * @param bool $count whether to return count or data. |
|
1260 | - * @param bool $trash |
|
1261 | - * @param string $orderby |
|
1262 | - * @return EE_Registration[]|int |
|
1263 | - * @throws EE_Error |
|
1264 | - * @throws InvalidArgumentException |
|
1265 | - * @throws InvalidDataTypeException |
|
1266 | - * @throws InvalidInterfaceException |
|
1267 | - */ |
|
1268 | - public function get_event_attendees($per_page = 10, $count = false, $trash = false, $orderby = 'ATT_fname') |
|
1269 | - { |
|
1270 | - // normalize some request params that get setup by the parent `get_registrations` method. |
|
1271 | - $request = $this->_req_data; |
|
1272 | - $request['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : $orderby; |
|
1273 | - $request['order'] = ! empty($this->_req_data['order']) ? $this->_req_data['order'] : 'ASC'; |
|
1274 | - if ($trash) { |
|
1275 | - $request['status'] = 'trash'; |
|
1276 | - } |
|
1277 | - $query_params = $this->_get_checkin_query_params_from_request($request, $per_page, $count); |
|
1278 | - /** |
|
1279 | - * Override the default groupby added by EEM_Base so that sorts with multiple order bys work as expected |
|
1280 | - * |
|
1281 | - * @link https://events.codebasehq.com/projects/event-espresso/tickets/10093 |
|
1282 | - * @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md |
|
1283 | - * or if you have the development copy of EE you can view this at the path: |
|
1284 | - * /docs/G--Model-System/model-query-params.md |
|
1285 | - */ |
|
1286 | - $query_params['group_by'] = ''; |
|
1255 | + /** |
|
1256 | + * Gets registrations for an event |
|
1257 | + * |
|
1258 | + * @param int $per_page |
|
1259 | + * @param bool $count whether to return count or data. |
|
1260 | + * @param bool $trash |
|
1261 | + * @param string $orderby |
|
1262 | + * @return EE_Registration[]|int |
|
1263 | + * @throws EE_Error |
|
1264 | + * @throws InvalidArgumentException |
|
1265 | + * @throws InvalidDataTypeException |
|
1266 | + * @throws InvalidInterfaceException |
|
1267 | + */ |
|
1268 | + public function get_event_attendees($per_page = 10, $count = false, $trash = false, $orderby = 'ATT_fname') |
|
1269 | + { |
|
1270 | + // normalize some request params that get setup by the parent `get_registrations` method. |
|
1271 | + $request = $this->_req_data; |
|
1272 | + $request['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : $orderby; |
|
1273 | + $request['order'] = ! empty($this->_req_data['order']) ? $this->_req_data['order'] : 'ASC'; |
|
1274 | + if ($trash) { |
|
1275 | + $request['status'] = 'trash'; |
|
1276 | + } |
|
1277 | + $query_params = $this->_get_checkin_query_params_from_request($request, $per_page, $count); |
|
1278 | + /** |
|
1279 | + * Override the default groupby added by EEM_Base so that sorts with multiple order bys work as expected |
|
1280 | + * |
|
1281 | + * @link https://events.codebasehq.com/projects/event-espresso/tickets/10093 |
|
1282 | + * @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md |
|
1283 | + * or if you have the development copy of EE you can view this at the path: |
|
1284 | + * /docs/G--Model-System/model-query-params.md |
|
1285 | + */ |
|
1286 | + $query_params['group_by'] = ''; |
|
1287 | 1287 | |
1288 | - return $count |
|
1289 | - ? EEM_Registration::instance()->count($query_params) |
|
1290 | - /** @type EE_Registration[] */ |
|
1291 | - : EEM_Registration::instance()->get_all($query_params); |
|
1292 | - } |
|
1288 | + return $count |
|
1289 | + ? EEM_Registration::instance()->count($query_params) |
|
1290 | + /** @type EE_Registration[] */ |
|
1291 | + : EEM_Registration::instance()->get_all($query_params); |
|
1292 | + } |
|
1293 | 1293 | } |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | public function __construct($routing = true) |
33 | 33 | { |
34 | 34 | parent::__construct($routing); |
35 | - if (! defined('REG_CAF_TEMPLATE_PATH')) { |
|
36 | - define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/templates/'); |
|
37 | - define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/assets/'); |
|
38 | - define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registrations/assets/'); |
|
35 | + if ( ! defined('REG_CAF_TEMPLATE_PATH')) { |
|
36 | + define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'registrations/templates/'); |
|
37 | + define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'registrations/assets/'); |
|
38 | + define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registrations/assets/'); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | protected function _extend_page_config() |
47 | 47 | { |
48 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations'; |
|
48 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'registrations'; |
|
49 | 49 | $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) |
50 | 50 | ? $this->_req_data['_REG_ID'] |
51 | 51 | : 0; |
@@ -186,14 +186,14 @@ discard block |
||
186 | 186 | // enqueue newsletter js |
187 | 187 | wp_enqueue_script( |
188 | 188 | 'ee-newsletter-trigger', |
189 | - REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js', |
|
189 | + REG_CAF_ASSETS_URL.'ee-newsletter-trigger.js', |
|
190 | 190 | array('ee-dialog'), |
191 | 191 | EVENT_ESPRESSO_VERSION, |
192 | 192 | true |
193 | 193 | ); |
194 | 194 | wp_enqueue_style( |
195 | 195 | 'ee-newsletter-trigger-css', |
196 | - REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css', |
|
196 | + REG_CAF_ASSETS_URL.'ee-newsletter-trigger.css', |
|
197 | 197 | array(), |
198 | 198 | EVENT_ESPRESSO_VERSION |
199 | 199 | ); |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | { |
215 | 215 | wp_register_script( |
216 | 216 | 'ee-reg-reports-js', |
217 | - REG_CAF_ASSETS_URL . 'ee-registration-admin-reports.js', |
|
217 | + REG_CAF_ASSETS_URL.'ee-registration-admin-reports.js', |
|
218 | 218 | array('google-charts'), |
219 | 219 | EVENT_ESPRESSO_VERSION, |
220 | 220 | true |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | $nonce_ref = 'get_newsletter_form_content_nonce'; |
301 | 301 | $this->_verify_nonce($nonce, $nonce_ref); |
302 | 302 | // let's get the mtp for the incoming MTP_ ID |
303 | - if (! isset($this->_req_data['GRP_ID'])) { |
|
303 | + if ( ! isset($this->_req_data['GRP_ID'])) { |
|
304 | 304 | EE_Error::add_error( |
305 | 305 | esc_html__( |
306 | 306 | 'There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | $this->_return_json(); |
316 | 316 | } |
317 | 317 | $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']); |
318 | - if (! $MTPG instanceof EE_Message_Template_Group) { |
|
318 | + if ( ! $MTPG instanceof EE_Message_Template_Group) { |
|
319 | 319 | EE_Error::add_error( |
320 | 320 | sprintf( |
321 | 321 | esc_html__( |
@@ -340,12 +340,12 @@ discard block |
||
340 | 340 | $field = $MTP->get('MTP_template_field'); |
341 | 341 | if ($field === 'content') { |
342 | 342 | $content = $MTP->get('MTP_content'); |
343 | - if (! empty($content['newsletter_content'])) { |
|
343 | + if ( ! empty($content['newsletter_content'])) { |
|
344 | 344 | $template_fields['newsletter_content'] = $content['newsletter_content']; |
345 | 345 | } |
346 | 346 | continue; |
347 | 347 | } |
348 | - $template_fields[ $MTP->get('MTP_template_field') ] = $MTP->get('MTP_content'); |
|
348 | + $template_fields[$MTP->get('MTP_template_field')] = $MTP->get('MTP_content'); |
|
349 | 349 | } |
350 | 350 | $this->_template_args['success'] = true; |
351 | 351 | $this->_template_args['error'] = false; |
@@ -447,17 +447,17 @@ discard block |
||
447 | 447 | $field_id = $field === '[NEWSLETTER_CONTENT]' |
448 | 448 | ? 'content' |
449 | 449 | : $field; |
450 | - $field_id = 'batch-message-' . strtolower($field_id); |
|
450 | + $field_id = 'batch-message-'.strtolower($field_id); |
|
451 | 451 | $available_shortcodes[] = '<span class="js-shortcode-selection" data-value="' |
452 | 452 | . $shortcode |
453 | - . '" data-linked-input-id="' . $field_id . '">' |
|
453 | + . '" data-linked-input-id="'.$field_id.'">' |
|
454 | 454 | . $shortcode |
455 | 455 | . '</span>'; |
456 | 456 | } |
457 | - $codes[ $field ] = implode(', ', $available_shortcodes); |
|
457 | + $codes[$field] = implode(', ', $available_shortcodes); |
|
458 | 458 | } |
459 | 459 | $shortcodes = $codes; |
460 | - $form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php'; |
|
460 | + $form_template = REG_CAF_TEMPLATE_PATH.'newsletter-send-form.template.php'; |
|
461 | 461 | $form_template_args = array( |
462 | 462 | 'form_action' => admin_url('admin.php?page=espresso_registrations'), |
463 | 463 | 'form_route' => 'newsletter_selected_send', |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | */ |
626 | 626 | protected function _registration_reports() |
627 | 627 | { |
628 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php'; |
|
628 | + $template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php'; |
|
629 | 629 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
630 | 630 | $template_path, |
631 | 631 | $this->_reports_template_data, |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | array_unshift($regs, $column_titles); |
681 | 681 | // setup the date range. |
682 | 682 | $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone()); |
683 | - $beginning_date = new DateTime("now " . $period, $DateTimeZone); |
|
683 | + $beginning_date = new DateTime("now ".$period, $DateTimeZone); |
|
684 | 684 | $ending_date = new DateTime("now", $DateTimeZone); |
685 | 685 | $subtitle = sprintf( |
686 | 686 | wp_strip_all_tags( |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | 'event_espresso' |
705 | 705 | ) |
706 | 706 | ), |
707 | - '<h2>' . $report_title . '</h2><p>', |
|
707 | + '<h2>'.$report_title.'</h2><p>', |
|
708 | 708 | '</p>' |
709 | 709 | ), |
710 | 710 | ); |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | array_unshift($regs, $column_titles); |
758 | 758 | // setup the date range. |
759 | 759 | $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone()); |
760 | - $beginning_date = new DateTime("now " . $period, $DateTimeZone); |
|
760 | + $beginning_date = new DateTime("now ".$period, $DateTimeZone); |
|
761 | 761 | $ending_date = new DateTime("now", $DateTimeZone); |
762 | 762 | $subtitle = sprintf( |
763 | 763 | wp_strip_all_tags( |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | 'event_espresso' |
782 | 782 | ) |
783 | 783 | ), |
784 | - '<h2>' . $report_title . '</h2><p>', |
|
784 | + '<h2>'.$report_title.'</h2><p>', |
|
785 | 785 | '</p>' |
786 | 786 | ), |
787 | 787 | ); |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | $reg_id = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : null; |
808 | 808 | /** @var EE_Registration $registration */ |
809 | 809 | $registration = EEM_Registration::instance()->get_one_by_ID($reg_id); |
810 | - if (! $registration instanceof EE_Registration) { |
|
810 | + if ( ! $registration instanceof EE_Registration) { |
|
811 | 811 | throw new EE_Error( |
812 | 812 | sprintf( |
813 | 813 | esc_html__('An error occurred. There is no registration with ID (%d)', 'event_espresso'), |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | if ($datetime instanceof EE_Datetime) { |
843 | 843 | $datetime_label = $datetime->get_dtt_display_name(true); |
844 | 844 | $datetime_label .= ! empty($datetime_label) |
845 | - ? ' (' . $datetime->get_dtt_display_name() . ')' |
|
845 | + ? ' ('.$datetime->get_dtt_display_name().')' |
|
846 | 846 | : $datetime->get_dtt_display_name(); |
847 | 847 | } |
848 | 848 | $datetime_link = ! empty($dtt_id) && $registration instanceof EE_Registration |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | ) |
857 | 857 | : ''; |
858 | 858 | $datetime_link = ! empty($datetime_link) |
859 | - ? '<a href="' . $datetime_link . '">' |
|
859 | + ? '<a href="'.$datetime_link.'">' |
|
860 | 860 | . '<span id="checkin-dtt">' |
861 | 861 | . $datetime_label |
862 | 862 | . '</span></a>' |
@@ -868,8 +868,8 @@ discard block |
||
868 | 868 | ? $attendee->get_admin_details_link() |
869 | 869 | : ''; |
870 | 870 | $attendee_link = ! empty($attendee_link) |
871 | - ? '<a href="' . $attendee->get_admin_details_link() . '"' |
|
872 | - . ' title="' . esc_html__('Click for attendee details', 'event_espresso') . '">' |
|
871 | + ? '<a href="'.$attendee->get_admin_details_link().'"' |
|
872 | + . ' title="'.esc_html__('Click for attendee details', 'event_espresso').'">' |
|
873 | 873 | . '<span id="checkin-attendee-name">' |
874 | 874 | . $attendee_name |
875 | 875 | . '</span></a>' |
@@ -878,25 +878,25 @@ discard block |
||
878 | 878 | ? $registration->event()->get_admin_details_link() |
879 | 879 | : ''; |
880 | 880 | $event_link = ! empty($event_link) |
881 | - ? '<a href="' . $event_link . '"' |
|
882 | - . ' title="' . esc_html__('Click here to edit event.', 'event_espresso') . '">' |
|
881 | + ? '<a href="'.$event_link.'"' |
|
882 | + . ' title="'.esc_html__('Click here to edit event.', 'event_espresso').'">' |
|
883 | 883 | . '<span id="checkin-event-name">' |
884 | 884 | . $registration->event_name() |
885 | 885 | . '</span>' |
886 | 886 | . '</a>' |
887 | 887 | : ''; |
888 | 888 | $this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id) |
889 | - ? '<h2>' . sprintf( |
|
889 | + ? '<h2>'.sprintf( |
|
890 | 890 | esc_html__('Displaying check in records for %1$s for %2$s at the event, %3$s', 'event_espresso'), |
891 | 891 | $attendee_link, |
892 | 892 | $datetime_link, |
893 | 893 | $event_link |
894 | - ) . '</h2>' |
|
894 | + ).'</h2>' |
|
895 | 895 | : ''; |
896 | 896 | $this->_template_args['list_table_hidden_fields'] = ! empty($reg_id) |
897 | - ? '<input type="hidden" name="_REG_ID" value="' . $reg_id . '">' : ''; |
|
897 | + ? '<input type="hidden" name="_REG_ID" value="'.$reg_id.'">' : ''; |
|
898 | 898 | $this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id) |
899 | - ? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : ''; |
|
899 | + ? '<input type="hidden" name="DTT_ID" value="'.$dtt_id.'">' : ''; |
|
900 | 900 | $this->display_admin_list_table_page_with_no_sidebar(); |
901 | 901 | } |
902 | 902 | |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | public function toggle_checkin_status() |
914 | 914 | { |
915 | 915 | // first make sure we have the necessary data |
916 | - if (! isset($this->_req_data['_regid'])) { |
|
916 | + if ( ! isset($this->_req_data['_regid'])) { |
|
917 | 917 | EE_Error::add_error( |
918 | 918 | esc_html__( |
919 | 919 | 'There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | // beautiful! Made it this far so let's get the status. |
936 | 936 | $new_status = new CheckinStatusDashicon($this->_toggle_checkin_status()); |
937 | 937 | // setup new class to return via ajax |
938 | - $this->_template_args['admin_page_content'] = 'clickable trigger-checkin ' . $new_status->cssClasses(); |
|
938 | + $this->_template_args['admin_page_content'] = 'clickable trigger-checkin '.$new_status->cssClasses(); |
|
939 | 939 | $this->_template_args['success'] = true; |
940 | 940 | $this->_return_json(); |
941 | 941 | } |
@@ -961,7 +961,7 @@ discard block |
||
961 | 961 | ); |
962 | 962 | $new_status = false; |
963 | 963 | // bulk action check in toggle |
964 | - if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
964 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
965 | 965 | // cycle thru checkboxes |
966 | 966 | while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) { |
967 | 967 | $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null; |
@@ -1031,9 +1031,9 @@ discard block |
||
1031 | 1031 | '_REG_ID' => isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0, |
1032 | 1032 | ); |
1033 | 1033 | $errors = 0; |
1034 | - if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1034 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1035 | 1035 | while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) { |
1036 | - if (! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) { |
|
1036 | + if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) { |
|
1037 | 1037 | $errors++; |
1038 | 1038 | } |
1039 | 1039 | } |
@@ -1079,8 +1079,8 @@ discard block |
||
1079 | 1079 | 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0, |
1080 | 1080 | '_REG_ID' => isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0, |
1081 | 1081 | ); |
1082 | - if (! empty($this->_req_data['CHK_ID'])) { |
|
1083 | - if (! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) { |
|
1082 | + if ( ! empty($this->_req_data['CHK_ID'])) { |
|
1083 | + if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) { |
|
1084 | 1084 | EE_Error::add_error( |
1085 | 1085 | esc_html__('Something went wrong and this check-in record was not deleted', 'event_espresso'), |
1086 | 1086 | __FILE__, |
@@ -1149,27 +1149,27 @@ discard block |
||
1149 | 1149 | 'desc' => $checked_never->legendLabel(), |
1150 | 1150 | ), |
1151 | 1151 | 'approved_status' => array( |
1152 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
1152 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved, |
|
1153 | 1153 | 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence'), |
1154 | 1154 | ), |
1155 | 1155 | 'cancelled_status' => array( |
1156 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
1156 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled, |
|
1157 | 1157 | 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence'), |
1158 | 1158 | ), |
1159 | 1159 | 'declined_status' => array( |
1160 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
1160 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined, |
|
1161 | 1161 | 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence'), |
1162 | 1162 | ), |
1163 | 1163 | 'not_approved' => array( |
1164 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
1164 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved, |
|
1165 | 1165 | 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence'), |
1166 | 1166 | ), |
1167 | 1167 | 'pending_status' => array( |
1168 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
1168 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment, |
|
1169 | 1169 | 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence'), |
1170 | 1170 | ), |
1171 | 1171 | 'wait_list' => array( |
1172 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list, |
|
1172 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_wait_list, |
|
1173 | 1173 | 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence'), |
1174 | 1174 | ), |
1175 | 1175 | ); |
@@ -1178,10 +1178,10 @@ discard block |
||
1178 | 1178 | /** @var EE_Event $event */ |
1179 | 1179 | $event = EEM_Event::instance()->get_one_by_ID($event_id); |
1180 | 1180 | $this->_template_args['before_list_table'] = $event instanceof EE_Event |
1181 | - ? '<h2>' . sprintf( |
|
1181 | + ? '<h2>'.sprintf( |
|
1182 | 1182 | esc_html__('Viewing Registrations for Event: %s', 'event_espresso'), |
1183 | 1183 | EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name') |
1184 | - ) . '</h2>' |
|
1184 | + ).'</h2>' |
|
1185 | 1185 | : ''; |
1186 | 1186 | // need to get the number of datetimes on the event and set default datetime_id if there is only one datetime on |
1187 | 1187 | // the event. |
@@ -1199,12 +1199,12 @@ discard block |
||
1199 | 1199 | $this->_template_args['before_list_table'] .= ' <span class="drk-grey-text">'; |
1200 | 1200 | $this->_template_args['before_list_table'] .= '<span class="dashicons dashicons-calendar"></span>'; |
1201 | 1201 | $this->_template_args['before_list_table'] .= $datetime->name(); |
1202 | - $this->_template_args['before_list_table'] .= ' ( ' . $datetime->date_and_time_range() . ' )'; |
|
1202 | + $this->_template_args['before_list_table'] .= ' ( '.$datetime->date_and_time_range().' )'; |
|
1203 | 1203 | $this->_template_args['before_list_table'] .= '</span></h2>'; |
1204 | 1204 | } |
1205 | 1205 | // if no datetime, then we're on the initial view, so let's give some helpful instructions on what the status |
1206 | 1206 | // column represents |
1207 | - if (! $datetime instanceof EE_Datetime) { |
|
1207 | + if ( ! $datetime instanceof EE_Datetime) { |
|
1208 | 1208 | $this->_template_args['before_list_table'] .= '<br><p class="description">' |
1209 | 1209 | . esc_html__( |
1210 | 1210 | 'In this view, the check-in status represents the latest check-in record for the registration in that row.', |
@@ -18,228 +18,228 @@ |
||
18 | 18 | class EE_Registration_CheckIn_List_Table extends EE_Admin_List_Table |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * EE_Registration_CheckIn_List_Table constructor. |
|
23 | - * |
|
24 | - * @param EE_Admin_Page $admin_page |
|
25 | - */ |
|
26 | - public function __construct($admin_page) |
|
27 | - { |
|
28 | - parent::__construct($admin_page); |
|
29 | - } |
|
30 | - |
|
31 | - |
|
32 | - /** |
|
33 | - * @throws EE_Error |
|
34 | - */ |
|
35 | - protected function _setup_data() |
|
36 | - { |
|
37 | - $this->_data = $this->_get_checkins($this->_per_page); |
|
38 | - $this->_all_data_count = $this->_get_checkins($this->_per_page, true); |
|
39 | - } |
|
40 | - |
|
41 | - |
|
42 | - /** |
|
43 | - * Sets up the properties for the list table. |
|
44 | - */ |
|
45 | - protected function _set_properties() |
|
46 | - { |
|
47 | - $this->_wp_list_args = array( |
|
48 | - 'singular' => esc_html__('check-in', 'event_espresso'), |
|
49 | - 'plural' => esc_html__('check-ins', 'event_espresso'), |
|
50 | - 'ajax' => true, |
|
51 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
52 | - ); |
|
53 | - |
|
54 | - $this->_columns = array( |
|
55 | - 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
56 | - 'CHK_in' => esc_html__('Check-In', 'event_espresso'), |
|
57 | - 'CHK_timestamp' => esc_html__('Timestamp', 'event_espresso'), |
|
58 | - ); |
|
59 | - |
|
60 | - $this->_sortable_columns = array( |
|
61 | - 'CHK_timestamp' => array('CHK_timestamp' => true), |
|
62 | - ); |
|
63 | - |
|
64 | - $this->_primary_column = 'CHK_in'; |
|
65 | - |
|
66 | - $this->_hidden_columns = array(); |
|
67 | - } |
|
68 | - |
|
69 | - |
|
70 | - /** |
|
71 | - * @return array |
|
72 | - */ |
|
73 | - protected function _get_table_filters() |
|
74 | - { |
|
75 | - return []; |
|
76 | - } |
|
77 | - |
|
78 | - |
|
79 | - /** |
|
80 | - * Returning an empty string to remove the search box for this view. |
|
81 | - * |
|
82 | - * @param string $text |
|
83 | - * @param string $input_id |
|
84 | - * @return string |
|
85 | - */ |
|
86 | - public function search_box($text, $input_id) |
|
87 | - { |
|
88 | - return ''; |
|
89 | - } |
|
90 | - |
|
91 | - |
|
92 | - /** |
|
93 | - * @throws EE_Error |
|
94 | - */ |
|
95 | - protected function _add_view_counts() |
|
96 | - { |
|
97 | - $this->_views['all']['count'] = $this->_get_checkins(null, true); |
|
98 | - } |
|
99 | - |
|
100 | - |
|
101 | - /** |
|
102 | - * @param EE_Checkin $item |
|
103 | - * @return string |
|
104 | - * @throws EE_Error |
|
105 | - * @throws InvalidArgumentException |
|
106 | - * @throws ReflectionException |
|
107 | - * @throws InvalidDataTypeException |
|
108 | - * @throws InvalidInterfaceException |
|
109 | - */ |
|
110 | - public function column_cb($item) |
|
111 | - { |
|
112 | - return sprintf('<input type="checkbox" name="checkbox[%1$s]" />', $item->ID()); |
|
113 | - } |
|
114 | - |
|
115 | - |
|
116 | - /** |
|
117 | - * @param EE_Checkin $item |
|
118 | - * @return string |
|
119 | - * @throws EE_Error |
|
120 | - * @throws InvalidArgumentException |
|
121 | - * @throws InvalidDataTypeException |
|
122 | - * @throws InvalidInterfaceException |
|
123 | - * @throws ReflectionException |
|
124 | - */ |
|
125 | - public function column_CHK_in(EE_Checkin $item) |
|
126 | - { |
|
127 | - $checkin_status_dashicon = CheckinStatusDashicon::fromCheckin($item); |
|
128 | - return '<span class="' |
|
129 | - . $checkin_status_dashicon->cssClasses() |
|
130 | - . '"></span><span class="show-on-mobile-view-only">' |
|
131 | - . $item->get_datetime('CHK_timestamp') |
|
132 | - . '</span>'; |
|
133 | - } |
|
134 | - |
|
135 | - |
|
136 | - /** |
|
137 | - * @param EE_Checkin $item |
|
138 | - * @return string |
|
139 | - * @throws EE_Error |
|
140 | - * @throws InvalidArgumentException |
|
141 | - * @throws InvalidDataTypeException |
|
142 | - * @throws InvalidInterfaceException |
|
143 | - * @throws ReflectionException |
|
144 | - */ |
|
145 | - public function column_CHK_timestamp(EE_Checkin $item) |
|
146 | - { |
|
147 | - $actions = array(); |
|
148 | - $delete_url = EE_Admin_Page::add_query_args_and_nonce( |
|
149 | - array( |
|
150 | - 'action' => 'delete_checkin_row', |
|
151 | - 'DTT_ID' => $this->_req_data['DTT_ID'], |
|
152 | - '_REG_ID' => $this->_req_data['_REG_ID'], |
|
153 | - 'CHK_ID' => $item->ID(), |
|
154 | - ) |
|
155 | - ); |
|
156 | - $actions['delete_checkin'] = EE_Registry::instance()->CAP->current_user_can( |
|
157 | - 'ee_delete_checkins', |
|
158 | - 'espresso_registrations_delete_checkin_row' |
|
159 | - ) |
|
160 | - ? '<a href="' . $delete_url . '" title="' |
|
161 | - . esc_attr__('Click here to delete this check-in record', 'event_espresso') . '">' |
|
162 | - . esc_html__('Delete', 'event_espresso') . '</a>' |
|
163 | - : ''; |
|
164 | - |
|
165 | - return sprintf( |
|
166 | - '%1$s %2$s', |
|
167 | - $item->get_datetime('CHK_timestamp', '', 'H:i:s a'), |
|
168 | - $this->row_actions($actions) |
|
169 | - ); |
|
170 | - } |
|
171 | - |
|
172 | - |
|
173 | - /** |
|
174 | - * This retrieves all the Check-ins for the given parameters. |
|
175 | - * experimenting with having the query for the table values within the list table. |
|
176 | - * |
|
177 | - * @param int $per_page How many to retrieve per page |
|
178 | - * @param bool $count Whether to return a count or not |
|
179 | - * @return EE_Checkin[]|int |
|
180 | - * @throws EE_Error |
|
181 | - * @throws InvalidArgumentException |
|
182 | - * @throws InvalidDataTypeException |
|
183 | - * @throws InvalidInterfaceException |
|
184 | - */ |
|
185 | - protected function _get_checkins($per_page = 10, $count = false) |
|
186 | - { |
|
187 | - $REG_ID = isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : false; |
|
188 | - $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : false; |
|
189 | - |
|
190 | - // if user does not have the capability for the checkins for this registration then get out! |
|
191 | - if ( |
|
192 | - ! EE_Registry::instance()->CAP->current_user_can( |
|
193 | - 'ee_read_checkin', |
|
194 | - 'espresso_registrations_registration_checkins', |
|
195 | - $REG_ID |
|
196 | - ) |
|
197 | - ) { |
|
198 | - return $count ? 0 : array(); |
|
199 | - } |
|
200 | - |
|
201 | - // if no reg id then get out cause need a reg id |
|
202 | - if (empty($REG_ID) || empty($DTT_ID)) { |
|
203 | - throw new EE_Error( |
|
204 | - esc_html__( |
|
205 | - 'This route cannot be viewed unless registration and datetime IDs are included in the request (via REG_ID and DTT_ID parameters)', |
|
206 | - 'event_espresso' |
|
207 | - ) |
|
208 | - ); |
|
209 | - } |
|
210 | - |
|
211 | - // set orderby |
|
212 | - // note that with this table we're only providing the option to orderby the timestamp value. |
|
213 | - $orderby = 'CHK_timestamp'; |
|
214 | - |
|
215 | - $order = ! empty($this->_req_data['order']) ? $this->_req_data['order'] : 'ASC'; |
|
216 | - |
|
217 | - $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
218 | - ? $this->_req_data['paged'] |
|
219 | - : 1; |
|
220 | - $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
221 | - ? $this->_req_data['perpage'] |
|
222 | - : $per_page; |
|
223 | - $limit = null; |
|
224 | - if (! $count) { |
|
225 | - $offset = ($current_page - 1) * $per_page; |
|
226 | - $limit = array($offset, $per_page); |
|
227 | - } |
|
228 | - |
|
229 | - $_where = array( |
|
230 | - 'REG_ID' => $REG_ID, |
|
231 | - 'DTT_ID' => $DTT_ID, |
|
232 | - ); |
|
233 | - |
|
234 | - $query_params = array($_where, 'order_by' => array($orderby => $order), 'limit' => $limit); |
|
235 | - |
|
236 | - // if no per_page value then we just want to return a count of all Check-ins |
|
237 | - if ($count) { |
|
238 | - return EEM_Checkin::instance()->count(array($_where)); |
|
239 | - } |
|
240 | - |
|
241 | - return $count |
|
242 | - ? EEM_Checkin::instance()->count(array($_where)) |
|
243 | - : EEM_Checkin::instance()->get_all($query_params); |
|
244 | - } |
|
21 | + /** |
|
22 | + * EE_Registration_CheckIn_List_Table constructor. |
|
23 | + * |
|
24 | + * @param EE_Admin_Page $admin_page |
|
25 | + */ |
|
26 | + public function __construct($admin_page) |
|
27 | + { |
|
28 | + parent::__construct($admin_page); |
|
29 | + } |
|
30 | + |
|
31 | + |
|
32 | + /** |
|
33 | + * @throws EE_Error |
|
34 | + */ |
|
35 | + protected function _setup_data() |
|
36 | + { |
|
37 | + $this->_data = $this->_get_checkins($this->_per_page); |
|
38 | + $this->_all_data_count = $this->_get_checkins($this->_per_page, true); |
|
39 | + } |
|
40 | + |
|
41 | + |
|
42 | + /** |
|
43 | + * Sets up the properties for the list table. |
|
44 | + */ |
|
45 | + protected function _set_properties() |
|
46 | + { |
|
47 | + $this->_wp_list_args = array( |
|
48 | + 'singular' => esc_html__('check-in', 'event_espresso'), |
|
49 | + 'plural' => esc_html__('check-ins', 'event_espresso'), |
|
50 | + 'ajax' => true, |
|
51 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
52 | + ); |
|
53 | + |
|
54 | + $this->_columns = array( |
|
55 | + 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
56 | + 'CHK_in' => esc_html__('Check-In', 'event_espresso'), |
|
57 | + 'CHK_timestamp' => esc_html__('Timestamp', 'event_espresso'), |
|
58 | + ); |
|
59 | + |
|
60 | + $this->_sortable_columns = array( |
|
61 | + 'CHK_timestamp' => array('CHK_timestamp' => true), |
|
62 | + ); |
|
63 | + |
|
64 | + $this->_primary_column = 'CHK_in'; |
|
65 | + |
|
66 | + $this->_hidden_columns = array(); |
|
67 | + } |
|
68 | + |
|
69 | + |
|
70 | + /** |
|
71 | + * @return array |
|
72 | + */ |
|
73 | + protected function _get_table_filters() |
|
74 | + { |
|
75 | + return []; |
|
76 | + } |
|
77 | + |
|
78 | + |
|
79 | + /** |
|
80 | + * Returning an empty string to remove the search box for this view. |
|
81 | + * |
|
82 | + * @param string $text |
|
83 | + * @param string $input_id |
|
84 | + * @return string |
|
85 | + */ |
|
86 | + public function search_box($text, $input_id) |
|
87 | + { |
|
88 | + return ''; |
|
89 | + } |
|
90 | + |
|
91 | + |
|
92 | + /** |
|
93 | + * @throws EE_Error |
|
94 | + */ |
|
95 | + protected function _add_view_counts() |
|
96 | + { |
|
97 | + $this->_views['all']['count'] = $this->_get_checkins(null, true); |
|
98 | + } |
|
99 | + |
|
100 | + |
|
101 | + /** |
|
102 | + * @param EE_Checkin $item |
|
103 | + * @return string |
|
104 | + * @throws EE_Error |
|
105 | + * @throws InvalidArgumentException |
|
106 | + * @throws ReflectionException |
|
107 | + * @throws InvalidDataTypeException |
|
108 | + * @throws InvalidInterfaceException |
|
109 | + */ |
|
110 | + public function column_cb($item) |
|
111 | + { |
|
112 | + return sprintf('<input type="checkbox" name="checkbox[%1$s]" />', $item->ID()); |
|
113 | + } |
|
114 | + |
|
115 | + |
|
116 | + /** |
|
117 | + * @param EE_Checkin $item |
|
118 | + * @return string |
|
119 | + * @throws EE_Error |
|
120 | + * @throws InvalidArgumentException |
|
121 | + * @throws InvalidDataTypeException |
|
122 | + * @throws InvalidInterfaceException |
|
123 | + * @throws ReflectionException |
|
124 | + */ |
|
125 | + public function column_CHK_in(EE_Checkin $item) |
|
126 | + { |
|
127 | + $checkin_status_dashicon = CheckinStatusDashicon::fromCheckin($item); |
|
128 | + return '<span class="' |
|
129 | + . $checkin_status_dashicon->cssClasses() |
|
130 | + . '"></span><span class="show-on-mobile-view-only">' |
|
131 | + . $item->get_datetime('CHK_timestamp') |
|
132 | + . '</span>'; |
|
133 | + } |
|
134 | + |
|
135 | + |
|
136 | + /** |
|
137 | + * @param EE_Checkin $item |
|
138 | + * @return string |
|
139 | + * @throws EE_Error |
|
140 | + * @throws InvalidArgumentException |
|
141 | + * @throws InvalidDataTypeException |
|
142 | + * @throws InvalidInterfaceException |
|
143 | + * @throws ReflectionException |
|
144 | + */ |
|
145 | + public function column_CHK_timestamp(EE_Checkin $item) |
|
146 | + { |
|
147 | + $actions = array(); |
|
148 | + $delete_url = EE_Admin_Page::add_query_args_and_nonce( |
|
149 | + array( |
|
150 | + 'action' => 'delete_checkin_row', |
|
151 | + 'DTT_ID' => $this->_req_data['DTT_ID'], |
|
152 | + '_REG_ID' => $this->_req_data['_REG_ID'], |
|
153 | + 'CHK_ID' => $item->ID(), |
|
154 | + ) |
|
155 | + ); |
|
156 | + $actions['delete_checkin'] = EE_Registry::instance()->CAP->current_user_can( |
|
157 | + 'ee_delete_checkins', |
|
158 | + 'espresso_registrations_delete_checkin_row' |
|
159 | + ) |
|
160 | + ? '<a href="' . $delete_url . '" title="' |
|
161 | + . esc_attr__('Click here to delete this check-in record', 'event_espresso') . '">' |
|
162 | + . esc_html__('Delete', 'event_espresso') . '</a>' |
|
163 | + : ''; |
|
164 | + |
|
165 | + return sprintf( |
|
166 | + '%1$s %2$s', |
|
167 | + $item->get_datetime('CHK_timestamp', '', 'H:i:s a'), |
|
168 | + $this->row_actions($actions) |
|
169 | + ); |
|
170 | + } |
|
171 | + |
|
172 | + |
|
173 | + /** |
|
174 | + * This retrieves all the Check-ins for the given parameters. |
|
175 | + * experimenting with having the query for the table values within the list table. |
|
176 | + * |
|
177 | + * @param int $per_page How many to retrieve per page |
|
178 | + * @param bool $count Whether to return a count or not |
|
179 | + * @return EE_Checkin[]|int |
|
180 | + * @throws EE_Error |
|
181 | + * @throws InvalidArgumentException |
|
182 | + * @throws InvalidDataTypeException |
|
183 | + * @throws InvalidInterfaceException |
|
184 | + */ |
|
185 | + protected function _get_checkins($per_page = 10, $count = false) |
|
186 | + { |
|
187 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : false; |
|
188 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : false; |
|
189 | + |
|
190 | + // if user does not have the capability for the checkins for this registration then get out! |
|
191 | + if ( |
|
192 | + ! EE_Registry::instance()->CAP->current_user_can( |
|
193 | + 'ee_read_checkin', |
|
194 | + 'espresso_registrations_registration_checkins', |
|
195 | + $REG_ID |
|
196 | + ) |
|
197 | + ) { |
|
198 | + return $count ? 0 : array(); |
|
199 | + } |
|
200 | + |
|
201 | + // if no reg id then get out cause need a reg id |
|
202 | + if (empty($REG_ID) || empty($DTT_ID)) { |
|
203 | + throw new EE_Error( |
|
204 | + esc_html__( |
|
205 | + 'This route cannot be viewed unless registration and datetime IDs are included in the request (via REG_ID and DTT_ID parameters)', |
|
206 | + 'event_espresso' |
|
207 | + ) |
|
208 | + ); |
|
209 | + } |
|
210 | + |
|
211 | + // set orderby |
|
212 | + // note that with this table we're only providing the option to orderby the timestamp value. |
|
213 | + $orderby = 'CHK_timestamp'; |
|
214 | + |
|
215 | + $order = ! empty($this->_req_data['order']) ? $this->_req_data['order'] : 'ASC'; |
|
216 | + |
|
217 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
218 | + ? $this->_req_data['paged'] |
|
219 | + : 1; |
|
220 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
221 | + ? $this->_req_data['perpage'] |
|
222 | + : $per_page; |
|
223 | + $limit = null; |
|
224 | + if (! $count) { |
|
225 | + $offset = ($current_page - 1) * $per_page; |
|
226 | + $limit = array($offset, $per_page); |
|
227 | + } |
|
228 | + |
|
229 | + $_where = array( |
|
230 | + 'REG_ID' => $REG_ID, |
|
231 | + 'DTT_ID' => $DTT_ID, |
|
232 | + ); |
|
233 | + |
|
234 | + $query_params = array($_where, 'order_by' => array($orderby => $order), 'limit' => $limit); |
|
235 | + |
|
236 | + // if no per_page value then we just want to return a count of all Check-ins |
|
237 | + if ($count) { |
|
238 | + return EEM_Checkin::instance()->count(array($_where)); |
|
239 | + } |
|
240 | + |
|
241 | + return $count |
|
242 | + ? EEM_Checkin::instance()->count(array($_where)) |
|
243 | + : EEM_Checkin::instance()->get_all($query_params); |
|
244 | + } |
|
245 | 245 | } |
@@ -157,9 +157,9 @@ discard block |
||
157 | 157 | 'ee_delete_checkins', |
158 | 158 | 'espresso_registrations_delete_checkin_row' |
159 | 159 | ) |
160 | - ? '<a href="' . $delete_url . '" title="' |
|
161 | - . esc_attr__('Click here to delete this check-in record', 'event_espresso') . '">' |
|
162 | - . esc_html__('Delete', 'event_espresso') . '</a>' |
|
160 | + ? '<a href="'.$delete_url.'" title="' |
|
161 | + . esc_attr__('Click here to delete this check-in record', 'event_espresso').'">' |
|
162 | + . esc_html__('Delete', 'event_espresso').'</a>' |
|
163 | 163 | : ''; |
164 | 164 | |
165 | 165 | return sprintf( |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | ? $this->_req_data['perpage'] |
222 | 222 | : $per_page; |
223 | 223 | $limit = null; |
224 | - if (! $count) { |
|
224 | + if ( ! $count) { |
|
225 | 225 | $offset = ($current_page - 1) * $per_page; |
226 | 226 | $limit = array($offset, $per_page); |
227 | 227 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | 'TXN_total' => esc_html__('Total', 'event_espresso'), |
82 | 82 | ); |
83 | 83 | // Add/remove columns when an event has been selected |
84 | - if (! empty($evt_id)) { |
|
84 | + if ( ! empty($evt_id)) { |
|
85 | 85 | // Render a checkbox column |
86 | 86 | $columns['cb'] = '<input type="checkbox" />'; |
87 | 87 | $this->_has_checkbox_column = true; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | { |
164 | 164 | $class = parent::_get_row_class($item); |
165 | 165 | // add status class |
166 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
166 | + $class .= ' ee-status-strip reg-status-'.$item->status_ID(); |
|
167 | 167 | if ($this->_has_checkbox_column) { |
168 | 168 | $class .= ' has-checkbox-column'; |
169 | 169 | } |
@@ -182,10 +182,10 @@ discard block |
||
182 | 182 | if (empty($this->_dtts_for_event) || count($this->_dtts_for_event) === 1) { |
183 | 183 | // this means we don't have an event so let's setup a filter dropdown for all the events to select |
184 | 184 | // note possible capability restrictions |
185 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { |
|
185 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { |
|
186 | 186 | $where['status**'] = array('!=', 'private'); |
187 | 187 | } |
188 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
188 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
189 | 189 | $where['EVT_wp_user'] = get_current_user_id(); |
190 | 190 | } |
191 | 191 | $events = EEM_Event::instance()->get_all( |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | /** @var EE_Event $evt */ |
203 | 203 | foreach ($events as $evt) { |
204 | 204 | // any registrations for this event? |
205 | - if (! $evt->get_count_of_all_registrations()) { |
|
205 | + if ( ! $evt->get_count_of_all_registrations()) { |
|
206 | 206 | continue; |
207 | 207 | } |
208 | 208 | $evts[] = array( |
@@ -221,22 +221,22 @@ discard block |
||
221 | 221 | $event_filter = '<div class="ee-event-filter">'; |
222 | 222 | $event_filter .= EEH_Form_Fields::select_input('event_id', $evts, $current_EVT_ID); |
223 | 223 | $event_filter .= '<span class="ee-event-filter-toggle">'; |
224 | - $event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" ' . $checked . '> '; |
|
224 | + $event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" '.$checked.'> '; |
|
225 | 225 | $event_filter .= esc_html__('Hide Expired Events', 'event_espresso'); |
226 | 226 | $event_filter .= '</span>'; |
227 | 227 | $event_filter .= '</div>'; |
228 | 228 | $filters[] = $event_filter; |
229 | 229 | } |
230 | - if (! empty($this->_dtts_for_event)) { |
|
230 | + if ( ! empty($this->_dtts_for_event)) { |
|
231 | 231 | // DTT datetimes filter |
232 | 232 | $this->_cur_dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0; |
233 | 233 | if (count($this->_dtts_for_event) > 1) { |
234 | 234 | $dtts[0] = esc_html__('To toggle check-in status, select a datetime.', 'event_espresso'); |
235 | 235 | foreach ($this->_dtts_for_event as $dtt) { |
236 | 236 | $datetime_string = $dtt->name(); |
237 | - $datetime_string = ! empty($datetime_string) ? ' (' . $datetime_string . ')' : ''; |
|
238 | - $datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time() . $datetime_string; |
|
239 | - $dtts[ $dtt->ID() ] = $datetime_string; |
|
237 | + $datetime_string = ! empty($datetime_string) ? ' ('.$datetime_string.')' : ''; |
|
238 | + $datetime_string = $dtt->start_date_and_time().' - '.$dtt->end_date_and_time().$datetime_string; |
|
239 | + $dtts[$dtt->ID()] = $datetime_string; |
|
240 | 240 | } |
241 | 241 | $input = new EE_Select_Input( |
242 | 242 | $dtts, |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | ) |
248 | 248 | ); |
249 | 249 | $filters[] = $input->get_html_for_input(); |
250 | - $filters[] = '<input type="hidden" name="event_id" value="' . $current_EVT_ID . '">'; |
|
250 | + $filters[] = '<input type="hidden" name="event_id" value="'.$current_EVT_ID.'">'; |
|
251 | 251 | } |
252 | 252 | } |
253 | 253 | return $filters; |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | */ |
292 | 292 | public function column__Reg_Status(EE_Registration $item) |
293 | 293 | { |
294 | - return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>'; |
|
294 | + return '<span class="ee-status-strip ee-status-strip-td reg-status-'.$item->status_ID().'"></span>'; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | |
@@ -340,11 +340,11 @@ discard block |
||
340 | 340 | ) |
341 | 341 | ? ' clickable trigger-checkin' |
342 | 342 | : ''; |
343 | - $mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>'; |
|
344 | - return '<span class="' . $checkin_status_dashicon->cssClasses() . $toggle_active . '"' |
|
345 | - . ' data-_regid="' . $item->ID() . '"' |
|
346 | - . ' data-dttid="' . $this->_cur_dtt_id . '"' |
|
347 | - . ' data-nonce="' . $nonce . '">' |
|
343 | + $mobile_view_content = ' <span class="show-on-mobile-view-only">'.$attendee_name.'</span>'; |
|
344 | + return '<span class="'.$checkin_status_dashicon->cssClasses().$toggle_active.'"' |
|
345 | + . ' data-_regid="'.$item->ID().'"' |
|
346 | + . ' data-dttid="'.$this->_cur_dtt_id.'"' |
|
347 | + . ' data-nonce="'.$nonce.'">' |
|
348 | 348 | . '</span>' |
349 | 349 | . $mobile_view_content; |
350 | 350 | } |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | public function column_ATT_name(EE_Registration $item) |
359 | 359 | { |
360 | 360 | $attendee = $item->attendee(); |
361 | - if (! $attendee instanceof EE_Attendee) { |
|
361 | + if ( ! $attendee instanceof EE_Attendee) { |
|
362 | 362 | return esc_html__('No contact record for this registration.', 'event_espresso'); |
363 | 363 | } |
364 | 364 | // edit attendee link |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | 'ee_edit_contacts', |
371 | 371 | 'espresso_registrations_edit_attendee' |
372 | 372 | ) |
373 | - ? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__('View Registration Details', 'event_espresso') . '">' |
|
373 | + ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">' |
|
374 | 374 | . $item->attendee()->full_name() |
375 | 375 | . '</a>' |
376 | 376 | : $item->attendee()->full_name(); |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup> ' |
379 | 379 | : ''; |
380 | 380 | // add group details |
381 | - $name_link .= ' ' . sprintf(esc_html__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
381 | + $name_link .= ' '.sprintf(esc_html__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
382 | 382 | // add regcode |
383 | 383 | $link = EE_Admin_Page::add_query_args_and_nonce( |
384 | 384 | array('action' => 'view_registration', '_REG_ID' => $item->ID()), |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | 'view_registration', |
391 | 391 | $item->ID() |
392 | 392 | ) |
393 | - ? '<a href="' . $link . '" title="' . esc_attr__('View Registration Details', 'event_espresso') . '">' |
|
393 | + ? '<a href="'.$link.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">' |
|
394 | 394 | . $item->reg_code() |
395 | 395 | . '</a>' |
396 | 396 | : $item->reg_code(); |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | ); |
420 | 420 | // get the timestamps for this registration's checkins, related to the selected datetime |
421 | 421 | $timestamps = $item->get_many_related('Checkin', array(array('DTT_ID' => $DTT_ID))); |
422 | - if (! empty($timestamps)) { |
|
422 | + if ( ! empty($timestamps)) { |
|
423 | 423 | // get the last timestamp |
424 | 424 | $last_timestamp = end($timestamps); |
425 | 425 | // checked in or checked out? |
@@ -428,14 +428,14 @@ discard block |
||
428 | 428 | : esc_html__('Checked Out', 'event_espresso'); |
429 | 429 | // get timestamp string |
430 | 430 | $timestamp_string = $last_timestamp->get_datetime('CHK_timestamp'); |
431 | - $actions['checkin'] = '<a href="' . $checkin_list_url . '" title="' |
|
431 | + $actions['checkin'] = '<a href="'.$checkin_list_url.'" title="' |
|
432 | 432 | . esc_attr__( |
433 | 433 | 'View this registrant\'s check-ins/checkouts for the datetime', |
434 | 434 | 'event_espresso' |
435 | - ) . '">' . $checkin_status . ': ' . $timestamp_string . '</a>'; |
|
435 | + ).'">'.$checkin_status.': '.$timestamp_string.'</a>'; |
|
436 | 436 | } |
437 | 437 | } |
438 | - return (! empty($DTT_ID) && ! empty($timestamps)) |
|
438 | + return ( ! empty($DTT_ID) && ! empty($timestamps)) |
|
439 | 439 | ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions, true)) |
440 | 440 | : $name_link; |
441 | 441 | } |
@@ -468,11 +468,11 @@ discard block |
||
468 | 468 | $event_label = EE_Registry::instance()->CAP->current_user_can( |
469 | 469 | 'ee_read_checkins', |
470 | 470 | 'espresso_registrations_registration_checkins' |
471 | - ) ? '<a href="' . $chkin_lnk_url . '" title="' |
|
471 | + ) ? '<a href="'.$chkin_lnk_url.'" title="' |
|
472 | 472 | . esc_attr__( |
473 | 473 | 'View Checkins for this Event', |
474 | 474 | 'event_espresso' |
475 | - ) . '">' . $event->name() . '</a>' : $event->name(); |
|
475 | + ).'">'.$event->name().'</a>' : $event->name(); |
|
476 | 476 | } catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) { |
477 | 477 | $event_label = esc_html__('Unknown', 'event_espresso'); |
478 | 478 | } |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | */ |
499 | 499 | public function column__REG_final_price(EE_Registration $item) |
500 | 500 | { |
501 | - return '<span class="reg-pad-rght">' . ' ' . $item->pretty_final_price() . '</span>'; |
|
501 | + return '<span class="reg-pad-rght">'.' '.$item->pretty_final_price().'</span>'; |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | . $item->transaction()->pretty_paid() |
536 | 536 | . ' |
537 | 537 | </a> |
538 | - <span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
538 | + <span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>'; |
|
539 | 539 | } |
540 | 540 | } else { |
541 | 541 | return '<span class="reg-pad-rght"></span>'; |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | . esc_attr__('View Transaction', 'event_espresso') |
572 | 572 | . '"><span class="reg-pad-rght">' |
573 | 573 | . $txn_total |
574 | - . '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>'; |
|
574 | + . '</span></a>' : '<span class="reg-pad-rght">'.$txn_total.'</span>'; |
|
575 | 575 | } else { |
576 | 576 | return '<span class="reg-pad-rght"></span>'; |
577 | 577 | } |
@@ -12,570 +12,570 @@ |
||
12 | 12 | class EE_Event_Registrations_List_Table extends EE_Admin_List_Table |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * This property will hold the related Datetimes on an event IF the event id is included in the request. |
|
17 | - * |
|
18 | - * @var EE_Datetime[] |
|
19 | - */ |
|
20 | - protected $_dtts_for_event = array(); |
|
21 | - |
|
22 | - |
|
23 | - /** |
|
24 | - * The event if one is specified in the request |
|
25 | - * |
|
26 | - * @var EE_Event |
|
27 | - */ |
|
28 | - protected $_evt = null; |
|
29 | - |
|
30 | - |
|
31 | - /** |
|
32 | - * The DTT_ID if the current view has a specified datetime. |
|
33 | - * |
|
34 | - * @var int $_cur_dtt_id |
|
35 | - */ |
|
36 | - protected $_cur_dtt_id = 0; |
|
37 | - |
|
38 | - |
|
39 | - /** |
|
40 | - * EE_Event_Registrations_List_Table constructor. |
|
41 | - * |
|
42 | - * @param \Registrations_Admin_Page $admin_page |
|
43 | - */ |
|
44 | - public function __construct($admin_page) |
|
45 | - { |
|
46 | - parent::__construct($admin_page); |
|
47 | - $this->_status = $this->_admin_page->get_registration_status_array(); |
|
48 | - } |
|
49 | - |
|
50 | - |
|
51 | - protected function _setup_data() |
|
52 | - { |
|
53 | - $this->_data = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page) |
|
54 | - : $this->_admin_page->get_event_attendees($this->_per_page, false, true); |
|
55 | - $this->_all_data_count = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees( |
|
56 | - $this->_per_page, |
|
57 | - true |
|
58 | - ) : $this->_admin_page->get_event_attendees($this->_per_page, true, true); |
|
59 | - } |
|
60 | - |
|
61 | - |
|
62 | - protected function _set_properties() |
|
63 | - { |
|
64 | - $return_url = $this->getReturnUrl(); |
|
65 | - |
|
66 | - $evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null; |
|
67 | - $this->_wp_list_args = array( |
|
68 | - 'singular' => esc_html__('registrant', 'event_espresso'), |
|
69 | - 'plural' => esc_html__('registrants', 'event_espresso'), |
|
70 | - 'ajax' => true, |
|
71 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
72 | - ); |
|
73 | - $columns = array(); |
|
74 | - // $columns['_Reg_Status'] = ''; |
|
75 | - $this->_columns = array( |
|
76 | - '_REG_att_checked_in' => '<span class="dashicons dashicons-yes ee-icon-size-18"></span>', |
|
77 | - 'ATT_name' => esc_html__('Registrant', 'event_espresso'), |
|
78 | - 'ATT_email' => esc_html__('Email Address', 'event_espresso'), |
|
79 | - 'Event' => esc_html__('Event', 'event_espresso'), |
|
80 | - 'PRC_name' => esc_html__('TKT Option', 'event_espresso'), |
|
81 | - '_REG_final_price' => esc_html__('Price', 'event_espresso'), |
|
82 | - 'TXN_paid' => esc_html__('Paid', 'event_espresso'), |
|
83 | - 'TXN_total' => esc_html__('Total', 'event_espresso'), |
|
84 | - ); |
|
85 | - // Add/remove columns when an event has been selected |
|
86 | - if (! empty($evt_id)) { |
|
87 | - // Render a checkbox column |
|
88 | - $columns['cb'] = '<input type="checkbox" />'; |
|
89 | - $this->_has_checkbox_column = true; |
|
90 | - // Remove the 'Event' column |
|
91 | - unset($this->_columns['Event']); |
|
92 | - } |
|
93 | - $this->_columns = array_merge($columns, $this->_columns); |
|
94 | - $this->_primary_column = '_REG_att_checked_in'; |
|
95 | - if ( |
|
96 | - ! empty($evt_id) |
|
97 | - && EE_Registry::instance()->CAP->current_user_can( |
|
98 | - 'ee_read_registrations', |
|
99 | - 'espresso_registrations_registrations_reports', |
|
100 | - $evt_id |
|
101 | - ) |
|
102 | - ) { |
|
103 | - $this->_bottom_buttons = array( |
|
104 | - 'report' => array( |
|
105 | - 'route' => 'registrations_report', |
|
106 | - 'extra_request' => |
|
107 | - array( |
|
108 | - 'EVT_ID' => $evt_id, |
|
109 | - 'return_url' => $return_url, |
|
110 | - ), |
|
111 | - ), |
|
112 | - ); |
|
113 | - } |
|
114 | - $this->_bottom_buttons['report_filtered'] = array( |
|
115 | - 'route' => 'registrations_checkin_report', |
|
116 | - 'extra_request' => array( |
|
117 | - 'use_filters' => true, |
|
118 | - 'filters' => array_merge( |
|
119 | - array( |
|
120 | - 'EVT_ID' => $evt_id, |
|
121 | - ), |
|
122 | - array_diff_key( |
|
123 | - $this->_req_data, |
|
124 | - array_flip( |
|
125 | - array( |
|
126 | - 'page', |
|
127 | - 'action', |
|
128 | - 'default_nonce', |
|
129 | - ) |
|
130 | - ) |
|
131 | - ) |
|
132 | - ), |
|
133 | - 'return_url' => $return_url, |
|
134 | - ), |
|
135 | - ); |
|
136 | - $this->_sortable_columns = array( |
|
137 | - /** |
|
138 | - * Allows users to change the default sort if they wish. |
|
139 | - * Returning a falsey on this filter will result in the default sort to be by firstname rather than last name. |
|
140 | - * |
|
141 | - * Note: usual naming conventions for filters aren't followed here so that just one filter can be used to |
|
142 | - * change the sorts on any list table involving registration contacts. If you want to only change the filter |
|
143 | - * for a specific list table you can use the provided reference to this object instance. |
|
144 | - */ |
|
145 | - 'ATT_name' => array( |
|
146 | - 'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name', |
|
147 | - true, |
|
148 | - $this, |
|
149 | - ) |
|
150 | - ? array('ATT_lname' => true) |
|
151 | - : array('ATT_fname' => true), |
|
152 | - 'Event' => array('Event.EVT_name' => false), |
|
153 | - ); |
|
154 | - $this->_hidden_columns = array(); |
|
155 | - $this->_evt = EEM_Event::instance()->get_one_by_ID($evt_id); |
|
156 | - $this->_dtts_for_event = $this->_evt instanceof EE_Event ? $this->_evt->datetimes_ordered() : array(); |
|
157 | - } |
|
158 | - |
|
159 | - |
|
160 | - /** |
|
161 | - * @param \EE_Registration $item |
|
162 | - * @return string |
|
163 | - */ |
|
164 | - protected function _get_row_class($item) |
|
165 | - { |
|
166 | - $class = parent::_get_row_class($item); |
|
167 | - // add status class |
|
168 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
169 | - if ($this->_has_checkbox_column) { |
|
170 | - $class .= ' has-checkbox-column'; |
|
171 | - } |
|
172 | - return $class; |
|
173 | - } |
|
174 | - |
|
175 | - |
|
176 | - /** |
|
177 | - * @return array |
|
178 | - * @throws \EE_Error |
|
179 | - */ |
|
180 | - protected function _get_table_filters() |
|
181 | - { |
|
182 | - $filters = $where = array(); |
|
183 | - $current_EVT_ID = isset($this->_req_data['event_id']) ? (int) $this->_req_data['event_id'] : 0; |
|
184 | - if (empty($this->_dtts_for_event) || count($this->_dtts_for_event) === 1) { |
|
185 | - // this means we don't have an event so let's setup a filter dropdown for all the events to select |
|
186 | - // note possible capability restrictions |
|
187 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { |
|
188 | - $where['status**'] = array('!=', 'private'); |
|
189 | - } |
|
190 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
191 | - $where['EVT_wp_user'] = get_current_user_id(); |
|
192 | - } |
|
193 | - $events = EEM_Event::instance()->get_all( |
|
194 | - array( |
|
195 | - $where, |
|
196 | - 'order_by' => array('Datetime.DTT_EVT_start' => 'DESC'), |
|
197 | - ) |
|
198 | - ); |
|
199 | - $evts[] = array( |
|
200 | - 'id' => 0, |
|
201 | - 'text' => esc_html__('To toggle Check-in status, select an event', 'event_espresso'), |
|
202 | - ); |
|
203 | - $checked = 'checked'; |
|
204 | - /** @var EE_Event $evt */ |
|
205 | - foreach ($events as $evt) { |
|
206 | - // any registrations for this event? |
|
207 | - if (! $evt->get_count_of_all_registrations()) { |
|
208 | - continue; |
|
209 | - } |
|
210 | - $evts[] = array( |
|
211 | - 'id' => $evt->ID(), |
|
212 | - 'text' => apply_filters( |
|
213 | - 'FHEE__EE_Event_Registrations___get_table_filters__event_name', |
|
214 | - $evt->get('EVT_name'), |
|
215 | - $evt |
|
216 | - ), |
|
217 | - 'class' => $evt->is_expired() ? 'ee-expired-event' : '', |
|
218 | - ); |
|
219 | - if ($evt->ID() === $current_EVT_ID && $evt->is_expired()) { |
|
220 | - $checked = ''; |
|
221 | - } |
|
222 | - } |
|
223 | - $event_filter = '<div class="ee-event-filter">'; |
|
224 | - $event_filter .= EEH_Form_Fields::select_input('event_id', $evts, $current_EVT_ID); |
|
225 | - $event_filter .= '<span class="ee-event-filter-toggle">'; |
|
226 | - $event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" ' . $checked . '> '; |
|
227 | - $event_filter .= esc_html__('Hide Expired Events', 'event_espresso'); |
|
228 | - $event_filter .= '</span>'; |
|
229 | - $event_filter .= '</div>'; |
|
230 | - $filters[] = $event_filter; |
|
231 | - } |
|
232 | - if (! empty($this->_dtts_for_event)) { |
|
233 | - // DTT datetimes filter |
|
234 | - $this->_cur_dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0; |
|
235 | - if (count($this->_dtts_for_event) > 1) { |
|
236 | - $dtts[0] = esc_html__('To toggle check-in status, select a datetime.', 'event_espresso'); |
|
237 | - foreach ($this->_dtts_for_event as $dtt) { |
|
238 | - $datetime_string = $dtt->name(); |
|
239 | - $datetime_string = ! empty($datetime_string) ? ' (' . $datetime_string . ')' : ''; |
|
240 | - $datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time() . $datetime_string; |
|
241 | - $dtts[ $dtt->ID() ] = $datetime_string; |
|
242 | - } |
|
243 | - $input = new EE_Select_Input( |
|
244 | - $dtts, |
|
245 | - array( |
|
246 | - 'html_name' => 'DTT_ID', |
|
247 | - 'html_id' => 'DTT_ID', |
|
248 | - 'default' => $this->_cur_dtt_id, |
|
249 | - ) |
|
250 | - ); |
|
251 | - $filters[] = $input->get_html_for_input(); |
|
252 | - $filters[] = '<input type="hidden" name="event_id" value="' . $current_EVT_ID . '">'; |
|
253 | - } |
|
254 | - } |
|
255 | - return $filters; |
|
256 | - } |
|
257 | - |
|
258 | - |
|
259 | - protected function _add_view_counts() |
|
260 | - { |
|
261 | - $this->_views['all']['count'] = $this->_get_total_event_attendees(); |
|
262 | - } |
|
263 | - |
|
264 | - |
|
265 | - /** |
|
266 | - * @return int |
|
267 | - * @throws \EE_Error |
|
268 | - */ |
|
269 | - protected function _get_total_event_attendees() |
|
270 | - { |
|
271 | - $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false; |
|
272 | - $DTT_ID = $this->_cur_dtt_id; |
|
273 | - $query_params = array(); |
|
274 | - if ($EVT_ID) { |
|
275 | - $query_params[0]['EVT_ID'] = $EVT_ID; |
|
276 | - } |
|
277 | - // if DTT is included we only show for that datetime. Otherwise we're showing for all datetimes (the event). |
|
278 | - if ($DTT_ID) { |
|
279 | - $query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID; |
|
280 | - } |
|
281 | - $status_ids_array = apply_filters( |
|
282 | - 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', |
|
283 | - array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved) |
|
284 | - ); |
|
285 | - $query_params[0]['STS_ID'] = array('IN', $status_ids_array); |
|
286 | - return EEM_Registration::instance()->count($query_params); |
|
287 | - } |
|
288 | - |
|
289 | - |
|
290 | - /** |
|
291 | - * @param \EE_Registration $item |
|
292 | - * @return string |
|
293 | - */ |
|
294 | - public function column__Reg_Status(EE_Registration $item) |
|
295 | - { |
|
296 | - return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>'; |
|
297 | - } |
|
298 | - |
|
299 | - |
|
300 | - /** |
|
301 | - * @param \EE_Registration $item |
|
302 | - * @return string |
|
303 | - * @throws \EE_Error |
|
304 | - */ |
|
305 | - public function column_cb($item) |
|
306 | - { |
|
307 | - return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID()); |
|
308 | - } |
|
309 | - |
|
310 | - |
|
311 | - /** |
|
312 | - * column_REG_att_checked_in |
|
313 | - * |
|
314 | - * @param EE_Registration $item |
|
315 | - * @return string |
|
316 | - * @throws EE_Error |
|
317 | - * @throws InvalidArgumentException |
|
318 | - * @throws InvalidDataTypeException |
|
319 | - * @throws InvalidInterfaceException |
|
320 | - */ |
|
321 | - public function column__REG_att_checked_in(EE_Registration $item) |
|
322 | - { |
|
323 | - $attendee = $item->attendee(); |
|
324 | - $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
|
325 | - |
|
326 | - if ($this->_cur_dtt_id === 0 && count($this->_dtts_for_event) === 1) { |
|
327 | - $latest_related_datetime = $item->get_latest_related_datetime(); |
|
328 | - if ($latest_related_datetime instanceof EE_Datetime) { |
|
329 | - $this->_cur_dtt_id = $latest_related_datetime->ID(); |
|
330 | - } |
|
331 | - } |
|
332 | - $checkin_status_dashicon = CheckinStatusDashicon::fromRegistrationAndDatetimeId( |
|
333 | - $item, |
|
334 | - $this->_cur_dtt_id |
|
335 | - ); |
|
336 | - $nonce = wp_create_nonce('checkin_nonce'); |
|
337 | - $toggle_active = ! empty($this->_cur_dtt_id) |
|
338 | - && EE_Registry::instance()->CAP->current_user_can( |
|
339 | - 'ee_edit_checkin', |
|
340 | - 'espresso_registrations_toggle_checkin_status', |
|
341 | - $item->ID() |
|
342 | - ) |
|
343 | - ? ' clickable trigger-checkin' |
|
344 | - : ''; |
|
345 | - $mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>'; |
|
346 | - return '<span class="' . $checkin_status_dashicon->cssClasses() . $toggle_active . '"' |
|
347 | - . ' data-_regid="' . $item->ID() . '"' |
|
348 | - . ' data-dttid="' . $this->_cur_dtt_id . '"' |
|
349 | - . ' data-nonce="' . $nonce . '">' |
|
350 | - . '</span>' |
|
351 | - . $mobile_view_content; |
|
352 | - } |
|
353 | - |
|
354 | - |
|
355 | - /** |
|
356 | - * @param \EE_Registration $item |
|
357 | - * @return mixed|string|void |
|
358 | - * @throws \EE_Error |
|
359 | - */ |
|
360 | - public function column_ATT_name(EE_Registration $item) |
|
361 | - { |
|
362 | - $attendee = $item->attendee(); |
|
363 | - if (! $attendee instanceof EE_Attendee) { |
|
364 | - return esc_html__('No contact record for this registration.', 'event_espresso'); |
|
365 | - } |
|
366 | - // edit attendee link |
|
367 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
368 | - array('action' => 'view_registration', '_REG_ID' => $item->ID()), |
|
369 | - REG_ADMIN_URL |
|
370 | - ); |
|
371 | - $name_link = EE_Registry::instance()->CAP->current_user_can( |
|
372 | - 'ee_edit_contacts', |
|
373 | - 'espresso_registrations_edit_attendee' |
|
374 | - ) |
|
375 | - ? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__('View Registration Details', 'event_espresso') . '">' |
|
376 | - . $item->attendee()->full_name() |
|
377 | - . '</a>' |
|
378 | - : $item->attendee()->full_name(); |
|
379 | - $name_link .= $item->count() === 1 |
|
380 | - ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup> ' |
|
381 | - : ''; |
|
382 | - // add group details |
|
383 | - $name_link .= ' ' . sprintf(esc_html__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
384 | - // add regcode |
|
385 | - $link = EE_Admin_Page::add_query_args_and_nonce( |
|
386 | - array('action' => 'view_registration', '_REG_ID' => $item->ID()), |
|
387 | - REG_ADMIN_URL |
|
388 | - ); |
|
389 | - $name_link .= '<br>'; |
|
390 | - $name_link .= EE_Registry::instance()->instance()->CAP->current_user_can( |
|
391 | - 'ee_read_registration', |
|
392 | - 'view_registration', |
|
393 | - $item->ID() |
|
394 | - ) |
|
395 | - ? '<a href="' . $link . '" title="' . esc_attr__('View Registration Details', 'event_espresso') . '">' |
|
396 | - . $item->reg_code() |
|
397 | - . '</a>' |
|
398 | - : $item->reg_code(); |
|
399 | - // status |
|
400 | - $name_link .= '<br><span class="ee-status-text-small">'; |
|
401 | - $name_link .= EEH_Template::pretty_status($item->status_ID(), false, 'sentence'); |
|
402 | - $name_link .= '</span>'; |
|
403 | - $actions = array(); |
|
404 | - $DTT_ID = $this->_cur_dtt_id; |
|
405 | - $latest_related_datetime = empty($DTT_ID) && ! empty($this->_req_data['event_id']) && $item instanceof EE_Registration |
|
406 | - ? $item->get_latest_related_datetime() |
|
407 | - : null; |
|
408 | - $DTT_ID = $latest_related_datetime instanceof EE_Datetime |
|
409 | - ? $latest_related_datetime->ID() |
|
410 | - : $DTT_ID; |
|
411 | - if ( |
|
412 | - ! empty($DTT_ID) |
|
413 | - && EE_Registry::instance()->CAP->current_user_can( |
|
414 | - 'ee_read_checkins', |
|
415 | - 'espresso_registrations_registration_checkins' |
|
416 | - ) |
|
417 | - ) { |
|
418 | - $checkin_list_url = EE_Admin_Page::add_query_args_and_nonce( |
|
419 | - array('action' => 'registration_checkins', '_REG_ID' => $item->ID(), 'DTT_ID' => $DTT_ID), |
|
420 | - REG_ADMIN_URL |
|
421 | - ); |
|
422 | - // get the timestamps for this registration's checkins, related to the selected datetime |
|
423 | - $timestamps = $item->get_many_related('Checkin', array(array('DTT_ID' => $DTT_ID))); |
|
424 | - if (! empty($timestamps)) { |
|
425 | - // get the last timestamp |
|
426 | - $last_timestamp = end($timestamps); |
|
427 | - // checked in or checked out? |
|
428 | - $checkin_status = $last_timestamp->get('CHK_in') |
|
429 | - ? esc_html__('Checked In', 'event_espresso') |
|
430 | - : esc_html__('Checked Out', 'event_espresso'); |
|
431 | - // get timestamp string |
|
432 | - $timestamp_string = $last_timestamp->get_datetime('CHK_timestamp'); |
|
433 | - $actions['checkin'] = '<a href="' . $checkin_list_url . '" title="' |
|
434 | - . esc_attr__( |
|
435 | - 'View this registrant\'s check-ins/checkouts for the datetime', |
|
436 | - 'event_espresso' |
|
437 | - ) . '">' . $checkin_status . ': ' . $timestamp_string . '</a>'; |
|
438 | - } |
|
439 | - } |
|
440 | - return (! empty($DTT_ID) && ! empty($timestamps)) |
|
441 | - ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions, true)) |
|
442 | - : $name_link; |
|
443 | - } |
|
444 | - |
|
445 | - |
|
446 | - /** |
|
447 | - * @param \EE_Registration $item |
|
448 | - * @return string |
|
449 | - */ |
|
450 | - public function column_ATT_email(EE_Registration $item) |
|
451 | - { |
|
452 | - $attendee = $item->attendee(); |
|
453 | - return $attendee instanceof EE_Attendee ? $attendee->email() : ''; |
|
454 | - } |
|
455 | - |
|
456 | - |
|
457 | - /** |
|
458 | - * @param \EE_Registration $item |
|
459 | - * @return bool|string |
|
460 | - * @throws \EE_Error |
|
461 | - */ |
|
462 | - public function column_Event(EE_Registration $item) |
|
463 | - { |
|
464 | - try { |
|
465 | - $event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event(); |
|
466 | - $chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
467 | - array('action' => 'event_registrations', 'event_id' => $event->ID()), |
|
468 | - REG_ADMIN_URL |
|
469 | - ); |
|
470 | - $event_label = EE_Registry::instance()->CAP->current_user_can( |
|
471 | - 'ee_read_checkins', |
|
472 | - 'espresso_registrations_registration_checkins' |
|
473 | - ) ? '<a href="' . $chkin_lnk_url . '" title="' |
|
474 | - . esc_attr__( |
|
475 | - 'View Checkins for this Event', |
|
476 | - 'event_espresso' |
|
477 | - ) . '">' . $event->name() . '</a>' : $event->name(); |
|
478 | - } catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) { |
|
479 | - $event_label = esc_html__('Unknown', 'event_espresso'); |
|
480 | - } |
|
481 | - return $event_label; |
|
482 | - } |
|
483 | - |
|
484 | - |
|
485 | - /** |
|
486 | - * @param \EE_Registration $item |
|
487 | - * @return mixed|string|void |
|
488 | - */ |
|
489 | - public function column_PRC_name(EE_Registration $item) |
|
490 | - { |
|
491 | - return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : esc_html__("Unknown", "event_espresso"); |
|
492 | - } |
|
493 | - |
|
494 | - |
|
495 | - /** |
|
496 | - * column_REG_final_price |
|
497 | - * |
|
498 | - * @param \EE_Registration $item |
|
499 | - * @return string |
|
500 | - */ |
|
501 | - public function column__REG_final_price(EE_Registration $item) |
|
502 | - { |
|
503 | - return '<span class="reg-pad-rght">' . ' ' . $item->pretty_final_price() . '</span>'; |
|
504 | - } |
|
505 | - |
|
506 | - |
|
507 | - /** |
|
508 | - * column_TXN_paid |
|
509 | - * |
|
510 | - * @param \EE_Registration $item |
|
511 | - * @return string |
|
512 | - * @throws \EE_Error |
|
513 | - */ |
|
514 | - public function column_TXN_paid(EE_Registration $item) |
|
515 | - { |
|
516 | - if ($item->count() === 1) { |
|
517 | - if ($item->transaction()->paid() >= $item->transaction()->total()) { |
|
518 | - return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
|
519 | - } else { |
|
520 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
521 | - array('action' => 'view_transaction', 'TXN_ID' => $item->transaction_ID()), |
|
522 | - TXN_ADMIN_URL |
|
523 | - ); |
|
524 | - return EE_Registry::instance()->CAP->current_user_can( |
|
525 | - 'ee_read_transaction', |
|
526 | - 'espresso_transactions_view_transaction' |
|
527 | - ) ? ' |
|
15 | + /** |
|
16 | + * This property will hold the related Datetimes on an event IF the event id is included in the request. |
|
17 | + * |
|
18 | + * @var EE_Datetime[] |
|
19 | + */ |
|
20 | + protected $_dtts_for_event = array(); |
|
21 | + |
|
22 | + |
|
23 | + /** |
|
24 | + * The event if one is specified in the request |
|
25 | + * |
|
26 | + * @var EE_Event |
|
27 | + */ |
|
28 | + protected $_evt = null; |
|
29 | + |
|
30 | + |
|
31 | + /** |
|
32 | + * The DTT_ID if the current view has a specified datetime. |
|
33 | + * |
|
34 | + * @var int $_cur_dtt_id |
|
35 | + */ |
|
36 | + protected $_cur_dtt_id = 0; |
|
37 | + |
|
38 | + |
|
39 | + /** |
|
40 | + * EE_Event_Registrations_List_Table constructor. |
|
41 | + * |
|
42 | + * @param \Registrations_Admin_Page $admin_page |
|
43 | + */ |
|
44 | + public function __construct($admin_page) |
|
45 | + { |
|
46 | + parent::__construct($admin_page); |
|
47 | + $this->_status = $this->_admin_page->get_registration_status_array(); |
|
48 | + } |
|
49 | + |
|
50 | + |
|
51 | + protected function _setup_data() |
|
52 | + { |
|
53 | + $this->_data = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page) |
|
54 | + : $this->_admin_page->get_event_attendees($this->_per_page, false, true); |
|
55 | + $this->_all_data_count = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees( |
|
56 | + $this->_per_page, |
|
57 | + true |
|
58 | + ) : $this->_admin_page->get_event_attendees($this->_per_page, true, true); |
|
59 | + } |
|
60 | + |
|
61 | + |
|
62 | + protected function _set_properties() |
|
63 | + { |
|
64 | + $return_url = $this->getReturnUrl(); |
|
65 | + |
|
66 | + $evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null; |
|
67 | + $this->_wp_list_args = array( |
|
68 | + 'singular' => esc_html__('registrant', 'event_espresso'), |
|
69 | + 'plural' => esc_html__('registrants', 'event_espresso'), |
|
70 | + 'ajax' => true, |
|
71 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
72 | + ); |
|
73 | + $columns = array(); |
|
74 | + // $columns['_Reg_Status'] = ''; |
|
75 | + $this->_columns = array( |
|
76 | + '_REG_att_checked_in' => '<span class="dashicons dashicons-yes ee-icon-size-18"></span>', |
|
77 | + 'ATT_name' => esc_html__('Registrant', 'event_espresso'), |
|
78 | + 'ATT_email' => esc_html__('Email Address', 'event_espresso'), |
|
79 | + 'Event' => esc_html__('Event', 'event_espresso'), |
|
80 | + 'PRC_name' => esc_html__('TKT Option', 'event_espresso'), |
|
81 | + '_REG_final_price' => esc_html__('Price', 'event_espresso'), |
|
82 | + 'TXN_paid' => esc_html__('Paid', 'event_espresso'), |
|
83 | + 'TXN_total' => esc_html__('Total', 'event_espresso'), |
|
84 | + ); |
|
85 | + // Add/remove columns when an event has been selected |
|
86 | + if (! empty($evt_id)) { |
|
87 | + // Render a checkbox column |
|
88 | + $columns['cb'] = '<input type="checkbox" />'; |
|
89 | + $this->_has_checkbox_column = true; |
|
90 | + // Remove the 'Event' column |
|
91 | + unset($this->_columns['Event']); |
|
92 | + } |
|
93 | + $this->_columns = array_merge($columns, $this->_columns); |
|
94 | + $this->_primary_column = '_REG_att_checked_in'; |
|
95 | + if ( |
|
96 | + ! empty($evt_id) |
|
97 | + && EE_Registry::instance()->CAP->current_user_can( |
|
98 | + 'ee_read_registrations', |
|
99 | + 'espresso_registrations_registrations_reports', |
|
100 | + $evt_id |
|
101 | + ) |
|
102 | + ) { |
|
103 | + $this->_bottom_buttons = array( |
|
104 | + 'report' => array( |
|
105 | + 'route' => 'registrations_report', |
|
106 | + 'extra_request' => |
|
107 | + array( |
|
108 | + 'EVT_ID' => $evt_id, |
|
109 | + 'return_url' => $return_url, |
|
110 | + ), |
|
111 | + ), |
|
112 | + ); |
|
113 | + } |
|
114 | + $this->_bottom_buttons['report_filtered'] = array( |
|
115 | + 'route' => 'registrations_checkin_report', |
|
116 | + 'extra_request' => array( |
|
117 | + 'use_filters' => true, |
|
118 | + 'filters' => array_merge( |
|
119 | + array( |
|
120 | + 'EVT_ID' => $evt_id, |
|
121 | + ), |
|
122 | + array_diff_key( |
|
123 | + $this->_req_data, |
|
124 | + array_flip( |
|
125 | + array( |
|
126 | + 'page', |
|
127 | + 'action', |
|
128 | + 'default_nonce', |
|
129 | + ) |
|
130 | + ) |
|
131 | + ) |
|
132 | + ), |
|
133 | + 'return_url' => $return_url, |
|
134 | + ), |
|
135 | + ); |
|
136 | + $this->_sortable_columns = array( |
|
137 | + /** |
|
138 | + * Allows users to change the default sort if they wish. |
|
139 | + * Returning a falsey on this filter will result in the default sort to be by firstname rather than last name. |
|
140 | + * |
|
141 | + * Note: usual naming conventions for filters aren't followed here so that just one filter can be used to |
|
142 | + * change the sorts on any list table involving registration contacts. If you want to only change the filter |
|
143 | + * for a specific list table you can use the provided reference to this object instance. |
|
144 | + */ |
|
145 | + 'ATT_name' => array( |
|
146 | + 'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name', |
|
147 | + true, |
|
148 | + $this, |
|
149 | + ) |
|
150 | + ? array('ATT_lname' => true) |
|
151 | + : array('ATT_fname' => true), |
|
152 | + 'Event' => array('Event.EVT_name' => false), |
|
153 | + ); |
|
154 | + $this->_hidden_columns = array(); |
|
155 | + $this->_evt = EEM_Event::instance()->get_one_by_ID($evt_id); |
|
156 | + $this->_dtts_for_event = $this->_evt instanceof EE_Event ? $this->_evt->datetimes_ordered() : array(); |
|
157 | + } |
|
158 | + |
|
159 | + |
|
160 | + /** |
|
161 | + * @param \EE_Registration $item |
|
162 | + * @return string |
|
163 | + */ |
|
164 | + protected function _get_row_class($item) |
|
165 | + { |
|
166 | + $class = parent::_get_row_class($item); |
|
167 | + // add status class |
|
168 | + $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
169 | + if ($this->_has_checkbox_column) { |
|
170 | + $class .= ' has-checkbox-column'; |
|
171 | + } |
|
172 | + return $class; |
|
173 | + } |
|
174 | + |
|
175 | + |
|
176 | + /** |
|
177 | + * @return array |
|
178 | + * @throws \EE_Error |
|
179 | + */ |
|
180 | + protected function _get_table_filters() |
|
181 | + { |
|
182 | + $filters = $where = array(); |
|
183 | + $current_EVT_ID = isset($this->_req_data['event_id']) ? (int) $this->_req_data['event_id'] : 0; |
|
184 | + if (empty($this->_dtts_for_event) || count($this->_dtts_for_event) === 1) { |
|
185 | + // this means we don't have an event so let's setup a filter dropdown for all the events to select |
|
186 | + // note possible capability restrictions |
|
187 | + if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { |
|
188 | + $where['status**'] = array('!=', 'private'); |
|
189 | + } |
|
190 | + if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
191 | + $where['EVT_wp_user'] = get_current_user_id(); |
|
192 | + } |
|
193 | + $events = EEM_Event::instance()->get_all( |
|
194 | + array( |
|
195 | + $where, |
|
196 | + 'order_by' => array('Datetime.DTT_EVT_start' => 'DESC'), |
|
197 | + ) |
|
198 | + ); |
|
199 | + $evts[] = array( |
|
200 | + 'id' => 0, |
|
201 | + 'text' => esc_html__('To toggle Check-in status, select an event', 'event_espresso'), |
|
202 | + ); |
|
203 | + $checked = 'checked'; |
|
204 | + /** @var EE_Event $evt */ |
|
205 | + foreach ($events as $evt) { |
|
206 | + // any registrations for this event? |
|
207 | + if (! $evt->get_count_of_all_registrations()) { |
|
208 | + continue; |
|
209 | + } |
|
210 | + $evts[] = array( |
|
211 | + 'id' => $evt->ID(), |
|
212 | + 'text' => apply_filters( |
|
213 | + 'FHEE__EE_Event_Registrations___get_table_filters__event_name', |
|
214 | + $evt->get('EVT_name'), |
|
215 | + $evt |
|
216 | + ), |
|
217 | + 'class' => $evt->is_expired() ? 'ee-expired-event' : '', |
|
218 | + ); |
|
219 | + if ($evt->ID() === $current_EVT_ID && $evt->is_expired()) { |
|
220 | + $checked = ''; |
|
221 | + } |
|
222 | + } |
|
223 | + $event_filter = '<div class="ee-event-filter">'; |
|
224 | + $event_filter .= EEH_Form_Fields::select_input('event_id', $evts, $current_EVT_ID); |
|
225 | + $event_filter .= '<span class="ee-event-filter-toggle">'; |
|
226 | + $event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" ' . $checked . '> '; |
|
227 | + $event_filter .= esc_html__('Hide Expired Events', 'event_espresso'); |
|
228 | + $event_filter .= '</span>'; |
|
229 | + $event_filter .= '</div>'; |
|
230 | + $filters[] = $event_filter; |
|
231 | + } |
|
232 | + if (! empty($this->_dtts_for_event)) { |
|
233 | + // DTT datetimes filter |
|
234 | + $this->_cur_dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0; |
|
235 | + if (count($this->_dtts_for_event) > 1) { |
|
236 | + $dtts[0] = esc_html__('To toggle check-in status, select a datetime.', 'event_espresso'); |
|
237 | + foreach ($this->_dtts_for_event as $dtt) { |
|
238 | + $datetime_string = $dtt->name(); |
|
239 | + $datetime_string = ! empty($datetime_string) ? ' (' . $datetime_string . ')' : ''; |
|
240 | + $datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time() . $datetime_string; |
|
241 | + $dtts[ $dtt->ID() ] = $datetime_string; |
|
242 | + } |
|
243 | + $input = new EE_Select_Input( |
|
244 | + $dtts, |
|
245 | + array( |
|
246 | + 'html_name' => 'DTT_ID', |
|
247 | + 'html_id' => 'DTT_ID', |
|
248 | + 'default' => $this->_cur_dtt_id, |
|
249 | + ) |
|
250 | + ); |
|
251 | + $filters[] = $input->get_html_for_input(); |
|
252 | + $filters[] = '<input type="hidden" name="event_id" value="' . $current_EVT_ID . '">'; |
|
253 | + } |
|
254 | + } |
|
255 | + return $filters; |
|
256 | + } |
|
257 | + |
|
258 | + |
|
259 | + protected function _add_view_counts() |
|
260 | + { |
|
261 | + $this->_views['all']['count'] = $this->_get_total_event_attendees(); |
|
262 | + } |
|
263 | + |
|
264 | + |
|
265 | + /** |
|
266 | + * @return int |
|
267 | + * @throws \EE_Error |
|
268 | + */ |
|
269 | + protected function _get_total_event_attendees() |
|
270 | + { |
|
271 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false; |
|
272 | + $DTT_ID = $this->_cur_dtt_id; |
|
273 | + $query_params = array(); |
|
274 | + if ($EVT_ID) { |
|
275 | + $query_params[0]['EVT_ID'] = $EVT_ID; |
|
276 | + } |
|
277 | + // if DTT is included we only show for that datetime. Otherwise we're showing for all datetimes (the event). |
|
278 | + if ($DTT_ID) { |
|
279 | + $query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID; |
|
280 | + } |
|
281 | + $status_ids_array = apply_filters( |
|
282 | + 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', |
|
283 | + array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved) |
|
284 | + ); |
|
285 | + $query_params[0]['STS_ID'] = array('IN', $status_ids_array); |
|
286 | + return EEM_Registration::instance()->count($query_params); |
|
287 | + } |
|
288 | + |
|
289 | + |
|
290 | + /** |
|
291 | + * @param \EE_Registration $item |
|
292 | + * @return string |
|
293 | + */ |
|
294 | + public function column__Reg_Status(EE_Registration $item) |
|
295 | + { |
|
296 | + return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>'; |
|
297 | + } |
|
298 | + |
|
299 | + |
|
300 | + /** |
|
301 | + * @param \EE_Registration $item |
|
302 | + * @return string |
|
303 | + * @throws \EE_Error |
|
304 | + */ |
|
305 | + public function column_cb($item) |
|
306 | + { |
|
307 | + return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID()); |
|
308 | + } |
|
309 | + |
|
310 | + |
|
311 | + /** |
|
312 | + * column_REG_att_checked_in |
|
313 | + * |
|
314 | + * @param EE_Registration $item |
|
315 | + * @return string |
|
316 | + * @throws EE_Error |
|
317 | + * @throws InvalidArgumentException |
|
318 | + * @throws InvalidDataTypeException |
|
319 | + * @throws InvalidInterfaceException |
|
320 | + */ |
|
321 | + public function column__REG_att_checked_in(EE_Registration $item) |
|
322 | + { |
|
323 | + $attendee = $item->attendee(); |
|
324 | + $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
|
325 | + |
|
326 | + if ($this->_cur_dtt_id === 0 && count($this->_dtts_for_event) === 1) { |
|
327 | + $latest_related_datetime = $item->get_latest_related_datetime(); |
|
328 | + if ($latest_related_datetime instanceof EE_Datetime) { |
|
329 | + $this->_cur_dtt_id = $latest_related_datetime->ID(); |
|
330 | + } |
|
331 | + } |
|
332 | + $checkin_status_dashicon = CheckinStatusDashicon::fromRegistrationAndDatetimeId( |
|
333 | + $item, |
|
334 | + $this->_cur_dtt_id |
|
335 | + ); |
|
336 | + $nonce = wp_create_nonce('checkin_nonce'); |
|
337 | + $toggle_active = ! empty($this->_cur_dtt_id) |
|
338 | + && EE_Registry::instance()->CAP->current_user_can( |
|
339 | + 'ee_edit_checkin', |
|
340 | + 'espresso_registrations_toggle_checkin_status', |
|
341 | + $item->ID() |
|
342 | + ) |
|
343 | + ? ' clickable trigger-checkin' |
|
344 | + : ''; |
|
345 | + $mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>'; |
|
346 | + return '<span class="' . $checkin_status_dashicon->cssClasses() . $toggle_active . '"' |
|
347 | + . ' data-_regid="' . $item->ID() . '"' |
|
348 | + . ' data-dttid="' . $this->_cur_dtt_id . '"' |
|
349 | + . ' data-nonce="' . $nonce . '">' |
|
350 | + . '</span>' |
|
351 | + . $mobile_view_content; |
|
352 | + } |
|
353 | + |
|
354 | + |
|
355 | + /** |
|
356 | + * @param \EE_Registration $item |
|
357 | + * @return mixed|string|void |
|
358 | + * @throws \EE_Error |
|
359 | + */ |
|
360 | + public function column_ATT_name(EE_Registration $item) |
|
361 | + { |
|
362 | + $attendee = $item->attendee(); |
|
363 | + if (! $attendee instanceof EE_Attendee) { |
|
364 | + return esc_html__('No contact record for this registration.', 'event_espresso'); |
|
365 | + } |
|
366 | + // edit attendee link |
|
367 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
368 | + array('action' => 'view_registration', '_REG_ID' => $item->ID()), |
|
369 | + REG_ADMIN_URL |
|
370 | + ); |
|
371 | + $name_link = EE_Registry::instance()->CAP->current_user_can( |
|
372 | + 'ee_edit_contacts', |
|
373 | + 'espresso_registrations_edit_attendee' |
|
374 | + ) |
|
375 | + ? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__('View Registration Details', 'event_espresso') . '">' |
|
376 | + . $item->attendee()->full_name() |
|
377 | + . '</a>' |
|
378 | + : $item->attendee()->full_name(); |
|
379 | + $name_link .= $item->count() === 1 |
|
380 | + ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup> ' |
|
381 | + : ''; |
|
382 | + // add group details |
|
383 | + $name_link .= ' ' . sprintf(esc_html__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
384 | + // add regcode |
|
385 | + $link = EE_Admin_Page::add_query_args_and_nonce( |
|
386 | + array('action' => 'view_registration', '_REG_ID' => $item->ID()), |
|
387 | + REG_ADMIN_URL |
|
388 | + ); |
|
389 | + $name_link .= '<br>'; |
|
390 | + $name_link .= EE_Registry::instance()->instance()->CAP->current_user_can( |
|
391 | + 'ee_read_registration', |
|
392 | + 'view_registration', |
|
393 | + $item->ID() |
|
394 | + ) |
|
395 | + ? '<a href="' . $link . '" title="' . esc_attr__('View Registration Details', 'event_espresso') . '">' |
|
396 | + . $item->reg_code() |
|
397 | + . '</a>' |
|
398 | + : $item->reg_code(); |
|
399 | + // status |
|
400 | + $name_link .= '<br><span class="ee-status-text-small">'; |
|
401 | + $name_link .= EEH_Template::pretty_status($item->status_ID(), false, 'sentence'); |
|
402 | + $name_link .= '</span>'; |
|
403 | + $actions = array(); |
|
404 | + $DTT_ID = $this->_cur_dtt_id; |
|
405 | + $latest_related_datetime = empty($DTT_ID) && ! empty($this->_req_data['event_id']) && $item instanceof EE_Registration |
|
406 | + ? $item->get_latest_related_datetime() |
|
407 | + : null; |
|
408 | + $DTT_ID = $latest_related_datetime instanceof EE_Datetime |
|
409 | + ? $latest_related_datetime->ID() |
|
410 | + : $DTT_ID; |
|
411 | + if ( |
|
412 | + ! empty($DTT_ID) |
|
413 | + && EE_Registry::instance()->CAP->current_user_can( |
|
414 | + 'ee_read_checkins', |
|
415 | + 'espresso_registrations_registration_checkins' |
|
416 | + ) |
|
417 | + ) { |
|
418 | + $checkin_list_url = EE_Admin_Page::add_query_args_and_nonce( |
|
419 | + array('action' => 'registration_checkins', '_REG_ID' => $item->ID(), 'DTT_ID' => $DTT_ID), |
|
420 | + REG_ADMIN_URL |
|
421 | + ); |
|
422 | + // get the timestamps for this registration's checkins, related to the selected datetime |
|
423 | + $timestamps = $item->get_many_related('Checkin', array(array('DTT_ID' => $DTT_ID))); |
|
424 | + if (! empty($timestamps)) { |
|
425 | + // get the last timestamp |
|
426 | + $last_timestamp = end($timestamps); |
|
427 | + // checked in or checked out? |
|
428 | + $checkin_status = $last_timestamp->get('CHK_in') |
|
429 | + ? esc_html__('Checked In', 'event_espresso') |
|
430 | + : esc_html__('Checked Out', 'event_espresso'); |
|
431 | + // get timestamp string |
|
432 | + $timestamp_string = $last_timestamp->get_datetime('CHK_timestamp'); |
|
433 | + $actions['checkin'] = '<a href="' . $checkin_list_url . '" title="' |
|
434 | + . esc_attr__( |
|
435 | + 'View this registrant\'s check-ins/checkouts for the datetime', |
|
436 | + 'event_espresso' |
|
437 | + ) . '">' . $checkin_status . ': ' . $timestamp_string . '</a>'; |
|
438 | + } |
|
439 | + } |
|
440 | + return (! empty($DTT_ID) && ! empty($timestamps)) |
|
441 | + ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions, true)) |
|
442 | + : $name_link; |
|
443 | + } |
|
444 | + |
|
445 | + |
|
446 | + /** |
|
447 | + * @param \EE_Registration $item |
|
448 | + * @return string |
|
449 | + */ |
|
450 | + public function column_ATT_email(EE_Registration $item) |
|
451 | + { |
|
452 | + $attendee = $item->attendee(); |
|
453 | + return $attendee instanceof EE_Attendee ? $attendee->email() : ''; |
|
454 | + } |
|
455 | + |
|
456 | + |
|
457 | + /** |
|
458 | + * @param \EE_Registration $item |
|
459 | + * @return bool|string |
|
460 | + * @throws \EE_Error |
|
461 | + */ |
|
462 | + public function column_Event(EE_Registration $item) |
|
463 | + { |
|
464 | + try { |
|
465 | + $event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event(); |
|
466 | + $chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
467 | + array('action' => 'event_registrations', 'event_id' => $event->ID()), |
|
468 | + REG_ADMIN_URL |
|
469 | + ); |
|
470 | + $event_label = EE_Registry::instance()->CAP->current_user_can( |
|
471 | + 'ee_read_checkins', |
|
472 | + 'espresso_registrations_registration_checkins' |
|
473 | + ) ? '<a href="' . $chkin_lnk_url . '" title="' |
|
474 | + . esc_attr__( |
|
475 | + 'View Checkins for this Event', |
|
476 | + 'event_espresso' |
|
477 | + ) . '">' . $event->name() . '</a>' : $event->name(); |
|
478 | + } catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) { |
|
479 | + $event_label = esc_html__('Unknown', 'event_espresso'); |
|
480 | + } |
|
481 | + return $event_label; |
|
482 | + } |
|
483 | + |
|
484 | + |
|
485 | + /** |
|
486 | + * @param \EE_Registration $item |
|
487 | + * @return mixed|string|void |
|
488 | + */ |
|
489 | + public function column_PRC_name(EE_Registration $item) |
|
490 | + { |
|
491 | + return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : esc_html__("Unknown", "event_espresso"); |
|
492 | + } |
|
493 | + |
|
494 | + |
|
495 | + /** |
|
496 | + * column_REG_final_price |
|
497 | + * |
|
498 | + * @param \EE_Registration $item |
|
499 | + * @return string |
|
500 | + */ |
|
501 | + public function column__REG_final_price(EE_Registration $item) |
|
502 | + { |
|
503 | + return '<span class="reg-pad-rght">' . ' ' . $item->pretty_final_price() . '</span>'; |
|
504 | + } |
|
505 | + |
|
506 | + |
|
507 | + /** |
|
508 | + * column_TXN_paid |
|
509 | + * |
|
510 | + * @param \EE_Registration $item |
|
511 | + * @return string |
|
512 | + * @throws \EE_Error |
|
513 | + */ |
|
514 | + public function column_TXN_paid(EE_Registration $item) |
|
515 | + { |
|
516 | + if ($item->count() === 1) { |
|
517 | + if ($item->transaction()->paid() >= $item->transaction()->total()) { |
|
518 | + return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
|
519 | + } else { |
|
520 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
521 | + array('action' => 'view_transaction', 'TXN_ID' => $item->transaction_ID()), |
|
522 | + TXN_ADMIN_URL |
|
523 | + ); |
|
524 | + return EE_Registry::instance()->CAP->current_user_can( |
|
525 | + 'ee_read_transaction', |
|
526 | + 'espresso_transactions_view_transaction' |
|
527 | + ) ? ' |
|
528 | 528 | <span class="reg-pad-rght"> |
529 | 529 | <a class="status-' |
530 | - . $item->transaction()->status_ID() |
|
531 | - . '" href="' |
|
532 | - . $view_txn_lnk_url |
|
533 | - . '" title="' |
|
534 | - . esc_attr__('View Transaction', 'event_espresso') |
|
535 | - . '"> |
|
530 | + . $item->transaction()->status_ID() |
|
531 | + . '" href="' |
|
532 | + . $view_txn_lnk_url |
|
533 | + . '" title="' |
|
534 | + . esc_attr__('View Transaction', 'event_espresso') |
|
535 | + . '"> |
|
536 | 536 | ' |
537 | - . $item->transaction()->pretty_paid() |
|
538 | - . ' |
|
537 | + . $item->transaction()->pretty_paid() |
|
538 | + . ' |
|
539 | 539 | </a> |
540 | 540 | <span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
541 | - } |
|
542 | - } else { |
|
543 | - return '<span class="reg-pad-rght"></span>'; |
|
544 | - } |
|
545 | - } |
|
546 | - |
|
547 | - |
|
548 | - /** |
|
549 | - * column_TXN_total |
|
550 | - * |
|
551 | - * @param \EE_Registration $item |
|
552 | - * @return string |
|
553 | - * @throws \EE_Error |
|
554 | - */ |
|
555 | - public function column_TXN_total(EE_Registration $item) |
|
556 | - { |
|
557 | - $txn = $item->transaction(); |
|
558 | - $view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL); |
|
559 | - if ($item->get('REG_count') === 1) { |
|
560 | - $line_total_obj = $txn->total_line_item(); |
|
561 | - $txn_total = $line_total_obj instanceof EE_Line_Item |
|
562 | - ? $line_total_obj->get_pretty('LIN_total') |
|
563 | - : esc_html__( |
|
564 | - 'View Transaction', |
|
565 | - 'event_espresso' |
|
566 | - ); |
|
567 | - return EE_Registry::instance()->CAP->current_user_can( |
|
568 | - 'ee_read_transaction', |
|
569 | - 'espresso_transactions_view_transaction' |
|
570 | - ) ? '<a href="' |
|
571 | - . $view_txn_url |
|
572 | - . '" title="' |
|
573 | - . esc_attr__('View Transaction', 'event_espresso') |
|
574 | - . '"><span class="reg-pad-rght">' |
|
575 | - . $txn_total |
|
576 | - . '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>'; |
|
577 | - } else { |
|
578 | - return '<span class="reg-pad-rght"></span>'; |
|
579 | - } |
|
580 | - } |
|
541 | + } |
|
542 | + } else { |
|
543 | + return '<span class="reg-pad-rght"></span>'; |
|
544 | + } |
|
545 | + } |
|
546 | + |
|
547 | + |
|
548 | + /** |
|
549 | + * column_TXN_total |
|
550 | + * |
|
551 | + * @param \EE_Registration $item |
|
552 | + * @return string |
|
553 | + * @throws \EE_Error |
|
554 | + */ |
|
555 | + public function column_TXN_total(EE_Registration $item) |
|
556 | + { |
|
557 | + $txn = $item->transaction(); |
|
558 | + $view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL); |
|
559 | + if ($item->get('REG_count') === 1) { |
|
560 | + $line_total_obj = $txn->total_line_item(); |
|
561 | + $txn_total = $line_total_obj instanceof EE_Line_Item |
|
562 | + ? $line_total_obj->get_pretty('LIN_total') |
|
563 | + : esc_html__( |
|
564 | + 'View Transaction', |
|
565 | + 'event_espresso' |
|
566 | + ); |
|
567 | + return EE_Registry::instance()->CAP->current_user_can( |
|
568 | + 'ee_read_transaction', |
|
569 | + 'espresso_transactions_view_transaction' |
|
570 | + ) ? '<a href="' |
|
571 | + . $view_txn_url |
|
572 | + . '" title="' |
|
573 | + . esc_attr__('View Transaction', 'event_espresso') |
|
574 | + . '"><span class="reg-pad-rght">' |
|
575 | + . $txn_total |
|
576 | + . '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>'; |
|
577 | + } else { |
|
578 | + return '<span class="reg-pad-rght"></span>'; |
|
579 | + } |
|
580 | + } |
|
581 | 581 | } |
@@ -17,151 +17,151 @@ |
||
17 | 17 | { |
18 | 18 | |
19 | 19 | |
20 | - protected function _setup_data() |
|
21 | - { |
|
22 | - $trashed = $this->_admin_page->get_view() == 'trashed' ? true : false; |
|
23 | - $this->_data = $this->_admin_page->get_default_tickets($this->_per_page, false, $trashed); |
|
24 | - $this->_all_data_count = $this->_admin_page->get_default_tickets($this->_per_page, true, false); |
|
25 | - $this->_trashed_count = $this->_admin_page->get_default_tickets($this->_per_page, true, true); |
|
26 | - } |
|
27 | - |
|
28 | - |
|
29 | - protected function _set_properties() |
|
30 | - { |
|
31 | - $this->_wp_list_args = array( |
|
32 | - 'singular' => esc_html__('ticket', 'event_espresso'), |
|
33 | - 'plural' => esc_html__('tickets', 'event_espresso'), |
|
34 | - 'ajax' => true, |
|
35 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
36 | - ); |
|
37 | - |
|
38 | - $this->_columns = array( |
|
39 | - 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
40 | - 'TKT_name' => esc_html__('Name', 'event_espresso'), |
|
41 | - 'TKT_description' => esc_html__('Description', 'event_espresso'), |
|
42 | - 'TKT_qty' => esc_html__('Quantity', 'event_espresso'), |
|
43 | - 'TKT_uses' => esc_html__('Datetimes', 'event_espresso'), |
|
44 | - 'TKT_min' => esc_html__('Minimum', 'event_espresso'), |
|
45 | - 'TKT_max' => esc_html__('Maximum', 'event_espresso'), |
|
46 | - 'TKT_price' => esc_html__('Price', 'event_espresso'), |
|
47 | - 'TKT_taxable' => esc_html__('Taxable', 'event_espresso'), |
|
48 | - ); |
|
49 | - |
|
50 | - $this->_sortable_columns = array( |
|
51 | - // TRUE means its already sorted |
|
52 | - 'TKT_name' => array('TKT_name' => true), |
|
53 | - 'TKT_description' => array('TKT_description' => false), |
|
54 | - 'TKT_qty' => array('TKT_qty' => false), |
|
55 | - 'TKT_uses' => array('TKT_uses' => false), |
|
56 | - 'TKT_min' => array('TKT_min' => false), |
|
57 | - 'TKT_max' => array('TKT_max' => false), |
|
58 | - 'TKT_price' => array('TKT_price' => false), |
|
59 | - ); |
|
60 | - |
|
61 | - $this->_hidden_columns = array(); |
|
62 | - } |
|
63 | - |
|
64 | - |
|
65 | - protected function _get_table_filters() |
|
66 | - { |
|
67 | - } |
|
68 | - |
|
69 | - |
|
70 | - protected function _add_view_counts() |
|
71 | - { |
|
72 | - $this->_views['all']['count'] = $this->_all_data_count; |
|
73 | - $this->_views['trashed']['count'] = $this->_trashed_count; |
|
74 | - } |
|
75 | - |
|
76 | - |
|
77 | - public function column_cb($item) |
|
78 | - { |
|
79 | - return $item->ID() === 1 |
|
80 | - ? '<span class="ee-lock-icon"></span>' |
|
81 | - : sprintf( |
|
82 | - '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', |
|
83 | - $item->ID() |
|
84 | - ); |
|
85 | - } |
|
86 | - |
|
87 | - |
|
88 | - public function column_TKT_name($item) |
|
89 | - { |
|
90 | - // build row actions |
|
91 | - $actions = array(); |
|
92 | - |
|
93 | - // trash links |
|
94 | - if ($item->ID() !== 1) { |
|
95 | - if ($this->_view == 'all') { |
|
96 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
97 | - 'action' => 'trash_ticket', |
|
98 | - 'TKT_ID' => $item->ID(), |
|
99 | - ), EVENTS_ADMIN_URL); |
|
100 | - $actions['trash'] = '<a href="' . $trash_lnk_url . '" title="' |
|
101 | - . esc_attr__('Move Ticket to trash', 'event_espresso') . '">' |
|
102 | - . esc_html__('Trash', 'event_espresso') . '</a>'; |
|
103 | - } else { |
|
104 | - // restore price link |
|
105 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
106 | - 'action' => 'restore_ticket', |
|
107 | - 'TKT_ID' => $item->ID(), |
|
108 | - ), EVENTS_ADMIN_URL); |
|
109 | - $actions['restore'] = '<a href="' . $restore_lnk_url . '" title="' |
|
110 | - . esc_attr__('Restore Ticket', 'event_espresso') . '">' |
|
111 | - . esc_html__('Restore', 'event_espresso') . '</a>'; |
|
112 | - // delete price link |
|
113 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
114 | - 'action' => 'delete_ticket', |
|
115 | - 'TKT_ID' => $item->ID(), |
|
116 | - ), EVENTS_ADMIN_URL); |
|
117 | - $actions['delete'] = '<a href="' . $delete_lnk_url . '" title="' |
|
118 | - . esc_attr__('Delete Ticket Permanently', 'event_espresso') . '">' |
|
119 | - . esc_html__('Delete Permanently', 'event_espresso') . '</a>'; |
|
120 | - } |
|
121 | - } |
|
122 | - |
|
123 | - return $item->get('TKT_name') . $this->row_actions($actions); |
|
124 | - } |
|
125 | - |
|
126 | - |
|
127 | - public function column_TKT_description($item) |
|
128 | - { |
|
129 | - return $item->get('TKT_description'); |
|
130 | - } |
|
131 | - |
|
132 | - |
|
133 | - public function column_TKT_qty($item) |
|
134 | - { |
|
135 | - return $item->get_pretty('TKT_qty', 'text'); |
|
136 | - } |
|
137 | - |
|
138 | - |
|
139 | - public function column_TKT_uses($item) |
|
140 | - { |
|
141 | - return $item->get_pretty('TKT_uses', 'text'); |
|
142 | - } |
|
143 | - |
|
144 | - |
|
145 | - public function column_TKT_min($item) |
|
146 | - { |
|
147 | - return $item->get('TKT_min'); |
|
148 | - } |
|
149 | - |
|
150 | - |
|
151 | - public function column_TKT_max($item) |
|
152 | - { |
|
153 | - return $item->get_pretty('TKT_max', 'text'); |
|
154 | - } |
|
155 | - |
|
156 | - |
|
157 | - public function column_TKT_price($item) |
|
158 | - { |
|
159 | - return EEH_Template::format_currency($item->get('TKT_price')); |
|
160 | - } |
|
161 | - |
|
162 | - |
|
163 | - public function column_TKT_taxable($item) |
|
164 | - { |
|
165 | - return $item->get('TKT_taxable') ? esc_html__('Yes', 'event_espresso') : esc_html__('No', 'event_espresso'); |
|
166 | - } |
|
20 | + protected function _setup_data() |
|
21 | + { |
|
22 | + $trashed = $this->_admin_page->get_view() == 'trashed' ? true : false; |
|
23 | + $this->_data = $this->_admin_page->get_default_tickets($this->_per_page, false, $trashed); |
|
24 | + $this->_all_data_count = $this->_admin_page->get_default_tickets($this->_per_page, true, false); |
|
25 | + $this->_trashed_count = $this->_admin_page->get_default_tickets($this->_per_page, true, true); |
|
26 | + } |
|
27 | + |
|
28 | + |
|
29 | + protected function _set_properties() |
|
30 | + { |
|
31 | + $this->_wp_list_args = array( |
|
32 | + 'singular' => esc_html__('ticket', 'event_espresso'), |
|
33 | + 'plural' => esc_html__('tickets', 'event_espresso'), |
|
34 | + 'ajax' => true, |
|
35 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
36 | + ); |
|
37 | + |
|
38 | + $this->_columns = array( |
|
39 | + 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
40 | + 'TKT_name' => esc_html__('Name', 'event_espresso'), |
|
41 | + 'TKT_description' => esc_html__('Description', 'event_espresso'), |
|
42 | + 'TKT_qty' => esc_html__('Quantity', 'event_espresso'), |
|
43 | + 'TKT_uses' => esc_html__('Datetimes', 'event_espresso'), |
|
44 | + 'TKT_min' => esc_html__('Minimum', 'event_espresso'), |
|
45 | + 'TKT_max' => esc_html__('Maximum', 'event_espresso'), |
|
46 | + 'TKT_price' => esc_html__('Price', 'event_espresso'), |
|
47 | + 'TKT_taxable' => esc_html__('Taxable', 'event_espresso'), |
|
48 | + ); |
|
49 | + |
|
50 | + $this->_sortable_columns = array( |
|
51 | + // TRUE means its already sorted |
|
52 | + 'TKT_name' => array('TKT_name' => true), |
|
53 | + 'TKT_description' => array('TKT_description' => false), |
|
54 | + 'TKT_qty' => array('TKT_qty' => false), |
|
55 | + 'TKT_uses' => array('TKT_uses' => false), |
|
56 | + 'TKT_min' => array('TKT_min' => false), |
|
57 | + 'TKT_max' => array('TKT_max' => false), |
|
58 | + 'TKT_price' => array('TKT_price' => false), |
|
59 | + ); |
|
60 | + |
|
61 | + $this->_hidden_columns = array(); |
|
62 | + } |
|
63 | + |
|
64 | + |
|
65 | + protected function _get_table_filters() |
|
66 | + { |
|
67 | + } |
|
68 | + |
|
69 | + |
|
70 | + protected function _add_view_counts() |
|
71 | + { |
|
72 | + $this->_views['all']['count'] = $this->_all_data_count; |
|
73 | + $this->_views['trashed']['count'] = $this->_trashed_count; |
|
74 | + } |
|
75 | + |
|
76 | + |
|
77 | + public function column_cb($item) |
|
78 | + { |
|
79 | + return $item->ID() === 1 |
|
80 | + ? '<span class="ee-lock-icon"></span>' |
|
81 | + : sprintf( |
|
82 | + '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', |
|
83 | + $item->ID() |
|
84 | + ); |
|
85 | + } |
|
86 | + |
|
87 | + |
|
88 | + public function column_TKT_name($item) |
|
89 | + { |
|
90 | + // build row actions |
|
91 | + $actions = array(); |
|
92 | + |
|
93 | + // trash links |
|
94 | + if ($item->ID() !== 1) { |
|
95 | + if ($this->_view == 'all') { |
|
96 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
97 | + 'action' => 'trash_ticket', |
|
98 | + 'TKT_ID' => $item->ID(), |
|
99 | + ), EVENTS_ADMIN_URL); |
|
100 | + $actions['trash'] = '<a href="' . $trash_lnk_url . '" title="' |
|
101 | + . esc_attr__('Move Ticket to trash', 'event_espresso') . '">' |
|
102 | + . esc_html__('Trash', 'event_espresso') . '</a>'; |
|
103 | + } else { |
|
104 | + // restore price link |
|
105 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
106 | + 'action' => 'restore_ticket', |
|
107 | + 'TKT_ID' => $item->ID(), |
|
108 | + ), EVENTS_ADMIN_URL); |
|
109 | + $actions['restore'] = '<a href="' . $restore_lnk_url . '" title="' |
|
110 | + . esc_attr__('Restore Ticket', 'event_espresso') . '">' |
|
111 | + . esc_html__('Restore', 'event_espresso') . '</a>'; |
|
112 | + // delete price link |
|
113 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
114 | + 'action' => 'delete_ticket', |
|
115 | + 'TKT_ID' => $item->ID(), |
|
116 | + ), EVENTS_ADMIN_URL); |
|
117 | + $actions['delete'] = '<a href="' . $delete_lnk_url . '" title="' |
|
118 | + . esc_attr__('Delete Ticket Permanently', 'event_espresso') . '">' |
|
119 | + . esc_html__('Delete Permanently', 'event_espresso') . '</a>'; |
|
120 | + } |
|
121 | + } |
|
122 | + |
|
123 | + return $item->get('TKT_name') . $this->row_actions($actions); |
|
124 | + } |
|
125 | + |
|
126 | + |
|
127 | + public function column_TKT_description($item) |
|
128 | + { |
|
129 | + return $item->get('TKT_description'); |
|
130 | + } |
|
131 | + |
|
132 | + |
|
133 | + public function column_TKT_qty($item) |
|
134 | + { |
|
135 | + return $item->get_pretty('TKT_qty', 'text'); |
|
136 | + } |
|
137 | + |
|
138 | + |
|
139 | + public function column_TKT_uses($item) |
|
140 | + { |
|
141 | + return $item->get_pretty('TKT_uses', 'text'); |
|
142 | + } |
|
143 | + |
|
144 | + |
|
145 | + public function column_TKT_min($item) |
|
146 | + { |
|
147 | + return $item->get('TKT_min'); |
|
148 | + } |
|
149 | + |
|
150 | + |
|
151 | + public function column_TKT_max($item) |
|
152 | + { |
|
153 | + return $item->get_pretty('TKT_max', 'text'); |
|
154 | + } |
|
155 | + |
|
156 | + |
|
157 | + public function column_TKT_price($item) |
|
158 | + { |
|
159 | + return EEH_Template::format_currency($item->get('TKT_price')); |
|
160 | + } |
|
161 | + |
|
162 | + |
|
163 | + public function column_TKT_taxable($item) |
|
164 | + { |
|
165 | + return $item->get('TKT_taxable') ? esc_html__('Yes', 'event_espresso') : esc_html__('No', 'event_espresso'); |
|
166 | + } |
|
167 | 167 | } |
@@ -97,30 +97,30 @@ |
||
97 | 97 | 'action' => 'trash_ticket', |
98 | 98 | 'TKT_ID' => $item->ID(), |
99 | 99 | ), EVENTS_ADMIN_URL); |
100 | - $actions['trash'] = '<a href="' . $trash_lnk_url . '" title="' |
|
101 | - . esc_attr__('Move Ticket to trash', 'event_espresso') . '">' |
|
102 | - . esc_html__('Trash', 'event_espresso') . '</a>'; |
|
100 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' |
|
101 | + . esc_attr__('Move Ticket to trash', 'event_espresso').'">' |
|
102 | + . esc_html__('Trash', 'event_espresso').'</a>'; |
|
103 | 103 | } else { |
104 | 104 | // restore price link |
105 | 105 | $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
106 | 106 | 'action' => 'restore_ticket', |
107 | 107 | 'TKT_ID' => $item->ID(), |
108 | 108 | ), EVENTS_ADMIN_URL); |
109 | - $actions['restore'] = '<a href="' . $restore_lnk_url . '" title="' |
|
110 | - . esc_attr__('Restore Ticket', 'event_espresso') . '">' |
|
111 | - . esc_html__('Restore', 'event_espresso') . '</a>'; |
|
109 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' |
|
110 | + . esc_attr__('Restore Ticket', 'event_espresso').'">' |
|
111 | + . esc_html__('Restore', 'event_espresso').'</a>'; |
|
112 | 112 | // delete price link |
113 | 113 | $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
114 | 114 | 'action' => 'delete_ticket', |
115 | 115 | 'TKT_ID' => $item->ID(), |
116 | 116 | ), EVENTS_ADMIN_URL); |
117 | - $actions['delete'] = '<a href="' . $delete_lnk_url . '" title="' |
|
118 | - . esc_attr__('Delete Ticket Permanently', 'event_espresso') . '">' |
|
119 | - . esc_html__('Delete Permanently', 'event_espresso') . '</a>'; |
|
117 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' |
|
118 | + . esc_attr__('Delete Ticket Permanently', 'event_espresso').'">' |
|
119 | + . esc_html__('Delete Permanently', 'event_espresso').'</a>'; |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
123 | - return $item->get('TKT_name') . $this->row_actions($actions); |
|
123 | + return $item->get('TKT_name').$this->row_actions($actions); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 |
@@ -16,247 +16,247 @@ |
||
16 | 16 | { |
17 | 17 | |
18 | 18 | |
19 | - /** |
|
20 | - * This is used to hold the reports template data which is setup early in the request. |
|
21 | - * |
|
22 | - * @type array |
|
23 | - */ |
|
24 | - protected $_reports_template_data = array(); |
|
25 | - |
|
26 | - /** |
|
27 | - * @Constructor |
|
28 | - * @access public |
|
29 | - * |
|
30 | - * @param bool $routing |
|
31 | - * |
|
32 | - * @return \Extend_Transactions_Admin_Page |
|
33 | - */ |
|
34 | - public function __construct($routing = true) |
|
35 | - { |
|
36 | - parent::__construct($routing); |
|
37 | - define('TXN_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/templates/'); |
|
38 | - define('TXN_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/assets/'); |
|
39 | - define('TXN_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'transactions/assets/'); |
|
40 | - } |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * _extend_page_config |
|
45 | - * |
|
46 | - * @access protected |
|
47 | - * @return void |
|
48 | - */ |
|
49 | - protected function _extend_page_config() |
|
50 | - { |
|
51 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'transactions'; |
|
52 | - |
|
53 | - $new_page_routes = array( |
|
54 | - 'reports' => array( |
|
55 | - 'func' => '_transaction_reports', |
|
56 | - 'capability' => 'ee_read_transactions', |
|
57 | - ), |
|
58 | - ); |
|
59 | - |
|
60 | - $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
61 | - |
|
62 | - $new_page_config = array( |
|
63 | - 'reports' => array( |
|
64 | - 'nav' => array( |
|
65 | - 'label' => esc_html__('Reports', 'event_espresso'), |
|
66 | - 'order' => 20, |
|
67 | - ), |
|
68 | - 'help_tabs' => array( |
|
69 | - 'transactions_reports_help_tab' => array( |
|
70 | - 'title' => esc_html__('Transaction Reports', 'event_espresso'), |
|
71 | - 'filename' => 'transactions_reports', |
|
72 | - ), |
|
73 | - ), |
|
74 | - /*'help_tour' => array( 'Transaction_Reports_Help_Tour' ),*/ |
|
75 | - 'require_nonce' => false, |
|
76 | - ), |
|
77 | - ); |
|
78 | - $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
79 | - } |
|
80 | - |
|
81 | - |
|
82 | - /** |
|
83 | - * load_scripts_styles_reports |
|
84 | - * |
|
85 | - * @access public |
|
86 | - * @return void |
|
87 | - */ |
|
88 | - public function load_scripts_styles_reports() |
|
89 | - { |
|
90 | - wp_register_script( |
|
91 | - 'ee-txn-reports-js', |
|
92 | - TXN_CAF_ASSETS_URL . 'ee-transaction-admin-reports.js', |
|
93 | - array('google-charts'), |
|
94 | - EVENT_ESPRESSO_VERSION, |
|
95 | - true |
|
96 | - ); |
|
97 | - wp_enqueue_script('ee-txn-reports-js'); |
|
98 | - $this->_transaction_reports_js_setup(); |
|
99 | - EE_Registry::$i18n_js_strings['currency_format'] = EEH_Money::get_format_for_google_charts(); |
|
100 | - } |
|
101 | - |
|
102 | - |
|
103 | - /** |
|
104 | - * This is called when javascript is being enqueued to setup the various data needed for the reports js. |
|
105 | - * Also $this->{$_reports_template_data} property is set for later usage by the _transaction_reports method. |
|
106 | - */ |
|
107 | - protected function _transaction_reports_js_setup() |
|
108 | - { |
|
109 | - $this->_reports_template_data['admin_reports'][] = $this->_revenue_per_day_report(); |
|
110 | - $this->_reports_template_data['admin_reports'][] = $this->_revenue_per_event_report(); |
|
111 | - } |
|
112 | - |
|
113 | - |
|
114 | - /** |
|
115 | - * _transaction_reports |
|
116 | - * generates Business Reports regarding Transactions |
|
117 | - * |
|
118 | - * @return void |
|
119 | - */ |
|
120 | - protected function _transaction_reports() |
|
121 | - { |
|
122 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php'; |
|
123 | - $this->_admin_page_title = esc_html__('Transactions', 'event_espresso'); |
|
124 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
125 | - $template_path, |
|
126 | - $this->_reports_template_data, |
|
127 | - true |
|
128 | - ); |
|
129 | - |
|
130 | - // the final template wrapper |
|
131 | - $this->display_admin_page_with_no_sidebar(); |
|
132 | - } |
|
133 | - |
|
134 | - |
|
135 | - /** |
|
136 | - * _revenue_per_day_report |
|
137 | - * generates Business Report showing Total Revenue per Day. |
|
138 | - * |
|
139 | - * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated. |
|
140 | - * |
|
141 | - * @return string |
|
142 | - */ |
|
143 | - private function _revenue_per_day_report($period = '-1 month') |
|
144 | - { |
|
145 | - |
|
146 | - $report_ID = 'txn-admin-revenue-per-day-report-dv'; |
|
147 | - |
|
148 | - $TXN = EEM_Transaction::instance(); |
|
149 | - |
|
150 | - $results = $TXN->get_revenue_per_day_report($period); |
|
151 | - $results = (array) $results; |
|
152 | - $revenue = array(); |
|
153 | - $subtitle = ''; |
|
154 | - |
|
155 | - if ($results) { |
|
156 | - $revenue[] = array( |
|
157 | - esc_html__('Date (only shows dates that have a revenue greater than 1)', 'event_espresso'), |
|
158 | - esc_html__('Total Revenue', 'event_espresso'), |
|
159 | - ); |
|
160 | - foreach ($results as $result) { |
|
161 | - $revenue[] = array($result->txnDate, (float) $result->revenue); |
|
162 | - } |
|
163 | - |
|
164 | - // setup the date range. |
|
165 | - $beginning_date = new DateTime('now' . $period, new DateTimeZone(EEH_DTT_Helper::get_timezone())); |
|
166 | - $ending_date = new DateTime('now', new DateTimeZone(EEH_DTT_Helper::get_timezone())); |
|
167 | - $subtitle = sprintf( |
|
168 | - wp_strip_all_tags( |
|
169 | - _x('For the period: %s to %s', 'Used to give date range', 'event_espresso') |
|
170 | - ), |
|
171 | - $beginning_date->format('Y-m-d'), |
|
172 | - $ending_date->format('Y-m-d') |
|
173 | - ); |
|
174 | - } |
|
175 | - |
|
176 | - $report_title = wp_strip_all_tags(__('Total Revenue per Day', 'event_espresso')); |
|
177 | - |
|
178 | - $report_params = array( |
|
179 | - 'title' => $report_title, |
|
180 | - 'subtitle' => $subtitle, |
|
181 | - 'id' => $report_ID, |
|
182 | - 'revenue' => $revenue, |
|
183 | - 'noResults' => empty($revenue) || count($revenue) === 1, |
|
184 | - 'noTxnMsg' => sprintf( |
|
185 | - wp_strip_all_tags( |
|
186 | - __('%sThere is no revenue to report for the last 30 days.%s', 'event_espresso') |
|
187 | - ), |
|
188 | - '<h2>' . $report_title . '</h2><p>', |
|
189 | - '</p>' |
|
190 | - ), |
|
191 | - ); |
|
192 | - wp_localize_script('ee-txn-reports-js', 'txnRevPerDay', $report_params); |
|
193 | - |
|
194 | - return $report_ID; |
|
195 | - } |
|
196 | - |
|
197 | - |
|
198 | - /** |
|
199 | - * _revenue_per_event_report |
|
200 | - * generates Business Report showing total revenue per event. |
|
201 | - * |
|
202 | - * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated. |
|
203 | - * |
|
204 | - * @return int |
|
205 | - */ |
|
206 | - private function _revenue_per_event_report($period = '-1 month') |
|
207 | - { |
|
208 | - |
|
209 | - $report_ID = 'txn-admin-revenue-per-event-report-dv'; |
|
210 | - |
|
211 | - $TXN = EEM_Transaction::instance(); |
|
212 | - $results = $TXN->get_revenue_per_event_report($period); |
|
213 | - $results = (array) $results; |
|
214 | - $revenue = array(); |
|
215 | - $subtitle = ''; |
|
216 | - |
|
217 | - if ($results) { |
|
218 | - $revenue[] = array( |
|
219 | - esc_html__('Event (only events that have a revenue greater than 1 are shown)', 'event_espresso'), |
|
220 | - esc_html__('Total Revenue', 'event_espresso'), |
|
221 | - ); |
|
222 | - foreach ($results as $result) { |
|
223 | - if ($result->revenue > 1) { |
|
224 | - $event_name = stripslashes(html_entity_decode($result->event_name, ENT_QUOTES, 'UTF-8')); |
|
225 | - $event_name = wp_trim_words($event_name, 5, '...'); |
|
226 | - $revenue[] = array($event_name, (float) $result->revenue); |
|
227 | - } |
|
228 | - } |
|
229 | - |
|
230 | - // setup the date range. |
|
231 | - $beginning_date = new DateTime('now' . $period, new DateTimeZone(EEH_DTT_Helper::get_timezone())); |
|
232 | - $ending_date = new DateTime('now', new DateTimeZone(EEH_DTT_Helper::get_timezone())); |
|
233 | - $subtitle = sprintf( |
|
234 | - wp_strip_all_tags( |
|
235 | - _x('For the period: %s to %s', 'Used to give date range', 'event_espresso') |
|
236 | - ), |
|
237 | - $beginning_date->format('Y-m-d'), |
|
238 | - $ending_date->format('Y-m-d') |
|
239 | - ); |
|
240 | - } |
|
241 | - |
|
242 | - $report_title = wp_strip_all_tags(__('Total Revenue per Event', 'event_espresso')); |
|
243 | - |
|
244 | - $report_params = array( |
|
245 | - 'title' => $report_title, |
|
246 | - 'subtitle' => $subtitle, |
|
247 | - 'id' => $report_ID, |
|
248 | - 'revenue' => $revenue, |
|
249 | - 'noResults' => empty($revenue), |
|
250 | - 'noTxnMsg' => sprintf( |
|
251 | - wp_strip_all_tags( |
|
252 | - __('%sThere is no revenue to report for the last 30 days.%s', 'event_espresso') |
|
253 | - ), |
|
254 | - '<h2>' . $report_title . '</h2><p>', |
|
255 | - '</p>' |
|
256 | - ), |
|
257 | - ); |
|
258 | - wp_localize_script('ee-txn-reports-js', 'txnRevPerEvent', $report_params); |
|
259 | - |
|
260 | - return $report_ID; |
|
261 | - } |
|
19 | + /** |
|
20 | + * This is used to hold the reports template data which is setup early in the request. |
|
21 | + * |
|
22 | + * @type array |
|
23 | + */ |
|
24 | + protected $_reports_template_data = array(); |
|
25 | + |
|
26 | + /** |
|
27 | + * @Constructor |
|
28 | + * @access public |
|
29 | + * |
|
30 | + * @param bool $routing |
|
31 | + * |
|
32 | + * @return \Extend_Transactions_Admin_Page |
|
33 | + */ |
|
34 | + public function __construct($routing = true) |
|
35 | + { |
|
36 | + parent::__construct($routing); |
|
37 | + define('TXN_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/templates/'); |
|
38 | + define('TXN_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/assets/'); |
|
39 | + define('TXN_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'transactions/assets/'); |
|
40 | + } |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * _extend_page_config |
|
45 | + * |
|
46 | + * @access protected |
|
47 | + * @return void |
|
48 | + */ |
|
49 | + protected function _extend_page_config() |
|
50 | + { |
|
51 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'transactions'; |
|
52 | + |
|
53 | + $new_page_routes = array( |
|
54 | + 'reports' => array( |
|
55 | + 'func' => '_transaction_reports', |
|
56 | + 'capability' => 'ee_read_transactions', |
|
57 | + ), |
|
58 | + ); |
|
59 | + |
|
60 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
61 | + |
|
62 | + $new_page_config = array( |
|
63 | + 'reports' => array( |
|
64 | + 'nav' => array( |
|
65 | + 'label' => esc_html__('Reports', 'event_espresso'), |
|
66 | + 'order' => 20, |
|
67 | + ), |
|
68 | + 'help_tabs' => array( |
|
69 | + 'transactions_reports_help_tab' => array( |
|
70 | + 'title' => esc_html__('Transaction Reports', 'event_espresso'), |
|
71 | + 'filename' => 'transactions_reports', |
|
72 | + ), |
|
73 | + ), |
|
74 | + /*'help_tour' => array( 'Transaction_Reports_Help_Tour' ),*/ |
|
75 | + 'require_nonce' => false, |
|
76 | + ), |
|
77 | + ); |
|
78 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
79 | + } |
|
80 | + |
|
81 | + |
|
82 | + /** |
|
83 | + * load_scripts_styles_reports |
|
84 | + * |
|
85 | + * @access public |
|
86 | + * @return void |
|
87 | + */ |
|
88 | + public function load_scripts_styles_reports() |
|
89 | + { |
|
90 | + wp_register_script( |
|
91 | + 'ee-txn-reports-js', |
|
92 | + TXN_CAF_ASSETS_URL . 'ee-transaction-admin-reports.js', |
|
93 | + array('google-charts'), |
|
94 | + EVENT_ESPRESSO_VERSION, |
|
95 | + true |
|
96 | + ); |
|
97 | + wp_enqueue_script('ee-txn-reports-js'); |
|
98 | + $this->_transaction_reports_js_setup(); |
|
99 | + EE_Registry::$i18n_js_strings['currency_format'] = EEH_Money::get_format_for_google_charts(); |
|
100 | + } |
|
101 | + |
|
102 | + |
|
103 | + /** |
|
104 | + * This is called when javascript is being enqueued to setup the various data needed for the reports js. |
|
105 | + * Also $this->{$_reports_template_data} property is set for later usage by the _transaction_reports method. |
|
106 | + */ |
|
107 | + protected function _transaction_reports_js_setup() |
|
108 | + { |
|
109 | + $this->_reports_template_data['admin_reports'][] = $this->_revenue_per_day_report(); |
|
110 | + $this->_reports_template_data['admin_reports'][] = $this->_revenue_per_event_report(); |
|
111 | + } |
|
112 | + |
|
113 | + |
|
114 | + /** |
|
115 | + * _transaction_reports |
|
116 | + * generates Business Reports regarding Transactions |
|
117 | + * |
|
118 | + * @return void |
|
119 | + */ |
|
120 | + protected function _transaction_reports() |
|
121 | + { |
|
122 | + $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php'; |
|
123 | + $this->_admin_page_title = esc_html__('Transactions', 'event_espresso'); |
|
124 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
125 | + $template_path, |
|
126 | + $this->_reports_template_data, |
|
127 | + true |
|
128 | + ); |
|
129 | + |
|
130 | + // the final template wrapper |
|
131 | + $this->display_admin_page_with_no_sidebar(); |
|
132 | + } |
|
133 | + |
|
134 | + |
|
135 | + /** |
|
136 | + * _revenue_per_day_report |
|
137 | + * generates Business Report showing Total Revenue per Day. |
|
138 | + * |
|
139 | + * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated. |
|
140 | + * |
|
141 | + * @return string |
|
142 | + */ |
|
143 | + private function _revenue_per_day_report($period = '-1 month') |
|
144 | + { |
|
145 | + |
|
146 | + $report_ID = 'txn-admin-revenue-per-day-report-dv'; |
|
147 | + |
|
148 | + $TXN = EEM_Transaction::instance(); |
|
149 | + |
|
150 | + $results = $TXN->get_revenue_per_day_report($period); |
|
151 | + $results = (array) $results; |
|
152 | + $revenue = array(); |
|
153 | + $subtitle = ''; |
|
154 | + |
|
155 | + if ($results) { |
|
156 | + $revenue[] = array( |
|
157 | + esc_html__('Date (only shows dates that have a revenue greater than 1)', 'event_espresso'), |
|
158 | + esc_html__('Total Revenue', 'event_espresso'), |
|
159 | + ); |
|
160 | + foreach ($results as $result) { |
|
161 | + $revenue[] = array($result->txnDate, (float) $result->revenue); |
|
162 | + } |
|
163 | + |
|
164 | + // setup the date range. |
|
165 | + $beginning_date = new DateTime('now' . $period, new DateTimeZone(EEH_DTT_Helper::get_timezone())); |
|
166 | + $ending_date = new DateTime('now', new DateTimeZone(EEH_DTT_Helper::get_timezone())); |
|
167 | + $subtitle = sprintf( |
|
168 | + wp_strip_all_tags( |
|
169 | + _x('For the period: %s to %s', 'Used to give date range', 'event_espresso') |
|
170 | + ), |
|
171 | + $beginning_date->format('Y-m-d'), |
|
172 | + $ending_date->format('Y-m-d') |
|
173 | + ); |
|
174 | + } |
|
175 | + |
|
176 | + $report_title = wp_strip_all_tags(__('Total Revenue per Day', 'event_espresso')); |
|
177 | + |
|
178 | + $report_params = array( |
|
179 | + 'title' => $report_title, |
|
180 | + 'subtitle' => $subtitle, |
|
181 | + 'id' => $report_ID, |
|
182 | + 'revenue' => $revenue, |
|
183 | + 'noResults' => empty($revenue) || count($revenue) === 1, |
|
184 | + 'noTxnMsg' => sprintf( |
|
185 | + wp_strip_all_tags( |
|
186 | + __('%sThere is no revenue to report for the last 30 days.%s', 'event_espresso') |
|
187 | + ), |
|
188 | + '<h2>' . $report_title . '</h2><p>', |
|
189 | + '</p>' |
|
190 | + ), |
|
191 | + ); |
|
192 | + wp_localize_script('ee-txn-reports-js', 'txnRevPerDay', $report_params); |
|
193 | + |
|
194 | + return $report_ID; |
|
195 | + } |
|
196 | + |
|
197 | + |
|
198 | + /** |
|
199 | + * _revenue_per_event_report |
|
200 | + * generates Business Report showing total revenue per event. |
|
201 | + * |
|
202 | + * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated. |
|
203 | + * |
|
204 | + * @return int |
|
205 | + */ |
|
206 | + private function _revenue_per_event_report($period = '-1 month') |
|
207 | + { |
|
208 | + |
|
209 | + $report_ID = 'txn-admin-revenue-per-event-report-dv'; |
|
210 | + |
|
211 | + $TXN = EEM_Transaction::instance(); |
|
212 | + $results = $TXN->get_revenue_per_event_report($period); |
|
213 | + $results = (array) $results; |
|
214 | + $revenue = array(); |
|
215 | + $subtitle = ''; |
|
216 | + |
|
217 | + if ($results) { |
|
218 | + $revenue[] = array( |
|
219 | + esc_html__('Event (only events that have a revenue greater than 1 are shown)', 'event_espresso'), |
|
220 | + esc_html__('Total Revenue', 'event_espresso'), |
|
221 | + ); |
|
222 | + foreach ($results as $result) { |
|
223 | + if ($result->revenue > 1) { |
|
224 | + $event_name = stripslashes(html_entity_decode($result->event_name, ENT_QUOTES, 'UTF-8')); |
|
225 | + $event_name = wp_trim_words($event_name, 5, '...'); |
|
226 | + $revenue[] = array($event_name, (float) $result->revenue); |
|
227 | + } |
|
228 | + } |
|
229 | + |
|
230 | + // setup the date range. |
|
231 | + $beginning_date = new DateTime('now' . $period, new DateTimeZone(EEH_DTT_Helper::get_timezone())); |
|
232 | + $ending_date = new DateTime('now', new DateTimeZone(EEH_DTT_Helper::get_timezone())); |
|
233 | + $subtitle = sprintf( |
|
234 | + wp_strip_all_tags( |
|
235 | + _x('For the period: %s to %s', 'Used to give date range', 'event_espresso') |
|
236 | + ), |
|
237 | + $beginning_date->format('Y-m-d'), |
|
238 | + $ending_date->format('Y-m-d') |
|
239 | + ); |
|
240 | + } |
|
241 | + |
|
242 | + $report_title = wp_strip_all_tags(__('Total Revenue per Event', 'event_espresso')); |
|
243 | + |
|
244 | + $report_params = array( |
|
245 | + 'title' => $report_title, |
|
246 | + 'subtitle' => $subtitle, |
|
247 | + 'id' => $report_ID, |
|
248 | + 'revenue' => $revenue, |
|
249 | + 'noResults' => empty($revenue), |
|
250 | + 'noTxnMsg' => sprintf( |
|
251 | + wp_strip_all_tags( |
|
252 | + __('%sThere is no revenue to report for the last 30 days.%s', 'event_espresso') |
|
253 | + ), |
|
254 | + '<h2>' . $report_title . '</h2><p>', |
|
255 | + '</p>' |
|
256 | + ), |
|
257 | + ); |
|
258 | + wp_localize_script('ee-txn-reports-js', 'txnRevPerEvent', $report_params); |
|
259 | + |
|
260 | + return $report_ID; |
|
261 | + } |
|
262 | 262 | } |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | public function __construct($routing = true) |
35 | 35 | { |
36 | 36 | parent::__construct($routing); |
37 | - define('TXN_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/templates/'); |
|
38 | - define('TXN_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/assets/'); |
|
39 | - define('TXN_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'transactions/assets/'); |
|
37 | + define('TXN_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'transactions/templates/'); |
|
38 | + define('TXN_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'transactions/assets/'); |
|
39 | + define('TXN_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'transactions/assets/'); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | protected function _extend_page_config() |
50 | 50 | { |
51 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'transactions'; |
|
51 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'transactions'; |
|
52 | 52 | |
53 | 53 | $new_page_routes = array( |
54 | 54 | 'reports' => array( |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | { |
90 | 90 | wp_register_script( |
91 | 91 | 'ee-txn-reports-js', |
92 | - TXN_CAF_ASSETS_URL . 'ee-transaction-admin-reports.js', |
|
92 | + TXN_CAF_ASSETS_URL.'ee-transaction-admin-reports.js', |
|
93 | 93 | array('google-charts'), |
94 | 94 | EVENT_ESPRESSO_VERSION, |
95 | 95 | true |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | protected function _transaction_reports() |
121 | 121 | { |
122 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php'; |
|
122 | + $template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php'; |
|
123 | 123 | $this->_admin_page_title = esc_html__('Transactions', 'event_espresso'); |
124 | 124 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
125 | 125 | $template_path, |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | } |
163 | 163 | |
164 | 164 | // setup the date range. |
165 | - $beginning_date = new DateTime('now' . $period, new DateTimeZone(EEH_DTT_Helper::get_timezone())); |
|
165 | + $beginning_date = new DateTime('now'.$period, new DateTimeZone(EEH_DTT_Helper::get_timezone())); |
|
166 | 166 | $ending_date = new DateTime('now', new DateTimeZone(EEH_DTT_Helper::get_timezone())); |
167 | 167 | $subtitle = sprintf( |
168 | 168 | wp_strip_all_tags( |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | wp_strip_all_tags( |
186 | 186 | __('%sThere is no revenue to report for the last 30 days.%s', 'event_espresso') |
187 | 187 | ), |
188 | - '<h2>' . $report_title . '</h2><p>', |
|
188 | + '<h2>'.$report_title.'</h2><p>', |
|
189 | 189 | '</p>' |
190 | 190 | ), |
191 | 191 | ); |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | } |
229 | 229 | |
230 | 230 | // setup the date range. |
231 | - $beginning_date = new DateTime('now' . $period, new DateTimeZone(EEH_DTT_Helper::get_timezone())); |
|
231 | + $beginning_date = new DateTime('now'.$period, new DateTimeZone(EEH_DTT_Helper::get_timezone())); |
|
232 | 232 | $ending_date = new DateTime('now', new DateTimeZone(EEH_DTT_Helper::get_timezone())); |
233 | 233 | $subtitle = sprintf( |
234 | 234 | wp_strip_all_tags( |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | wp_strip_all_tags( |
252 | 252 | __('%sThere is no revenue to report for the last 30 days.%s', 'event_espresso') |
253 | 253 | ), |
254 | - '<h2>' . $report_title . '</h2><p>', |
|
254 | + '<h2>'.$report_title.'</h2><p>', |
|
255 | 255 | '</p>' |
256 | 256 | ), |
257 | 257 | ); |