@@ -8,15 +8,15 @@ |
||
8 | 8 | <strong><?php esc_html_e('Recommendations', 'event_espresso'); ?></strong> |
9 | 9 | <br /> |
10 | 10 | <?php esc_html_e( |
11 | - 'To learn more about the options on this page, take a look at the different tabs that appear on the left side of the page.', |
|
12 | - 'event_espresso' |
|
13 | - ); ?> |
|
11 | + 'To learn more about the options on this page, take a look at the different tabs that appear on the left side of the page.', |
|
12 | + 'event_espresso' |
|
13 | + ); ?> |
|
14 | 14 | </p> |
15 | 15 | <p> |
16 | 16 | <strong><?php esc_html_e('Screen Options', 'event_espresso'); ?></strong> |
17 | 17 | <br /> |
18 | 18 | <?php esc_html_e( |
19 | - 'You can customize the information that is shown on this page by toggling the Screen Options tab. Then you can add or remove checkmarks to hide or show certain content and even adjust the pagination for venues.', |
|
20 | - 'event_espresso' |
|
21 | - ); ?> |
|
19 | + 'You can customize the information that is shown on this page by toggling the Screen Options tab. Then you can add or remove checkmarks to hide or show certain content and even adjust the pagination for venues.', |
|
20 | + 'event_espresso' |
|
21 | + ); ?> |
|
22 | 22 | </p> |
23 | 23 | \ No newline at end of file |
@@ -3,15 +3,15 @@ |
||
3 | 3 | </p> |
4 | 4 | <p> |
5 | 5 | <?php esc_html_e( |
6 | - 'This page shows all venue categories that have been created with Event Espresso.', |
|
7 | - 'event_espresso' |
|
8 | - ); ?> |
|
6 | + 'This page shows all venue categories that have been created with Event Espresso.', |
|
7 | + 'event_espresso' |
|
8 | + ); ?> |
|
9 | 9 | </p> |
10 | 10 | <p> |
11 | 11 | <strong><?php esc_html_e('Screen Options', 'event_espresso'); ?></strong> |
12 | 12 | <br /> |
13 | 13 | <?php esc_html_e( |
14 | - 'You can customize the information that is shown on this page by toggling the Screen Options tab. Then you can add or remove checkmarks to hide or show certain content and even adjust the pagination for venue categories.', |
|
15 | - 'event_espresso' |
|
16 | - ); ?> |
|
14 | + 'You can customize the information that is shown on this page by toggling the Screen Options tab. Then you can add or remove checkmarks to hide or show certain content and even adjust the pagination for venue categories.', |
|
15 | + 'event_espresso' |
|
16 | + ); ?> |
|
17 | 17 | </p> |
18 | 18 | \ No newline at end of file |
@@ -3,15 +3,15 @@ discard block |
||
3 | 3 | </p> |
4 | 4 | <p> |
5 | 5 | <?php esc_html_e( |
6 | - 'This page shows options for Google Maps. You can activate Google Maps by setting the toggle to Yes and clicking on the Save button to update settings.', |
|
7 | - 'event_espresso' |
|
8 | - ); ?> |
|
6 | + 'This page shows options for Google Maps. You can activate Google Maps by setting the toggle to Yes and clicking on the Save button to update settings.', |
|
7 | + 'event_espresso' |
|
8 | + ); ?> |
|
9 | 9 | </p> |
10 | 10 | <p> |
11 | 11 | <?php esc_html_e( |
12 | - 'The map options allow you to configure how your event map is displayed. You may configure your events lists and event registration pages independently of each other. For an event to display a Google Map you must have it enabled in the event editor or in the venue metabox. This allows you to select which events you would like to display with a map.', |
|
13 | - 'event_espresso' |
|
14 | - ); ?> |
|
12 | + 'The map options allow you to configure how your event map is displayed. You may configure your events lists and event registration pages independently of each other. For an event to display a Google Map you must have it enabled in the event editor or in the venue metabox. This allows you to select which events you would like to display with a map.', |
|
13 | + 'event_espresso' |
|
14 | + ); ?> |
|
15 | 15 | </p> |
16 | 16 | <p> |
17 | 17 | <strong><?php esc_html_e('Map Settings for Registration Page & Event List Options', 'event_espresso'); ?></strong> |
@@ -21,72 +21,72 @@ discard block |
||
21 | 21 | <strong><?php esc_html_e('Set Map Width', 'event_espresso'); ?></strong> |
22 | 22 | <br /> |
23 | 23 | <?php esc_html_e( |
24 | - 'You may set a pixel width for your map. This should be entered as a numeric value with no other characters. If a value is not set then default ones are used -- registration page single maps are set to 500 pixels and events list maps are set to 200 pixels.', |
|
25 | - 'event_espresso' |
|
26 | - ); ?> |
|
24 | + 'You may set a pixel width for your map. This should be entered as a numeric value with no other characters. If a value is not set then default ones are used -- registration page single maps are set to 500 pixels and events list maps are set to 200 pixels.', |
|
25 | + 'event_espresso' |
|
26 | + ); ?> |
|
27 | 27 | </li> |
28 | 28 | <li> |
29 | 29 | <strong><?php esc_html_e('Set Map Height', 'event_espresso'); ?></strong> |
30 | 30 | <br /> |
31 | 31 | <?php esc_html_e( |
32 | - 'This setting is similar to set map width except it is for the map height. Maps will display best when matching dimensions are used.', |
|
33 | - 'event_espresso' |
|
34 | - ); ?> |
|
32 | + 'This setting is similar to set map width except it is for the map height. Maps will display best when matching dimensions are used.', |
|
33 | + 'event_espresso' |
|
34 | + ); ?> |
|
35 | 35 | </li> |
36 | 36 | <li> |
37 | 37 | <strong><?php esc_html_e('Set Map Zoom', 'event_espresso'); ?></strong> |
38 | 38 | <br /> |
39 | 39 | <?php esc_html_e( |
40 | - 'Zoom level is the level of detail that is shown when the map first renders. A smaller value means you zoom out and therefore see a wider area. A higher value means that you zoom in and see the actual address in finer detail. A default value of 12 is recommended.', |
|
41 | - 'event_espresso' |
|
42 | - ); ?> |
|
40 | + 'Zoom level is the level of detail that is shown when the map first renders. A smaller value means you zoom out and therefore see a wider area. A higher value means that you zoom in and see the actual address in finer detail. A default value of 12 is recommended.', |
|
41 | + 'event_espresso' |
|
42 | + ); ?> |
|
43 | 43 | </li> |
44 | 44 | <li> |
45 | 45 | <strong><?php esc_html_e('Set Map Navigation Overlay', 'event_espresso'); ?></strong> |
46 | 46 | <br /> |
47 | 47 | <?php esc_html_e( |
48 | - 'The navigation overlay are the controls for panning and zooming the map.', |
|
49 | - 'event_espresso' |
|
50 | - ); ?> |
|
48 | + 'The navigation overlay are the controls for panning and zooming the map.', |
|
49 | + 'event_espresso' |
|
50 | + ); ?> |
|
51 | 51 | </li> |
52 | 52 | <li> |
53 | 53 | <strong><?php esc_html_e('Keep Map Navigation Small', 'event_espresso'); ?></strong> |
54 | 54 | <br /> |
55 | 55 | <?php esc_html_e( |
56 | - 'Keep map navigation small tells Google to only load the smaller map overlay regardless of map size. Google changes various options according to the size of a map. If you want to stop this change from happening, you can set this option to yes.', |
|
57 | - 'event_espresso' |
|
58 | - ); ?> |
|
56 | + 'Keep map navigation small tells Google to only load the smaller map overlay regardless of map size. Google changes various options according to the size of a map. If you want to stop this change from happening, you can set this option to yes.', |
|
57 | + 'event_espresso' |
|
58 | + ); ?> |
|
59 | 59 | </li> |
60 | 60 | <li> |
61 | 61 | <strong><?php esc_html_e('Set Map Type Control', 'event_espresso'); ?></strong> |
62 | 62 | <br /> |
63 | 63 | <?php esc_html_e( |
64 | - 'The map type control is the options bar that Google sets in the top right corner. This can appear as a dropdown or horizontal bar.', |
|
65 | - 'event_espresso' |
|
66 | - ); ?> |
|
64 | + 'The map type control is the options bar that Google sets in the top right corner. This can appear as a dropdown or horizontal bar.', |
|
65 | + 'event_espresso' |
|
66 | + ); ?> |
|
67 | 67 | </li> |
68 | 68 | <li> |
69 | 69 | <strong><?php esc_html_e('Set Map Alignment', 'event_espresso'); ?></strong> |
70 | 70 | <br /> |
71 | 71 | <?php esc_html_e( |
72 | - 'Alignment allows you to move the map left, center, or right within the parent event structure. The default alignment is left.', |
|
73 | - 'event_espresso' |
|
74 | - ); ?> |
|
72 | + 'Alignment allows you to move the map left, center, or right within the parent event structure. The default alignment is left.', |
|
73 | + 'event_espresso' |
|
74 | + ); ?> |
|
75 | 75 | </li> |
76 | 76 | </ul> |
77 | 77 | <p> |
78 | 78 | <strong><?php esc_html_e('Recommendations', 'event_espresso'); ?></strong> |
79 | 79 | <br /> |
80 | 80 | <?php esc_html_e( |
81 | - 'To learn more about the options on this page, take a look at the different tabs that appear on the left side of the page.', |
|
82 | - 'event_espresso' |
|
83 | - ); ?> |
|
81 | + 'To learn more about the options on this page, take a look at the different tabs that appear on the left side of the page.', |
|
82 | + 'event_espresso' |
|
83 | + ); ?> |
|
84 | 84 | </p> |
85 | 85 | <p> |
86 | 86 | <strong><?php esc_html_e('Screen Options', 'event_espresso'); ?></strong> |
87 | 87 | <br /> |
88 | 88 | <?php esc_html_e( |
89 | - 'You can customize the information that is shown on this page by toggling the Screen Options tab. Then you can add or remove checkmarks to hide or show certain content.', |
|
90 | - 'event_espresso' |
|
91 | - ); ?> |
|
89 | + 'You can customize the information that is shown on this page by toggling the Screen Options tab. Then you can add or remove checkmarks to hide or show certain content.', |
|
90 | + 'event_espresso' |
|
91 | + ); ?> |
|
92 | 92 | </p> |
93 | 93 | \ No newline at end of file |
@@ -19,16 +19,16 @@ |
||
19 | 19 | <strong><?php esc_html_e('Category Description', 'event_espresso'); ?></strong> |
20 | 20 | <br /> |
21 | 21 | <?php esc_html_e( |
22 | - 'The rich text editor can be used to create a description for your venue category.', |
|
23 | - 'event_espresso' |
|
24 | - ); ?> |
|
22 | + 'The rich text editor can be used to create a description for your venue category.', |
|
23 | + 'event_espresso' |
|
24 | + ); ?> |
|
25 | 25 | </li> |
26 | 26 | </ul> |
27 | 27 | <p> |
28 | 28 | <strong><?php esc_html_e('Screen Options', 'event_espresso'); ?></strong> |
29 | 29 | <br /> |
30 | 30 | <?php esc_html_e( |
31 | - 'You can customize the information that is shown on this page by toggling the screen options tab. Then you can add or remove checkmarks to hide or show certain content.', |
|
32 | - 'event_espresso' |
|
33 | - ); ?> |
|
31 | + 'You can customize the information that is shown on this page by toggling the screen options tab. Then you can add or remove checkmarks to hide or show certain content.', |
|
32 | + 'event_espresso' |
|
33 | + ); ?> |
|
34 | 34 | </p> |
@@ -14,1566 +14,1566 @@ |
||
14 | 14 | class Venues_Admin_Page extends EE_Admin_Page_CPT |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * _venue |
|
19 | - * This will hold the venue object for venue_details screen. |
|
20 | - * |
|
21 | - * @access protected |
|
22 | - * @var object |
|
23 | - */ |
|
24 | - protected $_venue; |
|
25 | - |
|
26 | - |
|
27 | - /** |
|
28 | - * This will hold the category object for category_details screen. |
|
29 | - * |
|
30 | - * @var object |
|
31 | - */ |
|
32 | - protected $_category; |
|
33 | - |
|
34 | - |
|
35 | - /** |
|
36 | - * This property will hold the venue model instance |
|
37 | - * |
|
38 | - * @var object |
|
39 | - */ |
|
40 | - protected $_venue_model; |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * @throws EE_Error |
|
45 | - */ |
|
46 | - protected function _init_page_props() |
|
47 | - { |
|
48 | - require_once(EE_MODELS . 'EEM_Venue.model.php'); |
|
49 | - $this->page_slug = EE_VENUES_PG_SLUG; |
|
50 | - $this->_admin_base_url = EE_VENUES_ADMIN_URL; |
|
51 | - $this->_admin_base_path = EE_ADMIN_PAGES . 'venues'; |
|
52 | - $this->page_label = esc_html__('Event Venues', 'event_espresso'); |
|
53 | - $this->_cpt_model_names = [ |
|
54 | - 'create_new' => 'EEM_Venue', |
|
55 | - 'edit' => 'EEM_Venue', |
|
56 | - ]; |
|
57 | - $this->_cpt_edit_routes = [ |
|
58 | - 'espresso_venues' => 'edit', |
|
59 | - ]; |
|
60 | - $this->_venue_model = EEM_Venue::instance(); |
|
61 | - } |
|
62 | - |
|
63 | - |
|
64 | - protected function _ajax_hooks() |
|
65 | - { |
|
66 | - // todo: all hooks for ee_venues ajax goes in here. |
|
67 | - } |
|
68 | - |
|
69 | - |
|
70 | - protected function _define_page_props() |
|
71 | - { |
|
72 | - $this->_admin_page_title = $this->page_label; |
|
73 | - $this->_labels = [ |
|
74 | - 'buttons' => [ |
|
75 | - 'add' => esc_html__('Add New Venue', 'event_espresso'), |
|
76 | - 'edit' => esc_html__('Edit Venue', 'event_espresso'), |
|
77 | - 'delete' => esc_html__('Delete Venue', 'event_espresso'), |
|
78 | - 'add_category' => esc_html__('Add New Category', 'event_espresso'), |
|
79 | - 'edit_category' => esc_html__('Edit Category', 'event_espresso'), |
|
80 | - 'delete_category' => esc_html__('Delete Category', 'event_espresso'), |
|
81 | - ], |
|
82 | - 'editor_title' => [ |
|
83 | - 'espresso_venues' => esc_html__('Enter Venue name here', 'event_espresso'), |
|
84 | - ], |
|
85 | - 'publishbox' => [ |
|
86 | - 'create_new' => esc_html__('Save New Venue', 'event_espresso'), |
|
87 | - 'edit' => esc_html__('Update Venue', 'event_espresso'), |
|
88 | - 'add_category' => esc_html__('Save New Category', 'event_espresso'), |
|
89 | - 'edit_category' => esc_html__('Update Category', 'event_espresso'), |
|
90 | - 'google_map_settings' => esc_html__('Update Settings', 'event_espresso'), |
|
91 | - ], |
|
92 | - ]; |
|
93 | - } |
|
94 | - |
|
95 | - |
|
96 | - protected function _set_page_routes() |
|
97 | - { |
|
98 | - |
|
99 | - // load formatter helper |
|
100 | - // load field generator helper |
|
101 | - |
|
102 | - // is there a vnu_id in the request? |
|
103 | - $VNU_ID = $this->request->getRequestParam('VNU_ID', 0, 'int'); |
|
104 | - $VNU_ID = $this->request->getRequestParam('post', $VNU_ID, 'int'); |
|
105 | - |
|
106 | - $this->_page_routes = [ |
|
107 | - 'default' => [ |
|
108 | - 'func' => '_overview_list_table', |
|
109 | - 'capability' => 'ee_read_venues', |
|
110 | - ], |
|
111 | - 'create_new' => [ |
|
112 | - 'func' => '_create_new_cpt_item', |
|
113 | - 'capability' => 'ee_edit_venues', |
|
114 | - ], |
|
115 | - 'edit' => [ |
|
116 | - 'func' => '_edit_cpt_item', |
|
117 | - 'capability' => 'ee_edit_venue', |
|
118 | - 'obj_id' => $VNU_ID, |
|
119 | - ], |
|
120 | - 'trash_venue' => [ |
|
121 | - 'func' => '_trash_or_restore_venue', |
|
122 | - 'args' => ['venue_status' => 'trash'], |
|
123 | - 'noheader' => true, |
|
124 | - 'capability' => 'ee_delete_venue', |
|
125 | - 'obj_id' => $VNU_ID, |
|
126 | - ], |
|
127 | - 'trash_venues' => [ |
|
128 | - 'func' => '_trash_or_restore_venues', |
|
129 | - 'args' => ['venue_status' => 'trash'], |
|
130 | - 'noheader' => true, |
|
131 | - 'capability' => 'ee_delete_venues', |
|
132 | - ], |
|
133 | - 'restore_venue' => [ |
|
134 | - 'func' => '_trash_or_restore_venue', |
|
135 | - 'args' => ['venue_status' => 'draft'], |
|
136 | - 'noheader' => true, |
|
137 | - 'capability' => 'ee_delete_venue', |
|
138 | - 'obj_id' => $VNU_ID, |
|
139 | - ], |
|
140 | - 'restore_venues' => [ |
|
141 | - 'func' => '_trash_or_restore_venues', |
|
142 | - 'args' => ['venue_status' => 'draft'], |
|
143 | - 'noheader' => true, |
|
144 | - 'capability' => 'ee_delete_venues', |
|
145 | - ], |
|
146 | - 'delete_venues' => [ |
|
147 | - 'func' => '_delete_venues', |
|
148 | - 'noheader' => true, |
|
149 | - 'capability' => 'ee_delete_venues', |
|
150 | - ], |
|
151 | - 'delete_venue' => [ |
|
152 | - 'func' => '_delete_venue', |
|
153 | - 'noheader' => true, |
|
154 | - 'capability' => 'ee_delete_venue', |
|
155 | - 'obj_id' => $VNU_ID, |
|
156 | - ], |
|
157 | - // settings related |
|
158 | - 'google_map_settings' => [ |
|
159 | - 'func' => '_google_map_settings', |
|
160 | - 'capability' => 'manage_options', |
|
161 | - ], |
|
162 | - 'update_google_map_settings' => [ |
|
163 | - 'func' => '_update_google_map_settings', |
|
164 | - 'capability' => 'manage_options', |
|
165 | - 'noheader' => true, |
|
166 | - ], |
|
167 | - // venue category tab related |
|
168 | - 'add_category' => [ |
|
169 | - 'func' => '_category_details', |
|
170 | - 'args' => ['add'], |
|
171 | - 'capability' => 'ee_edit_venue_category', |
|
172 | - ], |
|
173 | - 'edit_category' => [ |
|
174 | - 'func' => '_category_details', |
|
175 | - 'args' => ['edit'], |
|
176 | - 'capability' => 'ee_edit_venue_category', |
|
177 | - ], |
|
178 | - 'delete_categories' => [ |
|
179 | - 'func' => '_delete_categories', |
|
180 | - 'noheader' => true, |
|
181 | - 'capability' => 'ee_delete_venue_category', |
|
182 | - ], |
|
183 | - |
|
184 | - 'delete_category' => [ |
|
185 | - 'func' => '_delete_categories', |
|
186 | - 'noheader' => true, |
|
187 | - 'capability' => 'ee_delete_venue_category', |
|
188 | - ], |
|
189 | - |
|
190 | - 'insert_category' => [ |
|
191 | - 'func' => '_insert_or_update_category', |
|
192 | - 'args' => ['new_category' => true], |
|
193 | - 'noheader' => true, |
|
194 | - 'capability' => 'ee_edit_venue_category', |
|
195 | - ], |
|
196 | - |
|
197 | - 'update_category' => [ |
|
198 | - 'func' => '_insert_or_update_category', |
|
199 | - 'args' => ['new_category' => false], |
|
200 | - 'noheader' => true, |
|
201 | - 'capability' => 'ee_edit_venue_category', |
|
202 | - ], |
|
203 | - 'export_categories' => [ |
|
204 | - 'func' => '_categories_export', |
|
205 | - 'noheader' => true, |
|
206 | - 'capability' => 'export', |
|
207 | - ], |
|
208 | - 'import_categories' => [ |
|
209 | - 'func' => '_import_categories', |
|
210 | - 'capability' => 'import', |
|
211 | - ], |
|
212 | - 'category_list' => [ |
|
213 | - 'func' => '_category_list_table', |
|
214 | - 'capability' => 'ee_manage_venue_categories', |
|
215 | - ], |
|
216 | - ]; |
|
217 | - } |
|
218 | - |
|
219 | - |
|
220 | - protected function _set_page_config() |
|
221 | - { |
|
222 | - $VNU_ID = $this->request->getRequestParam('post', 0, 'int'); |
|
223 | - $EVT_CAT_ID = $this->request->getRequestParam('EVT_CAT_ID', 0, 'int'); |
|
224 | - |
|
225 | - $this->_page_config = [ |
|
226 | - 'default' => [ |
|
227 | - 'nav' => [ |
|
228 | - 'label' => esc_html__('Overview', 'event_espresso'), |
|
229 | - 'order' => 10, |
|
230 | - ], |
|
231 | - 'list_table' => 'Venues_Admin_List_Table', |
|
232 | - 'help_tabs' => [ |
|
233 | - 'venues_overview_help_tab' => [ |
|
234 | - 'title' => esc_html__('Venues Overview', 'event_espresso'), |
|
235 | - 'filename' => 'venues_overview', |
|
236 | - ], |
|
237 | - 'venues_overview_table_column_headings_help_tab' => [ |
|
238 | - 'title' => esc_html__('Venues Overview Table Column Headings', 'event_espresso'), |
|
239 | - 'filename' => 'venues_overview_table_column_headings', |
|
240 | - ], |
|
241 | - 'venues_overview_views_bulk_actions_search_help_tab' => [ |
|
242 | - 'title' => esc_html__('Venues Overview Views & Bulk Actions & Search', 'event_espresso'), |
|
243 | - 'filename' => 'venues_overview_views_bulk_actions_search', |
|
244 | - ], |
|
245 | - ], |
|
246 | - 'metaboxes' => ['_espresso_news_post_box', '_espresso_links_post_box'], |
|
247 | - 'require_nonce' => false, |
|
248 | - ], |
|
249 | - 'create_new' => [ |
|
250 | - 'nav' => [ |
|
251 | - 'label' => esc_html__('Add Venue', 'event_espresso'), |
|
252 | - 'order' => 5, |
|
253 | - 'persistent' => false, |
|
254 | - ], |
|
255 | - 'help_tabs' => [ |
|
256 | - 'venues_editor_help_tab' => [ |
|
257 | - 'title' => esc_html__('Venue Editor', 'event_espresso'), |
|
258 | - 'filename' => 'venues_editor', |
|
259 | - ], |
|
260 | - 'venues_editor_title_richtexteditor_help_tab' => [ |
|
261 | - 'title' => esc_html__('Venue Title & Rich Text Editor', 'event_espresso'), |
|
262 | - 'filename' => 'venues_editor_title_richtexteditor', |
|
263 | - ], |
|
264 | - 'venues_editor_tags_categories_help_tab' => [ |
|
265 | - 'title' => esc_html__('Venue Tags & Categories', 'event_espresso'), |
|
266 | - 'filename' => 'venues_editor_tags_categories', |
|
267 | - ], |
|
268 | - 'venues_editor_physical_location_google_map_virtual_location_help_tab' => [ |
|
269 | - 'title' => esc_html__( |
|
270 | - 'Venue Editor Physical Location & Google Map & Virtual Location', |
|
271 | - 'event_espresso' |
|
272 | - ), |
|
273 | - 'filename' => 'venues_editor_physical_location_google_map_virtual_location', |
|
274 | - ], |
|
275 | - 'venues_editor_save_new_venue_help_tab' => [ |
|
276 | - 'title' => esc_html__('Save New Venue', 'event_espresso'), |
|
277 | - 'filename' => 'venues_editor_save_new_venue', |
|
278 | - ], |
|
279 | - 'venues_editor_other_help_tab' => [ |
|
280 | - 'title' => esc_html__('Venue Editor Other', 'event_espresso'), |
|
281 | - 'filename' => 'venues_editor_other', |
|
282 | - ], |
|
283 | - ], |
|
284 | - 'metaboxes' => ['_venue_editor_metaboxes'], |
|
285 | - 'require_nonce' => false, |
|
286 | - ], |
|
287 | - 'edit' => [ |
|
288 | - 'nav' => [ |
|
289 | - 'label' => esc_html__('Edit Venue', 'event_espresso'), |
|
290 | - 'order' => 5, |
|
291 | - 'persistent' => false, |
|
292 | - 'url' => $VNU_ID |
|
293 | - ? add_query_arg(['post' => $VNU_ID], $this->_current_page_view_url) |
|
294 | - : $this->_admin_base_url, |
|
295 | - ], |
|
296 | - 'help_tabs' => [ |
|
297 | - 'venues_editor_help_tab' => [ |
|
298 | - 'title' => esc_html__('Venue Editor', 'event_espresso'), |
|
299 | - 'filename' => 'venues_editor', |
|
300 | - ], |
|
301 | - 'venues_editor_title_richtexteditor_help_tab' => [ |
|
302 | - 'title' => esc_html__('Venue Title & Rich Text Editor', 'event_espresso'), |
|
303 | - 'filename' => 'venues_editor_title_richtexteditor', |
|
304 | - ], |
|
305 | - 'venues_editor_tags_categories_help_tab' => [ |
|
306 | - 'title' => esc_html__('Venue Tags & Categories', 'event_espresso'), |
|
307 | - 'filename' => 'venues_editor_tags_categories', |
|
308 | - ], |
|
309 | - 'venues_editor_physical_location_google_map_virtual_location_help_tab' => [ |
|
310 | - 'title' => esc_html__( |
|
311 | - 'Venue Editor Physical Location & Google Map & Virtual Location', |
|
312 | - 'event_espresso' |
|
313 | - ), |
|
314 | - 'filename' => 'venues_editor_physical_location_google_map_virtual_location', |
|
315 | - ], |
|
316 | - 'venues_editor_save_new_venue_help_tab' => [ |
|
317 | - 'title' => esc_html__('Save New Venue', 'event_espresso'), |
|
318 | - 'filename' => 'venues_editor_save_new_venue', |
|
319 | - ], |
|
320 | - 'venues_editor_other_help_tab' => [ |
|
321 | - 'title' => esc_html__('Venue Editor Other', 'event_espresso'), |
|
322 | - 'filename' => 'venues_editor_other', |
|
323 | - ], |
|
324 | - ], |
|
325 | - 'metaboxes' => ['_venue_editor_metaboxes'], |
|
326 | - 'require_nonce' => false, |
|
327 | - ], |
|
328 | - 'google_map_settings' => [ |
|
329 | - 'nav' => [ |
|
330 | - 'label' => esc_html__('Google Maps', 'event_espresso'), |
|
331 | - 'order' => 40, |
|
332 | - ], |
|
333 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']), |
|
334 | - 'help_tabs' => [ |
|
335 | - 'general_settings_google_maps_help_tab' => [ |
|
336 | - 'title' => esc_html__('Google Maps', 'event_espresso'), |
|
337 | - 'filename' => 'general_settings_google_maps', |
|
338 | - ], |
|
339 | - ], |
|
340 | - 'require_nonce' => false, |
|
341 | - ], |
|
342 | - // venue category stuff |
|
343 | - 'add_category' => [ |
|
344 | - 'nav' => [ |
|
345 | - 'label' => esc_html__('Add Category', 'event_espresso'), |
|
346 | - 'order' => 15, |
|
347 | - 'persistent' => false, |
|
348 | - ], |
|
349 | - 'metaboxes' => ['_publish_post_box'], |
|
350 | - 'help_tabs' => [ |
|
351 | - 'venues_add_category_help_tab' => [ |
|
352 | - 'title' => esc_html__('Add New Venue Category', 'event_espresso'), |
|
353 | - 'filename' => 'venues_add_category', |
|
354 | - ], |
|
355 | - ], |
|
356 | - 'require_nonce' => false, |
|
357 | - ], |
|
358 | - 'edit_category' => [ |
|
359 | - 'nav' => [ |
|
360 | - 'label' => esc_html__('Edit Category', 'event_espresso'), |
|
361 | - 'order' => 15, |
|
362 | - 'persistent' => false, |
|
363 | - 'url' => $EVT_CAT_ID |
|
364 | - ? add_query_arg(['EVT_CAT_ID' => $EVT_CAT_ID], $this->_current_page_view_url) |
|
365 | - : $this->_admin_base_url, |
|
366 | - ], |
|
367 | - 'metaboxes' => ['_publish_post_box'], |
|
368 | - 'help_tabs' => [ |
|
369 | - 'venues_edit_category_help_tab' => [ |
|
370 | - 'title' => esc_html__('Edit Venue Category', 'event_espresso'), |
|
371 | - 'filename' => 'venues_edit_category', |
|
372 | - ], |
|
373 | - ], |
|
374 | - 'require_nonce' => false, |
|
375 | - ], |
|
376 | - 'category_list' => [ |
|
377 | - 'nav' => [ |
|
378 | - 'label' => esc_html__('Categories', 'event_espresso'), |
|
379 | - 'order' => 20, |
|
380 | - ], |
|
381 | - 'list_table' => 'Venue_Categories_Admin_List_Table', |
|
382 | - 'help_tabs' => [ |
|
383 | - 'venues_categories_help_tab' => [ |
|
384 | - 'title' => esc_html__('Venue Categories', 'event_espresso'), |
|
385 | - 'filename' => 'venues_categories', |
|
386 | - ], |
|
387 | - 'venues_categories_table_column_headings_help_tab' => [ |
|
388 | - 'title' => esc_html__('Venue Categories Table Column Headings', 'event_espresso'), |
|
389 | - 'filename' => 'venues_categories_table_column_headings', |
|
390 | - ], |
|
391 | - 'venues_categories_views_help_tab' => [ |
|
392 | - 'title' => esc_html__('Venue Categories Views', 'event_espresso'), |
|
393 | - 'filename' => 'venues_categories_views', |
|
394 | - ], |
|
395 | - 'venues_categories_other_help_tab' => [ |
|
396 | - 'title' => esc_html__('Venue Categories Other', 'event_espresso'), |
|
397 | - 'filename' => 'venues_categories_other', |
|
398 | - ], |
|
399 | - ], |
|
400 | - 'metaboxes' => $this->_default_espresso_metaboxes, |
|
401 | - 'require_nonce' => false, |
|
402 | - ], |
|
403 | - ]; |
|
404 | - } |
|
405 | - |
|
406 | - |
|
407 | - protected function _add_screen_options() |
|
408 | - { |
|
409 | - // todo |
|
410 | - } |
|
411 | - |
|
412 | - |
|
413 | - protected function _add_screen_options_default() |
|
414 | - { |
|
415 | - $this->_per_page_screen_option(); |
|
416 | - } |
|
417 | - |
|
418 | - |
|
419 | - protected function _add_screen_options_category_list() |
|
420 | - { |
|
421 | - $page_title = $this->_admin_page_title; |
|
422 | - $this->_admin_page_title = esc_html__('Venue Categories', 'event_espresso'); |
|
423 | - $this->_per_page_screen_option(); |
|
424 | - $this->_admin_page_title = $page_title; |
|
425 | - } |
|
426 | - |
|
427 | - |
|
428 | - // none of the below group are currently used for Event Venues |
|
429 | - protected function _add_feature_pointers() |
|
430 | - { |
|
431 | - } |
|
432 | - |
|
433 | - |
|
434 | - public function admin_init() |
|
435 | - { |
|
436 | - } |
|
437 | - |
|
438 | - |
|
439 | - public function admin_notices() |
|
440 | - { |
|
441 | - } |
|
442 | - |
|
443 | - |
|
444 | - public function admin_footer_scripts() |
|
445 | - { |
|
446 | - } |
|
447 | - |
|
448 | - |
|
449 | - public function load_scripts_styles_create_new() |
|
450 | - { |
|
451 | - $this->load_scripts_styles_edit(); |
|
452 | - } |
|
453 | - |
|
454 | - |
|
455 | - public function load_scripts_styles() |
|
456 | - { |
|
457 | - wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', [], EVENT_ESPRESSO_VERSION); |
|
458 | - wp_enqueue_style('ee-cat-admin'); |
|
459 | - } |
|
460 | - |
|
461 | - |
|
462 | - public function load_scripts_styles_add_category() |
|
463 | - { |
|
464 | - $this->load_scripts_styles_edit_category(); |
|
465 | - } |
|
466 | - |
|
467 | - |
|
468 | - public function load_scripts_styles_edit_category() |
|
469 | - { |
|
470 | - } |
|
471 | - |
|
472 | - |
|
473 | - public function load_scripts_styles_edit() |
|
474 | - { |
|
475 | - // styles |
|
476 | - wp_enqueue_style('espresso-ui-theme'); |
|
477 | - wp_register_style( |
|
478 | - 'espresso_venues', |
|
479 | - EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', |
|
480 | - [], |
|
481 | - EVENT_ESPRESSO_VERSION |
|
482 | - ); |
|
483 | - wp_enqueue_style('espresso_venues'); |
|
484 | - } |
|
485 | - |
|
486 | - |
|
487 | - protected function _set_list_table_views_default() |
|
488 | - { |
|
489 | - $this->_views = [ |
|
490 | - 'all' => [ |
|
491 | - 'slug' => 'all', |
|
492 | - 'label' => esc_html__('View All Venues', 'event_espresso'), |
|
493 | - 'count' => 0, |
|
494 | - 'bulk_action' => [], |
|
495 | - ], |
|
496 | - ]; |
|
497 | - |
|
498 | - if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) { |
|
499 | - $this->_views['all']['bulk_action'] = [ |
|
500 | - 'trash_venues' => esc_html__('Move to Trash', 'event_espresso'), |
|
501 | - ]; |
|
502 | - $this->_views['trash'] = [ |
|
503 | - 'slug' => 'trash', |
|
504 | - 'label' => esc_html__('Trash', 'event_espresso'), |
|
505 | - 'count' => 0, |
|
506 | - 'bulk_action' => [ |
|
507 | - 'restore_venues' => esc_html__('Restore from Trash', 'event_espresso'), |
|
508 | - 'delete_venues' => esc_html__('Delete', 'event_espresso'), |
|
509 | - ], |
|
510 | - ]; |
|
511 | - } |
|
512 | - } |
|
513 | - |
|
514 | - |
|
515 | - protected function _set_list_table_views_category_list() |
|
516 | - { |
|
517 | - $this->_views = [ |
|
518 | - 'all' => [ |
|
519 | - 'slug' => 'all', |
|
520 | - 'label' => esc_html__('All', 'event_espresso'), |
|
521 | - 'count' => 0, |
|
522 | - 'bulk_action' => [ |
|
523 | - 'delete_categories' => esc_html__('Delete Permanently', 'event_espresso'), |
|
524 | - ], |
|
525 | - ], |
|
526 | - ]; |
|
527 | - } |
|
528 | - |
|
529 | - |
|
530 | - /** |
|
531 | - * @throws EE_Error |
|
532 | - */ |
|
533 | - protected function _overview_list_table() |
|
534 | - { |
|
535 | - do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
536 | - $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( |
|
537 | - get_post_type_archive_link('espresso_venues'), |
|
538 | - esc_html__("View Venue Archive Page", "event_espresso"), |
|
539 | - 'button' |
|
540 | - ); |
|
541 | - |
|
542 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
543 | - 'create_new', |
|
544 | - 'add', |
|
545 | - [], |
|
546 | - 'add-new-h2' |
|
547 | - ); |
|
548 | - |
|
549 | - $this->_search_btn_label = esc_html__('Venues', 'event_espresso'); |
|
550 | - $this->display_admin_list_table_page_with_sidebar(); |
|
551 | - } |
|
552 | - |
|
553 | - |
|
554 | - /** |
|
555 | - * @throws EE_Error |
|
556 | - * @throws ReflectionException |
|
557 | - */ |
|
558 | - public function extra_misc_actions_publish_box() |
|
559 | - { |
|
560 | - $extra_rows = [ |
|
561 | - 'vnu_capacity' => $this->_cpt_model_obj->get_f('VNU_capacity'), |
|
562 | - 'vnu_url' => $this->_cpt_model_obj->get_f('VNU_url'), |
|
563 | - 'vnu_phone' => $this->_cpt_model_obj->get_f('VNU_phone'), |
|
564 | - ]; |
|
565 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php'; |
|
566 | - EEH_Template::display_template($template, $extra_rows); |
|
567 | - } |
|
568 | - |
|
569 | - |
|
570 | - /************* Google Maps ************* |
|
17 | + /** |
|
18 | + * _venue |
|
19 | + * This will hold the venue object for venue_details screen. |
|
20 | + * |
|
21 | + * @access protected |
|
22 | + * @var object |
|
23 | + */ |
|
24 | + protected $_venue; |
|
25 | + |
|
26 | + |
|
27 | + /** |
|
28 | + * This will hold the category object for category_details screen. |
|
29 | + * |
|
30 | + * @var object |
|
31 | + */ |
|
32 | + protected $_category; |
|
33 | + |
|
34 | + |
|
35 | + /** |
|
36 | + * This property will hold the venue model instance |
|
37 | + * |
|
38 | + * @var object |
|
39 | + */ |
|
40 | + protected $_venue_model; |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * @throws EE_Error |
|
45 | + */ |
|
46 | + protected function _init_page_props() |
|
47 | + { |
|
48 | + require_once(EE_MODELS . 'EEM_Venue.model.php'); |
|
49 | + $this->page_slug = EE_VENUES_PG_SLUG; |
|
50 | + $this->_admin_base_url = EE_VENUES_ADMIN_URL; |
|
51 | + $this->_admin_base_path = EE_ADMIN_PAGES . 'venues'; |
|
52 | + $this->page_label = esc_html__('Event Venues', 'event_espresso'); |
|
53 | + $this->_cpt_model_names = [ |
|
54 | + 'create_new' => 'EEM_Venue', |
|
55 | + 'edit' => 'EEM_Venue', |
|
56 | + ]; |
|
57 | + $this->_cpt_edit_routes = [ |
|
58 | + 'espresso_venues' => 'edit', |
|
59 | + ]; |
|
60 | + $this->_venue_model = EEM_Venue::instance(); |
|
61 | + } |
|
62 | + |
|
63 | + |
|
64 | + protected function _ajax_hooks() |
|
65 | + { |
|
66 | + // todo: all hooks for ee_venues ajax goes in here. |
|
67 | + } |
|
68 | + |
|
69 | + |
|
70 | + protected function _define_page_props() |
|
71 | + { |
|
72 | + $this->_admin_page_title = $this->page_label; |
|
73 | + $this->_labels = [ |
|
74 | + 'buttons' => [ |
|
75 | + 'add' => esc_html__('Add New Venue', 'event_espresso'), |
|
76 | + 'edit' => esc_html__('Edit Venue', 'event_espresso'), |
|
77 | + 'delete' => esc_html__('Delete Venue', 'event_espresso'), |
|
78 | + 'add_category' => esc_html__('Add New Category', 'event_espresso'), |
|
79 | + 'edit_category' => esc_html__('Edit Category', 'event_espresso'), |
|
80 | + 'delete_category' => esc_html__('Delete Category', 'event_espresso'), |
|
81 | + ], |
|
82 | + 'editor_title' => [ |
|
83 | + 'espresso_venues' => esc_html__('Enter Venue name here', 'event_espresso'), |
|
84 | + ], |
|
85 | + 'publishbox' => [ |
|
86 | + 'create_new' => esc_html__('Save New Venue', 'event_espresso'), |
|
87 | + 'edit' => esc_html__('Update Venue', 'event_espresso'), |
|
88 | + 'add_category' => esc_html__('Save New Category', 'event_espresso'), |
|
89 | + 'edit_category' => esc_html__('Update Category', 'event_espresso'), |
|
90 | + 'google_map_settings' => esc_html__('Update Settings', 'event_espresso'), |
|
91 | + ], |
|
92 | + ]; |
|
93 | + } |
|
94 | + |
|
95 | + |
|
96 | + protected function _set_page_routes() |
|
97 | + { |
|
98 | + |
|
99 | + // load formatter helper |
|
100 | + // load field generator helper |
|
101 | + |
|
102 | + // is there a vnu_id in the request? |
|
103 | + $VNU_ID = $this->request->getRequestParam('VNU_ID', 0, 'int'); |
|
104 | + $VNU_ID = $this->request->getRequestParam('post', $VNU_ID, 'int'); |
|
105 | + |
|
106 | + $this->_page_routes = [ |
|
107 | + 'default' => [ |
|
108 | + 'func' => '_overview_list_table', |
|
109 | + 'capability' => 'ee_read_venues', |
|
110 | + ], |
|
111 | + 'create_new' => [ |
|
112 | + 'func' => '_create_new_cpt_item', |
|
113 | + 'capability' => 'ee_edit_venues', |
|
114 | + ], |
|
115 | + 'edit' => [ |
|
116 | + 'func' => '_edit_cpt_item', |
|
117 | + 'capability' => 'ee_edit_venue', |
|
118 | + 'obj_id' => $VNU_ID, |
|
119 | + ], |
|
120 | + 'trash_venue' => [ |
|
121 | + 'func' => '_trash_or_restore_venue', |
|
122 | + 'args' => ['venue_status' => 'trash'], |
|
123 | + 'noheader' => true, |
|
124 | + 'capability' => 'ee_delete_venue', |
|
125 | + 'obj_id' => $VNU_ID, |
|
126 | + ], |
|
127 | + 'trash_venues' => [ |
|
128 | + 'func' => '_trash_or_restore_venues', |
|
129 | + 'args' => ['venue_status' => 'trash'], |
|
130 | + 'noheader' => true, |
|
131 | + 'capability' => 'ee_delete_venues', |
|
132 | + ], |
|
133 | + 'restore_venue' => [ |
|
134 | + 'func' => '_trash_or_restore_venue', |
|
135 | + 'args' => ['venue_status' => 'draft'], |
|
136 | + 'noheader' => true, |
|
137 | + 'capability' => 'ee_delete_venue', |
|
138 | + 'obj_id' => $VNU_ID, |
|
139 | + ], |
|
140 | + 'restore_venues' => [ |
|
141 | + 'func' => '_trash_or_restore_venues', |
|
142 | + 'args' => ['venue_status' => 'draft'], |
|
143 | + 'noheader' => true, |
|
144 | + 'capability' => 'ee_delete_venues', |
|
145 | + ], |
|
146 | + 'delete_venues' => [ |
|
147 | + 'func' => '_delete_venues', |
|
148 | + 'noheader' => true, |
|
149 | + 'capability' => 'ee_delete_venues', |
|
150 | + ], |
|
151 | + 'delete_venue' => [ |
|
152 | + 'func' => '_delete_venue', |
|
153 | + 'noheader' => true, |
|
154 | + 'capability' => 'ee_delete_venue', |
|
155 | + 'obj_id' => $VNU_ID, |
|
156 | + ], |
|
157 | + // settings related |
|
158 | + 'google_map_settings' => [ |
|
159 | + 'func' => '_google_map_settings', |
|
160 | + 'capability' => 'manage_options', |
|
161 | + ], |
|
162 | + 'update_google_map_settings' => [ |
|
163 | + 'func' => '_update_google_map_settings', |
|
164 | + 'capability' => 'manage_options', |
|
165 | + 'noheader' => true, |
|
166 | + ], |
|
167 | + // venue category tab related |
|
168 | + 'add_category' => [ |
|
169 | + 'func' => '_category_details', |
|
170 | + 'args' => ['add'], |
|
171 | + 'capability' => 'ee_edit_venue_category', |
|
172 | + ], |
|
173 | + 'edit_category' => [ |
|
174 | + 'func' => '_category_details', |
|
175 | + 'args' => ['edit'], |
|
176 | + 'capability' => 'ee_edit_venue_category', |
|
177 | + ], |
|
178 | + 'delete_categories' => [ |
|
179 | + 'func' => '_delete_categories', |
|
180 | + 'noheader' => true, |
|
181 | + 'capability' => 'ee_delete_venue_category', |
|
182 | + ], |
|
183 | + |
|
184 | + 'delete_category' => [ |
|
185 | + 'func' => '_delete_categories', |
|
186 | + 'noheader' => true, |
|
187 | + 'capability' => 'ee_delete_venue_category', |
|
188 | + ], |
|
189 | + |
|
190 | + 'insert_category' => [ |
|
191 | + 'func' => '_insert_or_update_category', |
|
192 | + 'args' => ['new_category' => true], |
|
193 | + 'noheader' => true, |
|
194 | + 'capability' => 'ee_edit_venue_category', |
|
195 | + ], |
|
196 | + |
|
197 | + 'update_category' => [ |
|
198 | + 'func' => '_insert_or_update_category', |
|
199 | + 'args' => ['new_category' => false], |
|
200 | + 'noheader' => true, |
|
201 | + 'capability' => 'ee_edit_venue_category', |
|
202 | + ], |
|
203 | + 'export_categories' => [ |
|
204 | + 'func' => '_categories_export', |
|
205 | + 'noheader' => true, |
|
206 | + 'capability' => 'export', |
|
207 | + ], |
|
208 | + 'import_categories' => [ |
|
209 | + 'func' => '_import_categories', |
|
210 | + 'capability' => 'import', |
|
211 | + ], |
|
212 | + 'category_list' => [ |
|
213 | + 'func' => '_category_list_table', |
|
214 | + 'capability' => 'ee_manage_venue_categories', |
|
215 | + ], |
|
216 | + ]; |
|
217 | + } |
|
218 | + |
|
219 | + |
|
220 | + protected function _set_page_config() |
|
221 | + { |
|
222 | + $VNU_ID = $this->request->getRequestParam('post', 0, 'int'); |
|
223 | + $EVT_CAT_ID = $this->request->getRequestParam('EVT_CAT_ID', 0, 'int'); |
|
224 | + |
|
225 | + $this->_page_config = [ |
|
226 | + 'default' => [ |
|
227 | + 'nav' => [ |
|
228 | + 'label' => esc_html__('Overview', 'event_espresso'), |
|
229 | + 'order' => 10, |
|
230 | + ], |
|
231 | + 'list_table' => 'Venues_Admin_List_Table', |
|
232 | + 'help_tabs' => [ |
|
233 | + 'venues_overview_help_tab' => [ |
|
234 | + 'title' => esc_html__('Venues Overview', 'event_espresso'), |
|
235 | + 'filename' => 'venues_overview', |
|
236 | + ], |
|
237 | + 'venues_overview_table_column_headings_help_tab' => [ |
|
238 | + 'title' => esc_html__('Venues Overview Table Column Headings', 'event_espresso'), |
|
239 | + 'filename' => 'venues_overview_table_column_headings', |
|
240 | + ], |
|
241 | + 'venues_overview_views_bulk_actions_search_help_tab' => [ |
|
242 | + 'title' => esc_html__('Venues Overview Views & Bulk Actions & Search', 'event_espresso'), |
|
243 | + 'filename' => 'venues_overview_views_bulk_actions_search', |
|
244 | + ], |
|
245 | + ], |
|
246 | + 'metaboxes' => ['_espresso_news_post_box', '_espresso_links_post_box'], |
|
247 | + 'require_nonce' => false, |
|
248 | + ], |
|
249 | + 'create_new' => [ |
|
250 | + 'nav' => [ |
|
251 | + 'label' => esc_html__('Add Venue', 'event_espresso'), |
|
252 | + 'order' => 5, |
|
253 | + 'persistent' => false, |
|
254 | + ], |
|
255 | + 'help_tabs' => [ |
|
256 | + 'venues_editor_help_tab' => [ |
|
257 | + 'title' => esc_html__('Venue Editor', 'event_espresso'), |
|
258 | + 'filename' => 'venues_editor', |
|
259 | + ], |
|
260 | + 'venues_editor_title_richtexteditor_help_tab' => [ |
|
261 | + 'title' => esc_html__('Venue Title & Rich Text Editor', 'event_espresso'), |
|
262 | + 'filename' => 'venues_editor_title_richtexteditor', |
|
263 | + ], |
|
264 | + 'venues_editor_tags_categories_help_tab' => [ |
|
265 | + 'title' => esc_html__('Venue Tags & Categories', 'event_espresso'), |
|
266 | + 'filename' => 'venues_editor_tags_categories', |
|
267 | + ], |
|
268 | + 'venues_editor_physical_location_google_map_virtual_location_help_tab' => [ |
|
269 | + 'title' => esc_html__( |
|
270 | + 'Venue Editor Physical Location & Google Map & Virtual Location', |
|
271 | + 'event_espresso' |
|
272 | + ), |
|
273 | + 'filename' => 'venues_editor_physical_location_google_map_virtual_location', |
|
274 | + ], |
|
275 | + 'venues_editor_save_new_venue_help_tab' => [ |
|
276 | + 'title' => esc_html__('Save New Venue', 'event_espresso'), |
|
277 | + 'filename' => 'venues_editor_save_new_venue', |
|
278 | + ], |
|
279 | + 'venues_editor_other_help_tab' => [ |
|
280 | + 'title' => esc_html__('Venue Editor Other', 'event_espresso'), |
|
281 | + 'filename' => 'venues_editor_other', |
|
282 | + ], |
|
283 | + ], |
|
284 | + 'metaboxes' => ['_venue_editor_metaboxes'], |
|
285 | + 'require_nonce' => false, |
|
286 | + ], |
|
287 | + 'edit' => [ |
|
288 | + 'nav' => [ |
|
289 | + 'label' => esc_html__('Edit Venue', 'event_espresso'), |
|
290 | + 'order' => 5, |
|
291 | + 'persistent' => false, |
|
292 | + 'url' => $VNU_ID |
|
293 | + ? add_query_arg(['post' => $VNU_ID], $this->_current_page_view_url) |
|
294 | + : $this->_admin_base_url, |
|
295 | + ], |
|
296 | + 'help_tabs' => [ |
|
297 | + 'venues_editor_help_tab' => [ |
|
298 | + 'title' => esc_html__('Venue Editor', 'event_espresso'), |
|
299 | + 'filename' => 'venues_editor', |
|
300 | + ], |
|
301 | + 'venues_editor_title_richtexteditor_help_tab' => [ |
|
302 | + 'title' => esc_html__('Venue Title & Rich Text Editor', 'event_espresso'), |
|
303 | + 'filename' => 'venues_editor_title_richtexteditor', |
|
304 | + ], |
|
305 | + 'venues_editor_tags_categories_help_tab' => [ |
|
306 | + 'title' => esc_html__('Venue Tags & Categories', 'event_espresso'), |
|
307 | + 'filename' => 'venues_editor_tags_categories', |
|
308 | + ], |
|
309 | + 'venues_editor_physical_location_google_map_virtual_location_help_tab' => [ |
|
310 | + 'title' => esc_html__( |
|
311 | + 'Venue Editor Physical Location & Google Map & Virtual Location', |
|
312 | + 'event_espresso' |
|
313 | + ), |
|
314 | + 'filename' => 'venues_editor_physical_location_google_map_virtual_location', |
|
315 | + ], |
|
316 | + 'venues_editor_save_new_venue_help_tab' => [ |
|
317 | + 'title' => esc_html__('Save New Venue', 'event_espresso'), |
|
318 | + 'filename' => 'venues_editor_save_new_venue', |
|
319 | + ], |
|
320 | + 'venues_editor_other_help_tab' => [ |
|
321 | + 'title' => esc_html__('Venue Editor Other', 'event_espresso'), |
|
322 | + 'filename' => 'venues_editor_other', |
|
323 | + ], |
|
324 | + ], |
|
325 | + 'metaboxes' => ['_venue_editor_metaboxes'], |
|
326 | + 'require_nonce' => false, |
|
327 | + ], |
|
328 | + 'google_map_settings' => [ |
|
329 | + 'nav' => [ |
|
330 | + 'label' => esc_html__('Google Maps', 'event_espresso'), |
|
331 | + 'order' => 40, |
|
332 | + ], |
|
333 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']), |
|
334 | + 'help_tabs' => [ |
|
335 | + 'general_settings_google_maps_help_tab' => [ |
|
336 | + 'title' => esc_html__('Google Maps', 'event_espresso'), |
|
337 | + 'filename' => 'general_settings_google_maps', |
|
338 | + ], |
|
339 | + ], |
|
340 | + 'require_nonce' => false, |
|
341 | + ], |
|
342 | + // venue category stuff |
|
343 | + 'add_category' => [ |
|
344 | + 'nav' => [ |
|
345 | + 'label' => esc_html__('Add Category', 'event_espresso'), |
|
346 | + 'order' => 15, |
|
347 | + 'persistent' => false, |
|
348 | + ], |
|
349 | + 'metaboxes' => ['_publish_post_box'], |
|
350 | + 'help_tabs' => [ |
|
351 | + 'venues_add_category_help_tab' => [ |
|
352 | + 'title' => esc_html__('Add New Venue Category', 'event_espresso'), |
|
353 | + 'filename' => 'venues_add_category', |
|
354 | + ], |
|
355 | + ], |
|
356 | + 'require_nonce' => false, |
|
357 | + ], |
|
358 | + 'edit_category' => [ |
|
359 | + 'nav' => [ |
|
360 | + 'label' => esc_html__('Edit Category', 'event_espresso'), |
|
361 | + 'order' => 15, |
|
362 | + 'persistent' => false, |
|
363 | + 'url' => $EVT_CAT_ID |
|
364 | + ? add_query_arg(['EVT_CAT_ID' => $EVT_CAT_ID], $this->_current_page_view_url) |
|
365 | + : $this->_admin_base_url, |
|
366 | + ], |
|
367 | + 'metaboxes' => ['_publish_post_box'], |
|
368 | + 'help_tabs' => [ |
|
369 | + 'venues_edit_category_help_tab' => [ |
|
370 | + 'title' => esc_html__('Edit Venue Category', 'event_espresso'), |
|
371 | + 'filename' => 'venues_edit_category', |
|
372 | + ], |
|
373 | + ], |
|
374 | + 'require_nonce' => false, |
|
375 | + ], |
|
376 | + 'category_list' => [ |
|
377 | + 'nav' => [ |
|
378 | + 'label' => esc_html__('Categories', 'event_espresso'), |
|
379 | + 'order' => 20, |
|
380 | + ], |
|
381 | + 'list_table' => 'Venue_Categories_Admin_List_Table', |
|
382 | + 'help_tabs' => [ |
|
383 | + 'venues_categories_help_tab' => [ |
|
384 | + 'title' => esc_html__('Venue Categories', 'event_espresso'), |
|
385 | + 'filename' => 'venues_categories', |
|
386 | + ], |
|
387 | + 'venues_categories_table_column_headings_help_tab' => [ |
|
388 | + 'title' => esc_html__('Venue Categories Table Column Headings', 'event_espresso'), |
|
389 | + 'filename' => 'venues_categories_table_column_headings', |
|
390 | + ], |
|
391 | + 'venues_categories_views_help_tab' => [ |
|
392 | + 'title' => esc_html__('Venue Categories Views', 'event_espresso'), |
|
393 | + 'filename' => 'venues_categories_views', |
|
394 | + ], |
|
395 | + 'venues_categories_other_help_tab' => [ |
|
396 | + 'title' => esc_html__('Venue Categories Other', 'event_espresso'), |
|
397 | + 'filename' => 'venues_categories_other', |
|
398 | + ], |
|
399 | + ], |
|
400 | + 'metaboxes' => $this->_default_espresso_metaboxes, |
|
401 | + 'require_nonce' => false, |
|
402 | + ], |
|
403 | + ]; |
|
404 | + } |
|
405 | + |
|
406 | + |
|
407 | + protected function _add_screen_options() |
|
408 | + { |
|
409 | + // todo |
|
410 | + } |
|
411 | + |
|
412 | + |
|
413 | + protected function _add_screen_options_default() |
|
414 | + { |
|
415 | + $this->_per_page_screen_option(); |
|
416 | + } |
|
417 | + |
|
418 | + |
|
419 | + protected function _add_screen_options_category_list() |
|
420 | + { |
|
421 | + $page_title = $this->_admin_page_title; |
|
422 | + $this->_admin_page_title = esc_html__('Venue Categories', 'event_espresso'); |
|
423 | + $this->_per_page_screen_option(); |
|
424 | + $this->_admin_page_title = $page_title; |
|
425 | + } |
|
426 | + |
|
427 | + |
|
428 | + // none of the below group are currently used for Event Venues |
|
429 | + protected function _add_feature_pointers() |
|
430 | + { |
|
431 | + } |
|
432 | + |
|
433 | + |
|
434 | + public function admin_init() |
|
435 | + { |
|
436 | + } |
|
437 | + |
|
438 | + |
|
439 | + public function admin_notices() |
|
440 | + { |
|
441 | + } |
|
442 | + |
|
443 | + |
|
444 | + public function admin_footer_scripts() |
|
445 | + { |
|
446 | + } |
|
447 | + |
|
448 | + |
|
449 | + public function load_scripts_styles_create_new() |
|
450 | + { |
|
451 | + $this->load_scripts_styles_edit(); |
|
452 | + } |
|
453 | + |
|
454 | + |
|
455 | + public function load_scripts_styles() |
|
456 | + { |
|
457 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', [], EVENT_ESPRESSO_VERSION); |
|
458 | + wp_enqueue_style('ee-cat-admin'); |
|
459 | + } |
|
460 | + |
|
461 | + |
|
462 | + public function load_scripts_styles_add_category() |
|
463 | + { |
|
464 | + $this->load_scripts_styles_edit_category(); |
|
465 | + } |
|
466 | + |
|
467 | + |
|
468 | + public function load_scripts_styles_edit_category() |
|
469 | + { |
|
470 | + } |
|
471 | + |
|
472 | + |
|
473 | + public function load_scripts_styles_edit() |
|
474 | + { |
|
475 | + // styles |
|
476 | + wp_enqueue_style('espresso-ui-theme'); |
|
477 | + wp_register_style( |
|
478 | + 'espresso_venues', |
|
479 | + EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', |
|
480 | + [], |
|
481 | + EVENT_ESPRESSO_VERSION |
|
482 | + ); |
|
483 | + wp_enqueue_style('espresso_venues'); |
|
484 | + } |
|
485 | + |
|
486 | + |
|
487 | + protected function _set_list_table_views_default() |
|
488 | + { |
|
489 | + $this->_views = [ |
|
490 | + 'all' => [ |
|
491 | + 'slug' => 'all', |
|
492 | + 'label' => esc_html__('View All Venues', 'event_espresso'), |
|
493 | + 'count' => 0, |
|
494 | + 'bulk_action' => [], |
|
495 | + ], |
|
496 | + ]; |
|
497 | + |
|
498 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) { |
|
499 | + $this->_views['all']['bulk_action'] = [ |
|
500 | + 'trash_venues' => esc_html__('Move to Trash', 'event_espresso'), |
|
501 | + ]; |
|
502 | + $this->_views['trash'] = [ |
|
503 | + 'slug' => 'trash', |
|
504 | + 'label' => esc_html__('Trash', 'event_espresso'), |
|
505 | + 'count' => 0, |
|
506 | + 'bulk_action' => [ |
|
507 | + 'restore_venues' => esc_html__('Restore from Trash', 'event_espresso'), |
|
508 | + 'delete_venues' => esc_html__('Delete', 'event_espresso'), |
|
509 | + ], |
|
510 | + ]; |
|
511 | + } |
|
512 | + } |
|
513 | + |
|
514 | + |
|
515 | + protected function _set_list_table_views_category_list() |
|
516 | + { |
|
517 | + $this->_views = [ |
|
518 | + 'all' => [ |
|
519 | + 'slug' => 'all', |
|
520 | + 'label' => esc_html__('All', 'event_espresso'), |
|
521 | + 'count' => 0, |
|
522 | + 'bulk_action' => [ |
|
523 | + 'delete_categories' => esc_html__('Delete Permanently', 'event_espresso'), |
|
524 | + ], |
|
525 | + ], |
|
526 | + ]; |
|
527 | + } |
|
528 | + |
|
529 | + |
|
530 | + /** |
|
531 | + * @throws EE_Error |
|
532 | + */ |
|
533 | + protected function _overview_list_table() |
|
534 | + { |
|
535 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
536 | + $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( |
|
537 | + get_post_type_archive_link('espresso_venues'), |
|
538 | + esc_html__("View Venue Archive Page", "event_espresso"), |
|
539 | + 'button' |
|
540 | + ); |
|
541 | + |
|
542 | + $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
543 | + 'create_new', |
|
544 | + 'add', |
|
545 | + [], |
|
546 | + 'add-new-h2' |
|
547 | + ); |
|
548 | + |
|
549 | + $this->_search_btn_label = esc_html__('Venues', 'event_espresso'); |
|
550 | + $this->display_admin_list_table_page_with_sidebar(); |
|
551 | + } |
|
552 | + |
|
553 | + |
|
554 | + /** |
|
555 | + * @throws EE_Error |
|
556 | + * @throws ReflectionException |
|
557 | + */ |
|
558 | + public function extra_misc_actions_publish_box() |
|
559 | + { |
|
560 | + $extra_rows = [ |
|
561 | + 'vnu_capacity' => $this->_cpt_model_obj->get_f('VNU_capacity'), |
|
562 | + 'vnu_url' => $this->_cpt_model_obj->get_f('VNU_url'), |
|
563 | + 'vnu_phone' => $this->_cpt_model_obj->get_f('VNU_phone'), |
|
564 | + ]; |
|
565 | + $template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php'; |
|
566 | + EEH_Template::display_template($template, $extra_rows); |
|
567 | + } |
|
568 | + |
|
569 | + |
|
570 | + /************* Google Maps ************* |
|
571 | 571 | * |
572 | 572 | * @throws EE_Error |
573 | 573 | * @throws EE_Error |
574 | 574 | */ |
575 | 575 | |
576 | 576 | |
577 | - protected function _google_map_settings() |
|
578 | - { |
|
579 | - |
|
580 | - |
|
581 | - $this->_template_args['values'] = $this->_yes_no_values; |
|
582 | - $default_map_settings = new stdClass(); |
|
583 | - $default_map_settings->use_google_maps = true; |
|
584 | - $default_map_settings->google_map_api_key = ''; |
|
585 | - // for event details pages (reg page) |
|
586 | - $default_map_settings->event_details_map_width = 585; |
|
587 | - // ee_map_width_single |
|
588 | - $default_map_settings->event_details_map_height = 362; |
|
589 | - // ee_map_height_single |
|
590 | - $default_map_settings->event_details_map_zoom = 14; |
|
591 | - // ee_map_zoom_single |
|
592 | - $default_map_settings->event_details_display_nav = true; |
|
593 | - // ee_map_nav_display_single |
|
594 | - $default_map_settings->event_details_nav_size = false; |
|
595 | - // ee_map_nav_size_single |
|
596 | - $default_map_settings->event_details_control_type = 'default'; |
|
597 | - // ee_map_type_control_single |
|
598 | - $default_map_settings->event_details_map_align = 'center'; |
|
599 | - // ee_map_align_single |
|
600 | - |
|
601 | - // for event list pages |
|
602 | - $default_map_settings->event_list_map_width = 300; |
|
603 | - // ee_map_width |
|
604 | - $default_map_settings->event_list_map_height = 185; |
|
605 | - // ee_map_height |
|
606 | - $default_map_settings->event_list_map_zoom = 12; |
|
607 | - // ee_map_zoom |
|
608 | - $default_map_settings->event_list_display_nav = false; |
|
609 | - // ee_map_nav_display |
|
610 | - $default_map_settings->event_list_nav_size = true; |
|
611 | - // ee_map_nav_size |
|
612 | - $default_map_settings->event_list_control_type = 'dropdown'; |
|
613 | - // ee_map_type_control |
|
614 | - $default_map_settings->event_list_map_align = 'center'; |
|
615 | - // ee_map_align |
|
616 | - |
|
617 | - $this->_template_args['map_settings'] = |
|
618 | - isset(EE_Registry::instance()->CFG->map_settings) |
|
619 | - && ! empty(EE_Registry::instance()->CFG->map_settings) |
|
620 | - ? (object) array_merge( |
|
621 | - (array) $default_map_settings, |
|
622 | - (array) EE_Registry::instance()->CFG->map_settings |
|
623 | - ) |
|
624 | - : $default_map_settings; |
|
625 | - |
|
626 | - $this->_set_add_edit_form_tags('update_google_map_settings'); |
|
627 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
628 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
629 | - EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', |
|
630 | - $this->_template_args, |
|
631 | - true |
|
632 | - ); |
|
633 | - $this->display_admin_page_with_sidebar(); |
|
634 | - } |
|
635 | - |
|
636 | - |
|
637 | - /** |
|
638 | - * @throws EE_Error |
|
639 | - */ |
|
640 | - protected function _update_google_map_settings() |
|
641 | - { |
|
642 | - $map_settings = EE_Registry::instance()->CFG->map_settings; |
|
643 | - |
|
644 | - $settings = [ |
|
645 | - 'use_google_maps' => 'int', |
|
646 | - 'google_map_api_key' => 'string', |
|
647 | - 'event_details_map_width' => 'int', |
|
648 | - 'event_details_map_zoom' => 'int', |
|
649 | - 'event_details_display_nav' => 'int', |
|
650 | - 'event_details_nav_size' => 'int', |
|
651 | - 'event_details_control_type' => 'string', |
|
652 | - 'event_details_map_align' => 'string', |
|
653 | - 'event_list_map_width' => 'int', |
|
654 | - 'event_list_map_height' => 'int', |
|
655 | - 'event_list_map_zoom' => 'int', |
|
656 | - 'event_list_display_nav' => 'int', |
|
657 | - 'event_list_nav_size' => 'int', |
|
658 | - 'event_list_control_type' => 'string', |
|
659 | - 'event_list_map_align' => 'string', |
|
660 | - ]; |
|
661 | - |
|
662 | - foreach ($settings as $setting => $type) { |
|
663 | - $map_settings->{$setting} = $this->request->getRequestParam($setting, $map_settings->{$setting}, $type); |
|
664 | - } |
|
665 | - |
|
666 | - EE_Registry::instance()->CFG->map_settings = apply_filters( |
|
667 | - 'FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', |
|
668 | - $map_settings |
|
669 | - ); |
|
670 | - |
|
671 | - $what = 'Google Map Settings'; |
|
672 | - $success = $this->_update_espresso_configuration( |
|
673 | - $what, |
|
674 | - EE_Registry::instance()->CFG->map_settings, |
|
675 | - __FILE__, |
|
676 | - __FUNCTION__, |
|
677 | - __LINE__ |
|
678 | - ); |
|
679 | - $this->_redirect_after_action($success, $what, 'updated', ['action' => 'google_map_settings']); |
|
680 | - } |
|
681 | - |
|
682 | - |
|
683 | - /** |
|
684 | - * @throws EE_Error |
|
685 | - * @throws ReflectionException |
|
686 | - */ |
|
687 | - protected function _venue_editor_metaboxes() |
|
688 | - { |
|
689 | - $this->verify_cpt_object(); |
|
690 | - |
|
691 | - add_meta_box( |
|
692 | - 'espresso_venue_address_options', |
|
693 | - esc_html__('Physical Location', 'event_espresso'), |
|
694 | - [$this, 'venue_address_metabox'], |
|
695 | - $this->page_slug, |
|
696 | - 'side' |
|
697 | - ); |
|
698 | - add_meta_box( |
|
699 | - 'espresso_venue_gmap_options', |
|
700 | - esc_html__('Google Map', 'event_espresso'), |
|
701 | - [$this, 'venue_gmap_metabox'], |
|
702 | - $this->page_slug, |
|
703 | - 'side' |
|
704 | - ); |
|
705 | - add_meta_box( |
|
706 | - 'espresso_venue_virtual_loc_options', |
|
707 | - esc_html__('Virtual Location', 'event_espresso'), |
|
708 | - [$this, 'venue_virtual_loc_metabox'], |
|
709 | - $this->page_slug, |
|
710 | - 'side' |
|
711 | - ); |
|
712 | - } |
|
713 | - |
|
714 | - |
|
715 | - public function venue_gmap_metabox() |
|
716 | - { |
|
717 | - $template_args = [ |
|
718 | - 'vnu_enable_for_gmap' => EEH_Form_Fields::select_input( |
|
719 | - 'vnu_enable_for_gmap', |
|
720 | - $this->get_yes_no_values(), |
|
721 | - $this->_cpt_model_obj instanceof EE_Venue ? $this->_cpt_model_obj->enable_for_gmap() : false |
|
722 | - ), |
|
723 | - 'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(), |
|
724 | - ]; |
|
725 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php'; |
|
726 | - EEH_Template::display_template($template, $template_args); |
|
727 | - } |
|
728 | - |
|
729 | - |
|
730 | - /** |
|
731 | - * @throws EE_Error |
|
732 | - * @throws ReflectionException |
|
733 | - */ |
|
734 | - public function venue_address_metabox() |
|
735 | - { |
|
736 | - $template_args['_venue'] = $this->_cpt_model_obj; |
|
737 | - |
|
738 | - $template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input( |
|
739 | - new EE_Question_Form_Input( |
|
740 | - EE_Question::new_instance( |
|
741 | - ['QST_display_text' => esc_html__('State', 'event_espresso'), 'QST_system' => 'state'] |
|
742 | - ), |
|
743 | - EE_Answer::new_instance( |
|
744 | - [ |
|
745 | - 'ANS_value' => $this->_cpt_model_obj instanceof EE_Venue |
|
746 | - ? $this->_cpt_model_obj->state_ID() |
|
747 | - : 0, |
|
748 | - ] |
|
749 | - ), |
|
750 | - [ |
|
751 | - 'input_name' => 'sta_id', |
|
752 | - 'input_id' => 'sta_id', |
|
753 | - 'input_class' => '', |
|
754 | - 'input_prefix' => '', |
|
755 | - 'append_qstn_id' => false, |
|
756 | - ] |
|
757 | - ) |
|
758 | - ); |
|
759 | - $template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input( |
|
760 | - new EE_Question_Form_Input( |
|
761 | - EE_Question::new_instance( |
|
762 | - ['QST_display_text' => esc_html__('Country', 'event_espresso'), 'QST_system' => 'country'] |
|
763 | - ), |
|
764 | - EE_Answer::new_instance( |
|
765 | - [ |
|
766 | - 'ANS_value' => $this->_cpt_model_obj instanceof EE_Venue |
|
767 | - ? $this->_cpt_model_obj->country_ID() |
|
768 | - : 0, |
|
769 | - ] |
|
770 | - ), |
|
771 | - [ |
|
772 | - 'input_name' => 'cnt_iso', |
|
773 | - 'input_id' => 'cnt_iso', |
|
774 | - 'input_class' => '', |
|
775 | - 'input_prefix' => '', |
|
776 | - 'append_qstn_id' => false, |
|
777 | - ] |
|
778 | - ) |
|
779 | - ); |
|
780 | - |
|
781 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php'; |
|
782 | - EEH_Template::display_template($template, $template_args); |
|
783 | - } |
|
784 | - |
|
785 | - |
|
786 | - public function venue_virtual_loc_metabox() |
|
787 | - { |
|
788 | - $template_args = [ |
|
789 | - '_venue' => $this->_cpt_model_obj, |
|
790 | - ]; |
|
791 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php'; |
|
792 | - EEH_Template::display_template($template, $template_args); |
|
793 | - } |
|
794 | - |
|
795 | - |
|
796 | - protected function _restore_cpt_item($post_id, $revision_id) |
|
797 | - { |
|
798 | - $venue_obj = $this->_venue_model->get_one_by_ID($post_id); |
|
799 | - |
|
800 | - // meta revision restore |
|
801 | - $venue_obj->restore_revision($revision_id); |
|
802 | - } |
|
803 | - |
|
804 | - |
|
805 | - /** |
|
806 | - * Handles updates for venue cpts |
|
807 | - * |
|
808 | - * @param int $post_id ID of Venue CPT |
|
809 | - * @param object $post Post object (with "blessed" WP properties) |
|
810 | - * @return void |
|
811 | - */ |
|
812 | - protected function _insert_update_cpt_item($post_id, $post) |
|
813 | - { |
|
814 | - |
|
815 | - if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') { |
|
816 | - return;// get out we're not processing the saving of venues. |
|
817 | - } |
|
818 | - |
|
819 | - $wheres = [$this->_venue_model->primary_key_name() => $post_id]; |
|
820 | - |
|
821 | - $venue_values = [ |
|
822 | - 'VNU_address' => $this->request->getRequestParam('vnu_address'), |
|
823 | - 'VNU_address2' => $this->request->getRequestParam('vnu_address2'), |
|
824 | - 'VNU_city' => $this->request->getRequestParam('vnu_city'), |
|
825 | - 'STA_ID' => $this->request->getRequestParam('sta_id'), |
|
826 | - 'CNT_ISO' => $this->request->getRequestParam('cnt_iso'), |
|
827 | - 'VNU_zip' => $this->request->getRequestParam('vnu_zip'), |
|
828 | - 'VNU_phone' => $this->request->getRequestParam('vnu_phone'), |
|
829 | - 'VNU_capacity' => $this->request->requestParamIsSet('vnu_capacity') |
|
830 | - ? str_replace(',', '', $this->request->getRequestParam('vnu_capacity')) |
|
831 | - : EE_INF, |
|
832 | - 'VNU_url' => $this->request->getRequestParam('vnu_url'), |
|
833 | - 'VNU_virtual_phone' => $this->request->getRequestParam('vnu_virtual_phone'), |
|
834 | - 'VNU_virtual_url' => $this->request->getRequestParam('vnu_virtual_url'), |
|
835 | - 'VNU_enable_for_gmap' => $this->request->getRequestParam('vnu_enable_for_gmap', false, 'bool'), |
|
836 | - 'VNU_google_map_link' => $this->request->getRequestParam('vnu_google_map_link'), |
|
837 | - ]; |
|
838 | - |
|
839 | - // update venue |
|
840 | - $success = $this->_venue_model->update($venue_values, [$wheres]); |
|
841 | - |
|
842 | - // get venue_object for other metaboxes that might be added via the filter... though it would seem to make sense to just use $this->_venue_model->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id! |
|
843 | - $get_one_where = [$this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status]; |
|
844 | - $venue = $this->_venue_model->get_one([$get_one_where]); |
|
845 | - |
|
846 | - // notice we've applied a filter for venue metabox callbacks but we don't actually have any default venue metaboxes in use. So this is just here for addons to more easily hook into venue saves. |
|
847 | - $venue_update_callbacks = apply_filters( |
|
848 | - 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', |
|
849 | - [] |
|
850 | - ); |
|
851 | - $att_success = true; |
|
852 | - foreach ($venue_update_callbacks as $v_callback) { |
|
853 | - // if ANY of these updates fail then we want the appropriate global error message |
|
854 | - $att_success = call_user_func_array($v_callback, [$venue, $this->request->requestParams()]) |
|
855 | - ? $att_success |
|
856 | - : false; |
|
857 | - } |
|
858 | - |
|
859 | - // any errors? |
|
860 | - if ($success && ! $att_success) { |
|
861 | - EE_Error::add_error( |
|
862 | - esc_html__( |
|
863 | - 'Venue Details saved successfully but something went wrong with saving attachments.', |
|
864 | - 'event_espresso' |
|
865 | - ), |
|
866 | - __FILE__, |
|
867 | - __FUNCTION__, |
|
868 | - __LINE__ |
|
869 | - ); |
|
870 | - } elseif ($success === false) { |
|
871 | - EE_Error::add_error( |
|
872 | - esc_html__('Venue Details did not save successfully.', 'event_espresso'), |
|
873 | - __FILE__, |
|
874 | - __FUNCTION__, |
|
875 | - __LINE__ |
|
876 | - ); |
|
877 | - } |
|
878 | - } |
|
879 | - |
|
880 | - |
|
881 | - /** |
|
882 | - * @param int $post_id |
|
883 | - * @throws EE_Error |
|
884 | - * @throws ReflectionException |
|
885 | - */ |
|
886 | - public function trash_cpt_item($post_id) |
|
887 | - { |
|
888 | - $this->request->setRequestParam('VNU_ID', $post_id); |
|
889 | - $this->_trash_or_restore_venue('trash', false); |
|
890 | - } |
|
891 | - |
|
892 | - |
|
893 | - /** |
|
894 | - * @param int $post_id |
|
895 | - * @throws EE_Error |
|
896 | - * @throws ReflectionException |
|
897 | - */ |
|
898 | - public function restore_cpt_item($post_id) |
|
899 | - { |
|
900 | - $this->request->setRequestParam('VNU_ID', $post_id); |
|
901 | - $this->_trash_or_restore_venue('draft', false); |
|
902 | - } |
|
903 | - |
|
904 | - |
|
905 | - /** |
|
906 | - * @param int $post_id |
|
907 | - * @throws EE_Error |
|
908 | - * @throws ReflectionException |
|
909 | - */ |
|
910 | - public function delete_cpt_item($post_id) |
|
911 | - { |
|
912 | - $this->request->setRequestParam('VNU_ID', $post_id); |
|
913 | - $this->_delete_venue(false); |
|
914 | - } |
|
915 | - |
|
916 | - |
|
917 | - public function get_venue_object() |
|
918 | - { |
|
919 | - return $this->_cpt_model_obj; |
|
920 | - } |
|
921 | - |
|
922 | - |
|
923 | - /** |
|
924 | - * @throws EE_Error |
|
925 | - * @throws ReflectionException |
|
926 | - */ |
|
927 | - protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = true) |
|
928 | - { |
|
929 | - $VNU_ID = $this->request->getRequestParam('VNU_ID', 0, 'int'); |
|
930 | - |
|
931 | - // loop thru venues |
|
932 | - if ($VNU_ID) { |
|
933 | - // clean status |
|
934 | - $venue_status = sanitize_key($venue_status); |
|
935 | - // grab status |
|
936 | - if (! empty($venue_status)) { |
|
937 | - $success = $this->_change_venue_status($VNU_ID, $venue_status); |
|
938 | - } else { |
|
939 | - $success = false; |
|
940 | - $msg = esc_html__( |
|
941 | - 'An error occurred. The venue could not be moved to the trash because a valid venue status was not not supplied.', |
|
942 | - 'event_espresso' |
|
943 | - ); |
|
944 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
945 | - } |
|
946 | - } else { |
|
947 | - $success = false; |
|
948 | - $msg = esc_html__( |
|
949 | - 'An error occurred. The venue could not be moved to the trash because a valid venue ID was not not supplied.', |
|
950 | - 'event_espresso' |
|
951 | - ); |
|
952 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
953 | - } |
|
954 | - $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
|
955 | - |
|
956 | - if ($redirect_after) { |
|
957 | - $this->_redirect_after_action($success, 'Venue', $action, ['action' => 'default']); |
|
958 | - } |
|
959 | - } |
|
960 | - |
|
961 | - |
|
962 | - /** |
|
963 | - * @throws EE_Error |
|
964 | - * @throws ReflectionException |
|
965 | - */ |
|
966 | - protected function _trash_or_restore_venues($venue_status = 'trash') |
|
967 | - { |
|
968 | - // clean status |
|
969 | - $venue_status = sanitize_key($venue_status); |
|
970 | - // grab status |
|
971 | - if (! empty($venue_status)) { |
|
972 | - $success = true; |
|
973 | - // determine the event id and set to array. |
|
974 | - $VNU_IDs = $this->request->getRequestParam('venue_id', [], 'int', true); |
|
975 | - // loop thru events |
|
976 | - foreach ($VNU_IDs as $VNU_ID) { |
|
977 | - if ($VNU_ID = absint($VNU_ID)) { |
|
978 | - $results = $this->_change_venue_status($VNU_ID, $venue_status); |
|
979 | - $success = $results !== false ? $success : false; |
|
980 | - } else { |
|
981 | - $msg = sprintf( |
|
982 | - esc_html__( |
|
983 | - 'An error occurred. Venue #%d could not be moved to the trash because a valid venue ID was not not supplied.', |
|
984 | - 'event_espresso' |
|
985 | - ), |
|
986 | - $VNU_ID |
|
987 | - ); |
|
988 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
989 | - $success = false; |
|
990 | - } |
|
991 | - } |
|
992 | - } else { |
|
993 | - $success = false; |
|
994 | - $msg = esc_html__( |
|
995 | - 'An error occurred. The venue could not be moved to the trash because a valid venue status was not not supplied.', |
|
996 | - 'event_espresso' |
|
997 | - ); |
|
998 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
999 | - } |
|
1000 | - // in order to force a pluralized result message we need to send back a success status greater than 1 |
|
1001 | - $success = $success ? 2 : false; |
|
1002 | - $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
|
1003 | - $this->_redirect_after_action($success, 'Venues', $action, ['action' => 'default']); |
|
1004 | - } |
|
1005 | - |
|
1006 | - |
|
1007 | - /** |
|
1008 | - * _trash_or_restore_venues |
|
1009 | - * |
|
1010 | - * //todo this is pretty much the same as the corresponding change_event_status method in Events_Admin_Page. We |
|
1011 | - * should probably abstract this up to the EE_Admin_Page_CPT (or even EE_Admin_Page) and make this a common method |
|
1012 | - * accepting a certain number of params. |
|
1013 | - * |
|
1014 | - * @access private |
|
1015 | - * @param int $VNU_ID |
|
1016 | - * @param string $venue_status |
|
1017 | - * @return bool |
|
1018 | - * @throws EE_Error |
|
1019 | - * @throws ReflectionException |
|
1020 | - */ |
|
1021 | - private function _change_venue_status($VNU_ID = 0, $venue_status = '') |
|
1022 | - { |
|
1023 | - // grab venue id |
|
1024 | - if (! $VNU_ID) { |
|
1025 | - $msg = esc_html__('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
|
1026 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1027 | - return false; |
|
1028 | - } |
|
1029 | - |
|
1030 | - $this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
1031 | - |
|
1032 | - // clean status |
|
1033 | - $venue_status = sanitize_key($venue_status); |
|
1034 | - // grab status |
|
1035 | - if (! $venue_status) { |
|
1036 | - $msg = esc_html__( |
|
1037 | - 'An error occurred. No Venue Status or an invalid Venue Status was received.', |
|
1038 | - 'event_espresso' |
|
1039 | - ); |
|
1040 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1041 | - return false; |
|
1042 | - } |
|
1043 | - |
|
1044 | - // was event trashed or restored ? |
|
1045 | - switch ($venue_status) { |
|
1046 | - case 'draft': |
|
1047 | - $action = 'restored from the trash'; |
|
1048 | - $hook = 'AHEE_venue_restored_from_trash'; |
|
1049 | - break; |
|
1050 | - case 'trash': |
|
1051 | - $action = 'moved to the trash'; |
|
1052 | - $hook = 'AHEE_venue_moved_to_trash'; |
|
1053 | - break; |
|
1054 | - default: |
|
1055 | - $action = 'updated'; |
|
1056 | - $hook = false; |
|
1057 | - } |
|
1058 | - // use class to change status |
|
1059 | - $this->_cpt_model_obj->set_status($venue_status); |
|
1060 | - $success = $this->_cpt_model_obj->save(); |
|
1061 | - |
|
1062 | - if ($success === false) { |
|
1063 | - $msg = sprintf(esc_html__('An error occurred. The venue could not be %s.', 'event_espresso'), $action); |
|
1064 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1065 | - return false; |
|
1066 | - } |
|
1067 | - if ($hook) { |
|
1068 | - do_action($hook); |
|
1069 | - } |
|
1070 | - return true; |
|
1071 | - } |
|
1072 | - |
|
1073 | - |
|
1074 | - /** |
|
1075 | - * @param bool $redirect_after |
|
1076 | - * @return void |
|
1077 | - * @throws EE_Error |
|
1078 | - * @throws ReflectionException |
|
1079 | - */ |
|
1080 | - protected function _delete_venue($redirect_after = true) |
|
1081 | - { |
|
1082 | - // determine the venue id and set to array. |
|
1083 | - $VNU_ID = $this->request->getRequestParam('VNU_ID', 0, 'int'); |
|
1084 | - $VNU_ID = $this->request->getRequestParam('post', $VNU_ID, 'int'); |
|
1085 | - |
|
1086 | - // loop thru venues |
|
1087 | - if ($VNU_ID) { |
|
1088 | - $success = $this->_delete_or_trash_venue($VNU_ID); |
|
1089 | - } else { |
|
1090 | - $success = false; |
|
1091 | - $msg = esc_html__( |
|
1092 | - 'An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', |
|
1093 | - 'event_espresso' |
|
1094 | - ); |
|
1095 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1096 | - } |
|
1097 | - if ($redirect_after) { |
|
1098 | - $this->_redirect_after_action($success, 'Venue', 'deleted', ['action' => 'default']); |
|
1099 | - } |
|
1100 | - } |
|
1101 | - |
|
1102 | - |
|
1103 | - /** |
|
1104 | - * @throws EE_Error |
|
1105 | - * @throws ReflectionException |
|
1106 | - */ |
|
1107 | - protected function _delete_venues() |
|
1108 | - { |
|
1109 | - $success = true; |
|
1110 | - // determine the event id and set to array. |
|
1111 | - $VNU_IDs = $this->request->getRequestParam('venue_id', [], 'int', true); |
|
1112 | - // loop thru events |
|
1113 | - foreach ($VNU_IDs as $VNU_ID) { |
|
1114 | - if ($VNU_ID = absint($VNU_ID)) { |
|
1115 | - $results = $this->_delete_or_trash_venue($VNU_ID); |
|
1116 | - $success = $results !== false ? $success : false; |
|
1117 | - } else { |
|
1118 | - $success = false; |
|
1119 | - $msg = esc_html__( |
|
1120 | - 'An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', |
|
1121 | - 'event_espresso' |
|
1122 | - ); |
|
1123 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1124 | - } |
|
1125 | - } |
|
1126 | - // in order to force a pluralized result message we need to send back a success status greater than 1 |
|
1127 | - $success = $success ? 2 : false; |
|
1128 | - $this->_redirect_after_action( |
|
1129 | - $success, |
|
1130 | - esc_html__('Venues', 'event_espresso'), |
|
1131 | - esc_html__('deleted', 'event_espresso'), |
|
1132 | - ['action' => 'default'] |
|
1133 | - ); |
|
1134 | - } |
|
1135 | - |
|
1136 | - |
|
1137 | - // todo: put in parent |
|
1138 | - |
|
1139 | - |
|
1140 | - /** |
|
1141 | - * @throws EE_Error |
|
1142 | - * @throws ReflectionException |
|
1143 | - */ |
|
1144 | - private function _delete_or_trash_venue($VNU_ID = false) |
|
1145 | - { |
|
1146 | - // grab event id |
|
1147 | - if (! $VNU_ID = absint($VNU_ID)) { |
|
1148 | - $msg = esc_html__('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
|
1149 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1150 | - return false; |
|
1151 | - } |
|
1152 | - |
|
1153 | - |
|
1154 | - $venue = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
1155 | - // first need to remove all term relationships |
|
1156 | - $venue->_remove_relations('Term_Taxonomy'); |
|
1157 | - $success = $venue->delete_permanently(); |
|
1158 | - // did it all go as planned ? |
|
1159 | - if ($success) { |
|
1160 | - $msg = sprintf(esc_html__('Venue ID # %d has been deleted.', 'event_espresso'), $VNU_ID); |
|
1161 | - EE_Error::add_success($msg); |
|
1162 | - } else { |
|
1163 | - $msg = |
|
1164 | - sprintf( |
|
1165 | - esc_html__('An error occurred. Venue ID # %d could not be deleted.', 'event_espresso'), |
|
1166 | - $VNU_ID |
|
1167 | - ); |
|
1168 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1169 | - return false; |
|
1170 | - } |
|
1171 | - do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted'); |
|
1172 | - return true; |
|
1173 | - } |
|
1174 | - |
|
1175 | - |
|
1176 | - |
|
1177 | - |
|
1178 | - /***********/ |
|
1179 | - /* QUERIES */ |
|
1180 | - |
|
1181 | - |
|
1182 | - public function get_venues($per_page = 10, $count = false) |
|
1183 | - { |
|
1184 | - |
|
1185 | - $orderby = $this->request->getRequestParam('orderby', ''); |
|
1186 | - |
|
1187 | - switch ($orderby) { |
|
1188 | - case 'id': |
|
1189 | - $orderby = 'VNU_ID'; |
|
1190 | - break; |
|
1191 | - |
|
1192 | - case 'capacity': |
|
1193 | - $orderby = 'VNU_capacity'; |
|
1194 | - break; |
|
1195 | - |
|
1196 | - case 'city': |
|
1197 | - $orderby = 'VNU_city'; |
|
1198 | - break; |
|
1199 | - |
|
1200 | - default: |
|
1201 | - $orderby = 'VNU_name'; |
|
1202 | - } |
|
1203 | - |
|
1204 | - $sort = $this->request->getRequestParam('order', 'ASC'); |
|
1205 | - $current_page = $this->request->getRequestParam('paged', 1, 'int'); |
|
1206 | - $per_page = ! empty($per_page) ? $per_page : 10; |
|
1207 | - $per_page = $this->request->getRequestParam('perpage', $per_page, 'int'); |
|
1208 | - |
|
1209 | - $offset = ($current_page - 1) * $per_page; |
|
1210 | - $limit = [$offset, $per_page]; |
|
1211 | - |
|
1212 | - $category = $this->request->getRequestParam('category'); |
|
1213 | - $category = $category > 0 ? $category : null; |
|
1214 | - |
|
1215 | - $where = []; |
|
1216 | - |
|
1217 | - // only set initial status if it is in the incoming request. Otherwise the "all" view display's all statuses. |
|
1218 | - $status = $this->request->getRequestParam('status'); |
|
1219 | - if ($status && $status !== 'all') { |
|
1220 | - $where['status'] = $status; |
|
1221 | - } |
|
1222 | - |
|
1223 | - $venue_status = $this->request->getRequestParam('venue_status'); |
|
1224 | - if ($venue_status) { |
|
1225 | - $where['status'] = $venue_status; |
|
1226 | - } |
|
1227 | - |
|
1228 | - |
|
1229 | - if ($category) { |
|
1230 | - $where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories'; |
|
1231 | - $where['Term_Taxonomy.term_id'] = $category; |
|
1232 | - } |
|
1233 | - |
|
1234 | - |
|
1235 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
1236 | - $where['VNU_wp_user'] = get_current_user_id(); |
|
1237 | - } else { |
|
1238 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
1239 | - $where['OR'] = [ |
|
1240 | - 'status*restrict_private' => ['!=', 'private'], |
|
1241 | - 'AND' => [ |
|
1242 | - 'status*inclusive' => ['=', 'private'], |
|
1243 | - 'VNU_wp_user' => get_current_user_id(), |
|
1244 | - ], |
|
1245 | - ]; |
|
1246 | - } |
|
1247 | - } |
|
1248 | - |
|
1249 | - $search_term = $this->request->getRequestParam('s'); |
|
1250 | - if ($search_term) { |
|
1251 | - $search_term = '%' . $search_term . '%'; |
|
1252 | - $where['OR'] = [ |
|
1253 | - 'VNU_name' => ['LIKE', $search_term], |
|
1254 | - 'VNU_desc' => ['LIKE', $search_term], |
|
1255 | - 'VNU_short_desc' => ['LIKE', $search_term], |
|
1256 | - 'VNU_address' => ['LIKE', $search_term], |
|
1257 | - 'VNU_address2' => ['LIKE', $search_term], |
|
1258 | - 'VNU_city' => ['LIKE', $search_term], |
|
1259 | - 'VNU_zip' => ['LIKE', $search_term], |
|
1260 | - 'VNU_phone' => ['LIKE', $search_term], |
|
1261 | - 'VNU_url' => ['LIKE', $search_term], |
|
1262 | - 'VNU_virtual_phone' => ['LIKE', $search_term], |
|
1263 | - 'VNU_virtual_url' => ['LIKE', $search_term], |
|
1264 | - 'VNU_google_map_link' => ['LIKE', $search_term], |
|
1265 | - 'Event.EVT_name' => ['LIKE', $search_term], |
|
1266 | - 'Event.EVT_desc' => ['LIKE', $search_term], |
|
1267 | - 'Event.EVT_phone' => ['LIKE', $search_term], |
|
1268 | - 'Event.EVT_external_URL' => ['LIKE', $search_term], |
|
1269 | - ]; |
|
1270 | - } |
|
1271 | - |
|
1272 | - |
|
1273 | - return $count |
|
1274 | - ? $this->_venue_model->count([$where], 'VNU_ID') |
|
1275 | - : $this->_venue_model->get_all( |
|
1276 | - [$where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort] |
|
1277 | - ); |
|
1278 | - } |
|
1279 | - |
|
1280 | - |
|
1281 | - |
|
1282 | - |
|
1283 | - /** Venue Category Stuff **/ |
|
1284 | - |
|
1285 | - /** |
|
1286 | - * set the _category property with the category object for the loaded page. |
|
1287 | - * |
|
1288 | - * @access private |
|
1289 | - * @return void |
|
1290 | - */ |
|
1291 | - private function _set_category_object() |
|
1292 | - { |
|
1293 | - if (isset($this->_category->id) && ! empty($this->_category->id)) { |
|
1294 | - return; |
|
1295 | - } // already have the category object so get out. |
|
1296 | - |
|
1297 | - // set default category object |
|
1298 | - $this->_set_empty_category_object(); |
|
1299 | - |
|
1300 | - // only set if we've got an id |
|
1301 | - $category_ID = $this->request->getRequestParam('VEN_CAT_ID', 0, 'int'); |
|
1302 | - if (! $category_ID) { |
|
1303 | - return; |
|
1304 | - } |
|
1305 | - |
|
1306 | - $term = get_term($category_ID, 'espresso_venue_categories'); |
|
1307 | - |
|
1308 | - |
|
1309 | - if (! empty($term)) { |
|
1310 | - $this->_category->category_name = $term->name; |
|
1311 | - $this->_category->category_identifier = $term->slug; |
|
1312 | - $this->_category->category_desc = $term->description; |
|
1313 | - $this->_category->id = $term->term_id; |
|
1314 | - $this->_category->parent = $term->parent; |
|
1315 | - } |
|
1316 | - } |
|
1317 | - |
|
1318 | - |
|
1319 | - private function _set_empty_category_object() |
|
1320 | - { |
|
1321 | - $this->_category = new stdClass(); |
|
1322 | - $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
1323 | - $this->_category->id = $this->_category->parent = 0; |
|
1324 | - } |
|
1325 | - |
|
1326 | - |
|
1327 | - /** |
|
1328 | - * @throws EE_Error |
|
1329 | - */ |
|
1330 | - protected function _category_list_table() |
|
1331 | - { |
|
1332 | - do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1333 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
1334 | - 'add_category', |
|
1335 | - 'add_category', |
|
1336 | - [], |
|
1337 | - 'add-new-h2' |
|
1338 | - ); |
|
1339 | - $this->_search_btn_label = esc_html__('Venue Categories', 'event_espresso'); |
|
1340 | - $this->display_admin_list_table_page_with_sidebar(); |
|
1341 | - } |
|
1342 | - |
|
1343 | - |
|
1344 | - /** |
|
1345 | - * @throws EE_Error |
|
1346 | - */ |
|
1347 | - protected function _category_details($view) |
|
1348 | - { |
|
1349 | - |
|
1350 | - // load formatter helper |
|
1351 | - // load field generator helper |
|
1352 | - |
|
1353 | - $route = $view == 'edit' ? 'update_category' : 'insert_category'; |
|
1354 | - $this->_set_add_edit_form_tags($route); |
|
1355 | - |
|
1356 | - $this->_set_category_object(); |
|
1357 | - $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
1358 | - |
|
1359 | - $delete_action = 'delete_category'; |
|
1360 | - |
|
1361 | - $redirect = EE_Admin_Page::add_query_args_and_nonce(['action' => 'category_list'], $this->_admin_base_url); |
|
1362 | - |
|
1363 | - $this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect); |
|
1364 | - |
|
1365 | - // take care of contents |
|
1366 | - $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
|
1367 | - $this->display_admin_page_with_sidebar(); |
|
1368 | - } |
|
1369 | - |
|
1370 | - |
|
1371 | - protected function _category_details_content() |
|
1372 | - { |
|
1373 | - $editor_args['category_desc'] = [ |
|
1374 | - 'type' => 'wp_editor', |
|
1375 | - 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
|
1376 | - 'class' => 'my_editor_custom', |
|
1377 | - 'wpeditor_args' => ['media_buttons' => false], |
|
1378 | - ]; |
|
1379 | - $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
1380 | - |
|
1381 | - $all_terms = get_terms( |
|
1382 | - ['espresso_venue_categories'], |
|
1383 | - ['hide_empty' => 0, 'exclude' => [$this->_category->id]] |
|
1384 | - ); |
|
1385 | - |
|
1386 | - // setup category select for term parents. |
|
1387 | - $category_select_values[] = [ |
|
1388 | - 'text' => esc_html__('No Parent', 'event_espresso'), |
|
1389 | - 'id' => 0, |
|
1390 | - ]; |
|
1391 | - foreach ($all_terms as $term) { |
|
1392 | - $category_select_values[] = [ |
|
1393 | - 'text' => $term->name, |
|
1394 | - 'id' => $term->term_id, |
|
1395 | - ]; |
|
1396 | - } |
|
1397 | - |
|
1398 | - $category_select = EEH_Form_Fields::select_input( |
|
1399 | - 'category_parent', |
|
1400 | - $category_select_values, |
|
1401 | - $this->_category->parent |
|
1402 | - ); |
|
1403 | - $template_args = [ |
|
1404 | - 'category' => $this->_category, |
|
1405 | - 'category_select' => $category_select, |
|
1406 | - 'unique_id_info_help_link' => $this->_get_help_tab_link('unique_id_info'), |
|
1407 | - 'category_desc_editor' => $_wp_editor['category_desc']['field'], |
|
1408 | - 'disable' => '', |
|
1409 | - 'disabled_message' => false, |
|
1410 | - ]; |
|
1411 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
1412 | - return EEH_Template::display_template($template, $template_args, true); |
|
1413 | - } |
|
1414 | - |
|
1415 | - |
|
1416 | - /** |
|
1417 | - * @throws EE_Error |
|
1418 | - */ |
|
1419 | - protected function _delete_categories() |
|
1420 | - { |
|
1421 | - $category_ID = $this->request->getRequestParam('category_id', 0, 'int'); |
|
1422 | - $category_IDs = $this->request->getRequestParam('VEN_CAT_ID', [$category_ID], 'int', true); |
|
1423 | - |
|
1424 | - foreach ($category_IDs as $cat_id) { |
|
1425 | - $this->_delete_category($cat_id); |
|
1426 | - } |
|
1427 | - |
|
1428 | - // doesn't matter what page we're coming from... we're going to the same place after delete. |
|
1429 | - $query_args = [ |
|
1430 | - 'action' => 'category_list', |
|
1431 | - ]; |
|
1432 | - $this->_redirect_after_action(0, '', '', $query_args); |
|
1433 | - } |
|
1434 | - |
|
1435 | - |
|
1436 | - protected function _delete_category($cat_id) |
|
1437 | - { |
|
1438 | - $cat_id = absint($cat_id); |
|
1439 | - wp_delete_term($cat_id, 'espresso_venue_categories'); |
|
1440 | - } |
|
1441 | - |
|
1442 | - |
|
1443 | - /** |
|
1444 | - * @throws EE_Error |
|
1445 | - */ |
|
1446 | - protected function _insert_or_update_category($new_category) |
|
1447 | - { |
|
1448 | - |
|
1449 | - $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(true); |
|
1450 | - $success = 0; // we already have a success message so lets not send another. |
|
1451 | - if ($cat_id) { |
|
1452 | - $query_args = [ |
|
1453 | - 'action' => 'edit_category', |
|
1454 | - 'VEN_CAT_ID' => $cat_id, |
|
1455 | - ]; |
|
1456 | - } else { |
|
1457 | - $query_args = ['action' => 'add_category']; |
|
1458 | - } |
|
1459 | - $this->_redirect_after_action($success, '', '', $query_args, true); |
|
1460 | - } |
|
1461 | - |
|
1462 | - |
|
1463 | - private function _insert_category($update = false) |
|
1464 | - { |
|
1465 | - $category_ID = $update ? $this->request->getRequestParam('VEN_CAT_ID', '', 'int') : ''; |
|
1466 | - $category_name = $this->request->getRequestParam('category_name', ''); |
|
1467 | - $category_desc = $this->request->getRequestParam('category_desc', '', 'html'); |
|
1468 | - $category_parent = $this->request->getRequestParam('category_parent', 0, 'int'); |
|
1469 | - |
|
1470 | - if (empty($category_name)) { |
|
1471 | - $msg = esc_html__('You must add a name for the category.', 'event_espresso'); |
|
1472 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1473 | - return false; |
|
1474 | - } |
|
1475 | - |
|
1476 | - |
|
1477 | - $term_args = [ |
|
1478 | - 'name' => $category_name, |
|
1479 | - 'description' => $category_desc, |
|
1480 | - 'parent' => $category_parent, |
|
1481 | - ]; |
|
1482 | - |
|
1483 | - $insert_ids = $update |
|
1484 | - ? wp_update_term($category_ID, 'espresso_venue_categories', $term_args) |
|
1485 | - : wp_insert_term( |
|
1486 | - $category_name, |
|
1487 | - 'espresso_venue_categories', |
|
1488 | - $term_args |
|
1489 | - ); |
|
1490 | - |
|
1491 | - if (! is_array($insert_ids)) { |
|
1492 | - EE_Error::add_error( |
|
1493 | - esc_html__('An error occurred and the category has not been saved to the database.', 'event_espresso'), |
|
1494 | - __FILE__, |
|
1495 | - __FUNCTION__, |
|
1496 | - __LINE__ |
|
1497 | - ); |
|
1498 | - } else { |
|
1499 | - $category_ID = $insert_ids['term_id']; |
|
1500 | - EE_Error::add_success( |
|
1501 | - sprintf( |
|
1502 | - esc_html__('The category %s was successfully created', 'event_espresso'), |
|
1503 | - $category_name |
|
1504 | - ) |
|
1505 | - ); |
|
1506 | - } |
|
1507 | - |
|
1508 | - return $category_ID; |
|
1509 | - } |
|
1510 | - |
|
1511 | - |
|
1512 | - /** |
|
1513 | - * TODO handle category exports() |
|
1514 | - * |
|
1515 | - * @return void |
|
1516 | - */ |
|
1517 | - protected function _categories_export() |
|
1518 | - { |
|
1519 | - // todo: I don't like doing this but it'll do until we modify EE_Export Class. |
|
1520 | - $this->request->mergeRequestParams( |
|
1521 | - [ |
|
1522 | - 'export' => 'report', |
|
1523 | - 'action' => 'categories', |
|
1524 | - 'category_ids' => $this->request->getRequestParam('VEN_CAT_ID', 0, 'int'), |
|
1525 | - ] |
|
1526 | - ); |
|
1527 | - |
|
1528 | - if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
1529 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
1530 | - $EE_Export = EE_Export::instance($this->request->requestParams()); |
|
1531 | - $EE_Export->export(); |
|
1532 | - } |
|
1533 | - } |
|
1534 | - |
|
1535 | - |
|
1536 | - protected function _import_categories() |
|
1537 | - { |
|
1538 | - |
|
1539 | - require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
1540 | - EE_Import::instance()->import(); |
|
1541 | - } |
|
1542 | - |
|
1543 | - |
|
1544 | - /** |
|
1545 | - * @throws EE_Error |
|
1546 | - */ |
|
1547 | - public function get_categories($per_page = 10, $current_page = 1, $count = false) |
|
1548 | - { |
|
1549 | - |
|
1550 | - // testing term stuff |
|
1551 | - $orderby = $this->request->getRequestParam('orderby', 'Term.term_id'); |
|
1552 | - $order = $this->request->getRequestParam('order', 'DESC'); |
|
1553 | - $limit = ($current_page - 1) * $per_page; |
|
1554 | - $where = ['taxonomy' => 'espresso_venue_categories']; |
|
1555 | - $search_term = $this->request->getRequestParam('s'); |
|
1556 | - if ($search_term) { |
|
1557 | - $search_term = '%' . $search_term . '%'; |
|
1558 | - $where['OR'] = [ |
|
1559 | - 'Term.name' => ['LIKE', $search_term], |
|
1560 | - 'description' => ['LIKE', $search_term], |
|
1561 | - ]; |
|
1562 | - } |
|
1563 | - |
|
1564 | - $query_params = [ |
|
1565 | - $where, |
|
1566 | - 'order_by' => [$orderby => $order], |
|
1567 | - 'limit' => $limit . ',' . $per_page, |
|
1568 | - 'force_join' => ['Term'], |
|
1569 | - ]; |
|
1570 | - |
|
1571 | - return $count |
|
1572 | - ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') |
|
1573 | - : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
1574 | - } |
|
1575 | - |
|
1576 | - |
|
1577 | - /* end category stuff */ |
|
1578 | - /**************/ |
|
577 | + protected function _google_map_settings() |
|
578 | + { |
|
579 | + |
|
580 | + |
|
581 | + $this->_template_args['values'] = $this->_yes_no_values; |
|
582 | + $default_map_settings = new stdClass(); |
|
583 | + $default_map_settings->use_google_maps = true; |
|
584 | + $default_map_settings->google_map_api_key = ''; |
|
585 | + // for event details pages (reg page) |
|
586 | + $default_map_settings->event_details_map_width = 585; |
|
587 | + // ee_map_width_single |
|
588 | + $default_map_settings->event_details_map_height = 362; |
|
589 | + // ee_map_height_single |
|
590 | + $default_map_settings->event_details_map_zoom = 14; |
|
591 | + // ee_map_zoom_single |
|
592 | + $default_map_settings->event_details_display_nav = true; |
|
593 | + // ee_map_nav_display_single |
|
594 | + $default_map_settings->event_details_nav_size = false; |
|
595 | + // ee_map_nav_size_single |
|
596 | + $default_map_settings->event_details_control_type = 'default'; |
|
597 | + // ee_map_type_control_single |
|
598 | + $default_map_settings->event_details_map_align = 'center'; |
|
599 | + // ee_map_align_single |
|
600 | + |
|
601 | + // for event list pages |
|
602 | + $default_map_settings->event_list_map_width = 300; |
|
603 | + // ee_map_width |
|
604 | + $default_map_settings->event_list_map_height = 185; |
|
605 | + // ee_map_height |
|
606 | + $default_map_settings->event_list_map_zoom = 12; |
|
607 | + // ee_map_zoom |
|
608 | + $default_map_settings->event_list_display_nav = false; |
|
609 | + // ee_map_nav_display |
|
610 | + $default_map_settings->event_list_nav_size = true; |
|
611 | + // ee_map_nav_size |
|
612 | + $default_map_settings->event_list_control_type = 'dropdown'; |
|
613 | + // ee_map_type_control |
|
614 | + $default_map_settings->event_list_map_align = 'center'; |
|
615 | + // ee_map_align |
|
616 | + |
|
617 | + $this->_template_args['map_settings'] = |
|
618 | + isset(EE_Registry::instance()->CFG->map_settings) |
|
619 | + && ! empty(EE_Registry::instance()->CFG->map_settings) |
|
620 | + ? (object) array_merge( |
|
621 | + (array) $default_map_settings, |
|
622 | + (array) EE_Registry::instance()->CFG->map_settings |
|
623 | + ) |
|
624 | + : $default_map_settings; |
|
625 | + |
|
626 | + $this->_set_add_edit_form_tags('update_google_map_settings'); |
|
627 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
628 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
629 | + EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', |
|
630 | + $this->_template_args, |
|
631 | + true |
|
632 | + ); |
|
633 | + $this->display_admin_page_with_sidebar(); |
|
634 | + } |
|
635 | + |
|
636 | + |
|
637 | + /** |
|
638 | + * @throws EE_Error |
|
639 | + */ |
|
640 | + protected function _update_google_map_settings() |
|
641 | + { |
|
642 | + $map_settings = EE_Registry::instance()->CFG->map_settings; |
|
643 | + |
|
644 | + $settings = [ |
|
645 | + 'use_google_maps' => 'int', |
|
646 | + 'google_map_api_key' => 'string', |
|
647 | + 'event_details_map_width' => 'int', |
|
648 | + 'event_details_map_zoom' => 'int', |
|
649 | + 'event_details_display_nav' => 'int', |
|
650 | + 'event_details_nav_size' => 'int', |
|
651 | + 'event_details_control_type' => 'string', |
|
652 | + 'event_details_map_align' => 'string', |
|
653 | + 'event_list_map_width' => 'int', |
|
654 | + 'event_list_map_height' => 'int', |
|
655 | + 'event_list_map_zoom' => 'int', |
|
656 | + 'event_list_display_nav' => 'int', |
|
657 | + 'event_list_nav_size' => 'int', |
|
658 | + 'event_list_control_type' => 'string', |
|
659 | + 'event_list_map_align' => 'string', |
|
660 | + ]; |
|
661 | + |
|
662 | + foreach ($settings as $setting => $type) { |
|
663 | + $map_settings->{$setting} = $this->request->getRequestParam($setting, $map_settings->{$setting}, $type); |
|
664 | + } |
|
665 | + |
|
666 | + EE_Registry::instance()->CFG->map_settings = apply_filters( |
|
667 | + 'FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', |
|
668 | + $map_settings |
|
669 | + ); |
|
670 | + |
|
671 | + $what = 'Google Map Settings'; |
|
672 | + $success = $this->_update_espresso_configuration( |
|
673 | + $what, |
|
674 | + EE_Registry::instance()->CFG->map_settings, |
|
675 | + __FILE__, |
|
676 | + __FUNCTION__, |
|
677 | + __LINE__ |
|
678 | + ); |
|
679 | + $this->_redirect_after_action($success, $what, 'updated', ['action' => 'google_map_settings']); |
|
680 | + } |
|
681 | + |
|
682 | + |
|
683 | + /** |
|
684 | + * @throws EE_Error |
|
685 | + * @throws ReflectionException |
|
686 | + */ |
|
687 | + protected function _venue_editor_metaboxes() |
|
688 | + { |
|
689 | + $this->verify_cpt_object(); |
|
690 | + |
|
691 | + add_meta_box( |
|
692 | + 'espresso_venue_address_options', |
|
693 | + esc_html__('Physical Location', 'event_espresso'), |
|
694 | + [$this, 'venue_address_metabox'], |
|
695 | + $this->page_slug, |
|
696 | + 'side' |
|
697 | + ); |
|
698 | + add_meta_box( |
|
699 | + 'espresso_venue_gmap_options', |
|
700 | + esc_html__('Google Map', 'event_espresso'), |
|
701 | + [$this, 'venue_gmap_metabox'], |
|
702 | + $this->page_slug, |
|
703 | + 'side' |
|
704 | + ); |
|
705 | + add_meta_box( |
|
706 | + 'espresso_venue_virtual_loc_options', |
|
707 | + esc_html__('Virtual Location', 'event_espresso'), |
|
708 | + [$this, 'venue_virtual_loc_metabox'], |
|
709 | + $this->page_slug, |
|
710 | + 'side' |
|
711 | + ); |
|
712 | + } |
|
713 | + |
|
714 | + |
|
715 | + public function venue_gmap_metabox() |
|
716 | + { |
|
717 | + $template_args = [ |
|
718 | + 'vnu_enable_for_gmap' => EEH_Form_Fields::select_input( |
|
719 | + 'vnu_enable_for_gmap', |
|
720 | + $this->get_yes_no_values(), |
|
721 | + $this->_cpt_model_obj instanceof EE_Venue ? $this->_cpt_model_obj->enable_for_gmap() : false |
|
722 | + ), |
|
723 | + 'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(), |
|
724 | + ]; |
|
725 | + $template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php'; |
|
726 | + EEH_Template::display_template($template, $template_args); |
|
727 | + } |
|
728 | + |
|
729 | + |
|
730 | + /** |
|
731 | + * @throws EE_Error |
|
732 | + * @throws ReflectionException |
|
733 | + */ |
|
734 | + public function venue_address_metabox() |
|
735 | + { |
|
736 | + $template_args['_venue'] = $this->_cpt_model_obj; |
|
737 | + |
|
738 | + $template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input( |
|
739 | + new EE_Question_Form_Input( |
|
740 | + EE_Question::new_instance( |
|
741 | + ['QST_display_text' => esc_html__('State', 'event_espresso'), 'QST_system' => 'state'] |
|
742 | + ), |
|
743 | + EE_Answer::new_instance( |
|
744 | + [ |
|
745 | + 'ANS_value' => $this->_cpt_model_obj instanceof EE_Venue |
|
746 | + ? $this->_cpt_model_obj->state_ID() |
|
747 | + : 0, |
|
748 | + ] |
|
749 | + ), |
|
750 | + [ |
|
751 | + 'input_name' => 'sta_id', |
|
752 | + 'input_id' => 'sta_id', |
|
753 | + 'input_class' => '', |
|
754 | + 'input_prefix' => '', |
|
755 | + 'append_qstn_id' => false, |
|
756 | + ] |
|
757 | + ) |
|
758 | + ); |
|
759 | + $template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input( |
|
760 | + new EE_Question_Form_Input( |
|
761 | + EE_Question::new_instance( |
|
762 | + ['QST_display_text' => esc_html__('Country', 'event_espresso'), 'QST_system' => 'country'] |
|
763 | + ), |
|
764 | + EE_Answer::new_instance( |
|
765 | + [ |
|
766 | + 'ANS_value' => $this->_cpt_model_obj instanceof EE_Venue |
|
767 | + ? $this->_cpt_model_obj->country_ID() |
|
768 | + : 0, |
|
769 | + ] |
|
770 | + ), |
|
771 | + [ |
|
772 | + 'input_name' => 'cnt_iso', |
|
773 | + 'input_id' => 'cnt_iso', |
|
774 | + 'input_class' => '', |
|
775 | + 'input_prefix' => '', |
|
776 | + 'append_qstn_id' => false, |
|
777 | + ] |
|
778 | + ) |
|
779 | + ); |
|
780 | + |
|
781 | + $template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php'; |
|
782 | + EEH_Template::display_template($template, $template_args); |
|
783 | + } |
|
784 | + |
|
785 | + |
|
786 | + public function venue_virtual_loc_metabox() |
|
787 | + { |
|
788 | + $template_args = [ |
|
789 | + '_venue' => $this->_cpt_model_obj, |
|
790 | + ]; |
|
791 | + $template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php'; |
|
792 | + EEH_Template::display_template($template, $template_args); |
|
793 | + } |
|
794 | + |
|
795 | + |
|
796 | + protected function _restore_cpt_item($post_id, $revision_id) |
|
797 | + { |
|
798 | + $venue_obj = $this->_venue_model->get_one_by_ID($post_id); |
|
799 | + |
|
800 | + // meta revision restore |
|
801 | + $venue_obj->restore_revision($revision_id); |
|
802 | + } |
|
803 | + |
|
804 | + |
|
805 | + /** |
|
806 | + * Handles updates for venue cpts |
|
807 | + * |
|
808 | + * @param int $post_id ID of Venue CPT |
|
809 | + * @param object $post Post object (with "blessed" WP properties) |
|
810 | + * @return void |
|
811 | + */ |
|
812 | + protected function _insert_update_cpt_item($post_id, $post) |
|
813 | + { |
|
814 | + |
|
815 | + if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') { |
|
816 | + return;// get out we're not processing the saving of venues. |
|
817 | + } |
|
818 | + |
|
819 | + $wheres = [$this->_venue_model->primary_key_name() => $post_id]; |
|
820 | + |
|
821 | + $venue_values = [ |
|
822 | + 'VNU_address' => $this->request->getRequestParam('vnu_address'), |
|
823 | + 'VNU_address2' => $this->request->getRequestParam('vnu_address2'), |
|
824 | + 'VNU_city' => $this->request->getRequestParam('vnu_city'), |
|
825 | + 'STA_ID' => $this->request->getRequestParam('sta_id'), |
|
826 | + 'CNT_ISO' => $this->request->getRequestParam('cnt_iso'), |
|
827 | + 'VNU_zip' => $this->request->getRequestParam('vnu_zip'), |
|
828 | + 'VNU_phone' => $this->request->getRequestParam('vnu_phone'), |
|
829 | + 'VNU_capacity' => $this->request->requestParamIsSet('vnu_capacity') |
|
830 | + ? str_replace(',', '', $this->request->getRequestParam('vnu_capacity')) |
|
831 | + : EE_INF, |
|
832 | + 'VNU_url' => $this->request->getRequestParam('vnu_url'), |
|
833 | + 'VNU_virtual_phone' => $this->request->getRequestParam('vnu_virtual_phone'), |
|
834 | + 'VNU_virtual_url' => $this->request->getRequestParam('vnu_virtual_url'), |
|
835 | + 'VNU_enable_for_gmap' => $this->request->getRequestParam('vnu_enable_for_gmap', false, 'bool'), |
|
836 | + 'VNU_google_map_link' => $this->request->getRequestParam('vnu_google_map_link'), |
|
837 | + ]; |
|
838 | + |
|
839 | + // update venue |
|
840 | + $success = $this->_venue_model->update($venue_values, [$wheres]); |
|
841 | + |
|
842 | + // get venue_object for other metaboxes that might be added via the filter... though it would seem to make sense to just use $this->_venue_model->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id! |
|
843 | + $get_one_where = [$this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status]; |
|
844 | + $venue = $this->_venue_model->get_one([$get_one_where]); |
|
845 | + |
|
846 | + // notice we've applied a filter for venue metabox callbacks but we don't actually have any default venue metaboxes in use. So this is just here for addons to more easily hook into venue saves. |
|
847 | + $venue_update_callbacks = apply_filters( |
|
848 | + 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', |
|
849 | + [] |
|
850 | + ); |
|
851 | + $att_success = true; |
|
852 | + foreach ($venue_update_callbacks as $v_callback) { |
|
853 | + // if ANY of these updates fail then we want the appropriate global error message |
|
854 | + $att_success = call_user_func_array($v_callback, [$venue, $this->request->requestParams()]) |
|
855 | + ? $att_success |
|
856 | + : false; |
|
857 | + } |
|
858 | + |
|
859 | + // any errors? |
|
860 | + if ($success && ! $att_success) { |
|
861 | + EE_Error::add_error( |
|
862 | + esc_html__( |
|
863 | + 'Venue Details saved successfully but something went wrong with saving attachments.', |
|
864 | + 'event_espresso' |
|
865 | + ), |
|
866 | + __FILE__, |
|
867 | + __FUNCTION__, |
|
868 | + __LINE__ |
|
869 | + ); |
|
870 | + } elseif ($success === false) { |
|
871 | + EE_Error::add_error( |
|
872 | + esc_html__('Venue Details did not save successfully.', 'event_espresso'), |
|
873 | + __FILE__, |
|
874 | + __FUNCTION__, |
|
875 | + __LINE__ |
|
876 | + ); |
|
877 | + } |
|
878 | + } |
|
879 | + |
|
880 | + |
|
881 | + /** |
|
882 | + * @param int $post_id |
|
883 | + * @throws EE_Error |
|
884 | + * @throws ReflectionException |
|
885 | + */ |
|
886 | + public function trash_cpt_item($post_id) |
|
887 | + { |
|
888 | + $this->request->setRequestParam('VNU_ID', $post_id); |
|
889 | + $this->_trash_or_restore_venue('trash', false); |
|
890 | + } |
|
891 | + |
|
892 | + |
|
893 | + /** |
|
894 | + * @param int $post_id |
|
895 | + * @throws EE_Error |
|
896 | + * @throws ReflectionException |
|
897 | + */ |
|
898 | + public function restore_cpt_item($post_id) |
|
899 | + { |
|
900 | + $this->request->setRequestParam('VNU_ID', $post_id); |
|
901 | + $this->_trash_or_restore_venue('draft', false); |
|
902 | + } |
|
903 | + |
|
904 | + |
|
905 | + /** |
|
906 | + * @param int $post_id |
|
907 | + * @throws EE_Error |
|
908 | + * @throws ReflectionException |
|
909 | + */ |
|
910 | + public function delete_cpt_item($post_id) |
|
911 | + { |
|
912 | + $this->request->setRequestParam('VNU_ID', $post_id); |
|
913 | + $this->_delete_venue(false); |
|
914 | + } |
|
915 | + |
|
916 | + |
|
917 | + public function get_venue_object() |
|
918 | + { |
|
919 | + return $this->_cpt_model_obj; |
|
920 | + } |
|
921 | + |
|
922 | + |
|
923 | + /** |
|
924 | + * @throws EE_Error |
|
925 | + * @throws ReflectionException |
|
926 | + */ |
|
927 | + protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = true) |
|
928 | + { |
|
929 | + $VNU_ID = $this->request->getRequestParam('VNU_ID', 0, 'int'); |
|
930 | + |
|
931 | + // loop thru venues |
|
932 | + if ($VNU_ID) { |
|
933 | + // clean status |
|
934 | + $venue_status = sanitize_key($venue_status); |
|
935 | + // grab status |
|
936 | + if (! empty($venue_status)) { |
|
937 | + $success = $this->_change_venue_status($VNU_ID, $venue_status); |
|
938 | + } else { |
|
939 | + $success = false; |
|
940 | + $msg = esc_html__( |
|
941 | + 'An error occurred. The venue could not be moved to the trash because a valid venue status was not not supplied.', |
|
942 | + 'event_espresso' |
|
943 | + ); |
|
944 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
945 | + } |
|
946 | + } else { |
|
947 | + $success = false; |
|
948 | + $msg = esc_html__( |
|
949 | + 'An error occurred. The venue could not be moved to the trash because a valid venue ID was not not supplied.', |
|
950 | + 'event_espresso' |
|
951 | + ); |
|
952 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
953 | + } |
|
954 | + $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
|
955 | + |
|
956 | + if ($redirect_after) { |
|
957 | + $this->_redirect_after_action($success, 'Venue', $action, ['action' => 'default']); |
|
958 | + } |
|
959 | + } |
|
960 | + |
|
961 | + |
|
962 | + /** |
|
963 | + * @throws EE_Error |
|
964 | + * @throws ReflectionException |
|
965 | + */ |
|
966 | + protected function _trash_or_restore_venues($venue_status = 'trash') |
|
967 | + { |
|
968 | + // clean status |
|
969 | + $venue_status = sanitize_key($venue_status); |
|
970 | + // grab status |
|
971 | + if (! empty($venue_status)) { |
|
972 | + $success = true; |
|
973 | + // determine the event id and set to array. |
|
974 | + $VNU_IDs = $this->request->getRequestParam('venue_id', [], 'int', true); |
|
975 | + // loop thru events |
|
976 | + foreach ($VNU_IDs as $VNU_ID) { |
|
977 | + if ($VNU_ID = absint($VNU_ID)) { |
|
978 | + $results = $this->_change_venue_status($VNU_ID, $venue_status); |
|
979 | + $success = $results !== false ? $success : false; |
|
980 | + } else { |
|
981 | + $msg = sprintf( |
|
982 | + esc_html__( |
|
983 | + 'An error occurred. Venue #%d could not be moved to the trash because a valid venue ID was not not supplied.', |
|
984 | + 'event_espresso' |
|
985 | + ), |
|
986 | + $VNU_ID |
|
987 | + ); |
|
988 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
989 | + $success = false; |
|
990 | + } |
|
991 | + } |
|
992 | + } else { |
|
993 | + $success = false; |
|
994 | + $msg = esc_html__( |
|
995 | + 'An error occurred. The venue could not be moved to the trash because a valid venue status was not not supplied.', |
|
996 | + 'event_espresso' |
|
997 | + ); |
|
998 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
999 | + } |
|
1000 | + // in order to force a pluralized result message we need to send back a success status greater than 1 |
|
1001 | + $success = $success ? 2 : false; |
|
1002 | + $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
|
1003 | + $this->_redirect_after_action($success, 'Venues', $action, ['action' => 'default']); |
|
1004 | + } |
|
1005 | + |
|
1006 | + |
|
1007 | + /** |
|
1008 | + * _trash_or_restore_venues |
|
1009 | + * |
|
1010 | + * //todo this is pretty much the same as the corresponding change_event_status method in Events_Admin_Page. We |
|
1011 | + * should probably abstract this up to the EE_Admin_Page_CPT (or even EE_Admin_Page) and make this a common method |
|
1012 | + * accepting a certain number of params. |
|
1013 | + * |
|
1014 | + * @access private |
|
1015 | + * @param int $VNU_ID |
|
1016 | + * @param string $venue_status |
|
1017 | + * @return bool |
|
1018 | + * @throws EE_Error |
|
1019 | + * @throws ReflectionException |
|
1020 | + */ |
|
1021 | + private function _change_venue_status($VNU_ID = 0, $venue_status = '') |
|
1022 | + { |
|
1023 | + // grab venue id |
|
1024 | + if (! $VNU_ID) { |
|
1025 | + $msg = esc_html__('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
|
1026 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1027 | + return false; |
|
1028 | + } |
|
1029 | + |
|
1030 | + $this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
1031 | + |
|
1032 | + // clean status |
|
1033 | + $venue_status = sanitize_key($venue_status); |
|
1034 | + // grab status |
|
1035 | + if (! $venue_status) { |
|
1036 | + $msg = esc_html__( |
|
1037 | + 'An error occurred. No Venue Status or an invalid Venue Status was received.', |
|
1038 | + 'event_espresso' |
|
1039 | + ); |
|
1040 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1041 | + return false; |
|
1042 | + } |
|
1043 | + |
|
1044 | + // was event trashed or restored ? |
|
1045 | + switch ($venue_status) { |
|
1046 | + case 'draft': |
|
1047 | + $action = 'restored from the trash'; |
|
1048 | + $hook = 'AHEE_venue_restored_from_trash'; |
|
1049 | + break; |
|
1050 | + case 'trash': |
|
1051 | + $action = 'moved to the trash'; |
|
1052 | + $hook = 'AHEE_venue_moved_to_trash'; |
|
1053 | + break; |
|
1054 | + default: |
|
1055 | + $action = 'updated'; |
|
1056 | + $hook = false; |
|
1057 | + } |
|
1058 | + // use class to change status |
|
1059 | + $this->_cpt_model_obj->set_status($venue_status); |
|
1060 | + $success = $this->_cpt_model_obj->save(); |
|
1061 | + |
|
1062 | + if ($success === false) { |
|
1063 | + $msg = sprintf(esc_html__('An error occurred. The venue could not be %s.', 'event_espresso'), $action); |
|
1064 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1065 | + return false; |
|
1066 | + } |
|
1067 | + if ($hook) { |
|
1068 | + do_action($hook); |
|
1069 | + } |
|
1070 | + return true; |
|
1071 | + } |
|
1072 | + |
|
1073 | + |
|
1074 | + /** |
|
1075 | + * @param bool $redirect_after |
|
1076 | + * @return void |
|
1077 | + * @throws EE_Error |
|
1078 | + * @throws ReflectionException |
|
1079 | + */ |
|
1080 | + protected function _delete_venue($redirect_after = true) |
|
1081 | + { |
|
1082 | + // determine the venue id and set to array. |
|
1083 | + $VNU_ID = $this->request->getRequestParam('VNU_ID', 0, 'int'); |
|
1084 | + $VNU_ID = $this->request->getRequestParam('post', $VNU_ID, 'int'); |
|
1085 | + |
|
1086 | + // loop thru venues |
|
1087 | + if ($VNU_ID) { |
|
1088 | + $success = $this->_delete_or_trash_venue($VNU_ID); |
|
1089 | + } else { |
|
1090 | + $success = false; |
|
1091 | + $msg = esc_html__( |
|
1092 | + 'An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', |
|
1093 | + 'event_espresso' |
|
1094 | + ); |
|
1095 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1096 | + } |
|
1097 | + if ($redirect_after) { |
|
1098 | + $this->_redirect_after_action($success, 'Venue', 'deleted', ['action' => 'default']); |
|
1099 | + } |
|
1100 | + } |
|
1101 | + |
|
1102 | + |
|
1103 | + /** |
|
1104 | + * @throws EE_Error |
|
1105 | + * @throws ReflectionException |
|
1106 | + */ |
|
1107 | + protected function _delete_venues() |
|
1108 | + { |
|
1109 | + $success = true; |
|
1110 | + // determine the event id and set to array. |
|
1111 | + $VNU_IDs = $this->request->getRequestParam('venue_id', [], 'int', true); |
|
1112 | + // loop thru events |
|
1113 | + foreach ($VNU_IDs as $VNU_ID) { |
|
1114 | + if ($VNU_ID = absint($VNU_ID)) { |
|
1115 | + $results = $this->_delete_or_trash_venue($VNU_ID); |
|
1116 | + $success = $results !== false ? $success : false; |
|
1117 | + } else { |
|
1118 | + $success = false; |
|
1119 | + $msg = esc_html__( |
|
1120 | + 'An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', |
|
1121 | + 'event_espresso' |
|
1122 | + ); |
|
1123 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1124 | + } |
|
1125 | + } |
|
1126 | + // in order to force a pluralized result message we need to send back a success status greater than 1 |
|
1127 | + $success = $success ? 2 : false; |
|
1128 | + $this->_redirect_after_action( |
|
1129 | + $success, |
|
1130 | + esc_html__('Venues', 'event_espresso'), |
|
1131 | + esc_html__('deleted', 'event_espresso'), |
|
1132 | + ['action' => 'default'] |
|
1133 | + ); |
|
1134 | + } |
|
1135 | + |
|
1136 | + |
|
1137 | + // todo: put in parent |
|
1138 | + |
|
1139 | + |
|
1140 | + /** |
|
1141 | + * @throws EE_Error |
|
1142 | + * @throws ReflectionException |
|
1143 | + */ |
|
1144 | + private function _delete_or_trash_venue($VNU_ID = false) |
|
1145 | + { |
|
1146 | + // grab event id |
|
1147 | + if (! $VNU_ID = absint($VNU_ID)) { |
|
1148 | + $msg = esc_html__('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
|
1149 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1150 | + return false; |
|
1151 | + } |
|
1152 | + |
|
1153 | + |
|
1154 | + $venue = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
1155 | + // first need to remove all term relationships |
|
1156 | + $venue->_remove_relations('Term_Taxonomy'); |
|
1157 | + $success = $venue->delete_permanently(); |
|
1158 | + // did it all go as planned ? |
|
1159 | + if ($success) { |
|
1160 | + $msg = sprintf(esc_html__('Venue ID # %d has been deleted.', 'event_espresso'), $VNU_ID); |
|
1161 | + EE_Error::add_success($msg); |
|
1162 | + } else { |
|
1163 | + $msg = |
|
1164 | + sprintf( |
|
1165 | + esc_html__('An error occurred. Venue ID # %d could not be deleted.', 'event_espresso'), |
|
1166 | + $VNU_ID |
|
1167 | + ); |
|
1168 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1169 | + return false; |
|
1170 | + } |
|
1171 | + do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted'); |
|
1172 | + return true; |
|
1173 | + } |
|
1174 | + |
|
1175 | + |
|
1176 | + |
|
1177 | + |
|
1178 | + /***********/ |
|
1179 | + /* QUERIES */ |
|
1180 | + |
|
1181 | + |
|
1182 | + public function get_venues($per_page = 10, $count = false) |
|
1183 | + { |
|
1184 | + |
|
1185 | + $orderby = $this->request->getRequestParam('orderby', ''); |
|
1186 | + |
|
1187 | + switch ($orderby) { |
|
1188 | + case 'id': |
|
1189 | + $orderby = 'VNU_ID'; |
|
1190 | + break; |
|
1191 | + |
|
1192 | + case 'capacity': |
|
1193 | + $orderby = 'VNU_capacity'; |
|
1194 | + break; |
|
1195 | + |
|
1196 | + case 'city': |
|
1197 | + $orderby = 'VNU_city'; |
|
1198 | + break; |
|
1199 | + |
|
1200 | + default: |
|
1201 | + $orderby = 'VNU_name'; |
|
1202 | + } |
|
1203 | + |
|
1204 | + $sort = $this->request->getRequestParam('order', 'ASC'); |
|
1205 | + $current_page = $this->request->getRequestParam('paged', 1, 'int'); |
|
1206 | + $per_page = ! empty($per_page) ? $per_page : 10; |
|
1207 | + $per_page = $this->request->getRequestParam('perpage', $per_page, 'int'); |
|
1208 | + |
|
1209 | + $offset = ($current_page - 1) * $per_page; |
|
1210 | + $limit = [$offset, $per_page]; |
|
1211 | + |
|
1212 | + $category = $this->request->getRequestParam('category'); |
|
1213 | + $category = $category > 0 ? $category : null; |
|
1214 | + |
|
1215 | + $where = []; |
|
1216 | + |
|
1217 | + // only set initial status if it is in the incoming request. Otherwise the "all" view display's all statuses. |
|
1218 | + $status = $this->request->getRequestParam('status'); |
|
1219 | + if ($status && $status !== 'all') { |
|
1220 | + $where['status'] = $status; |
|
1221 | + } |
|
1222 | + |
|
1223 | + $venue_status = $this->request->getRequestParam('venue_status'); |
|
1224 | + if ($venue_status) { |
|
1225 | + $where['status'] = $venue_status; |
|
1226 | + } |
|
1227 | + |
|
1228 | + |
|
1229 | + if ($category) { |
|
1230 | + $where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories'; |
|
1231 | + $where['Term_Taxonomy.term_id'] = $category; |
|
1232 | + } |
|
1233 | + |
|
1234 | + |
|
1235 | + if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
1236 | + $where['VNU_wp_user'] = get_current_user_id(); |
|
1237 | + } else { |
|
1238 | + if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
1239 | + $where['OR'] = [ |
|
1240 | + 'status*restrict_private' => ['!=', 'private'], |
|
1241 | + 'AND' => [ |
|
1242 | + 'status*inclusive' => ['=', 'private'], |
|
1243 | + 'VNU_wp_user' => get_current_user_id(), |
|
1244 | + ], |
|
1245 | + ]; |
|
1246 | + } |
|
1247 | + } |
|
1248 | + |
|
1249 | + $search_term = $this->request->getRequestParam('s'); |
|
1250 | + if ($search_term) { |
|
1251 | + $search_term = '%' . $search_term . '%'; |
|
1252 | + $where['OR'] = [ |
|
1253 | + 'VNU_name' => ['LIKE', $search_term], |
|
1254 | + 'VNU_desc' => ['LIKE', $search_term], |
|
1255 | + 'VNU_short_desc' => ['LIKE', $search_term], |
|
1256 | + 'VNU_address' => ['LIKE', $search_term], |
|
1257 | + 'VNU_address2' => ['LIKE', $search_term], |
|
1258 | + 'VNU_city' => ['LIKE', $search_term], |
|
1259 | + 'VNU_zip' => ['LIKE', $search_term], |
|
1260 | + 'VNU_phone' => ['LIKE', $search_term], |
|
1261 | + 'VNU_url' => ['LIKE', $search_term], |
|
1262 | + 'VNU_virtual_phone' => ['LIKE', $search_term], |
|
1263 | + 'VNU_virtual_url' => ['LIKE', $search_term], |
|
1264 | + 'VNU_google_map_link' => ['LIKE', $search_term], |
|
1265 | + 'Event.EVT_name' => ['LIKE', $search_term], |
|
1266 | + 'Event.EVT_desc' => ['LIKE', $search_term], |
|
1267 | + 'Event.EVT_phone' => ['LIKE', $search_term], |
|
1268 | + 'Event.EVT_external_URL' => ['LIKE', $search_term], |
|
1269 | + ]; |
|
1270 | + } |
|
1271 | + |
|
1272 | + |
|
1273 | + return $count |
|
1274 | + ? $this->_venue_model->count([$where], 'VNU_ID') |
|
1275 | + : $this->_venue_model->get_all( |
|
1276 | + [$where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort] |
|
1277 | + ); |
|
1278 | + } |
|
1279 | + |
|
1280 | + |
|
1281 | + |
|
1282 | + |
|
1283 | + /** Venue Category Stuff **/ |
|
1284 | + |
|
1285 | + /** |
|
1286 | + * set the _category property with the category object for the loaded page. |
|
1287 | + * |
|
1288 | + * @access private |
|
1289 | + * @return void |
|
1290 | + */ |
|
1291 | + private function _set_category_object() |
|
1292 | + { |
|
1293 | + if (isset($this->_category->id) && ! empty($this->_category->id)) { |
|
1294 | + return; |
|
1295 | + } // already have the category object so get out. |
|
1296 | + |
|
1297 | + // set default category object |
|
1298 | + $this->_set_empty_category_object(); |
|
1299 | + |
|
1300 | + // only set if we've got an id |
|
1301 | + $category_ID = $this->request->getRequestParam('VEN_CAT_ID', 0, 'int'); |
|
1302 | + if (! $category_ID) { |
|
1303 | + return; |
|
1304 | + } |
|
1305 | + |
|
1306 | + $term = get_term($category_ID, 'espresso_venue_categories'); |
|
1307 | + |
|
1308 | + |
|
1309 | + if (! empty($term)) { |
|
1310 | + $this->_category->category_name = $term->name; |
|
1311 | + $this->_category->category_identifier = $term->slug; |
|
1312 | + $this->_category->category_desc = $term->description; |
|
1313 | + $this->_category->id = $term->term_id; |
|
1314 | + $this->_category->parent = $term->parent; |
|
1315 | + } |
|
1316 | + } |
|
1317 | + |
|
1318 | + |
|
1319 | + private function _set_empty_category_object() |
|
1320 | + { |
|
1321 | + $this->_category = new stdClass(); |
|
1322 | + $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
1323 | + $this->_category->id = $this->_category->parent = 0; |
|
1324 | + } |
|
1325 | + |
|
1326 | + |
|
1327 | + /** |
|
1328 | + * @throws EE_Error |
|
1329 | + */ |
|
1330 | + protected function _category_list_table() |
|
1331 | + { |
|
1332 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1333 | + $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
1334 | + 'add_category', |
|
1335 | + 'add_category', |
|
1336 | + [], |
|
1337 | + 'add-new-h2' |
|
1338 | + ); |
|
1339 | + $this->_search_btn_label = esc_html__('Venue Categories', 'event_espresso'); |
|
1340 | + $this->display_admin_list_table_page_with_sidebar(); |
|
1341 | + } |
|
1342 | + |
|
1343 | + |
|
1344 | + /** |
|
1345 | + * @throws EE_Error |
|
1346 | + */ |
|
1347 | + protected function _category_details($view) |
|
1348 | + { |
|
1349 | + |
|
1350 | + // load formatter helper |
|
1351 | + // load field generator helper |
|
1352 | + |
|
1353 | + $route = $view == 'edit' ? 'update_category' : 'insert_category'; |
|
1354 | + $this->_set_add_edit_form_tags($route); |
|
1355 | + |
|
1356 | + $this->_set_category_object(); |
|
1357 | + $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
1358 | + |
|
1359 | + $delete_action = 'delete_category'; |
|
1360 | + |
|
1361 | + $redirect = EE_Admin_Page::add_query_args_and_nonce(['action' => 'category_list'], $this->_admin_base_url); |
|
1362 | + |
|
1363 | + $this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect); |
|
1364 | + |
|
1365 | + // take care of contents |
|
1366 | + $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
|
1367 | + $this->display_admin_page_with_sidebar(); |
|
1368 | + } |
|
1369 | + |
|
1370 | + |
|
1371 | + protected function _category_details_content() |
|
1372 | + { |
|
1373 | + $editor_args['category_desc'] = [ |
|
1374 | + 'type' => 'wp_editor', |
|
1375 | + 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
|
1376 | + 'class' => 'my_editor_custom', |
|
1377 | + 'wpeditor_args' => ['media_buttons' => false], |
|
1378 | + ]; |
|
1379 | + $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
1380 | + |
|
1381 | + $all_terms = get_terms( |
|
1382 | + ['espresso_venue_categories'], |
|
1383 | + ['hide_empty' => 0, 'exclude' => [$this->_category->id]] |
|
1384 | + ); |
|
1385 | + |
|
1386 | + // setup category select for term parents. |
|
1387 | + $category_select_values[] = [ |
|
1388 | + 'text' => esc_html__('No Parent', 'event_espresso'), |
|
1389 | + 'id' => 0, |
|
1390 | + ]; |
|
1391 | + foreach ($all_terms as $term) { |
|
1392 | + $category_select_values[] = [ |
|
1393 | + 'text' => $term->name, |
|
1394 | + 'id' => $term->term_id, |
|
1395 | + ]; |
|
1396 | + } |
|
1397 | + |
|
1398 | + $category_select = EEH_Form_Fields::select_input( |
|
1399 | + 'category_parent', |
|
1400 | + $category_select_values, |
|
1401 | + $this->_category->parent |
|
1402 | + ); |
|
1403 | + $template_args = [ |
|
1404 | + 'category' => $this->_category, |
|
1405 | + 'category_select' => $category_select, |
|
1406 | + 'unique_id_info_help_link' => $this->_get_help_tab_link('unique_id_info'), |
|
1407 | + 'category_desc_editor' => $_wp_editor['category_desc']['field'], |
|
1408 | + 'disable' => '', |
|
1409 | + 'disabled_message' => false, |
|
1410 | + ]; |
|
1411 | + $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
1412 | + return EEH_Template::display_template($template, $template_args, true); |
|
1413 | + } |
|
1414 | + |
|
1415 | + |
|
1416 | + /** |
|
1417 | + * @throws EE_Error |
|
1418 | + */ |
|
1419 | + protected function _delete_categories() |
|
1420 | + { |
|
1421 | + $category_ID = $this->request->getRequestParam('category_id', 0, 'int'); |
|
1422 | + $category_IDs = $this->request->getRequestParam('VEN_CAT_ID', [$category_ID], 'int', true); |
|
1423 | + |
|
1424 | + foreach ($category_IDs as $cat_id) { |
|
1425 | + $this->_delete_category($cat_id); |
|
1426 | + } |
|
1427 | + |
|
1428 | + // doesn't matter what page we're coming from... we're going to the same place after delete. |
|
1429 | + $query_args = [ |
|
1430 | + 'action' => 'category_list', |
|
1431 | + ]; |
|
1432 | + $this->_redirect_after_action(0, '', '', $query_args); |
|
1433 | + } |
|
1434 | + |
|
1435 | + |
|
1436 | + protected function _delete_category($cat_id) |
|
1437 | + { |
|
1438 | + $cat_id = absint($cat_id); |
|
1439 | + wp_delete_term($cat_id, 'espresso_venue_categories'); |
|
1440 | + } |
|
1441 | + |
|
1442 | + |
|
1443 | + /** |
|
1444 | + * @throws EE_Error |
|
1445 | + */ |
|
1446 | + protected function _insert_or_update_category($new_category) |
|
1447 | + { |
|
1448 | + |
|
1449 | + $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(true); |
|
1450 | + $success = 0; // we already have a success message so lets not send another. |
|
1451 | + if ($cat_id) { |
|
1452 | + $query_args = [ |
|
1453 | + 'action' => 'edit_category', |
|
1454 | + 'VEN_CAT_ID' => $cat_id, |
|
1455 | + ]; |
|
1456 | + } else { |
|
1457 | + $query_args = ['action' => 'add_category']; |
|
1458 | + } |
|
1459 | + $this->_redirect_after_action($success, '', '', $query_args, true); |
|
1460 | + } |
|
1461 | + |
|
1462 | + |
|
1463 | + private function _insert_category($update = false) |
|
1464 | + { |
|
1465 | + $category_ID = $update ? $this->request->getRequestParam('VEN_CAT_ID', '', 'int') : ''; |
|
1466 | + $category_name = $this->request->getRequestParam('category_name', ''); |
|
1467 | + $category_desc = $this->request->getRequestParam('category_desc', '', 'html'); |
|
1468 | + $category_parent = $this->request->getRequestParam('category_parent', 0, 'int'); |
|
1469 | + |
|
1470 | + if (empty($category_name)) { |
|
1471 | + $msg = esc_html__('You must add a name for the category.', 'event_espresso'); |
|
1472 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1473 | + return false; |
|
1474 | + } |
|
1475 | + |
|
1476 | + |
|
1477 | + $term_args = [ |
|
1478 | + 'name' => $category_name, |
|
1479 | + 'description' => $category_desc, |
|
1480 | + 'parent' => $category_parent, |
|
1481 | + ]; |
|
1482 | + |
|
1483 | + $insert_ids = $update |
|
1484 | + ? wp_update_term($category_ID, 'espresso_venue_categories', $term_args) |
|
1485 | + : wp_insert_term( |
|
1486 | + $category_name, |
|
1487 | + 'espresso_venue_categories', |
|
1488 | + $term_args |
|
1489 | + ); |
|
1490 | + |
|
1491 | + if (! is_array($insert_ids)) { |
|
1492 | + EE_Error::add_error( |
|
1493 | + esc_html__('An error occurred and the category has not been saved to the database.', 'event_espresso'), |
|
1494 | + __FILE__, |
|
1495 | + __FUNCTION__, |
|
1496 | + __LINE__ |
|
1497 | + ); |
|
1498 | + } else { |
|
1499 | + $category_ID = $insert_ids['term_id']; |
|
1500 | + EE_Error::add_success( |
|
1501 | + sprintf( |
|
1502 | + esc_html__('The category %s was successfully created', 'event_espresso'), |
|
1503 | + $category_name |
|
1504 | + ) |
|
1505 | + ); |
|
1506 | + } |
|
1507 | + |
|
1508 | + return $category_ID; |
|
1509 | + } |
|
1510 | + |
|
1511 | + |
|
1512 | + /** |
|
1513 | + * TODO handle category exports() |
|
1514 | + * |
|
1515 | + * @return void |
|
1516 | + */ |
|
1517 | + protected function _categories_export() |
|
1518 | + { |
|
1519 | + // todo: I don't like doing this but it'll do until we modify EE_Export Class. |
|
1520 | + $this->request->mergeRequestParams( |
|
1521 | + [ |
|
1522 | + 'export' => 'report', |
|
1523 | + 'action' => 'categories', |
|
1524 | + 'category_ids' => $this->request->getRequestParam('VEN_CAT_ID', 0, 'int'), |
|
1525 | + ] |
|
1526 | + ); |
|
1527 | + |
|
1528 | + if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
1529 | + require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
1530 | + $EE_Export = EE_Export::instance($this->request->requestParams()); |
|
1531 | + $EE_Export->export(); |
|
1532 | + } |
|
1533 | + } |
|
1534 | + |
|
1535 | + |
|
1536 | + protected function _import_categories() |
|
1537 | + { |
|
1538 | + |
|
1539 | + require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
1540 | + EE_Import::instance()->import(); |
|
1541 | + } |
|
1542 | + |
|
1543 | + |
|
1544 | + /** |
|
1545 | + * @throws EE_Error |
|
1546 | + */ |
|
1547 | + public function get_categories($per_page = 10, $current_page = 1, $count = false) |
|
1548 | + { |
|
1549 | + |
|
1550 | + // testing term stuff |
|
1551 | + $orderby = $this->request->getRequestParam('orderby', 'Term.term_id'); |
|
1552 | + $order = $this->request->getRequestParam('order', 'DESC'); |
|
1553 | + $limit = ($current_page - 1) * $per_page; |
|
1554 | + $where = ['taxonomy' => 'espresso_venue_categories']; |
|
1555 | + $search_term = $this->request->getRequestParam('s'); |
|
1556 | + if ($search_term) { |
|
1557 | + $search_term = '%' . $search_term . '%'; |
|
1558 | + $where['OR'] = [ |
|
1559 | + 'Term.name' => ['LIKE', $search_term], |
|
1560 | + 'description' => ['LIKE', $search_term], |
|
1561 | + ]; |
|
1562 | + } |
|
1563 | + |
|
1564 | + $query_params = [ |
|
1565 | + $where, |
|
1566 | + 'order_by' => [$orderby => $order], |
|
1567 | + 'limit' => $limit . ',' . $per_page, |
|
1568 | + 'force_join' => ['Term'], |
|
1569 | + ]; |
|
1570 | + |
|
1571 | + return $count |
|
1572 | + ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') |
|
1573 | + : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
1574 | + } |
|
1575 | + |
|
1576 | + |
|
1577 | + /* end category stuff */ |
|
1578 | + /**************/ |
|
1579 | 1579 | } |
@@ -8,34 +8,34 @@ discard block |
||
8 | 8 | </p> |
9 | 9 | <p> |
10 | 10 | <?php printf( |
11 | - esc_html__('This page allows you to add a new question for %s.', 'event_espresso'), |
|
12 | - Domain::brandName() |
|
13 | - ); ?> |
|
11 | + esc_html__('This page allows you to add a new question for %s.', 'event_espresso'), |
|
12 | + Domain::brandName() |
|
13 | + ); ?> |
|
14 | 14 | </p> |
15 | 15 | <ul> |
16 | 16 | <li> |
17 | 17 | <strong><?php esc_html_e('Question Text', 'event_espresso'); ?></strong> |
18 | 18 | <br /> |
19 | 19 | <?php esc_html_e( |
20 | - 'This shows the question as it will be displayed on the registration form. HTML can be used here.', |
|
21 | - 'event_espresso' |
|
22 | - ); ?> |
|
20 | + 'This shows the question as it will be displayed on the registration form. HTML can be used here.', |
|
21 | + 'event_espresso' |
|
22 | + ); ?> |
|
23 | 23 | </li> |
24 | 24 | <li> |
25 | 25 | <strong><?php esc_html_e('Question Label (admin-only)', 'event_espresso'); ?></strong> |
26 | 26 | <br /> |
27 | 27 | <?php esc_html_e( |
28 | - 'This field is only shown to the admin. It is useful for understanding the difference between questions that appear to be similar but are used in various situations. HTML cannot be used.', |
|
29 | - 'event_espresso' |
|
30 | - ); ?> |
|
28 | + 'This field is only shown to the admin. It is useful for understanding the difference between questions that appear to be similar but are used in various situations. HTML cannot be used.', |
|
29 | + 'event_espresso' |
|
30 | + ); ?> |
|
31 | 31 | </li> |
32 | 32 | <li> |
33 | 33 | <strong><?php esc_html_e('Question Order', 'event_espresso'); ?></strong> |
34 | 34 | <br /> |
35 | 35 | <?php esc_html_e( |
36 | - 'Questions can be sorted by using the drag and drop feature on the Questions Overview page. Another way to sort questions is to adjust their order of application by using this field. A smaller order of application will be shown first. For example, a question with an order of application of 1 will appear before one that has an order of application of 5.', |
|
37 | - 'event_espresso' |
|
38 | - ); ?> |
|
36 | + 'Questions can be sorted by using the drag and drop feature on the Questions Overview page. Another way to sort questions is to adjust their order of application by using this field. A smaller order of application will be shown first. For example, a question with an order of application of 1 will appear before one that has an order of application of 5.', |
|
37 | + 'event_espresso' |
|
38 | + ); ?> |
|
39 | 39 | </li> |
40 | 40 | <li> |
41 | 41 | <strong><?php esc_html_e('Admin-Only Question?', 'event_espresso'); ?></strong> |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | <strong><?php esc_html_e('Question Type', 'event_espresso'); ?></strong> |
47 | 47 | <br /> |
48 | 48 | <?php esc_html_e( |
49 | - 'This shows the type of question. Available options are Text, Textarea, Checkboxes, Radio Buttons, Dropdown, State/Province Dropdown, Country Dropdown, and Date Picker.', |
|
50 | - 'event_espresso' |
|
51 | - ); ?> |
|
49 | + 'This shows the type of question. Available options are Text, Textarea, Checkboxes, Radio Buttons, Dropdown, State/Province Dropdown, Country Dropdown, and Date Picker.', |
|
50 | + 'event_espresso' |
|
51 | + ); ?> |
|
52 | 52 | </li> |
53 | 53 | <li> |
54 | 54 | <strong><?php esc_html_e('Answer Options (for applicable question types)', 'event_espresso'); ?></strong> |
@@ -64,24 +64,24 @@ discard block |
||
64 | 64 | <strong><?php esc_html_e('Required Text', 'event_espresso'); ?></strong> |
65 | 65 | <br /> |
66 | 66 | <?php esc_html_e( |
67 | - 'This text is displayed when a registrant does not answer a question but is required to do so. The default message will show "this field is required."', |
|
68 | - 'event_espresso' |
|
69 | - ); ?> |
|
67 | + 'This text is displayed when a registrant does not answer a question but is required to do so. The default message will show "this field is required."', |
|
68 | + 'event_espresso' |
|
69 | + ); ?> |
|
70 | 70 | </li> |
71 | 71 | </ul> |
72 | 72 | <p> |
73 | 73 | <strong><?php esc_html_e('Recommendations', 'event_espresso'); ?></strong> |
74 | 74 | <br /> |
75 | 75 | <?php esc_html_e( |
76 | - 'To learn more about the options on this page, take a look at the different tabs that appear on the left side of the page.', |
|
77 | - 'event_espresso' |
|
78 | - ); ?> |
|
76 | + 'To learn more about the options on this page, take a look at the different tabs that appear on the left side of the page.', |
|
77 | + 'event_espresso' |
|
78 | + ); ?> |
|
79 | 79 | </p> |
80 | 80 | <p> |
81 | 81 | <strong><?php esc_html_e('Screen Options', 'event_espresso'); ?></strong> |
82 | 82 | <br /> |
83 | 83 | <?php esc_html_e( |
84 | - 'You can customize the information that is shown on this page by toggling the Screen Options tab. Then you can add or remove checkmarks to hide or show certain content.', |
|
85 | - 'event_espresso' |
|
86 | - ); ?> |
|
84 | + 'You can customize the information that is shown on this page by toggling the Screen Options tab. Then you can add or remove checkmarks to hide or show certain content.', |
|
85 | + 'event_espresso' |
|
86 | + ); ?> |
|
87 | 87 | </p> |
88 | 88 | \ No newline at end of file |
@@ -3,9 +3,9 @@ discard block |
||
3 | 3 | </p> |
4 | 4 | <p> |
5 | 5 | <?php esc_html_e( |
6 | - 'This page shows options for Email Validation, the EE "Bot Trap" and reCAPTCHA which can help prevent SPAM registrations on your site.', |
|
7 | - 'event_espresso' |
|
8 | - ); ?> |
|
6 | + 'This page shows options for Email Validation, the EE "Bot Trap" and reCAPTCHA which can help prevent SPAM registrations on your site.', |
|
7 | + 'event_espresso' |
|
8 | + ); ?> |
|
9 | 9 | </p> |
10 | 10 | <div id="email_validation_info"> |
11 | 11 | <p> |
@@ -13,9 +13,9 @@ discard block |
||
13 | 13 | </p> |
14 | 14 | <p> |
15 | 15 | <?php esc_html_e( |
16 | - "Validating an email address is extremely difficult to do correctly. Your server's configuration, as well as your own tolerances and needs, can affect the type of validation needed. We offer different types of validation so that you can control how strict your registration form responds to entered email addresses. If you are receiving too many bogus email addresses, then you can try the WordPress Default validation setting. If you find that the form validation is blocking a valid email address you can try the Basic setting, or if available, the International validation settings.", |
|
17 | - 'event_espresso' |
|
18 | - ); ?> |
|
16 | + "Validating an email address is extremely difficult to do correctly. Your server's configuration, as well as your own tolerances and needs, can affect the type of validation needed. We offer different types of validation so that you can control how strict your registration form responds to entered email addresses. If you are receiving too many bogus email addresses, then you can try the WordPress Default validation setting. If you find that the form validation is blocking a valid email address you can try the Basic setting, or if available, the International validation settings.", |
|
17 | + 'event_espresso' |
|
18 | + ); ?> |
|
19 | 19 | </p> |
20 | 20 | <p> |
21 | 21 | <strong><?php esc_html_e('Validation Options:', 'event_espresso'); ?></strong> |
@@ -23,27 +23,27 @@ discard block |
||
23 | 23 | <ul> |
24 | 24 | <li> |
25 | 25 | <?php esc_html_e( |
26 | - '"Basic" - only checks that an email address follows the most basic structure guidelines ( ie: [email protected] ). Will work with the widest range of email addresses but will also allow the most garbage through.', |
|
27 | - 'event_espresso' |
|
28 | - ); ?> |
|
26 | + '"Basic" - only checks that an email address follows the most basic structure guidelines ( ie: [email protected] ). Will work with the widest range of email addresses but will also allow the most garbage through.', |
|
27 | + 'event_espresso' |
|
28 | + ); ?> |
|
29 | 29 | </li> |
30 | 30 | <li> |
31 | 31 | <?php esc_html_e( |
32 | - '"WordPress Default" - uses built in WordPress email validation, but does not support unicode characters (ie: international characters from non-latin based languages).', |
|
33 | - 'event_espresso' |
|
34 | - ); ?> |
|
32 | + '"WordPress Default" - uses built in WordPress email validation, but does not support unicode characters (ie: international characters from non-latin based languages).', |
|
33 | + 'event_espresso' |
|
34 | + ); ?> |
|
35 | 35 | </li> |
36 | 36 | <li> |
37 | 37 | <?php esc_html_e( |
38 | - '"International" - supports unicode characters but may not be supported by all server configurations. Try this first if you need to international language support, but drop back down to "Basic" if your server configuration conflicts.', |
|
39 | - 'event_espresso' |
|
40 | - ); ?> |
|
38 | + '"International" - supports unicode characters but may not be supported by all server configurations. Try this first if you need to international language support, but drop back down to "Basic" if your server configuration conflicts.', |
|
39 | + 'event_espresso' |
|
40 | + ); ?> |
|
41 | 41 | </li> |
42 | 42 | <li> |
43 | 43 | <?php esc_html_e( |
44 | - '"International + DNS Check" - same as "International" but also performs MX and A record DNS checks to verify that the email address domain exists (ie: the portion of the address after the "@"). Can not verify that the local portion of the email address is valid (ie: the first portion of the address before the "@").', |
|
45 | - 'event_espresso' |
|
46 | - ); ?> |
|
44 | + '"International + DNS Check" - same as "International" but also performs MX and A record DNS checks to verify that the email address domain exists (ie: the portion of the address after the "@"). Can not verify that the local portion of the email address is valid (ie: the first portion of the address before the "@").', |
|
45 | + 'event_espresso' |
|
46 | + ); ?> |
|
47 | 47 | </li> |
48 | 48 | </ul> |
49 | 49 | </div> |
@@ -51,21 +51,21 @@ discard block |
||
51 | 51 | <p><strong><?php esc_html_e('reCAPTCHA Information', 'event_espresso'); ?></strong></p> |
52 | 52 | <p> |
53 | 53 | <?php printf( |
54 | - esc_html__( |
|
55 | - '%s helps prevent automated abuse of your site (such as comment spam or bogus registrations) by using a reCAPTCHA to ensure that only humans perform certain actions.', |
|
56 | - 'event_espresso' |
|
57 | - ), |
|
58 | - '<a href="https://www.google.com/recaptcha/intro/index.html" target="_blank" rel="noopener noreferrer">reCAPTCHA</a>' |
|
59 | - ); ?> |
|
54 | + esc_html__( |
|
55 | + '%s helps prevent automated abuse of your site (such as comment spam or bogus registrations) by using a reCAPTCHA to ensure that only humans perform certain actions.', |
|
56 | + 'event_espresso' |
|
57 | + ), |
|
58 | + '<a href="https://www.google.com/recaptcha/intro/index.html" target="_blank" rel="noopener noreferrer">reCAPTCHA</a>' |
|
59 | + ); ?> |
|
60 | 60 | </p> |
61 | 61 | <p> |
62 | 62 | <?php printf( |
63 | - esc_html__( |
|
64 | - 'You must sign up for a free %s account to use it with this plugin. If you already have a reCAPTCHA account enter your "Public" and "Private" keys on this page.', |
|
65 | - 'event_espresso' |
|
66 | - ), |
|
67 | - '<a href="https://www.google.com/recaptcha/admin#createsite" target="_blank" rel="noopener noreferrer">reCAPTCHA</a>' |
|
68 | - ); ?> |
|
63 | + esc_html__( |
|
64 | + 'You must sign up for a free %s account to use it with this plugin. If you already have a reCAPTCHA account enter your "Public" and "Private" keys on this page.', |
|
65 | + 'event_espresso' |
|
66 | + ), |
|
67 | + '<a href="https://www.google.com/recaptcha/admin#createsite" target="_blank" rel="noopener noreferrer">reCAPTCHA</a>' |
|
68 | + ); ?> |
|
69 | 69 | </p> |
70 | 70 | <p><strong><?php esc_html_e('Helpful Information:', 'event_espresso'); ?></strong></p> |
71 | 71 | <ul> |
@@ -82,14 +82,14 @@ discard block |
||
82 | 82 | <p> |
83 | 83 | <strong><?php esc_html_e('Recommendations', 'event_espresso'); ?></strong><br /> |
84 | 84 | <?php esc_html_e( |
85 | - 'To learn more about the options on this page, take a look at the different tabs that appear on the left side of the page.', |
|
86 | - 'event_espresso' |
|
87 | - ); ?> |
|
85 | + 'To learn more about the options on this page, take a look at the different tabs that appear on the left side of the page.', |
|
86 | + 'event_espresso' |
|
87 | + ); ?> |
|
88 | 88 | </p> |
89 | 89 | <p> |
90 | 90 | <strong><?php esc_html_e('Screen Options', 'event_espresso'); ?></strong><br /> |
91 | 91 | <?php esc_html_e( |
92 | - 'You can customize the information that is shown on this page by toggling the Screen Options tab. Then you can add or remove checkmarks to hide or show certain content.', |
|
93 | - 'event_espresso' |
|
94 | - ); ?> |
|
92 | + 'You can customize the information that is shown on this page by toggling the Screen Options tab. Then you can add or remove checkmarks to hide or show certain content.', |
|
93 | + 'event_espresso' |
|
94 | + ); ?> |
|
95 | 95 | </p> |
@@ -7,38 +7,38 @@ discard block |
||
7 | 7 | <p> |
8 | 8 | <strong><?php esc_html_e('Notice', 'event_espresso'); ?></strong><br /> |
9 | 9 | <?php esc_html_e( |
10 | - 'System questions groups may have some options disabled. This is to ensure that your registrations don\'t break from accidental changes.', |
|
11 | - 'event_espresso' |
|
12 | - ); ?> |
|
10 | + 'System questions groups may have some options disabled. This is to ensure that your registrations don\'t break from accidental changes.', |
|
11 | + 'event_espresso' |
|
12 | + ); ?> |
|
13 | 13 | </p> |
14 | 14 | <ul> |
15 | 15 | <li> |
16 | 16 | <strong><?php esc_html_e('Group Name', 'event_espresso'); ?></strong><br /> |
17 | 17 | <?php esc_html_e( |
18 | - 'This is the name (title) of the question group as it will be displayed on the registration form. HTML cannot be used.', |
|
19 | - 'event_espresso' |
|
20 | - ); ?> |
|
18 | + 'This is the name (title) of the question group as it will be displayed on the registration form. HTML cannot be used.', |
|
19 | + 'event_espresso' |
|
20 | + ); ?> |
|
21 | 21 | </li> |
22 | 22 | <li> |
23 | 23 | <strong><?php esc_html_e('Group Identifier', 'event_espresso'); ?></strong><br /> |
24 | 24 | <?php esc_html_e( |
25 | - 'This is a unique name (slug) for this group. It helps you tell the difference between this group and other groups that may appear to be similar. It is not shown to registrants and HTML cannot be used.', |
|
26 | - 'event_espresso' |
|
27 | - ); ?> |
|
25 | + 'This is a unique name (slug) for this group. It helps you tell the difference between this group and other groups that may appear to be similar. It is not shown to registrants and HTML cannot be used.', |
|
26 | + 'event_espresso' |
|
27 | + ); ?> |
|
28 | 28 | </li> |
29 | 29 | <li> |
30 | 30 | <strong><?php esc_html_e('Group Description', 'event_espresso'); ?></strong><br /> |
31 | 31 | <?php esc_html_e( |
32 | - 'This is the description for the question group as it will be shown on the registration form. This can be shown to registrants and HTML is allowed.', |
|
33 | - 'event_espresso' |
|
34 | - ); ?> |
|
32 | + 'This is the description for the question group as it will be shown on the registration form. This can be shown to registrants and HTML is allowed.', |
|
33 | + 'event_espresso' |
|
34 | + ); ?> |
|
35 | 35 | </li> |
36 | 36 | <li> |
37 | 37 | <strong><?php esc_html_e('Question Group Order', 'event_espresso'); ?></strong><br /> |
38 | 38 | <?php esc_html_e( |
39 | - 'Question Groups can be sorted by using the drag and drop feature on the Questions Group page. Another way to sort question groups is to adjust their order of application by using this field. A smaller order of application will be shown first. For example, a question group with an order of application of 1 will appear before one that has an order of application of 5.', |
|
40 | - 'event_espresso' |
|
41 | - ); ?> |
|
39 | + 'Question Groups can be sorted by using the drag and drop feature on the Questions Group page. Another way to sort question groups is to adjust their order of application by using this field. A smaller order of application will be shown first. For example, a question group with an order of application of 1 will appear before one that has an order of application of 5.', |
|
40 | + 'event_espresso' |
|
41 | + ); ?> |
|
42 | 42 | </li> |
43 | 43 | <li> |
44 | 44 | <strong><?php esc_html_e('Show Name', 'event_espresso'); ?></strong><br /> |
@@ -47,29 +47,29 @@ discard block |
||
47 | 47 | <li> |
48 | 48 | <strong><?php esc_html_e('Show Description', 'event_espresso'); ?></strong><br /> |
49 | 49 | <?php esc_html_e( |
50 | - 'Whether the description for the question group be will displayed on the registration form.', |
|
51 | - 'event_espresso' |
|
52 | - ); ?> |
|
50 | + 'Whether the description for the question group be will displayed on the registration form.', |
|
51 | + 'event_espresso' |
|
52 | + ); ?> |
|
53 | 53 | </li> |
54 | 54 | <li> |
55 | 55 | <strong><?php esc_html_e('Questions that appear in this group', 'event_espresso'); ?></strong><br /> |
56 | 56 | <?php esc_html_e( |
57 | - 'This shows all available custom questions. If checked, then that question will appear with this question group. Questions that appear here can also be sorted using drag and drop.', |
|
58 | - 'event_espresso' |
|
59 | - ); ?> |
|
57 | + 'This shows all available custom questions. If checked, then that question will appear with this question group. Questions that appear here can also be sorted using drag and drop.', |
|
58 | + 'event_espresso' |
|
59 | + ); ?> |
|
60 | 60 | </li> |
61 | 61 | </ul> |
62 | 62 | <p> |
63 | 63 | <strong><?php esc_html_e('Recommendations', 'event_espresso'); ?></strong><br /> |
64 | 64 | <?php esc_html_e( |
65 | - 'To learn more about the options on this page, take a look at the different tabs that appear on the left side of the page.', |
|
66 | - 'event_espresso' |
|
67 | - ); ?> |
|
65 | + 'To learn more about the options on this page, take a look at the different tabs that appear on the left side of the page.', |
|
66 | + 'event_espresso' |
|
67 | + ); ?> |
|
68 | 68 | </p> |
69 | 69 | <p> |
70 | 70 | <strong><?php esc_html_e('Screen Options', 'event_espresso'); ?></strong><br /> |
71 | 71 | <?php esc_html_e( |
72 | - 'You can customize the information that is shown on this page by toggling the Screen Options tab. Then you can add or remove checkmarks to hide or show certain content.', |
|
73 | - 'event_espresso' |
|
74 | - ); ?> |
|
72 | + 'You can customize the information that is shown on this page by toggling the Screen Options tab. Then you can add or remove checkmarks to hide or show certain content.', |
|
73 | + 'event_espresso' |
|
74 | + ); ?> |
|
75 | 75 | </p> |
76 | 76 | \ No newline at end of file |
@@ -3,23 +3,23 @@ |
||
3 | 3 | </p> |
4 | 4 | <p> |
5 | 5 | <?php esc_html_e( |
6 | - "This page shows all Question Groups that have been created for Event Espresso. Question Groups allow you to create modular registration forms. Each registration form consists of one or more question groups, and these are allocated on a per event basis.", |
|
7 | - 'event_espresso' |
|
8 | - ); ?> |
|
6 | + "This page shows all Question Groups that have been created for Event Espresso. Question Groups allow you to create modular registration forms. Each registration form consists of one or more question groups, and these are allocated on a per event basis.", |
|
7 | + 'event_espresso' |
|
8 | + ); ?> |
|
9 | 9 | </p> |
10 | 10 | <p> |
11 | 11 | <strong><?php esc_html_e('Recommendations', 'event_espresso'); ?></strong> |
12 | 12 | <br /> |
13 | 13 | <?php esc_html_e( |
14 | - 'To learn more about the options on this page, take a look at the different tabs that appear on the left side of the page.', |
|
15 | - 'event_espresso' |
|
16 | - ); ?> |
|
14 | + 'To learn more about the options on this page, take a look at the different tabs that appear on the left side of the page.', |
|
15 | + 'event_espresso' |
|
16 | + ); ?> |
|
17 | 17 | </p> |
18 | 18 | <p> |
19 | 19 | <strong><?php esc_html_e('Screen Options', 'event_espresso'); ?></strong> |
20 | 20 | <br /> |
21 | 21 | <?php esc_html_e( |
22 | - 'You can customize the information that is shown on this page by toggling the Screen Options tab. Then you can add or remove checkmarks to hide or show certain content.', |
|
23 | - 'event_espresso' |
|
24 | - ); ?> |
|
22 | + 'You can customize the information that is shown on this page by toggling the Screen Options tab. Then you can add or remove checkmarks to hide or show certain content.', |
|
23 | + 'event_espresso' |
|
24 | + ); ?> |
|
25 | 25 | </p> |
26 | 26 | \ No newline at end of file |