@@ -1,15 +1,15 @@ |
||
1 | 1 | <h2><?php esc_html_e('What is the Event Espresso Messages System?', 'event_espresso'); ?></h2> |
2 | 2 | <p> |
3 | 3 | <?php printf( |
4 | - esc_html__( |
|
5 | - 'The Event Espresso Messages system is a powerful framework that Event Espresso uses to prepare %1$smessages%2$s for different types of use (message types) and delivered by different %1$smessengers%2$s.', |
|
6 | - 'event_espresso' |
|
7 | - ), |
|
8 | - '<strong>', |
|
9 | - '</strong>' |
|
10 | - ); ?></p> |
|
4 | + esc_html__( |
|
5 | + 'The Event Espresso Messages system is a powerful framework that Event Espresso uses to prepare %1$smessages%2$s for different types of use (message types) and delivered by different %1$smessengers%2$s.', |
|
6 | + 'event_espresso' |
|
7 | + ), |
|
8 | + '<strong>', |
|
9 | + '</strong>' |
|
10 | + ); ?></p> |
|
11 | 11 | <p> |
12 | 12 | <?php esc_html_e( |
13 | - 'We\'ve intentionally created this framework so that we have as much flexibility as possible for future ideas that we think of (or customers think of) for the kinds of messages that get sent out related to your events.', |
|
14 | - 'event_espresso' |
|
15 | - ); ?></p> |
|
16 | 13 | \ No newline at end of file |
14 | + 'We\'ve intentionally created this framework so that we have as much flexibility as possible for future ideas that we think of (or customers think of) for the kinds of messages that get sent out related to your events.', |
|
15 | + 'event_espresso' |
|
16 | + ); ?></p> |
|
17 | 17 | \ No newline at end of file |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <div id="admin-primary-mbox-dv" class="admin-primary-mbox-dv"> |
2 | 2 | |
3 | - <h3 class="admin-primary-mbox-h4"><?php echo isset($event_name) ? $event_name . ' Custom Template' : ''; ?></h3> |
|
3 | + <h3 class="admin-primary-mbox-h4"><?php echo isset($event_name) ? $event_name.' Custom Template' : ''; ?></h3> |
|
4 | 4 | <input type="hidden" id="ee-msg-current-context" name="MTP_context" value="<?php echo $context; ?>"/> |
5 | 5 | <!-- if this is not a global template then let's show the name and description fields --> |
6 | 6 | <?php |
7 | - if (! $MTP->is_global()) : ?> |
|
7 | + if ( ! $MTP->is_global()) : ?> |
|
8 | 8 | <div class="non-global-mtp-fields"> |
9 | 9 | <p> |
10 | 10 | <?php _e( |
@@ -4,21 +4,21 @@ discard block |
||
4 | 4 | <input type="hidden" id="ee-msg-current-context" name="MTP_context" value="<?php echo $context; ?>"/> |
5 | 5 | <!-- if this is not a global template then let's show the name and description fields --> |
6 | 6 | <?php |
7 | - if (! $MTP->is_global()) : ?> |
|
7 | + if (! $MTP->is_global()) : ?> |
|
8 | 8 | <div class="non-global-mtp-fields"> |
9 | 9 | <p> |
10 | 10 | <?php _e( |
11 | - 'This is a custom template. Custom Templates have an editable name and description to help you differentiate between templates.', |
|
12 | - 'event_espresso' |
|
13 | - ); ?> |
|
11 | + 'This is a custom template. Custom Templates have an editable name and description to help you differentiate between templates.', |
|
12 | + 'event_espresso' |
|
13 | + ); ?> |
|
14 | 14 | </p> |
15 | 15 | <div id="titlediv"> |
16 | 16 | <div id="titlewrap"> |
17 | 17 | <label for="title" class="label-MTP_name" style="visibility:hidden"> |
18 | 18 | <?php _e( |
19 | - 'Message Template Name:', |
|
20 | - 'event_espresso' |
|
21 | - ); ?></label> |
|
19 | + 'Message Template Name:', |
|
20 | + 'event_espresso' |
|
21 | + ); ?></label> |
|
22 | 22 | <input id="title" type="text" class="regular-text" name="ee_msg_non_global_fields[MTP_name]" |
23 | 23 | value="<?php echo $MTP->name(); ?>"> |
24 | 24 | </div> |
@@ -27,29 +27,29 @@ discard block |
||
27 | 27 | <label for="ee-msg-non-global-fields-MTP_description" class="label-MTP_description" |
28 | 28 | style="visibility:hidden;"> |
29 | 29 | <?php _e( |
30 | - 'Message Template Description:', |
|
31 | - 'event_espresso' |
|
32 | - ); ?></label> |
|
30 | + 'Message Template Description:', |
|
31 | + 'event_espresso' |
|
32 | + ); ?></label> |
|
33 | 33 | <textarea id="ee-msg-non-global-fields-MTP_description" class="large-text" |
34 | 34 | name="ee_msg_non_global_fields[MTP_description]"><?php echo $MTP->description(); ?></textarea> |
35 | 35 | </p> |
36 | 36 | </div> |
37 | 37 | <?php |
38 | - else : |
|
39 | - ?> |
|
38 | + else : |
|
39 | + ?> |
|
40 | 40 | <input type="hidden" name="ee_msg_non_global_fields[MTP_name]" value="<?php echo $MTP->name(); ?>"> |
41 | 41 | <input type="hidden" name="ee_msg_non_global_fields[MTP_description]" |
42 | 42 | value="<?php echo $MTP->description(); ?>"> |
43 | 43 | <?php endif; ?> |
44 | 44 | <!-- we need to loop through the template_fields so we know our structure --> |
45 | 45 | <?php |
46 | - if (isset($template_fields) && ! empty($template_fields) && ! is_wp_error($template_fields)) { |
|
47 | - echo $template_fields; |
|
48 | - } else { |
|
49 | - ?> |
|
46 | + if (isset($template_fields) && ! empty($template_fields) && ! is_wp_error($template_fields)) { |
|
47 | + echo $template_fields; |
|
48 | + } else { |
|
49 | + ?> |
|
50 | 50 | <p><?php _e('Something has gone wrong, there are no template fields to output.', 'event_espresso'); ?></p> |
51 | 51 | <?php |
52 | - } |
|
52 | + } |
|
53 | 53 | |
54 | - ?> |
|
54 | + ?> |
|
55 | 55 | </div> <!-- end #admin-primary-mbox-dv --> |
@@ -35,9 +35,12 @@ |
||
35 | 35 | </p> |
36 | 36 | </div> |
37 | 37 | <?php |
38 | - else : |
|
38 | + else { |
|
39 | + : |
|
39 | 40 | ?> |
40 | - <input type="hidden" name="ee_msg_non_global_fields[MTP_name]" value="<?php echo $MTP->name(); ?>"> |
|
41 | + <input type="hidden" name="ee_msg_non_global_fields[MTP_name]" value="<?php echo $MTP->name(); |
|
42 | + } |
|
43 | + ?>"> |
|
41 | 44 | <input type="hidden" name="ee_msg_non_global_fields[MTP_description]" |
42 | 45 | value="<?php echo $MTP->description(); ?>"> |
43 | 46 | <?php endif; ?> |
@@ -1,28 +1,28 @@ |
||
1 | 1 | <div class="<?php echo $messenger; ?>-content"> |
2 | 2 | <?php |
3 | - if (empty($inactive_message_types) && empty($active_message_types)) : |
|
4 | - echo '<p>' |
|
5 | - . __( |
|
6 | - 'This messenger is not currently used with any message types for templates but merely adds to the shortcodes available for templates on other messenger and message types.', |
|
7 | - 'event_espresso' |
|
8 | - ) . '</p>'; |
|
9 | - else : ?> |
|
3 | + if (empty($inactive_message_types) && empty($active_message_types)) : |
|
4 | + echo '<p>' |
|
5 | + . __( |
|
6 | + 'This messenger is not currently used with any message types for templates but merely adds to the shortcodes available for templates on other messenger and message types.', |
|
7 | + 'event_espresso' |
|
8 | + ) . '</p>'; |
|
9 | + else : ?> |
|
10 | 10 | <p class="inactive-on-message <?php echo $hide_on_message; ?>"> |
11 | 11 | <?php _e( |
12 | - 'Below are message types that are currently inactive with this messenger. Drag them over to the messenger box to activate them.', |
|
13 | - 'event_espresso' |
|
14 | - ); ?> |
|
12 | + 'Below are message types that are currently inactive with this messenger. Drag them over to the messenger box to activate them.', |
|
13 | + 'event_espresso' |
|
14 | + ); ?> |
|
15 | 15 | <p> |
16 | 16 | <p class="inactive-off-message <?php echo $hide_off_message; ?>"> |
17 | 17 | <?php _e( |
18 | - 'This messenger is currently inactive. Once the messenger is activated any inactive message types associated with the messenger will be shown here.', |
|
19 | - 'event_espresso' |
|
20 | - ); ?> |
|
18 | + 'This messenger is currently inactive. Once the messenger is activated any inactive message types associated with the messenger will be shown here.', |
|
19 | + 'event_espresso' |
|
20 | + ); ?> |
|
21 | 21 | </p> |
22 | 22 | <div<?php |
23 | - if ($active) : |
|
24 | - ?> id="inactive-message-types"<?php |
|
25 | - endif; ?> |
|
23 | + if ($active) : |
|
24 | + ?> id="inactive-message-types"<?php |
|
25 | + endif; ?> |
|
26 | 26 | class="inactive-message-types mt-tab-container ui-widget-content-ui-state-default <?php echo $hide_on_message; ?>"> |
27 | 27 | <ul class="messenger-activation"> |
28 | 28 | <?php echo $inactive_message_types; ?> |
@@ -5,7 +5,7 @@ |
||
5 | 5 | . __( |
6 | 6 | 'This messenger is not currently used with any message types for templates but merely adds to the shortcodes available for templates on other messenger and message types.', |
7 | 7 | 'event_espresso' |
8 | - ) . '</p>'; |
|
8 | + ).'</p>'; |
|
9 | 9 | else : ?> |
10 | 10 | <p class="inactive-on-message <?php echo $hide_on_message; ?>"> |
11 | 11 | <?php _e( |
@@ -6,8 +6,11 @@ |
||
6 | 6 | 'This messenger is not currently used with any message types for templates but merely adds to the shortcodes available for templates on other messenger and message types.', |
7 | 7 | 'event_espresso' |
8 | 8 | ) . '</p>'; |
9 | - else : ?> |
|
10 | - <p class="inactive-on-message <?php echo $hide_on_message; ?>"> |
|
9 | + else { |
|
10 | + : ?> |
|
11 | + <p class="inactive-on-message <?php echo $hide_on_message; |
|
12 | + } |
|
13 | + ?>"> |
|
11 | 14 | <?php _e( |
12 | 15 | 'Below are message types that are currently inactive with this messenger. Drag them over to the messenger box to activate them.', |
13 | 16 | 'event_espresso' |
@@ -1,31 +1,31 @@ |
||
1 | 1 | <h2><?php esc_html_e('What are Message Types?', 'event_espresso'); ?></h2> |
2 | 2 | <p> |
3 | 3 | <?php printf( |
4 | - esc_html__( |
|
5 | - 'Message Types are the %1$skinds%2$s of messages that get delivered. Think of them as the "type" of package that is being delivered by the messenger. For example, Event Espresso comes with two Message Types attached to the Email messenger: Registration Confirmation (which is triggered by frontend event registrations), and Payment Confirmation (which is triggered by frontend payments).', |
|
6 | - 'event_espresso' |
|
7 | - ), |
|
8 | - '<em>', |
|
9 | - '</em>' |
|
10 | - ); ?></p> |
|
4 | + esc_html__( |
|
5 | + 'Message Types are the %1$skinds%2$s of messages that get delivered. Think of them as the "type" of package that is being delivered by the messenger. For example, Event Espresso comes with two Message Types attached to the Email messenger: Registration Confirmation (which is triggered by frontend event registrations), and Payment Confirmation (which is triggered by frontend payments).', |
|
6 | + 'event_espresso' |
|
7 | + ), |
|
8 | + '<em>', |
|
9 | + '</em>' |
|
10 | + ); ?></p> |
|
11 | 11 | <p> |
12 | 12 | <?php esc_html_e( |
13 | - 'Future iterations of Event Espresso 4.0 (premium versions), will include more and more different message types that can be attached to the various messengers that are available', |
|
14 | - 'event_espresso' |
|
15 | - ); ?></p> |
|
13 | + 'Future iterations of Event Espresso 4.0 (premium versions), will include more and more different message types that can be attached to the various messengers that are available', |
|
14 | + 'event_espresso' |
|
15 | + ); ?></p> |
|
16 | 16 | |
17 | 17 | <h3><?php esc_html_e('Contexts', 'event_espresso'); ?></h3> |
18 | 18 | <p> |
19 | 19 | <?php printf( |
20 | - esc_html__( |
|
21 | - 'Each message type (or %1$skind%1$s of message remember!) has different contexts for messages created for that message type. Contexts are dynamic but generally speaking they tend to represent recipients. So for example, Registration Confirmation message type has three types of recipients for every time a registration confirmation is triggered: Event Administrator, Primary Registrant, and Registrant (which may be multiple messages if there are more than one attendee per event). Whereas the Payment Message Type only has two recipients (Event Administrator, Primary Registrant [the one making the payment]).', |
|
22 | - 'event_espresso' |
|
23 | - ), |
|
24 | - '<em>', |
|
25 | - '</em>' |
|
26 | - ); ?></p> |
|
20 | + esc_html__( |
|
21 | + 'Each message type (or %1$skind%1$s of message remember!) has different contexts for messages created for that message type. Contexts are dynamic but generally speaking they tend to represent recipients. So for example, Registration Confirmation message type has three types of recipients for every time a registration confirmation is triggered: Event Administrator, Primary Registrant, and Registrant (which may be multiple messages if there are more than one attendee per event). Whereas the Payment Message Type only has two recipients (Event Administrator, Primary Registrant [the one making the payment]).', |
|
22 | + 'event_espresso' |
|
23 | + ), |
|
24 | + '<em>', |
|
25 | + '</em>' |
|
26 | + ); ?></p> |
|
27 | 27 | <p> |
28 | 28 | <?php esc_html_e( |
29 | - 'You will most likely never see the word "context" in any of the Messages system labelling because they are dynamic per message type. Usually, contexts will be labelled "Recipients" but there may be cases down the road where a message type might use contexts to represent something totally different', |
|
30 | - 'event_espresso' |
|
31 | - ); ?></p> |
|
32 | 29 | \ No newline at end of file |
30 | + 'You will most likely never see the word "context" in any of the Messages system labelling because they are dynamic per message type. Usually, contexts will be labelled "Recipients" but there may be cases down the road where a message type might use contexts to represent something totally different', |
|
31 | + 'event_espresso' |
|
32 | + ); ?></p> |
|
33 | 33 | \ No newline at end of file |
@@ -5,15 +5,15 @@ discard block |
||
5 | 5 | </h2> |
6 | 6 | <p class="ee-attention"> |
7 | 7 | <?php |
8 | - echo sprintf( |
|
9 | - __( |
|
10 | - 'The following shortcodes and page settings are required for Event Espresso to function properly. These shortcodes should not be replaced with any other shortcodes. Please view %sthis page%s for a list of optional shortcodes you can use on other pages.', |
|
11 | - 'event_espresso' |
|
12 | - ), |
|
13 | - '<a href="admin.php?page=espresso_support">', |
|
14 | - '</a>' |
|
15 | - ); |
|
16 | - ?> |
|
8 | + echo sprintf( |
|
9 | + __( |
|
10 | + 'The following shortcodes and page settings are required for Event Espresso to function properly. These shortcodes should not be replaced with any other shortcodes. Please view %sthis page%s for a list of optional shortcodes you can use on other pages.', |
|
11 | + 'event_espresso' |
|
12 | + ), |
|
13 | + '<a href="admin.php?page=espresso_support">', |
|
14 | + '</a>' |
|
15 | + ); |
|
16 | + ?> |
|
17 | 17 | </p> |
18 | 18 | |
19 | 19 | <table class="form-table"> |
@@ -39,21 +39,21 @@ discard block |
||
39 | 39 | </select> |
40 | 40 | <span> |
41 | 41 | <?php echo General_Settings_Admin_Page::page_and_shortcode_status( |
42 | - $reg_page_obj, |
|
43 | - '[ESPRESSO_CHECKOUT]' |
|
44 | - ); ?> |
|
42 | + $reg_page_obj, |
|
43 | + '[ESPRESSO_CHECKOUT]' |
|
44 | + ); ?> |
|
45 | 45 | </span> |
46 | 46 | <br/> |
47 | 47 | <p class="description"> |
48 | 48 | <?php |
49 | - echo sprintf( |
|
50 | - __( |
|
51 | - 'This page can be hidden from navigation if desired, but should always contain the %s shortcode.', |
|
52 | - 'event_espresso' |
|
53 | - ), |
|
54 | - '<span class="highlight" style="padding:3px;margin:0;">[ESPRESSO_CHECKOUT]</span>' |
|
55 | - ); |
|
56 | - ?> |
|
49 | + echo sprintf( |
|
50 | + __( |
|
51 | + 'This page can be hidden from navigation if desired, but should always contain the %s shortcode.', |
|
52 | + 'event_espresso' |
|
53 | + ), |
|
54 | + '<span class="highlight" style="padding:3px;margin:0;">[ESPRESSO_CHECKOUT]</span>' |
|
55 | + ); |
|
56 | + ?> |
|
57 | 57 | </p> |
58 | 58 | <br/><br/> |
59 | 59 | </td> |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | <br/> |
70 | 70 | <span class="lt-grey-text"> |
71 | 71 | <?php _e( |
72 | - 'Notify URL (processes payments)', |
|
73 | - 'event_espresso' |
|
74 | - ); ?></span><br/> |
|
72 | + 'Notify URL (processes payments)', |
|
73 | + 'event_espresso' |
|
74 | + ); ?></span><br/> |
|
75 | 75 | <?php echo General_Settings_Admin_Page::edit_view_links($txn_page_id); ?> |
76 | 76 | </label> |
77 | 77 | </th> |
@@ -84,21 +84,21 @@ discard block |
||
84 | 84 | </select> |
85 | 85 | <span> |
86 | 86 | <?php echo General_Settings_Admin_Page::page_and_shortcode_status( |
87 | - $txn_page_obj, |
|
88 | - '[ESPRESSO_TXN_PAGE]' |
|
89 | - ); ?> |
|
87 | + $txn_page_obj, |
|
88 | + '[ESPRESSO_TXN_PAGE]' |
|
89 | + ); ?> |
|
90 | 90 | </span> |
91 | 91 | <br/> |
92 | 92 | <p class="description"> |
93 | 93 | <?php |
94 | - echo sprintf( |
|
95 | - __( |
|
96 | - 'This page should be hidden from your navigation, but still viewable to the public (not password protected), and should always contain the %s shortcode.', |
|
97 | - 'event_espresso' |
|
98 | - ), |
|
99 | - '<span class="highlight" style="padding:3px;margin:0;">[ESPRESSO_TXN_PAGE]</span>' |
|
100 | - ); |
|
101 | - ?> |
|
94 | + echo sprintf( |
|
95 | + __( |
|
96 | + 'This page should be hidden from your navigation, but still viewable to the public (not password protected), and should always contain the %s shortcode.', |
|
97 | + 'event_espresso' |
|
98 | + ), |
|
99 | + '<span class="highlight" style="padding:3px;margin:0;">[ESPRESSO_TXN_PAGE]</span>' |
|
100 | + ); |
|
101 | + ?> |
|
102 | 102 | </p> |
103 | 103 | <br/><br/> |
104 | 104 | </td> |
@@ -124,21 +124,21 @@ discard block |
||
124 | 124 | </select> |
125 | 125 | <span> |
126 | 126 | <?php echo General_Settings_Admin_Page::page_and_shortcode_status( |
127 | - $thank_you_page_obj, |
|
128 | - '[ESPRESSO_THANK_YOU]' |
|
129 | - ); ?> |
|
127 | + $thank_you_page_obj, |
|
128 | + '[ESPRESSO_THANK_YOU]' |
|
129 | + ); ?> |
|
130 | 130 | </span> |
131 | 131 | <br/> |
132 | 132 | <p class="description"> |
133 | 133 | <?php |
134 | - echo sprintf( |
|
135 | - __( |
|
136 | - 'This page should be hidden from your navigation, but still viewable to the public (not password protected), and should always contain the %s shortcode.', |
|
137 | - 'event_espresso' |
|
138 | - ), |
|
139 | - '<span class="highlight" style="padding:3px;margin:0;">[ESPRESSO_THANK_YOU]</span>' |
|
140 | - ); |
|
141 | - ?> |
|
134 | + echo sprintf( |
|
135 | + __( |
|
136 | + 'This page should be hidden from your navigation, but still viewable to the public (not password protected), and should always contain the %s shortcode.', |
|
137 | + 'event_espresso' |
|
138 | + ), |
|
139 | + '<span class="highlight" style="padding:3px;margin:0;">[ESPRESSO_THANK_YOU]</span>' |
|
140 | + ); |
|
141 | + ?> |
|
142 | 142 | </p> |
143 | 143 | <br/><br/> |
144 | 144 | </td> |
@@ -164,21 +164,21 @@ discard block |
||
164 | 164 | </select> |
165 | 165 | <span> |
166 | 166 | <?php echo General_Settings_Admin_Page::page_and_shortcode_status( |
167 | - $cancel_page_obj, |
|
168 | - '[ESPRESSO_CANCELLED]' |
|
169 | - ); ?> |
|
167 | + $cancel_page_obj, |
|
168 | + '[ESPRESSO_CANCELLED]' |
|
169 | + ); ?> |
|
170 | 170 | </span> |
171 | 171 | <br/> |
172 | 172 | <p class="description"> |
173 | 173 | <?php |
174 | - echo sprintf( |
|
175 | - __( |
|
176 | - 'This page should be hidden from your navigation, but still viewable to the public (not password protected), and should always contain a "cancelled transaction" message and the %s shortcode.', |
|
177 | - 'event_espresso' |
|
178 | - ), |
|
179 | - '<span class="highlight" style="padding:3px;margin:0;">[ESPRESSO_CANCELLED]</span>' |
|
180 | - ); |
|
181 | - ?> |
|
174 | + echo sprintf( |
|
175 | + __( |
|
176 | + 'This page should be hidden from your navigation, but still viewable to the public (not password protected), and should always contain a "cancelled transaction" message and the %s shortcode.', |
|
177 | + 'event_espresso' |
|
178 | + ), |
|
179 | + '<span class="highlight" style="padding:3px;margin:0;">[ESPRESSO_CANCELLED]</span>' |
|
180 | + ); |
|
181 | + ?> |
|
182 | 182 | </p> |
183 | 183 | <br/><br/> |
184 | 184 | </td> |
@@ -194,27 +194,27 @@ discard block |
||
194 | 194 | <br/> |
195 | 195 | <a href='<?php echo get_post_type_archive_link('espresso_events') ?>'> |
196 | 196 | <?php _e( |
197 | - 'View', |
|
198 | - 'event_espresso' |
|
199 | - ); ?></a> |
|
197 | + 'View', |
|
198 | + 'event_espresso' |
|
199 | + ); ?></a> |
|
200 | 200 | </label> |
201 | 201 | </th> |
202 | 202 | <td> |
203 | 203 | <p class="description"> |
204 | 204 | <?php echo __( |
205 | - 'Events are custom post types and use WordPress\' normal archive pages for displaying events.', |
|
206 | - 'event_espresso' |
|
207 | - ) ?> |
|
205 | + 'Events are custom post types and use WordPress\' normal archive pages for displaying events.', |
|
206 | + 'event_espresso' |
|
207 | + ) ?> |
|
208 | 208 | </p> |
209 | 209 | <p class="description"> |
210 | 210 | <?php printf( |
211 | - __( |
|
212 | - 'If you would still like your events on a page like in Event Espresso 3.1 or earlier, simply create a page and place a shortcode to display them on the page, as described %s here %s', |
|
213 | - 'event_espresso' |
|
214 | - ), |
|
215 | - '<a href="admin.php?page=espresso_support">', |
|
216 | - '</a>' |
|
217 | - ) ?> |
|
211 | + __( |
|
212 | + 'If you would still like your events on a page like in Event Espresso 3.1 or earlier, simply create a page and place a shortcode to display them on the page, as described %s here %s', |
|
213 | + 'event_espresso' |
|
214 | + ), |
|
215 | + '<a href="admin.php?page=espresso_support">', |
|
216 | + '</a>' |
|
217 | + ) ?> |
|
218 | 218 | </p> |
219 | 219 | <br/><br/> |
220 | 220 | </td> |
@@ -230,27 +230,27 @@ discard block |
||
230 | 230 | <br/> |
231 | 231 | <a href='<?php echo get_post_type_archive_link('espresso_venues') ?>'> |
232 | 232 | <?php _e( |
233 | - 'View', |
|
234 | - 'event_espresso' |
|
235 | - ); ?></a> |
|
233 | + 'View', |
|
234 | + 'event_espresso' |
|
235 | + ); ?></a> |
|
236 | 236 | </label> |
237 | 237 | </th> |
238 | 238 | <td> |
239 | 239 | <p class="description"> |
240 | 240 | <?php echo __( |
241 | - 'Venues are custom post types and use WordPress\' normal archive pages for displaying events.', |
|
242 | - 'event_espresso' |
|
243 | - ) ?> |
|
241 | + 'Venues are custom post types and use WordPress\' normal archive pages for displaying events.', |
|
242 | + 'event_espresso' |
|
243 | + ) ?> |
|
244 | 244 | </p> |
245 | 245 | <p class="description"> |
246 | 246 | <?php printf( |
247 | - __( |
|
248 | - 'If you would still like your venues on a page like in Event Espresso 3.1 or earlier, simply create a page and place a shortcode to display them on the page, as described %s here %s', |
|
249 | - 'event_espresso' |
|
250 | - ), |
|
251 | - '<a href="admin.php?page=espresso_support">', |
|
252 | - '</a>' |
|
253 | - ) ?> |
|
247 | + __( |
|
248 | + 'If you would still like your venues on a page like in Event Espresso 3.1 or earlier, simply create a page and place a shortcode to display them on the page, as described %s here %s', |
|
249 | + 'event_espresso' |
|
250 | + ), |
|
251 | + '<a href="admin.php?page=espresso_support">', |
|
252 | + '</a>' |
|
253 | + ) ?> |
|
254 | 254 | </p> |
255 | 255 | </td> |
256 | 256 | </tr> |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | |
46 | 46 | protected function _init_page_props() |
47 | 47 | { |
48 | - require_once(EE_MODELS . 'EEM_Venue.model.php'); |
|
48 | + require_once(EE_MODELS.'EEM_Venue.model.php'); |
|
49 | 49 | $this->page_slug = EE_VENUES_PG_SLUG; |
50 | 50 | $this->_admin_base_url = EE_VENUES_ADMIN_URL; |
51 | - $this->_admin_base_path = EE_ADMIN_PAGES . 'venues'; |
|
51 | + $this->_admin_base_path = EE_ADMIN_PAGES.'venues'; |
|
52 | 52 | $this->page_label = __('Event Venues', 'event_espresso'); |
53 | 53 | $this->_cpt_model_names = array( |
54 | 54 | 'create_new' => 'EEM_Venue', |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | |
459 | 459 | public function load_scripts_styles() |
460 | 460 | { |
461 | - wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
461 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
462 | 462 | wp_enqueue_style('ee-cat-admin'); |
463 | 463 | } |
464 | 464 | |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | wp_enqueue_style('espresso-ui-theme'); |
481 | 481 | wp_register_style( |
482 | 482 | 'espresso_venues', |
483 | - EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', |
|
483 | + EE_VENUES_ASSETS_URL.'ee-venues-admin.css', |
|
484 | 484 | array(), |
485 | 485 | EVENT_ESPRESSO_VERSION |
486 | 486 | ); |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | __("View Venue Archive Page", "event_espresso"), |
540 | 540 | 'button' |
541 | 541 | ); |
542 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
|
542 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
|
543 | 543 | $this->_search_btn_label = __('Venues', 'event_espresso'); |
544 | 544 | $this->display_admin_list_table_page_with_sidebar(); |
545 | 545 | } |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | 'vnu_url' => $this->_cpt_model_obj->get_f('VNU_url'), |
553 | 553 | 'vnu_phone' => $this->_cpt_model_obj->get_f('VNU_phone'), |
554 | 554 | ); |
555 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php'; |
|
555 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_publish_box_extras.template.php'; |
|
556 | 556 | EEH_Template::display_template($template, $extra_rows); |
557 | 557 | } |
558 | 558 | |
@@ -569,21 +569,21 @@ discard block |
||
569 | 569 | $default_map_settings->use_google_maps = true; |
570 | 570 | $default_map_settings->google_map_api_key = ''; |
571 | 571 | // for event details pages (reg page) |
572 | - $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
573 | - $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
574 | - $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
575 | - $default_map_settings->event_details_display_nav = true; // ee_map_nav_display_single |
|
576 | - $default_map_settings->event_details_nav_size = false; // ee_map_nav_size_single |
|
577 | - $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
578 | - $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
572 | + $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
573 | + $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
574 | + $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
575 | + $default_map_settings->event_details_display_nav = true; // ee_map_nav_display_single |
|
576 | + $default_map_settings->event_details_nav_size = false; // ee_map_nav_size_single |
|
577 | + $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
578 | + $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
579 | 579 | // for event list pages |
580 | - $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
581 | - $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
582 | - $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
583 | - $default_map_settings->event_list_display_nav = false; // ee_map_nav_display |
|
584 | - $default_map_settings->event_list_nav_size = true; // ee_map_nav_size |
|
585 | - $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
586 | - $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
580 | + $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
581 | + $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
582 | + $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
583 | + $default_map_settings->event_list_display_nav = false; // ee_map_nav_display |
|
584 | + $default_map_settings->event_list_nav_size = true; // ee_map_nav_size |
|
585 | + $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
586 | + $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
587 | 587 | |
588 | 588 | $this->_template_args['map_settings'] = |
589 | 589 | isset(EE_Registry::instance()->CFG->map_settings) |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | $this->_set_add_edit_form_tags('update_google_map_settings'); |
598 | 598 | $this->_set_publish_post_box_vars(null, false, false, null, false); |
599 | 599 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
600 | - EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', |
|
600 | + EE_VENUES_TEMPLATE_PATH.'google_map.template.php', |
|
601 | 601 | $this->_template_args, |
602 | 602 | true |
603 | 603 | ); |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | ), |
746 | 746 | 'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(), |
747 | 747 | ); |
748 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php'; |
|
748 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_gmap_metabox_content.template.php'; |
|
749 | 749 | EEH_Template::display_template($template, $template_args); |
750 | 750 | } |
751 | 751 | |
@@ -786,7 +786,7 @@ discard block |
||
786 | 786 | ) |
787 | 787 | ); |
788 | 788 | |
789 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php'; |
|
789 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_address_metabox_content.template.php'; |
|
790 | 790 | EEH_Template::display_template($template, $template_args); |
791 | 791 | } |
792 | 792 | |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | $template_args = array( |
797 | 797 | '_venue' => $this->_cpt_model_obj, |
798 | 798 | ); |
799 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php'; |
|
799 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_virtual_location_metabox_content.template.php'; |
|
800 | 800 | EEH_Template::display_template($template, $template_args); |
801 | 801 | } |
802 | 802 | |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | { |
822 | 822 | |
823 | 823 | if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') { |
824 | - return;// get out we're not processing the saving of venues. |
|
824 | + return; // get out we're not processing the saving of venues. |
|
825 | 825 | } |
826 | 826 | |
827 | 827 | $wheres = array($this->_venue_model->primary_key_name() => $post_id); |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | // clean status |
930 | 930 | $venue_status = sanitize_key($venue_status); |
931 | 931 | // grab status |
932 | - if (! empty($venue_status)) { |
|
932 | + if ( ! empty($venue_status)) { |
|
933 | 933 | $success = $this->_change_venue_status($VNU_ID, $venue_status); |
934 | 934 | } else { |
935 | 935 | $success = false; |
@@ -960,7 +960,7 @@ discard block |
||
960 | 960 | // clean status |
961 | 961 | $venue_status = sanitize_key($venue_status); |
962 | 962 | // grab status |
963 | - if (! empty($venue_status)) { |
|
963 | + if ( ! empty($venue_status)) { |
|
964 | 964 | $success = true; |
965 | 965 | // determine the event id and set to array. |
966 | 966 | $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
@@ -1011,7 +1011,7 @@ discard block |
||
1011 | 1011 | private function _change_venue_status($VNU_ID = 0, $venue_status = '') |
1012 | 1012 | { |
1013 | 1013 | // grab venue id |
1014 | - if (! $VNU_ID) { |
|
1014 | + if ( ! $VNU_ID) { |
|
1015 | 1015 | $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
1016 | 1016 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1017 | 1017 | return false; |
@@ -1022,7 +1022,7 @@ discard block |
||
1022 | 1022 | // clean status |
1023 | 1023 | $venue_status = sanitize_key($venue_status); |
1024 | 1024 | // grab status |
1025 | - if (! $venue_status) { |
|
1025 | + if ( ! $venue_status) { |
|
1026 | 1026 | $msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso'); |
1027 | 1027 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1028 | 1028 | return false; |
@@ -1120,7 +1120,7 @@ discard block |
||
1120 | 1120 | private function _delete_or_trash_venue($VNU_ID = false) |
1121 | 1121 | { |
1122 | 1122 | // grab event id |
1123 | - if (! $VNU_ID = absint($VNU_ID)) { |
|
1123 | + if ( ! $VNU_ID = absint($VNU_ID)) { |
|
1124 | 1124 | $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
1125 | 1125 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1126 | 1126 | return false; |
@@ -1207,10 +1207,10 @@ discard block |
||
1207 | 1207 | } |
1208 | 1208 | |
1209 | 1209 | |
1210 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
1210 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
1211 | 1211 | $where['VNU_wp_user'] = get_current_user_id(); |
1212 | 1212 | } else { |
1213 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
1213 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
1214 | 1214 | $where['OR'] = array( |
1215 | 1215 | 'status*restrict_private' => array('!=', 'private'), |
1216 | 1216 | 'AND' => array( |
@@ -1223,7 +1223,7 @@ discard block |
||
1223 | 1223 | |
1224 | 1224 | |
1225 | 1225 | if (isset($this->_req_data['s'])) { |
1226 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1226 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1227 | 1227 | $where['OR'] = array( |
1228 | 1228 | 'VNU_name' => array('LIKE', $sstr), |
1229 | 1229 | 'VNU_desc' => array('LIKE', $sstr), |
@@ -1275,7 +1275,7 @@ discard block |
||
1275 | 1275 | $this->_set_empty_category_object(); |
1276 | 1276 | |
1277 | 1277 | // only set if we've got an id |
1278 | - if (! isset($this->_req_data['VEN_CAT_ID'])) { |
|
1278 | + if ( ! isset($this->_req_data['VEN_CAT_ID'])) { |
|
1279 | 1279 | return; |
1280 | 1280 | } |
1281 | 1281 | |
@@ -1283,7 +1283,7 @@ discard block |
||
1283 | 1283 | $term = get_term($category_id, 'espresso_venue_categories'); |
1284 | 1284 | |
1285 | 1285 | |
1286 | - if (! empty($term)) { |
|
1286 | + if ( ! empty($term)) { |
|
1287 | 1287 | $this->_category->category_name = $term->name; |
1288 | 1288 | $this->_category->category_identifier = $term->slug; |
1289 | 1289 | $this->_category->category_desc = $term->description; |
@@ -1304,7 +1304,7 @@ discard block |
||
1304 | 1304 | protected function _category_list_table() |
1305 | 1305 | { |
1306 | 1306 | do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
1307 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
1307 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
1308 | 1308 | 'add_category', |
1309 | 1309 | 'add_category', |
1310 | 1310 | array(), |
@@ -1379,7 +1379,7 @@ discard block |
||
1379 | 1379 | 'disable' => '', |
1380 | 1380 | 'disabled_message' => false, |
1381 | 1381 | ); |
1382 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
1382 | + $template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php'; |
|
1383 | 1383 | return EEH_Template::display_template($template, $template_args, true); |
1384 | 1384 | } |
1385 | 1385 | |
@@ -1453,7 +1453,7 @@ discard block |
||
1453 | 1453 | $term_args |
1454 | 1454 | ); |
1455 | 1455 | |
1456 | - if (! is_array($insert_ids)) { |
|
1456 | + if ( ! is_array($insert_ids)) { |
|
1457 | 1457 | $msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
1458 | 1458 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1459 | 1459 | } else { |
@@ -1483,8 +1483,8 @@ discard block |
||
1483 | 1483 | |
1484 | 1484 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
1485 | 1485 | |
1486 | - if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
1487 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
1486 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
1487 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
1488 | 1488 | $EE_Export = EE_Export::instance($this->_req_data); |
1489 | 1489 | $EE_Export->export(); |
1490 | 1490 | } |
@@ -1494,7 +1494,7 @@ discard block |
||
1494 | 1494 | protected function _import_categories() |
1495 | 1495 | { |
1496 | 1496 | |
1497 | - require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
1497 | + require_once(EE_CLASSES.'EE_Import.class.php'); |
|
1498 | 1498 | EE_Import::instance()->import(); |
1499 | 1499 | } |
1500 | 1500 | |
@@ -1508,7 +1508,7 @@ discard block |
||
1508 | 1508 | $limit = ($current_page - 1) * $per_page; |
1509 | 1509 | $where = array('taxonomy' => 'espresso_venue_categories'); |
1510 | 1510 | if (isset($this->_req_data['s'])) { |
1511 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1511 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1512 | 1512 | $where['OR'] = array( |
1513 | 1513 | 'Term.name' => array('LIKE', $sstr), |
1514 | 1514 | 'description' => array('LIKE', $sstr), |
@@ -1518,7 +1518,7 @@ discard block |
||
1518 | 1518 | $query_params = array( |
1519 | 1519 | $where, |
1520 | 1520 | 'order_by' => array($orderby => $order), |
1521 | - 'limit' => $limit . ',' . $per_page, |
|
1521 | + 'limit' => $limit.','.$per_page, |
|
1522 | 1522 | 'force_join' => array('Term'), |
1523 | 1523 | ); |
1524 | 1524 |
@@ -17,1523 +17,1523 @@ |
||
17 | 17 | { |
18 | 18 | |
19 | 19 | |
20 | - /** |
|
21 | - * _venue |
|
22 | - * This will hold the venue object for venue_details screen. |
|
23 | - * |
|
24 | - * @access protected |
|
25 | - * @var object |
|
26 | - */ |
|
27 | - protected $_venue; |
|
28 | - |
|
29 | - |
|
30 | - /** |
|
31 | - * This will hold the category object for category_details screen. |
|
32 | - * |
|
33 | - * @var object |
|
34 | - */ |
|
35 | - protected $_category; |
|
36 | - |
|
37 | - |
|
38 | - /** |
|
39 | - * This property will hold the venue model instance |
|
40 | - * |
|
41 | - * @var object |
|
42 | - */ |
|
43 | - protected $_venue_model; |
|
44 | - |
|
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 = __('Event Venues', 'event_espresso'); |
|
53 | - $this->_cpt_model_names = array( |
|
54 | - 'create_new' => 'EEM_Venue', |
|
55 | - 'edit' => 'EEM_Venue', |
|
56 | - ); |
|
57 | - $this->_cpt_edit_routes = array( |
|
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 = array( |
|
74 | - 'buttons' => array( |
|
75 | - 'add' => __('Add New Venue', 'event_espresso'), |
|
76 | - 'edit' => __('Edit Venue', 'event_espresso'), |
|
77 | - 'delete' => __('Delete Venue', 'event_espresso'), |
|
78 | - 'add_category' => __('Add New Category', 'event_espresso'), |
|
79 | - 'edit_category' => __('Edit Category', 'event_espresso'), |
|
80 | - 'delete_category' => __('Delete Category', 'event_espresso'), |
|
81 | - ), |
|
82 | - 'editor_title' => array( |
|
83 | - 'espresso_venues' => __('Enter Venue name here', 'event_espresso'), |
|
84 | - ), |
|
85 | - 'publishbox' => array( |
|
86 | - 'create_new' => __('Save New Venue', 'event_espresso'), |
|
87 | - 'edit' => __('Update Venue', 'event_espresso'), |
|
88 | - 'add_category' => __('Save New Category', 'event_espresso'), |
|
89 | - 'edit_category' => __('Update Category', 'event_espresso'), |
|
90 | - 'google_map_settings' => __('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 = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) |
|
104 | - ? $this->_req_data['VNU_ID'] : 0; |
|
105 | - $vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id; |
|
106 | - |
|
107 | - $this->_page_routes = array( |
|
108 | - 'default' => array( |
|
109 | - 'func' => '_overview_list_table', |
|
110 | - 'capability' => 'ee_read_venues', |
|
111 | - ), |
|
112 | - 'create_new' => array( |
|
113 | - 'func' => '_create_new_cpt_item', |
|
114 | - 'capability' => 'ee_edit_venues', |
|
115 | - ), |
|
116 | - 'edit' => array( |
|
117 | - 'func' => '_edit_cpt_item', |
|
118 | - 'capability' => 'ee_edit_venue', |
|
119 | - 'obj_id' => $vnu_id, |
|
120 | - ), |
|
121 | - 'trash_venue' => array( |
|
122 | - 'func' => '_trash_or_restore_venue', |
|
123 | - 'args' => array('venue_status' => 'trash'), |
|
124 | - 'noheader' => true, |
|
125 | - 'capability' => 'ee_delete_venue', |
|
126 | - 'obj_id' => $vnu_id, |
|
127 | - ), |
|
128 | - 'trash_venues' => array( |
|
129 | - 'func' => '_trash_or_restore_venues', |
|
130 | - 'args' => array('venue_status' => 'trash'), |
|
131 | - 'noheader' => true, |
|
132 | - 'capability' => 'ee_delete_venues', |
|
133 | - ), |
|
134 | - 'restore_venue' => array( |
|
135 | - 'func' => '_trash_or_restore_venue', |
|
136 | - 'args' => array('venue_status' => 'draft'), |
|
137 | - 'noheader' => true, |
|
138 | - 'capability' => 'ee_delete_venue', |
|
139 | - 'obj_id' => $vnu_id, |
|
140 | - ), |
|
141 | - 'restore_venues' => array( |
|
142 | - 'func' => '_trash_or_restore_venues', |
|
143 | - 'args' => array('venue_status' => 'draft'), |
|
144 | - 'noheader' => true, |
|
145 | - 'capability' => 'ee_delete_venues', |
|
146 | - ), |
|
147 | - 'delete_venues' => array( |
|
148 | - 'func' => '_delete_venues', |
|
149 | - 'noheader' => true, |
|
150 | - 'capability' => 'ee_delete_venues', |
|
151 | - ), |
|
152 | - 'delete_venue' => array( |
|
153 | - 'func' => '_delete_venue', |
|
154 | - 'noheader' => true, |
|
155 | - 'capability' => 'ee_delete_venue', |
|
156 | - 'obj_id' => $vnu_id, |
|
157 | - ), |
|
158 | - // settings related |
|
159 | - 'google_map_settings' => array( |
|
160 | - 'func' => '_google_map_settings', |
|
161 | - 'capability' => 'manage_options', |
|
162 | - ), |
|
163 | - 'update_google_map_settings' => array( |
|
164 | - 'func' => '_update_google_map_settings', |
|
165 | - 'capability' => 'manage_options', |
|
166 | - 'noheader' => true, |
|
167 | - ), |
|
168 | - // venue category tab related |
|
169 | - 'add_category' => array( |
|
170 | - 'func' => '_category_details', |
|
171 | - 'args' => array('add'), |
|
172 | - 'capability' => 'ee_edit_venue_category', |
|
173 | - ), |
|
174 | - 'edit_category' => array( |
|
175 | - 'func' => '_category_details', |
|
176 | - 'args' => array('edit'), |
|
177 | - 'capability' => 'ee_edit_venue_category', |
|
178 | - ), |
|
179 | - 'delete_categories' => array( |
|
180 | - 'func' => '_delete_categories', |
|
181 | - 'noheader' => true, |
|
182 | - 'capability' => 'ee_delete_venue_category', |
|
183 | - ), |
|
184 | - |
|
185 | - 'delete_category' => array( |
|
186 | - 'func' => '_delete_categories', |
|
187 | - 'noheader' => true, |
|
188 | - 'capability' => 'ee_delete_venue_category', |
|
189 | - ), |
|
190 | - |
|
191 | - 'insert_category' => array( |
|
192 | - 'func' => '_insert_or_update_category', |
|
193 | - 'args' => array('new_category' => true), |
|
194 | - 'noheader' => true, |
|
195 | - 'capability' => 'ee_edit_venue_category', |
|
196 | - ), |
|
197 | - |
|
198 | - 'update_category' => array( |
|
199 | - 'func' => '_insert_or_update_category', |
|
200 | - 'args' => array('new_category' => false), |
|
201 | - 'noheader' => true, |
|
202 | - 'capability' => 'ee_edit_venue_category', |
|
203 | - ), |
|
204 | - 'export_categories' => array( |
|
205 | - 'func' => '_categories_export', |
|
206 | - 'noheader' => true, |
|
207 | - 'capability' => 'export', |
|
208 | - ), |
|
209 | - 'import_categories' => array( |
|
210 | - 'func' => '_import_categories', |
|
211 | - 'capability' => 'import', |
|
212 | - ), |
|
213 | - 'category_list' => array( |
|
214 | - 'func' => '_category_list_table', |
|
215 | - 'capability' => 'ee_manage_venue_categories', |
|
216 | - ), |
|
217 | - ); |
|
218 | - } |
|
219 | - |
|
220 | - |
|
221 | - protected function _set_page_config() |
|
222 | - { |
|
223 | - $this->_page_config = array( |
|
224 | - 'default' => array( |
|
225 | - 'nav' => array( |
|
226 | - 'label' => __('Overview', 'event_espresso'), |
|
227 | - 'order' => 10, |
|
228 | - ), |
|
229 | - 'list_table' => 'Venues_Admin_List_Table', |
|
230 | - 'help_tabs' => array( |
|
231 | - 'venues_overview_help_tab' => array( |
|
232 | - 'title' => __('Venues Overview', 'event_espresso'), |
|
233 | - 'filename' => 'venues_overview', |
|
234 | - ), |
|
235 | - 'venues_overview_table_column_headings_help_tab' => array( |
|
236 | - 'title' => __('Venues Overview Table Column Headings', 'event_espresso'), |
|
237 | - 'filename' => 'venues_overview_table_column_headings', |
|
238 | - ), |
|
239 | - 'venues_overview_views_bulk_actions_search_help_tab' => array( |
|
240 | - 'title' => __('Venues Overview Views & Bulk Actions & Search', 'event_espresso'), |
|
241 | - 'filename' => 'venues_overview_views_bulk_actions_search', |
|
242 | - ), |
|
243 | - ), |
|
244 | - // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836 |
|
245 | - // 'help_tour' => array('Venues_Overview_Help_Tour'), |
|
246 | - 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
|
247 | - 'require_nonce' => false, |
|
248 | - ), |
|
249 | - 'create_new' => array( |
|
250 | - 'nav' => array( |
|
251 | - 'label' => __('Add Venue', 'event_espresso'), |
|
252 | - 'order' => 5, |
|
253 | - 'persistent' => false, |
|
254 | - ), |
|
255 | - 'help_tabs' => array( |
|
256 | - 'venues_editor_help_tab' => array( |
|
257 | - 'title' => __('Venue Editor', 'event_espresso'), |
|
258 | - 'filename' => 'venues_editor', |
|
259 | - ), |
|
260 | - 'venues_editor_title_richtexteditor_help_tab' => array( |
|
261 | - 'title' => __('Venue Title & Rich Text Editor', 'event_espresso'), |
|
262 | - 'filename' => 'venues_editor_title_richtexteditor', |
|
263 | - ), |
|
264 | - 'venues_editor_tags_categories_help_tab' => array( |
|
265 | - 'title' => __('Venue Tags & Categories', 'event_espresso'), |
|
266 | - 'filename' => 'venues_editor_tags_categories', |
|
267 | - ), |
|
268 | - 'venues_editor_physical_location_google_map_virtual_location_help_tab' => array( |
|
269 | - 'title' => __( |
|
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' => array( |
|
276 | - 'title' => __('Save New Venue', 'event_espresso'), |
|
277 | - 'filename' => 'venues_editor_save_new_venue', |
|
278 | - ), |
|
279 | - 'venues_editor_other_help_tab' => array( |
|
280 | - 'title' => __('Venue Editor Other', 'event_espresso'), |
|
281 | - 'filename' => 'venues_editor_other', |
|
282 | - ), |
|
283 | - ), |
|
284 | - // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836 |
|
285 | - // 'help_tour' => array('Venues_Add_Venue_Help_Tour'), |
|
286 | - 'metaboxes' => array('_venue_editor_metaboxes'), |
|
287 | - 'require_nonce' => false, |
|
288 | - ), |
|
289 | - 'edit' => array( |
|
290 | - 'nav' => array( |
|
291 | - 'label' => __('Edit Venue', 'event_espresso'), |
|
292 | - 'order' => 5, |
|
293 | - 'persistent' => false, |
|
294 | - 'url' => isset($this->_req_data['post']) ? add_query_arg( |
|
295 | - array('post' => $this->_req_data['post']), |
|
296 | - $this->_current_page_view_url |
|
297 | - ) : $this->_admin_base_url, |
|
298 | - ), |
|
299 | - 'help_tabs' => array( |
|
300 | - 'venues_editor_help_tab' => array( |
|
301 | - 'title' => __('Venue Editor', 'event_espresso'), |
|
302 | - 'filename' => 'venues_editor', |
|
303 | - ), |
|
304 | - 'venues_editor_title_richtexteditor_help_tab' => array( |
|
305 | - 'title' => __('Venue Title & Rich Text Editor', 'event_espresso'), |
|
306 | - 'filename' => 'venues_editor_title_richtexteditor', |
|
307 | - ), |
|
308 | - 'venues_editor_tags_categories_help_tab' => array( |
|
309 | - 'title' => __('Venue Tags & Categories', 'event_espresso'), |
|
310 | - 'filename' => 'venues_editor_tags_categories', |
|
311 | - ), |
|
312 | - 'venues_editor_physical_location_google_map_virtual_location_help_tab' => array( |
|
313 | - 'title' => __( |
|
314 | - 'Venue Editor Physical Location & Google Map & Virtual Location', |
|
315 | - 'event_espresso' |
|
316 | - ), |
|
317 | - 'filename' => 'venues_editor_physical_location_google_map_virtual_location', |
|
318 | - ), |
|
319 | - 'venues_editor_save_new_venue_help_tab' => array( |
|
320 | - 'title' => __('Save New Venue', 'event_espresso'), |
|
321 | - 'filename' => 'venues_editor_save_new_venue', |
|
322 | - ), |
|
323 | - 'venues_editor_other_help_tab' => array( |
|
324 | - 'title' => __('Venue Editor Other', 'event_espresso'), |
|
325 | - 'filename' => 'venues_editor_other', |
|
326 | - ), |
|
327 | - ), |
|
328 | - /*'help_tour' => array( 'Venues_Edit_Venue_Help_Tour' ),*/ |
|
329 | - 'metaboxes' => array('_venue_editor_metaboxes'), |
|
330 | - 'require_nonce' => false, |
|
331 | - ), |
|
332 | - 'google_map_settings' => array( |
|
333 | - 'nav' => array( |
|
334 | - 'label' => esc_html__('Google Maps', 'event_espresso'), |
|
335 | - 'order' => 40, |
|
336 | - ), |
|
337 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
338 | - 'help_tabs' => array( |
|
339 | - 'general_settings_google_maps_help_tab' => array( |
|
340 | - 'title' => __('Google Maps', 'event_espresso'), |
|
341 | - 'filename' => 'general_settings_google_maps', |
|
342 | - ), |
|
343 | - ), |
|
344 | - // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836 |
|
345 | - // 'help_tour' => array('Google_Maps_Help_Tour'), |
|
346 | - 'require_nonce' => false, |
|
347 | - ), |
|
348 | - // venue category stuff |
|
349 | - 'add_category' => array( |
|
350 | - 'nav' => array( |
|
351 | - 'label' => __('Add Category', 'event_espresso'), |
|
352 | - 'order' => 15, |
|
353 | - 'persistent' => false, |
|
354 | - ), |
|
355 | - 'metaboxes' => array('_publish_post_box'), |
|
356 | - 'help_tabs' => array( |
|
357 | - 'venues_add_category_help_tab' => array( |
|
358 | - 'title' => __('Add New Venue Category', 'event_espresso'), |
|
359 | - 'filename' => 'venues_add_category', |
|
360 | - ), |
|
361 | - ), |
|
362 | - // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836 |
|
363 | - // 'help_tour' => array('Venues_Add_Category_Help_Tour'), |
|
364 | - 'require_nonce' => false, |
|
365 | - ), |
|
366 | - 'edit_category' => array( |
|
367 | - 'nav' => array( |
|
368 | - 'label' => __('Edit Category', 'event_espresso'), |
|
369 | - 'order' => 15, |
|
370 | - 'persistent' => false, |
|
371 | - 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg( |
|
372 | - array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), |
|
373 | - $this->_current_page_view_url |
|
374 | - ) : $this->_admin_base_url, |
|
375 | - ), |
|
376 | - 'metaboxes' => array('_publish_post_box'), |
|
377 | - 'help_tabs' => array( |
|
378 | - 'venues_edit_category_help_tab' => array( |
|
379 | - 'title' => __('Edit Venue Category', 'event_espresso'), |
|
380 | - 'filename' => 'venues_edit_category', |
|
381 | - ), |
|
382 | - ), |
|
383 | - /*'help_tour' => array( 'Venues_Edit_Category_Help_Tour' ),*/ |
|
384 | - 'require_nonce' => false, |
|
385 | - ), |
|
386 | - 'category_list' => array( |
|
387 | - 'nav' => array( |
|
388 | - 'label' => __('Categories', 'event_espresso'), |
|
389 | - 'order' => 20, |
|
390 | - ), |
|
391 | - 'list_table' => 'Venue_Categories_Admin_List_Table', |
|
392 | - 'help_tabs' => array( |
|
393 | - 'venues_categories_help_tab' => array( |
|
394 | - 'title' => __('Venue Categories', 'event_espresso'), |
|
395 | - 'filename' => 'venues_categories', |
|
396 | - ), |
|
397 | - 'venues_categories_table_column_headings_help_tab' => array( |
|
398 | - 'title' => __('Venue Categories Table Column Headings', 'event_espresso'), |
|
399 | - 'filename' => 'venues_categories_table_column_headings', |
|
400 | - ), |
|
401 | - 'venues_categories_views_help_tab' => array( |
|
402 | - 'title' => __('Venue Categories Views', 'event_espresso'), |
|
403 | - 'filename' => 'venues_categories_views', |
|
404 | - ), |
|
405 | - 'venues_categories_other_help_tab' => array( |
|
406 | - 'title' => __('Venue Categories Other', 'event_espresso'), |
|
407 | - 'filename' => 'venues_categories_other', |
|
408 | - ), |
|
409 | - ), |
|
410 | - // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836 |
|
411 | - // 'help_tour' => array('Venues_Categories_Help_Tour'), |
|
412 | - 'metaboxes' => $this->_default_espresso_metaboxes, |
|
413 | - 'require_nonce' => false, |
|
414 | - ), |
|
415 | - ); |
|
416 | - } |
|
417 | - |
|
418 | - |
|
419 | - protected function _add_screen_options() |
|
420 | - { |
|
421 | - // todo |
|
422 | - } |
|
423 | - |
|
424 | - |
|
425 | - protected function _add_screen_options_default() |
|
426 | - { |
|
427 | - $this->_per_page_screen_option(); |
|
428 | - } |
|
429 | - |
|
430 | - |
|
431 | - protected function _add_screen_options_category_list() |
|
432 | - { |
|
433 | - $page_title = $this->_admin_page_title; |
|
434 | - $this->_admin_page_title = __('Venue Categories', 'event_espresso'); |
|
435 | - $this->_per_page_screen_option(); |
|
436 | - $this->_admin_page_title = $page_title; |
|
437 | - } |
|
438 | - |
|
439 | - |
|
440 | - // none of the below group are currently used for Event Venues |
|
441 | - protected function _add_feature_pointers() |
|
442 | - { |
|
443 | - } |
|
444 | - |
|
445 | - public function admin_init() |
|
446 | - { |
|
447 | - } |
|
448 | - |
|
449 | - public function admin_notices() |
|
450 | - { |
|
451 | - } |
|
452 | - |
|
453 | - public function admin_footer_scripts() |
|
454 | - { |
|
455 | - } |
|
456 | - |
|
457 | - |
|
458 | - public function load_scripts_styles_create_new() |
|
459 | - { |
|
460 | - $this->load_scripts_styles_edit(); |
|
461 | - } |
|
462 | - |
|
463 | - |
|
464 | - public function load_scripts_styles() |
|
465 | - { |
|
466 | - wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
467 | - wp_enqueue_style('ee-cat-admin'); |
|
468 | - } |
|
469 | - |
|
470 | - |
|
471 | - public function load_scripts_styles_add_category() |
|
472 | - { |
|
473 | - $this->load_scripts_styles_edit_category(); |
|
474 | - } |
|
475 | - |
|
476 | - |
|
477 | - public function load_scripts_styles_edit_category() |
|
478 | - { |
|
479 | - } |
|
480 | - |
|
481 | - |
|
482 | - public function load_scripts_styles_edit() |
|
483 | - { |
|
484 | - // styles |
|
485 | - wp_enqueue_style('espresso-ui-theme'); |
|
486 | - wp_register_style( |
|
487 | - 'espresso_venues', |
|
488 | - EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', |
|
489 | - array(), |
|
490 | - EVENT_ESPRESSO_VERSION |
|
491 | - ); |
|
492 | - wp_enqueue_style('espresso_venues'); |
|
493 | - } |
|
494 | - |
|
495 | - |
|
496 | - protected function _set_list_table_views_default() |
|
497 | - { |
|
498 | - $this->_views = array( |
|
499 | - 'all' => array( |
|
500 | - 'slug' => 'all', |
|
501 | - 'label' => __('View All Venues', 'event_espresso'), |
|
502 | - 'count' => 0, |
|
503 | - 'bulk_action' => array(), |
|
504 | - ), |
|
505 | - ); |
|
506 | - |
|
507 | - if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) { |
|
508 | - $this->_views['all']['bulk_action'] = array( |
|
509 | - 'trash_venues' => __('Move to Trash', 'event_espresso'), |
|
510 | - ); |
|
511 | - $this->_views['trash'] = array( |
|
512 | - 'slug' => 'trash', |
|
513 | - 'label' => __('Trash', 'event_espresso'), |
|
514 | - 'count' => 0, |
|
515 | - 'bulk_action' => array( |
|
516 | - 'restore_venues' => __('Restore from Trash', 'event_espresso'), |
|
517 | - 'delete_venues' => __('Delete', 'event_espresso'), |
|
518 | - ), |
|
519 | - ); |
|
520 | - } |
|
521 | - } |
|
522 | - |
|
523 | - |
|
524 | - protected function _set_list_table_views_category_list() |
|
525 | - { |
|
526 | - $this->_views = array( |
|
527 | - 'all' => array( |
|
528 | - 'slug' => 'all', |
|
529 | - 'label' => __('All', 'event_espresso'), |
|
530 | - 'count' => 0, |
|
531 | - 'bulk_action' => array( |
|
532 | - 'delete_categories' => __('Delete Permanently', 'event_espresso'), |
|
533 | - ), |
|
534 | - ), |
|
535 | - ); |
|
536 | - } |
|
537 | - |
|
538 | - |
|
539 | - protected function _overview_list_table() |
|
540 | - { |
|
541 | - do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
542 | - $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( |
|
543 | - get_post_type_archive_link('espresso_venues'), |
|
544 | - __("View Venue Archive Page", "event_espresso"), |
|
545 | - 'button' |
|
546 | - ); |
|
547 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
|
548 | - $this->_search_btn_label = __('Venues', 'event_espresso'); |
|
549 | - $this->display_admin_list_table_page_with_sidebar(); |
|
550 | - } |
|
551 | - |
|
552 | - |
|
553 | - public function extra_misc_actions_publish_box() |
|
554 | - { |
|
555 | - $extra_rows = array( |
|
556 | - 'vnu_capacity' => $this->_cpt_model_obj->get_f('VNU_capacity'), |
|
557 | - 'vnu_url' => $this->_cpt_model_obj->get_f('VNU_url'), |
|
558 | - 'vnu_phone' => $this->_cpt_model_obj->get_f('VNU_phone'), |
|
559 | - ); |
|
560 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php'; |
|
561 | - EEH_Template::display_template($template, $extra_rows); |
|
562 | - } |
|
563 | - |
|
564 | - |
|
565 | - /************* Google Maps *************/ |
|
566 | - |
|
567 | - |
|
568 | - protected function _google_map_settings() |
|
569 | - { |
|
570 | - |
|
571 | - |
|
572 | - $this->_template_args['values'] = $this->_yes_no_values; |
|
573 | - $default_map_settings = new stdClass(); |
|
574 | - $default_map_settings->use_google_maps = true; |
|
575 | - $default_map_settings->google_map_api_key = ''; |
|
576 | - // for event details pages (reg page) |
|
577 | - $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
578 | - $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
579 | - $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
580 | - $default_map_settings->event_details_display_nav = true; // ee_map_nav_display_single |
|
581 | - $default_map_settings->event_details_nav_size = false; // ee_map_nav_size_single |
|
582 | - $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
583 | - $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
584 | - // for event list pages |
|
585 | - $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
586 | - $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
587 | - $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
588 | - $default_map_settings->event_list_display_nav = false; // ee_map_nav_display |
|
589 | - $default_map_settings->event_list_nav_size = true; // ee_map_nav_size |
|
590 | - $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
591 | - $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
592 | - |
|
593 | - $this->_template_args['map_settings'] = |
|
594 | - isset(EE_Registry::instance()->CFG->map_settings) |
|
595 | - && ! empty(EE_Registry::instance()->CFG->map_settings) |
|
596 | - ? (object) array_merge( |
|
597 | - (array) $default_map_settings, |
|
598 | - (array) EE_Registry::instance()->CFG->map_settings |
|
599 | - ) |
|
600 | - : $default_map_settings; |
|
601 | - |
|
602 | - $this->_set_add_edit_form_tags('update_google_map_settings'); |
|
603 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
604 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
605 | - EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', |
|
606 | - $this->_template_args, |
|
607 | - true |
|
608 | - ); |
|
609 | - $this->display_admin_page_with_sidebar(); |
|
610 | - } |
|
611 | - |
|
612 | - protected function _update_google_map_settings() |
|
613 | - { |
|
614 | - |
|
615 | - EE_Registry::instance()->CFG->map_settings->use_google_maps = |
|
616 | - isset($this->_req_data['use_google_maps']) |
|
617 | - ? absint($this->_req_data['use_google_maps']) |
|
618 | - : EE_Registry::instance()->CFG->map_settings->use_google_maps; |
|
619 | - |
|
620 | - EE_Registry::instance()->CFG->map_settings->google_map_api_key = |
|
621 | - isset($this->_req_data['google_map_api_key']) |
|
622 | - ? sanitize_text_field($this->_req_data['google_map_api_key']) |
|
623 | - : EE_Registry::instance()->CFG->map_settings->google_map_api_key; |
|
624 | - |
|
625 | - EE_Registry::instance()->CFG->map_settings->event_details_map_width = |
|
626 | - isset($this->_req_data['event_details_map_width']) |
|
627 | - ? absint($this->_req_data['event_details_map_width']) |
|
628 | - : EE_Registry::instance()->CFG->map_settings->event_details_map_width; |
|
629 | - |
|
630 | - EE_Registry::instance()->CFG->map_settings->event_details_map_height = |
|
631 | - isset($this->_req_data['event_details_map_height']) |
|
632 | - ? absint($this->_req_data['event_details_map_height']) |
|
633 | - : EE_Registry::instance()->CFG->map_settings->event_details_map_height; |
|
634 | - |
|
635 | - EE_Registry::instance()->CFG->map_settings->event_details_map_zoom = |
|
636 | - isset($this->_req_data['event_details_map_zoom']) |
|
637 | - ? absint($this->_req_data['event_details_map_zoom']) |
|
638 | - : EE_Registry::instance()->CFG->map_settings->event_details_map_zoom; |
|
639 | - |
|
640 | - EE_Registry::instance()->CFG->map_settings->event_details_display_nav = |
|
641 | - isset($this->_req_data['event_details_display_nav']) |
|
642 | - ? absint($this->_req_data['event_details_display_nav']) |
|
643 | - : EE_Registry::instance()->CFG->map_settings->event_details_display_nav; |
|
644 | - |
|
645 | - EE_Registry::instance()->CFG->map_settings->event_details_nav_size = |
|
646 | - isset($this->_req_data['event_details_nav_size']) |
|
647 | - ? absint($this->_req_data['event_details_nav_size']) |
|
648 | - : EE_Registry::instance()->CFG->map_settings->event_details_nav_size; |
|
649 | - |
|
650 | - EE_Registry::instance()->CFG->map_settings->event_details_control_type = |
|
651 | - isset($this->_req_data['event_details_control_type']) |
|
652 | - ? sanitize_text_field($this->_req_data['event_details_control_type']) |
|
653 | - : EE_Registry::instance()->CFG->map_settings->event_details_control_type; |
|
654 | - |
|
655 | - EE_Registry::instance()->CFG->map_settings->event_details_map_align = |
|
656 | - isset($this->_req_data['event_details_map_align']) |
|
657 | - ? sanitize_text_field($this->_req_data['event_details_map_align']) |
|
658 | - : EE_Registry::instance()->CFG->map_settings->event_details_map_align; |
|
659 | - |
|
660 | - EE_Registry::instance()->CFG->map_settings->event_list_map_width = |
|
661 | - isset($this->_req_data['event_list_map_width']) |
|
662 | - ? absint($this->_req_data['event_list_map_width']) |
|
663 | - : EE_Registry::instance()->CFG->map_settings->event_list_map_width; |
|
664 | - |
|
665 | - EE_Registry::instance()->CFG->map_settings->event_list_map_height = |
|
666 | - isset($this->_req_data['event_list_map_height']) |
|
667 | - ? absint($this->_req_data['event_list_map_height']) |
|
668 | - : EE_Registry::instance()->CFG->map_settings->event_list_map_height; |
|
669 | - |
|
670 | - EE_Registry::instance()->CFG->map_settings->event_list_map_zoom = |
|
671 | - isset($this->_req_data['event_list_map_zoom']) |
|
672 | - ? absint($this->_req_data['event_list_map_zoom']) |
|
673 | - : EE_Registry::instance()->CFG->map_settings->event_list_map_zoom; |
|
674 | - |
|
675 | - EE_Registry::instance()->CFG->map_settings->event_list_display_nav = |
|
676 | - isset($this->_req_data['event_list_display_nav']) |
|
677 | - ? absint($this->_req_data['event_list_display_nav']) |
|
678 | - : EE_Registry::instance()->CFG->map_settings->event_list_display_nav; |
|
679 | - |
|
680 | - EE_Registry::instance()->CFG->map_settings->event_list_nav_size = |
|
681 | - isset($this->_req_data['event_list_nav_size']) |
|
682 | - ? absint($this->_req_data['event_list_nav_size']) |
|
683 | - : EE_Registry::instance()->CFG->map_settings->event_list_nav_size; |
|
684 | - |
|
685 | - EE_Registry::instance()->CFG->map_settings->event_list_control_type = |
|
686 | - isset($this->_req_data['event_list_control_type']) |
|
687 | - ? sanitize_text_field($this->_req_data['event_list_control_type']) |
|
688 | - : EE_Registry::instance()->CFG->map_settings->event_list_control_type; |
|
689 | - |
|
690 | - EE_Registry::instance()->CFG->map_settings->event_list_map_align = |
|
691 | - isset($this->_req_data['event_list_map_align']) |
|
692 | - ? sanitize_text_field($this->_req_data['event_list_map_align']) |
|
693 | - : EE_Registry::instance()->CFG->map_settings->event_list_map_align; |
|
694 | - |
|
695 | - EE_Registry::instance()->CFG->map_settings = apply_filters( |
|
696 | - 'FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', |
|
697 | - EE_Registry::instance()->CFG->map_settings |
|
698 | - ); |
|
699 | - |
|
700 | - $what = 'Google Map Settings'; |
|
701 | - $success = $this->_update_espresso_configuration( |
|
702 | - $what, |
|
703 | - EE_Registry::instance()->CFG->map_settings, |
|
704 | - __FILE__, |
|
705 | - __FUNCTION__, |
|
706 | - __LINE__ |
|
707 | - ); |
|
708 | - $this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings')); |
|
709 | - } |
|
710 | - |
|
711 | - |
|
712 | - protected function _venue_editor_metaboxes() |
|
713 | - { |
|
714 | - $this->verify_cpt_object(); |
|
715 | - |
|
716 | - add_meta_box( |
|
717 | - 'espresso_venue_address_options', |
|
718 | - __('Physical Location', 'event_espresso'), |
|
719 | - array($this, 'venue_address_metabox'), |
|
720 | - $this->page_slug, |
|
721 | - 'side', |
|
722 | - 'default' |
|
723 | - ); |
|
724 | - add_meta_box( |
|
725 | - 'espresso_venue_gmap_options', |
|
726 | - __('Google Map', 'event_espresso'), |
|
727 | - array($this, 'venue_gmap_metabox'), |
|
728 | - $this->page_slug, |
|
729 | - 'side', |
|
730 | - 'default' |
|
731 | - ); |
|
732 | - add_meta_box( |
|
733 | - 'espresso_venue_virtual_loc_options', |
|
734 | - __('Virtual Location', 'event_espresso'), |
|
735 | - array($this, 'venue_virtual_loc_metabox'), |
|
736 | - $this->page_slug, |
|
737 | - 'side', |
|
738 | - 'default' |
|
739 | - ); |
|
740 | - } |
|
741 | - |
|
742 | - |
|
743 | - public function venue_gmap_metabox() |
|
744 | - { |
|
745 | - $template_args = array( |
|
746 | - 'vnu_enable_for_gmap' => EEH_Form_Fields::select_input( |
|
747 | - 'vnu_enable_for_gmap', |
|
748 | - $this->get_yes_no_values(), |
|
749 | - $this->_cpt_model_obj->enable_for_gmap() |
|
750 | - ), |
|
751 | - 'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(), |
|
752 | - ); |
|
753 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php'; |
|
754 | - EEH_Template::display_template($template, $template_args); |
|
755 | - } |
|
756 | - |
|
757 | - |
|
758 | - public function venue_address_metabox() |
|
759 | - { |
|
760 | - |
|
761 | - $template_args['_venue'] = $this->_cpt_model_obj; |
|
762 | - |
|
763 | - $template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input( |
|
764 | - $QFI = new EE_Question_Form_Input( |
|
765 | - EE_Question::new_instance( |
|
766 | - array('QST_display_text' => esc_html__('State', 'event_espresso'), 'QST_system' => 'state') |
|
767 | - ), |
|
768 | - EE_Answer::new_instance(array('ANS_value' => $this->_cpt_model_obj->state_ID())), |
|
769 | - array( |
|
770 | - 'input_name' => 'sta_id', |
|
771 | - 'input_id' => 'sta_id', |
|
772 | - 'input_class' => '', |
|
773 | - 'input_prefix' => '', |
|
774 | - 'append_qstn_id' => false, |
|
775 | - ) |
|
776 | - ) |
|
777 | - ); |
|
778 | - $template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input( |
|
779 | - $QFI = new EE_Question_Form_Input( |
|
780 | - EE_Question::new_instance( |
|
781 | - array('QST_display_text' => esc_html__('Country', 'event_espresso'), 'QST_system' => 'country') |
|
782 | - ), |
|
783 | - EE_Answer::new_instance(array('ANS_value' => $this->_cpt_model_obj->country_ID())), |
|
784 | - array( |
|
785 | - 'input_name' => 'cnt_iso', |
|
786 | - 'input_id' => 'cnt_iso', |
|
787 | - 'input_class' => '', |
|
788 | - 'input_prefix' => '', |
|
789 | - 'append_qstn_id' => false, |
|
790 | - ) |
|
791 | - ) |
|
792 | - ); |
|
793 | - |
|
794 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php'; |
|
795 | - EEH_Template::display_template($template, $template_args); |
|
796 | - } |
|
797 | - |
|
798 | - |
|
799 | - public function venue_virtual_loc_metabox() |
|
800 | - { |
|
801 | - $template_args = array( |
|
802 | - '_venue' => $this->_cpt_model_obj, |
|
803 | - ); |
|
804 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php'; |
|
805 | - EEH_Template::display_template($template, $template_args); |
|
806 | - } |
|
807 | - |
|
808 | - |
|
809 | - protected function _restore_cpt_item($post_id, $revision_id) |
|
810 | - { |
|
811 | - $venue_obj = $this->_venue_model->get_one_by_ID($post_id); |
|
812 | - |
|
813 | - // meta revision restore |
|
814 | - $venue_obj->restore_revision($revision_id); |
|
815 | - } |
|
816 | - |
|
817 | - |
|
818 | - /** |
|
819 | - * Handles updates for venue cpts |
|
820 | - * |
|
821 | - * @param int $post_id ID of Venue CPT |
|
822 | - * @param object $post Post object (with "blessed" WP properties) |
|
823 | - * @return void |
|
824 | - */ |
|
825 | - protected function _insert_update_cpt_item($post_id, $post) |
|
826 | - { |
|
827 | - |
|
828 | - if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') { |
|
829 | - return;// get out we're not processing the saving of venues. |
|
830 | - } |
|
831 | - |
|
832 | - $wheres = array($this->_venue_model->primary_key_name() => $post_id); |
|
833 | - |
|
834 | - $venue_values = array( |
|
835 | - 'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : null, |
|
836 | - 'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] |
|
837 | - : null, |
|
838 | - 'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : null, |
|
839 | - 'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : null, |
|
840 | - 'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : null, |
|
841 | - 'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : null, |
|
842 | - 'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : null, |
|
843 | - 'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace( |
|
844 | - ',', |
|
845 | - '', |
|
846 | - $this->_req_data['vnu_capacity'] |
|
847 | - ) : EE_INF, |
|
848 | - 'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : null, |
|
849 | - 'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) |
|
850 | - ? $this->_req_data['vnu_virtual_phone'] : null, |
|
851 | - 'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] |
|
852 | - : null, |
|
853 | - 'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? true : false, |
|
854 | - 'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) |
|
855 | - ? $this->_req_data['vnu_google_map_link'] : null, |
|
856 | - ); |
|
857 | - |
|
858 | - // update venue |
|
859 | - $success = $this->_venue_model->update($venue_values, array($wheres)); |
|
860 | - |
|
861 | - // 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! |
|
862 | - $get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
863 | - $venue = $this->_venue_model->get_one(array($get_one_where)); |
|
864 | - |
|
865 | - // 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. |
|
866 | - $venue_update_callbacks = apply_filters( |
|
867 | - 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', |
|
868 | - array() |
|
869 | - ); |
|
870 | - |
|
871 | - $att_success = true; |
|
872 | - |
|
873 | - foreach ($venue_update_callbacks as $v_callback) { |
|
874 | - $_succ = call_user_func_array($v_callback, array($venue, $this->_req_data)); |
|
875 | - $att_success = ! $att_success ? $att_success |
|
876 | - : $_succ; // if ANY of these updates fail then we want the appropriate global error message |
|
877 | - } |
|
878 | - |
|
879 | - // any errors? |
|
880 | - if ($success && ! $att_success) { |
|
881 | - EE_Error::add_error( |
|
882 | - __( |
|
883 | - 'Venue Details saved successfully but something went wrong with saving attachments.', |
|
884 | - 'event_espresso' |
|
885 | - ), |
|
886 | - __FILE__, |
|
887 | - __FUNCTION__, |
|
888 | - __LINE__ |
|
889 | - ); |
|
890 | - } elseif ($success === false) { |
|
891 | - EE_Error::add_error( |
|
892 | - __('Venue Details did not save successfully.', 'event_espresso'), |
|
893 | - __FILE__, |
|
894 | - __FUNCTION__, |
|
895 | - __LINE__ |
|
896 | - ); |
|
897 | - } |
|
898 | - } |
|
899 | - |
|
900 | - |
|
901 | - public function trash_cpt_item($post_id) |
|
902 | - { |
|
903 | - $this->_req_data['VNU_ID'] = $post_id; |
|
904 | - $this->_trash_or_restore_venue('trash', false); |
|
905 | - } |
|
906 | - |
|
907 | - |
|
908 | - public function restore_cpt_item($post_id) |
|
909 | - { |
|
910 | - $this->_req_data['VNU_ID'] = $post_id; |
|
911 | - $this->_trash_or_restore_venue('draft', false); |
|
912 | - } |
|
913 | - |
|
914 | - |
|
915 | - public function delete_cpt_item($post_id) |
|
916 | - { |
|
917 | - $this->_req_data['VNU_ID'] = $post_id; |
|
918 | - $this->_delete_venue(false); |
|
919 | - } |
|
920 | - |
|
921 | - |
|
922 | - public function get_venue_object() |
|
923 | - { |
|
924 | - return $this->_cpt_model_obj; |
|
925 | - } |
|
926 | - |
|
927 | - |
|
928 | - protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = true) |
|
929 | - { |
|
930 | - $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : false; |
|
931 | - |
|
932 | - // loop thru venues |
|
933 | - if ($VNU_ID) { |
|
934 | - // clean status |
|
935 | - $venue_status = sanitize_key($venue_status); |
|
936 | - // grab status |
|
937 | - if (! empty($venue_status)) { |
|
938 | - $success = $this->_change_venue_status($VNU_ID, $venue_status); |
|
939 | - } else { |
|
940 | - $success = false; |
|
941 | - $msg = __( |
|
942 | - 'An error occurred. The venue could not be moved to the trash because a valid venue status was not not supplied.', |
|
943 | - 'event_espresso' |
|
944 | - ); |
|
945 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
946 | - } |
|
947 | - } else { |
|
948 | - $success = false; |
|
949 | - $msg = __( |
|
950 | - 'An error occurred. The venue could not be moved to the trash because a valid venue ID was not not supplied.', |
|
951 | - 'event_espresso' |
|
952 | - ); |
|
953 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
954 | - } |
|
955 | - $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
|
956 | - |
|
957 | - if ($redirect_after) { |
|
958 | - $this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default')); |
|
959 | - } |
|
960 | - } |
|
961 | - |
|
962 | - |
|
963 | - protected function _trash_or_restore_venues($venue_status = 'trash') |
|
964 | - { |
|
965 | - // clean status |
|
966 | - $venue_status = sanitize_key($venue_status); |
|
967 | - // grab status |
|
968 | - if (! empty($venue_status)) { |
|
969 | - $success = true; |
|
970 | - // determine the event id and set to array. |
|
971 | - $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
|
972 | - // loop thru events |
|
973 | - foreach ($VNU_IDs as $VNU_ID) { |
|
974 | - if ($VNU_ID = absint($VNU_ID)) { |
|
975 | - $results = $this->_change_venue_status($VNU_ID, $venue_status); |
|
976 | - $success = $results !== false ? $success : false; |
|
977 | - } else { |
|
978 | - $msg = sprintf( |
|
979 | - __( |
|
980 | - 'An error occurred. Venue #%d could not be moved to the trash because a valid venue ID was not not supplied.', |
|
981 | - 'event_espresso' |
|
982 | - ), |
|
983 | - $VNU_ID |
|
984 | - ); |
|
985 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
986 | - $success = false; |
|
987 | - } |
|
988 | - } |
|
989 | - } else { |
|
990 | - $success = false; |
|
991 | - $msg = __( |
|
992 | - 'An error occurred. The venue could not be moved to the trash because a valid venue status was not not supplied.', |
|
993 | - 'event_espresso' |
|
994 | - ); |
|
995 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
996 | - } |
|
997 | - // in order to force a pluralized result message we need to send back a success status greater than 1 |
|
998 | - $success = $success ? 2 : false; |
|
999 | - $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
|
1000 | - $this->_redirect_after_action($success, 'Venues', $action, array('action' => 'default')); |
|
1001 | - } |
|
1002 | - |
|
1003 | - |
|
1004 | - /** |
|
1005 | - * _trash_or_restore_venues |
|
1006 | - * |
|
1007 | - * //todo this is pretty much the same as the corresponding change_event_status method in Events_Admin_Page. We |
|
1008 | - * should probably abstract this up to the EE_Admin_Page_CPT (or even EE_Admin_Page) and make this a common method |
|
1009 | - * accepting a certain number of params. |
|
1010 | - * |
|
1011 | - * @access private |
|
1012 | - * @param int $VNU_ID |
|
1013 | - * @param string $venue_status |
|
1014 | - * @return void |
|
1015 | - */ |
|
1016 | - private function _change_venue_status($VNU_ID = 0, $venue_status = '') |
|
1017 | - { |
|
1018 | - // grab venue id |
|
1019 | - if (! $VNU_ID) { |
|
1020 | - $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
|
1021 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1022 | - return false; |
|
1023 | - } |
|
1024 | - |
|
1025 | - $this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
1026 | - |
|
1027 | - // clean status |
|
1028 | - $venue_status = sanitize_key($venue_status); |
|
1029 | - // grab status |
|
1030 | - if (! $venue_status) { |
|
1031 | - $msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso'); |
|
1032 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1033 | - return false; |
|
1034 | - } |
|
1035 | - |
|
1036 | - // was event trashed or restored ? |
|
1037 | - switch ($venue_status) { |
|
1038 | - case 'draft': |
|
1039 | - $action = 'restored from the trash'; |
|
1040 | - $hook = 'AHEE_venue_restored_from_trash'; |
|
1041 | - break; |
|
1042 | - case 'trash': |
|
1043 | - $action = 'moved to the trash'; |
|
1044 | - $hook = 'AHEE_venue_moved_to_trash'; |
|
1045 | - break; |
|
1046 | - default: |
|
1047 | - $action = 'updated'; |
|
1048 | - $hook = false; |
|
1049 | - } |
|
1050 | - // use class to change status |
|
1051 | - $this->_cpt_model_obj->set_status($venue_status); |
|
1052 | - $success = $this->_cpt_model_obj->save(); |
|
1053 | - |
|
1054 | - if ($success === false) { |
|
1055 | - $msg = sprintf(__('An error occurred. The venue could not be %s.', 'event_espresso'), $action); |
|
1056 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1057 | - return false; |
|
1058 | - } |
|
1059 | - if ($hook) { |
|
1060 | - do_action($hook); |
|
1061 | - } |
|
1062 | - return true; |
|
1063 | - } |
|
1064 | - |
|
1065 | - |
|
1066 | - /** |
|
1067 | - * @param bool $redirect_after |
|
1068 | - * @return void |
|
1069 | - */ |
|
1070 | - protected function _delete_venue($redirect_after = true) |
|
1071 | - { |
|
1072 | - // determine the venue id and set to array. |
|
1073 | - $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : null; |
|
1074 | - $VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID; |
|
1075 | - |
|
1076 | - |
|
1077 | - // loop thru venues |
|
1078 | - if ($VNU_ID) { |
|
1079 | - $success = $this->_delete_or_trash_venue($VNU_ID); |
|
1080 | - } else { |
|
1081 | - $success = false; |
|
1082 | - $msg = __( |
|
1083 | - 'An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', |
|
1084 | - 'event_espresso' |
|
1085 | - ); |
|
1086 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1087 | - } |
|
1088 | - if ($redirect_after) { |
|
1089 | - $this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default')); |
|
1090 | - } |
|
1091 | - } |
|
1092 | - |
|
1093 | - |
|
1094 | - protected function _delete_venues() |
|
1095 | - { |
|
1096 | - $success = true; |
|
1097 | - // determine the event id and set to array. |
|
1098 | - $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
|
1099 | - // loop thru events |
|
1100 | - foreach ($VNU_IDs as $VNU_ID) { |
|
1101 | - if ($VNU_ID = absint($VNU_ID)) { |
|
1102 | - $results = $this->_delete_or_trash_venue($VNU_ID); |
|
1103 | - $success = $results !== false ? $success : false; |
|
1104 | - } else { |
|
1105 | - $success = false; |
|
1106 | - $msg = __( |
|
1107 | - 'An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', |
|
1108 | - 'event_espresso' |
|
1109 | - ); |
|
1110 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1111 | - } |
|
1112 | - } |
|
1113 | - // in order to force a pluralized result message we need to send back a success status greater than 1 |
|
1114 | - $success = $success ? 2 : false; |
|
1115 | - $this->_redirect_after_action( |
|
1116 | - $success, |
|
1117 | - __('Venues', 'event_espresso'), |
|
1118 | - __('deleted', 'event_espresso'), |
|
1119 | - array('action' => 'default') |
|
1120 | - ); |
|
1121 | - } |
|
1122 | - |
|
1123 | - |
|
1124 | - // todo: put in parent |
|
1125 | - private function _delete_or_trash_venue($VNU_ID = false) |
|
1126 | - { |
|
1127 | - // grab event id |
|
1128 | - if (! $VNU_ID = absint($VNU_ID)) { |
|
1129 | - $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
|
1130 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1131 | - return false; |
|
1132 | - } |
|
1133 | - |
|
1134 | - |
|
1135 | - $venue = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
1136 | - // first need to remove all term relationships |
|
1137 | - $venue->_remove_relations('Term_Taxonomy'); |
|
1138 | - $success = $venue->delete_permanently(); |
|
1139 | - // did it all go as planned ? |
|
1140 | - if ($success) { |
|
1141 | - $msg = sprintf(__('Venue ID # %d has been deleted.', 'event_espresso'), $VNU_ID); |
|
1142 | - EE_Error::add_success($msg); |
|
1143 | - } else { |
|
1144 | - $msg = sprintf(__('An error occurred. Venue ID # %d could not be deleted.', 'event_espresso'), $VNU_ID); |
|
1145 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1146 | - return false; |
|
1147 | - } |
|
1148 | - do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted'); |
|
1149 | - return true; |
|
1150 | - } |
|
1151 | - |
|
1152 | - |
|
1153 | - |
|
1154 | - |
|
1155 | - /***********/ |
|
1156 | - /* QUERIES */ |
|
1157 | - |
|
1158 | - |
|
1159 | - public function get_venues($per_page = 10, $count = false) |
|
1160 | - { |
|
1161 | - |
|
1162 | - $_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
|
1163 | - |
|
1164 | - switch ($_orderby) { |
|
1165 | - case 'id': |
|
1166 | - $orderby = 'VNU_ID'; |
|
1167 | - break; |
|
1168 | - |
|
1169 | - case 'capacity': |
|
1170 | - $orderby = 'VNU_capacity'; |
|
1171 | - break; |
|
1172 | - |
|
1173 | - case 'city': |
|
1174 | - $orderby = 'VNU_city'; |
|
1175 | - break; |
|
1176 | - |
|
1177 | - default: |
|
1178 | - $orderby = 'VNU_name'; |
|
1179 | - } |
|
1180 | - |
|
1181 | - |
|
1182 | - $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] |
|
1183 | - : 'ASC'; |
|
1184 | - |
|
1185 | - $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
1186 | - ? $this->_req_data['paged'] : 1; |
|
1187 | - $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
1188 | - $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
1189 | - ? $this->_req_data['perpage'] : $per_page; |
|
1190 | - |
|
1191 | - |
|
1192 | - $offset = ($current_page - 1) * $per_page; |
|
1193 | - $limit = array($offset, $per_page); |
|
1194 | - |
|
1195 | - $category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 |
|
1196 | - ? $this->_req_data['category'] : null; |
|
1197 | - $where = array(); |
|
1198 | - |
|
1199 | - // only set initial status if it is in the incoming request. Otherwise the "all" view display's all statuses. |
|
1200 | - if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') { |
|
1201 | - $where['status'] = $this->_req_data['status']; |
|
1202 | - } |
|
1203 | - |
|
1204 | - if (isset($this->_req_data['venue_status'])) { |
|
1205 | - $where['status'] = $this->_req_data['venue_status']; |
|
1206 | - } |
|
1207 | - |
|
1208 | - |
|
1209 | - if ($category) { |
|
1210 | - $where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories'; |
|
1211 | - $where['Term_Taxonomy.term_id'] = $category; |
|
1212 | - } |
|
1213 | - |
|
1214 | - |
|
1215 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
1216 | - $where['VNU_wp_user'] = get_current_user_id(); |
|
1217 | - } else { |
|
1218 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
1219 | - $where['OR'] = array( |
|
1220 | - 'status*restrict_private' => array('!=', 'private'), |
|
1221 | - 'AND' => array( |
|
1222 | - 'status*inclusive' => array('=', 'private'), |
|
1223 | - 'VNU_wp_user' => get_current_user_id(), |
|
1224 | - ), |
|
1225 | - ); |
|
1226 | - } |
|
1227 | - } |
|
1228 | - |
|
1229 | - |
|
1230 | - if (isset($this->_req_data['s'])) { |
|
1231 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1232 | - $where['OR'] = array( |
|
1233 | - 'VNU_name' => array('LIKE', $sstr), |
|
1234 | - 'VNU_desc' => array('LIKE', $sstr), |
|
1235 | - 'VNU_short_desc' => array('LIKE', $sstr), |
|
1236 | - 'VNU_address' => array('LIKE', $sstr), |
|
1237 | - 'VNU_address2' => array('LIKE', $sstr), |
|
1238 | - 'VNU_city' => array('LIKE', $sstr), |
|
1239 | - 'VNU_zip' => array('LIKE', $sstr), |
|
1240 | - 'VNU_phone' => array('LIKE', $sstr), |
|
1241 | - 'VNU_url' => array('LIKE', $sstr), |
|
1242 | - 'VNU_virtual_phone' => array('LIKE', $sstr), |
|
1243 | - 'VNU_virtual_url' => array('LIKE', $sstr), |
|
1244 | - 'VNU_google_map_link' => array('LIKE', $sstr), |
|
1245 | - 'Event.EVT_name' => array('LIKE', $sstr), |
|
1246 | - 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1247 | - 'Event.EVT_phone' => array('LIKE', $sstr), |
|
1248 | - 'Event.EVT_external_URL' => array('LIKE', $sstr), |
|
1249 | - ); |
|
1250 | - } |
|
20 | + /** |
|
21 | + * _venue |
|
22 | + * This will hold the venue object for venue_details screen. |
|
23 | + * |
|
24 | + * @access protected |
|
25 | + * @var object |
|
26 | + */ |
|
27 | + protected $_venue; |
|
28 | + |
|
29 | + |
|
30 | + /** |
|
31 | + * This will hold the category object for category_details screen. |
|
32 | + * |
|
33 | + * @var object |
|
34 | + */ |
|
35 | + protected $_category; |
|
36 | + |
|
37 | + |
|
38 | + /** |
|
39 | + * This property will hold the venue model instance |
|
40 | + * |
|
41 | + * @var object |
|
42 | + */ |
|
43 | + protected $_venue_model; |
|
44 | + |
|
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 = __('Event Venues', 'event_espresso'); |
|
53 | + $this->_cpt_model_names = array( |
|
54 | + 'create_new' => 'EEM_Venue', |
|
55 | + 'edit' => 'EEM_Venue', |
|
56 | + ); |
|
57 | + $this->_cpt_edit_routes = array( |
|
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 = array( |
|
74 | + 'buttons' => array( |
|
75 | + 'add' => __('Add New Venue', 'event_espresso'), |
|
76 | + 'edit' => __('Edit Venue', 'event_espresso'), |
|
77 | + 'delete' => __('Delete Venue', 'event_espresso'), |
|
78 | + 'add_category' => __('Add New Category', 'event_espresso'), |
|
79 | + 'edit_category' => __('Edit Category', 'event_espresso'), |
|
80 | + 'delete_category' => __('Delete Category', 'event_espresso'), |
|
81 | + ), |
|
82 | + 'editor_title' => array( |
|
83 | + 'espresso_venues' => __('Enter Venue name here', 'event_espresso'), |
|
84 | + ), |
|
85 | + 'publishbox' => array( |
|
86 | + 'create_new' => __('Save New Venue', 'event_espresso'), |
|
87 | + 'edit' => __('Update Venue', 'event_espresso'), |
|
88 | + 'add_category' => __('Save New Category', 'event_espresso'), |
|
89 | + 'edit_category' => __('Update Category', 'event_espresso'), |
|
90 | + 'google_map_settings' => __('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 = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) |
|
104 | + ? $this->_req_data['VNU_ID'] : 0; |
|
105 | + $vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id; |
|
106 | + |
|
107 | + $this->_page_routes = array( |
|
108 | + 'default' => array( |
|
109 | + 'func' => '_overview_list_table', |
|
110 | + 'capability' => 'ee_read_venues', |
|
111 | + ), |
|
112 | + 'create_new' => array( |
|
113 | + 'func' => '_create_new_cpt_item', |
|
114 | + 'capability' => 'ee_edit_venues', |
|
115 | + ), |
|
116 | + 'edit' => array( |
|
117 | + 'func' => '_edit_cpt_item', |
|
118 | + 'capability' => 'ee_edit_venue', |
|
119 | + 'obj_id' => $vnu_id, |
|
120 | + ), |
|
121 | + 'trash_venue' => array( |
|
122 | + 'func' => '_trash_or_restore_venue', |
|
123 | + 'args' => array('venue_status' => 'trash'), |
|
124 | + 'noheader' => true, |
|
125 | + 'capability' => 'ee_delete_venue', |
|
126 | + 'obj_id' => $vnu_id, |
|
127 | + ), |
|
128 | + 'trash_venues' => array( |
|
129 | + 'func' => '_trash_or_restore_venues', |
|
130 | + 'args' => array('venue_status' => 'trash'), |
|
131 | + 'noheader' => true, |
|
132 | + 'capability' => 'ee_delete_venues', |
|
133 | + ), |
|
134 | + 'restore_venue' => array( |
|
135 | + 'func' => '_trash_or_restore_venue', |
|
136 | + 'args' => array('venue_status' => 'draft'), |
|
137 | + 'noheader' => true, |
|
138 | + 'capability' => 'ee_delete_venue', |
|
139 | + 'obj_id' => $vnu_id, |
|
140 | + ), |
|
141 | + 'restore_venues' => array( |
|
142 | + 'func' => '_trash_or_restore_venues', |
|
143 | + 'args' => array('venue_status' => 'draft'), |
|
144 | + 'noheader' => true, |
|
145 | + 'capability' => 'ee_delete_venues', |
|
146 | + ), |
|
147 | + 'delete_venues' => array( |
|
148 | + 'func' => '_delete_venues', |
|
149 | + 'noheader' => true, |
|
150 | + 'capability' => 'ee_delete_venues', |
|
151 | + ), |
|
152 | + 'delete_venue' => array( |
|
153 | + 'func' => '_delete_venue', |
|
154 | + 'noheader' => true, |
|
155 | + 'capability' => 'ee_delete_venue', |
|
156 | + 'obj_id' => $vnu_id, |
|
157 | + ), |
|
158 | + // settings related |
|
159 | + 'google_map_settings' => array( |
|
160 | + 'func' => '_google_map_settings', |
|
161 | + 'capability' => 'manage_options', |
|
162 | + ), |
|
163 | + 'update_google_map_settings' => array( |
|
164 | + 'func' => '_update_google_map_settings', |
|
165 | + 'capability' => 'manage_options', |
|
166 | + 'noheader' => true, |
|
167 | + ), |
|
168 | + // venue category tab related |
|
169 | + 'add_category' => array( |
|
170 | + 'func' => '_category_details', |
|
171 | + 'args' => array('add'), |
|
172 | + 'capability' => 'ee_edit_venue_category', |
|
173 | + ), |
|
174 | + 'edit_category' => array( |
|
175 | + 'func' => '_category_details', |
|
176 | + 'args' => array('edit'), |
|
177 | + 'capability' => 'ee_edit_venue_category', |
|
178 | + ), |
|
179 | + 'delete_categories' => array( |
|
180 | + 'func' => '_delete_categories', |
|
181 | + 'noheader' => true, |
|
182 | + 'capability' => 'ee_delete_venue_category', |
|
183 | + ), |
|
184 | + |
|
185 | + 'delete_category' => array( |
|
186 | + 'func' => '_delete_categories', |
|
187 | + 'noheader' => true, |
|
188 | + 'capability' => 'ee_delete_venue_category', |
|
189 | + ), |
|
190 | + |
|
191 | + 'insert_category' => array( |
|
192 | + 'func' => '_insert_or_update_category', |
|
193 | + 'args' => array('new_category' => true), |
|
194 | + 'noheader' => true, |
|
195 | + 'capability' => 'ee_edit_venue_category', |
|
196 | + ), |
|
197 | + |
|
198 | + 'update_category' => array( |
|
199 | + 'func' => '_insert_or_update_category', |
|
200 | + 'args' => array('new_category' => false), |
|
201 | + 'noheader' => true, |
|
202 | + 'capability' => 'ee_edit_venue_category', |
|
203 | + ), |
|
204 | + 'export_categories' => array( |
|
205 | + 'func' => '_categories_export', |
|
206 | + 'noheader' => true, |
|
207 | + 'capability' => 'export', |
|
208 | + ), |
|
209 | + 'import_categories' => array( |
|
210 | + 'func' => '_import_categories', |
|
211 | + 'capability' => 'import', |
|
212 | + ), |
|
213 | + 'category_list' => array( |
|
214 | + 'func' => '_category_list_table', |
|
215 | + 'capability' => 'ee_manage_venue_categories', |
|
216 | + ), |
|
217 | + ); |
|
218 | + } |
|
219 | + |
|
220 | + |
|
221 | + protected function _set_page_config() |
|
222 | + { |
|
223 | + $this->_page_config = array( |
|
224 | + 'default' => array( |
|
225 | + 'nav' => array( |
|
226 | + 'label' => __('Overview', 'event_espresso'), |
|
227 | + 'order' => 10, |
|
228 | + ), |
|
229 | + 'list_table' => 'Venues_Admin_List_Table', |
|
230 | + 'help_tabs' => array( |
|
231 | + 'venues_overview_help_tab' => array( |
|
232 | + 'title' => __('Venues Overview', 'event_espresso'), |
|
233 | + 'filename' => 'venues_overview', |
|
234 | + ), |
|
235 | + 'venues_overview_table_column_headings_help_tab' => array( |
|
236 | + 'title' => __('Venues Overview Table Column Headings', 'event_espresso'), |
|
237 | + 'filename' => 'venues_overview_table_column_headings', |
|
238 | + ), |
|
239 | + 'venues_overview_views_bulk_actions_search_help_tab' => array( |
|
240 | + 'title' => __('Venues Overview Views & Bulk Actions & Search', 'event_espresso'), |
|
241 | + 'filename' => 'venues_overview_views_bulk_actions_search', |
|
242 | + ), |
|
243 | + ), |
|
244 | + // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836 |
|
245 | + // 'help_tour' => array('Venues_Overview_Help_Tour'), |
|
246 | + 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
|
247 | + 'require_nonce' => false, |
|
248 | + ), |
|
249 | + 'create_new' => array( |
|
250 | + 'nav' => array( |
|
251 | + 'label' => __('Add Venue', 'event_espresso'), |
|
252 | + 'order' => 5, |
|
253 | + 'persistent' => false, |
|
254 | + ), |
|
255 | + 'help_tabs' => array( |
|
256 | + 'venues_editor_help_tab' => array( |
|
257 | + 'title' => __('Venue Editor', 'event_espresso'), |
|
258 | + 'filename' => 'venues_editor', |
|
259 | + ), |
|
260 | + 'venues_editor_title_richtexteditor_help_tab' => array( |
|
261 | + 'title' => __('Venue Title & Rich Text Editor', 'event_espresso'), |
|
262 | + 'filename' => 'venues_editor_title_richtexteditor', |
|
263 | + ), |
|
264 | + 'venues_editor_tags_categories_help_tab' => array( |
|
265 | + 'title' => __('Venue Tags & Categories', 'event_espresso'), |
|
266 | + 'filename' => 'venues_editor_tags_categories', |
|
267 | + ), |
|
268 | + 'venues_editor_physical_location_google_map_virtual_location_help_tab' => array( |
|
269 | + 'title' => __( |
|
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' => array( |
|
276 | + 'title' => __('Save New Venue', 'event_espresso'), |
|
277 | + 'filename' => 'venues_editor_save_new_venue', |
|
278 | + ), |
|
279 | + 'venues_editor_other_help_tab' => array( |
|
280 | + 'title' => __('Venue Editor Other', 'event_espresso'), |
|
281 | + 'filename' => 'venues_editor_other', |
|
282 | + ), |
|
283 | + ), |
|
284 | + // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836 |
|
285 | + // 'help_tour' => array('Venues_Add_Venue_Help_Tour'), |
|
286 | + 'metaboxes' => array('_venue_editor_metaboxes'), |
|
287 | + 'require_nonce' => false, |
|
288 | + ), |
|
289 | + 'edit' => array( |
|
290 | + 'nav' => array( |
|
291 | + 'label' => __('Edit Venue', 'event_espresso'), |
|
292 | + 'order' => 5, |
|
293 | + 'persistent' => false, |
|
294 | + 'url' => isset($this->_req_data['post']) ? add_query_arg( |
|
295 | + array('post' => $this->_req_data['post']), |
|
296 | + $this->_current_page_view_url |
|
297 | + ) : $this->_admin_base_url, |
|
298 | + ), |
|
299 | + 'help_tabs' => array( |
|
300 | + 'venues_editor_help_tab' => array( |
|
301 | + 'title' => __('Venue Editor', 'event_espresso'), |
|
302 | + 'filename' => 'venues_editor', |
|
303 | + ), |
|
304 | + 'venues_editor_title_richtexteditor_help_tab' => array( |
|
305 | + 'title' => __('Venue Title & Rich Text Editor', 'event_espresso'), |
|
306 | + 'filename' => 'venues_editor_title_richtexteditor', |
|
307 | + ), |
|
308 | + 'venues_editor_tags_categories_help_tab' => array( |
|
309 | + 'title' => __('Venue Tags & Categories', 'event_espresso'), |
|
310 | + 'filename' => 'venues_editor_tags_categories', |
|
311 | + ), |
|
312 | + 'venues_editor_physical_location_google_map_virtual_location_help_tab' => array( |
|
313 | + 'title' => __( |
|
314 | + 'Venue Editor Physical Location & Google Map & Virtual Location', |
|
315 | + 'event_espresso' |
|
316 | + ), |
|
317 | + 'filename' => 'venues_editor_physical_location_google_map_virtual_location', |
|
318 | + ), |
|
319 | + 'venues_editor_save_new_venue_help_tab' => array( |
|
320 | + 'title' => __('Save New Venue', 'event_espresso'), |
|
321 | + 'filename' => 'venues_editor_save_new_venue', |
|
322 | + ), |
|
323 | + 'venues_editor_other_help_tab' => array( |
|
324 | + 'title' => __('Venue Editor Other', 'event_espresso'), |
|
325 | + 'filename' => 'venues_editor_other', |
|
326 | + ), |
|
327 | + ), |
|
328 | + /*'help_tour' => array( 'Venues_Edit_Venue_Help_Tour' ),*/ |
|
329 | + 'metaboxes' => array('_venue_editor_metaboxes'), |
|
330 | + 'require_nonce' => false, |
|
331 | + ), |
|
332 | + 'google_map_settings' => array( |
|
333 | + 'nav' => array( |
|
334 | + 'label' => esc_html__('Google Maps', 'event_espresso'), |
|
335 | + 'order' => 40, |
|
336 | + ), |
|
337 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
338 | + 'help_tabs' => array( |
|
339 | + 'general_settings_google_maps_help_tab' => array( |
|
340 | + 'title' => __('Google Maps', 'event_espresso'), |
|
341 | + 'filename' => 'general_settings_google_maps', |
|
342 | + ), |
|
343 | + ), |
|
344 | + // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836 |
|
345 | + // 'help_tour' => array('Google_Maps_Help_Tour'), |
|
346 | + 'require_nonce' => false, |
|
347 | + ), |
|
348 | + // venue category stuff |
|
349 | + 'add_category' => array( |
|
350 | + 'nav' => array( |
|
351 | + 'label' => __('Add Category', 'event_espresso'), |
|
352 | + 'order' => 15, |
|
353 | + 'persistent' => false, |
|
354 | + ), |
|
355 | + 'metaboxes' => array('_publish_post_box'), |
|
356 | + 'help_tabs' => array( |
|
357 | + 'venues_add_category_help_tab' => array( |
|
358 | + 'title' => __('Add New Venue Category', 'event_espresso'), |
|
359 | + 'filename' => 'venues_add_category', |
|
360 | + ), |
|
361 | + ), |
|
362 | + // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836 |
|
363 | + // 'help_tour' => array('Venues_Add_Category_Help_Tour'), |
|
364 | + 'require_nonce' => false, |
|
365 | + ), |
|
366 | + 'edit_category' => array( |
|
367 | + 'nav' => array( |
|
368 | + 'label' => __('Edit Category', 'event_espresso'), |
|
369 | + 'order' => 15, |
|
370 | + 'persistent' => false, |
|
371 | + 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg( |
|
372 | + array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), |
|
373 | + $this->_current_page_view_url |
|
374 | + ) : $this->_admin_base_url, |
|
375 | + ), |
|
376 | + 'metaboxes' => array('_publish_post_box'), |
|
377 | + 'help_tabs' => array( |
|
378 | + 'venues_edit_category_help_tab' => array( |
|
379 | + 'title' => __('Edit Venue Category', 'event_espresso'), |
|
380 | + 'filename' => 'venues_edit_category', |
|
381 | + ), |
|
382 | + ), |
|
383 | + /*'help_tour' => array( 'Venues_Edit_Category_Help_Tour' ),*/ |
|
384 | + 'require_nonce' => false, |
|
385 | + ), |
|
386 | + 'category_list' => array( |
|
387 | + 'nav' => array( |
|
388 | + 'label' => __('Categories', 'event_espresso'), |
|
389 | + 'order' => 20, |
|
390 | + ), |
|
391 | + 'list_table' => 'Venue_Categories_Admin_List_Table', |
|
392 | + 'help_tabs' => array( |
|
393 | + 'venues_categories_help_tab' => array( |
|
394 | + 'title' => __('Venue Categories', 'event_espresso'), |
|
395 | + 'filename' => 'venues_categories', |
|
396 | + ), |
|
397 | + 'venues_categories_table_column_headings_help_tab' => array( |
|
398 | + 'title' => __('Venue Categories Table Column Headings', 'event_espresso'), |
|
399 | + 'filename' => 'venues_categories_table_column_headings', |
|
400 | + ), |
|
401 | + 'venues_categories_views_help_tab' => array( |
|
402 | + 'title' => __('Venue Categories Views', 'event_espresso'), |
|
403 | + 'filename' => 'venues_categories_views', |
|
404 | + ), |
|
405 | + 'venues_categories_other_help_tab' => array( |
|
406 | + 'title' => __('Venue Categories Other', 'event_espresso'), |
|
407 | + 'filename' => 'venues_categories_other', |
|
408 | + ), |
|
409 | + ), |
|
410 | + // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836 |
|
411 | + // 'help_tour' => array('Venues_Categories_Help_Tour'), |
|
412 | + 'metaboxes' => $this->_default_espresso_metaboxes, |
|
413 | + 'require_nonce' => false, |
|
414 | + ), |
|
415 | + ); |
|
416 | + } |
|
417 | + |
|
418 | + |
|
419 | + protected function _add_screen_options() |
|
420 | + { |
|
421 | + // todo |
|
422 | + } |
|
423 | + |
|
424 | + |
|
425 | + protected function _add_screen_options_default() |
|
426 | + { |
|
427 | + $this->_per_page_screen_option(); |
|
428 | + } |
|
429 | + |
|
430 | + |
|
431 | + protected function _add_screen_options_category_list() |
|
432 | + { |
|
433 | + $page_title = $this->_admin_page_title; |
|
434 | + $this->_admin_page_title = __('Venue Categories', 'event_espresso'); |
|
435 | + $this->_per_page_screen_option(); |
|
436 | + $this->_admin_page_title = $page_title; |
|
437 | + } |
|
438 | + |
|
439 | + |
|
440 | + // none of the below group are currently used for Event Venues |
|
441 | + protected function _add_feature_pointers() |
|
442 | + { |
|
443 | + } |
|
444 | + |
|
445 | + public function admin_init() |
|
446 | + { |
|
447 | + } |
|
448 | + |
|
449 | + public function admin_notices() |
|
450 | + { |
|
451 | + } |
|
452 | + |
|
453 | + public function admin_footer_scripts() |
|
454 | + { |
|
455 | + } |
|
456 | + |
|
457 | + |
|
458 | + public function load_scripts_styles_create_new() |
|
459 | + { |
|
460 | + $this->load_scripts_styles_edit(); |
|
461 | + } |
|
462 | + |
|
463 | + |
|
464 | + public function load_scripts_styles() |
|
465 | + { |
|
466 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
467 | + wp_enqueue_style('ee-cat-admin'); |
|
468 | + } |
|
469 | + |
|
470 | + |
|
471 | + public function load_scripts_styles_add_category() |
|
472 | + { |
|
473 | + $this->load_scripts_styles_edit_category(); |
|
474 | + } |
|
475 | + |
|
476 | + |
|
477 | + public function load_scripts_styles_edit_category() |
|
478 | + { |
|
479 | + } |
|
480 | + |
|
481 | + |
|
482 | + public function load_scripts_styles_edit() |
|
483 | + { |
|
484 | + // styles |
|
485 | + wp_enqueue_style('espresso-ui-theme'); |
|
486 | + wp_register_style( |
|
487 | + 'espresso_venues', |
|
488 | + EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', |
|
489 | + array(), |
|
490 | + EVENT_ESPRESSO_VERSION |
|
491 | + ); |
|
492 | + wp_enqueue_style('espresso_venues'); |
|
493 | + } |
|
494 | + |
|
495 | + |
|
496 | + protected function _set_list_table_views_default() |
|
497 | + { |
|
498 | + $this->_views = array( |
|
499 | + 'all' => array( |
|
500 | + 'slug' => 'all', |
|
501 | + 'label' => __('View All Venues', 'event_espresso'), |
|
502 | + 'count' => 0, |
|
503 | + 'bulk_action' => array(), |
|
504 | + ), |
|
505 | + ); |
|
506 | + |
|
507 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) { |
|
508 | + $this->_views['all']['bulk_action'] = array( |
|
509 | + 'trash_venues' => __('Move to Trash', 'event_espresso'), |
|
510 | + ); |
|
511 | + $this->_views['trash'] = array( |
|
512 | + 'slug' => 'trash', |
|
513 | + 'label' => __('Trash', 'event_espresso'), |
|
514 | + 'count' => 0, |
|
515 | + 'bulk_action' => array( |
|
516 | + 'restore_venues' => __('Restore from Trash', 'event_espresso'), |
|
517 | + 'delete_venues' => __('Delete', 'event_espresso'), |
|
518 | + ), |
|
519 | + ); |
|
520 | + } |
|
521 | + } |
|
522 | + |
|
523 | + |
|
524 | + protected function _set_list_table_views_category_list() |
|
525 | + { |
|
526 | + $this->_views = array( |
|
527 | + 'all' => array( |
|
528 | + 'slug' => 'all', |
|
529 | + 'label' => __('All', 'event_espresso'), |
|
530 | + 'count' => 0, |
|
531 | + 'bulk_action' => array( |
|
532 | + 'delete_categories' => __('Delete Permanently', 'event_espresso'), |
|
533 | + ), |
|
534 | + ), |
|
535 | + ); |
|
536 | + } |
|
537 | + |
|
538 | + |
|
539 | + protected function _overview_list_table() |
|
540 | + { |
|
541 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
542 | + $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( |
|
543 | + get_post_type_archive_link('espresso_venues'), |
|
544 | + __("View Venue Archive Page", "event_espresso"), |
|
545 | + 'button' |
|
546 | + ); |
|
547 | + $this->_admin_page_title .= ' ' . $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
|
548 | + $this->_search_btn_label = __('Venues', 'event_espresso'); |
|
549 | + $this->display_admin_list_table_page_with_sidebar(); |
|
550 | + } |
|
551 | + |
|
552 | + |
|
553 | + public function extra_misc_actions_publish_box() |
|
554 | + { |
|
555 | + $extra_rows = array( |
|
556 | + 'vnu_capacity' => $this->_cpt_model_obj->get_f('VNU_capacity'), |
|
557 | + 'vnu_url' => $this->_cpt_model_obj->get_f('VNU_url'), |
|
558 | + 'vnu_phone' => $this->_cpt_model_obj->get_f('VNU_phone'), |
|
559 | + ); |
|
560 | + $template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php'; |
|
561 | + EEH_Template::display_template($template, $extra_rows); |
|
562 | + } |
|
563 | + |
|
564 | + |
|
565 | + /************* Google Maps *************/ |
|
566 | + |
|
567 | + |
|
568 | + protected function _google_map_settings() |
|
569 | + { |
|
570 | + |
|
571 | + |
|
572 | + $this->_template_args['values'] = $this->_yes_no_values; |
|
573 | + $default_map_settings = new stdClass(); |
|
574 | + $default_map_settings->use_google_maps = true; |
|
575 | + $default_map_settings->google_map_api_key = ''; |
|
576 | + // for event details pages (reg page) |
|
577 | + $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
578 | + $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
579 | + $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
580 | + $default_map_settings->event_details_display_nav = true; // ee_map_nav_display_single |
|
581 | + $default_map_settings->event_details_nav_size = false; // ee_map_nav_size_single |
|
582 | + $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
583 | + $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
584 | + // for event list pages |
|
585 | + $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
586 | + $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
587 | + $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
588 | + $default_map_settings->event_list_display_nav = false; // ee_map_nav_display |
|
589 | + $default_map_settings->event_list_nav_size = true; // ee_map_nav_size |
|
590 | + $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
591 | + $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
592 | + |
|
593 | + $this->_template_args['map_settings'] = |
|
594 | + isset(EE_Registry::instance()->CFG->map_settings) |
|
595 | + && ! empty(EE_Registry::instance()->CFG->map_settings) |
|
596 | + ? (object) array_merge( |
|
597 | + (array) $default_map_settings, |
|
598 | + (array) EE_Registry::instance()->CFG->map_settings |
|
599 | + ) |
|
600 | + : $default_map_settings; |
|
601 | + |
|
602 | + $this->_set_add_edit_form_tags('update_google_map_settings'); |
|
603 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
604 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
605 | + EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', |
|
606 | + $this->_template_args, |
|
607 | + true |
|
608 | + ); |
|
609 | + $this->display_admin_page_with_sidebar(); |
|
610 | + } |
|
611 | + |
|
612 | + protected function _update_google_map_settings() |
|
613 | + { |
|
614 | + |
|
615 | + EE_Registry::instance()->CFG->map_settings->use_google_maps = |
|
616 | + isset($this->_req_data['use_google_maps']) |
|
617 | + ? absint($this->_req_data['use_google_maps']) |
|
618 | + : EE_Registry::instance()->CFG->map_settings->use_google_maps; |
|
619 | + |
|
620 | + EE_Registry::instance()->CFG->map_settings->google_map_api_key = |
|
621 | + isset($this->_req_data['google_map_api_key']) |
|
622 | + ? sanitize_text_field($this->_req_data['google_map_api_key']) |
|
623 | + : EE_Registry::instance()->CFG->map_settings->google_map_api_key; |
|
624 | + |
|
625 | + EE_Registry::instance()->CFG->map_settings->event_details_map_width = |
|
626 | + isset($this->_req_data['event_details_map_width']) |
|
627 | + ? absint($this->_req_data['event_details_map_width']) |
|
628 | + : EE_Registry::instance()->CFG->map_settings->event_details_map_width; |
|
629 | + |
|
630 | + EE_Registry::instance()->CFG->map_settings->event_details_map_height = |
|
631 | + isset($this->_req_data['event_details_map_height']) |
|
632 | + ? absint($this->_req_data['event_details_map_height']) |
|
633 | + : EE_Registry::instance()->CFG->map_settings->event_details_map_height; |
|
634 | + |
|
635 | + EE_Registry::instance()->CFG->map_settings->event_details_map_zoom = |
|
636 | + isset($this->_req_data['event_details_map_zoom']) |
|
637 | + ? absint($this->_req_data['event_details_map_zoom']) |
|
638 | + : EE_Registry::instance()->CFG->map_settings->event_details_map_zoom; |
|
639 | + |
|
640 | + EE_Registry::instance()->CFG->map_settings->event_details_display_nav = |
|
641 | + isset($this->_req_data['event_details_display_nav']) |
|
642 | + ? absint($this->_req_data['event_details_display_nav']) |
|
643 | + : EE_Registry::instance()->CFG->map_settings->event_details_display_nav; |
|
644 | + |
|
645 | + EE_Registry::instance()->CFG->map_settings->event_details_nav_size = |
|
646 | + isset($this->_req_data['event_details_nav_size']) |
|
647 | + ? absint($this->_req_data['event_details_nav_size']) |
|
648 | + : EE_Registry::instance()->CFG->map_settings->event_details_nav_size; |
|
649 | + |
|
650 | + EE_Registry::instance()->CFG->map_settings->event_details_control_type = |
|
651 | + isset($this->_req_data['event_details_control_type']) |
|
652 | + ? sanitize_text_field($this->_req_data['event_details_control_type']) |
|
653 | + : EE_Registry::instance()->CFG->map_settings->event_details_control_type; |
|
654 | + |
|
655 | + EE_Registry::instance()->CFG->map_settings->event_details_map_align = |
|
656 | + isset($this->_req_data['event_details_map_align']) |
|
657 | + ? sanitize_text_field($this->_req_data['event_details_map_align']) |
|
658 | + : EE_Registry::instance()->CFG->map_settings->event_details_map_align; |
|
659 | + |
|
660 | + EE_Registry::instance()->CFG->map_settings->event_list_map_width = |
|
661 | + isset($this->_req_data['event_list_map_width']) |
|
662 | + ? absint($this->_req_data['event_list_map_width']) |
|
663 | + : EE_Registry::instance()->CFG->map_settings->event_list_map_width; |
|
664 | + |
|
665 | + EE_Registry::instance()->CFG->map_settings->event_list_map_height = |
|
666 | + isset($this->_req_data['event_list_map_height']) |
|
667 | + ? absint($this->_req_data['event_list_map_height']) |
|
668 | + : EE_Registry::instance()->CFG->map_settings->event_list_map_height; |
|
669 | + |
|
670 | + EE_Registry::instance()->CFG->map_settings->event_list_map_zoom = |
|
671 | + isset($this->_req_data['event_list_map_zoom']) |
|
672 | + ? absint($this->_req_data['event_list_map_zoom']) |
|
673 | + : EE_Registry::instance()->CFG->map_settings->event_list_map_zoom; |
|
674 | + |
|
675 | + EE_Registry::instance()->CFG->map_settings->event_list_display_nav = |
|
676 | + isset($this->_req_data['event_list_display_nav']) |
|
677 | + ? absint($this->_req_data['event_list_display_nav']) |
|
678 | + : EE_Registry::instance()->CFG->map_settings->event_list_display_nav; |
|
679 | + |
|
680 | + EE_Registry::instance()->CFG->map_settings->event_list_nav_size = |
|
681 | + isset($this->_req_data['event_list_nav_size']) |
|
682 | + ? absint($this->_req_data['event_list_nav_size']) |
|
683 | + : EE_Registry::instance()->CFG->map_settings->event_list_nav_size; |
|
684 | + |
|
685 | + EE_Registry::instance()->CFG->map_settings->event_list_control_type = |
|
686 | + isset($this->_req_data['event_list_control_type']) |
|
687 | + ? sanitize_text_field($this->_req_data['event_list_control_type']) |
|
688 | + : EE_Registry::instance()->CFG->map_settings->event_list_control_type; |
|
689 | + |
|
690 | + EE_Registry::instance()->CFG->map_settings->event_list_map_align = |
|
691 | + isset($this->_req_data['event_list_map_align']) |
|
692 | + ? sanitize_text_field($this->_req_data['event_list_map_align']) |
|
693 | + : EE_Registry::instance()->CFG->map_settings->event_list_map_align; |
|
694 | + |
|
695 | + EE_Registry::instance()->CFG->map_settings = apply_filters( |
|
696 | + 'FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', |
|
697 | + EE_Registry::instance()->CFG->map_settings |
|
698 | + ); |
|
699 | + |
|
700 | + $what = 'Google Map Settings'; |
|
701 | + $success = $this->_update_espresso_configuration( |
|
702 | + $what, |
|
703 | + EE_Registry::instance()->CFG->map_settings, |
|
704 | + __FILE__, |
|
705 | + __FUNCTION__, |
|
706 | + __LINE__ |
|
707 | + ); |
|
708 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings')); |
|
709 | + } |
|
710 | + |
|
711 | + |
|
712 | + protected function _venue_editor_metaboxes() |
|
713 | + { |
|
714 | + $this->verify_cpt_object(); |
|
715 | + |
|
716 | + add_meta_box( |
|
717 | + 'espresso_venue_address_options', |
|
718 | + __('Physical Location', 'event_espresso'), |
|
719 | + array($this, 'venue_address_metabox'), |
|
720 | + $this->page_slug, |
|
721 | + 'side', |
|
722 | + 'default' |
|
723 | + ); |
|
724 | + add_meta_box( |
|
725 | + 'espresso_venue_gmap_options', |
|
726 | + __('Google Map', 'event_espresso'), |
|
727 | + array($this, 'venue_gmap_metabox'), |
|
728 | + $this->page_slug, |
|
729 | + 'side', |
|
730 | + 'default' |
|
731 | + ); |
|
732 | + add_meta_box( |
|
733 | + 'espresso_venue_virtual_loc_options', |
|
734 | + __('Virtual Location', 'event_espresso'), |
|
735 | + array($this, 'venue_virtual_loc_metabox'), |
|
736 | + $this->page_slug, |
|
737 | + 'side', |
|
738 | + 'default' |
|
739 | + ); |
|
740 | + } |
|
741 | + |
|
742 | + |
|
743 | + public function venue_gmap_metabox() |
|
744 | + { |
|
745 | + $template_args = array( |
|
746 | + 'vnu_enable_for_gmap' => EEH_Form_Fields::select_input( |
|
747 | + 'vnu_enable_for_gmap', |
|
748 | + $this->get_yes_no_values(), |
|
749 | + $this->_cpt_model_obj->enable_for_gmap() |
|
750 | + ), |
|
751 | + 'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(), |
|
752 | + ); |
|
753 | + $template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php'; |
|
754 | + EEH_Template::display_template($template, $template_args); |
|
755 | + } |
|
756 | + |
|
757 | + |
|
758 | + public function venue_address_metabox() |
|
759 | + { |
|
760 | + |
|
761 | + $template_args['_venue'] = $this->_cpt_model_obj; |
|
762 | + |
|
763 | + $template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input( |
|
764 | + $QFI = new EE_Question_Form_Input( |
|
765 | + EE_Question::new_instance( |
|
766 | + array('QST_display_text' => esc_html__('State', 'event_espresso'), 'QST_system' => 'state') |
|
767 | + ), |
|
768 | + EE_Answer::new_instance(array('ANS_value' => $this->_cpt_model_obj->state_ID())), |
|
769 | + array( |
|
770 | + 'input_name' => 'sta_id', |
|
771 | + 'input_id' => 'sta_id', |
|
772 | + 'input_class' => '', |
|
773 | + 'input_prefix' => '', |
|
774 | + 'append_qstn_id' => false, |
|
775 | + ) |
|
776 | + ) |
|
777 | + ); |
|
778 | + $template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input( |
|
779 | + $QFI = new EE_Question_Form_Input( |
|
780 | + EE_Question::new_instance( |
|
781 | + array('QST_display_text' => esc_html__('Country', 'event_espresso'), 'QST_system' => 'country') |
|
782 | + ), |
|
783 | + EE_Answer::new_instance(array('ANS_value' => $this->_cpt_model_obj->country_ID())), |
|
784 | + array( |
|
785 | + 'input_name' => 'cnt_iso', |
|
786 | + 'input_id' => 'cnt_iso', |
|
787 | + 'input_class' => '', |
|
788 | + 'input_prefix' => '', |
|
789 | + 'append_qstn_id' => false, |
|
790 | + ) |
|
791 | + ) |
|
792 | + ); |
|
793 | + |
|
794 | + $template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php'; |
|
795 | + EEH_Template::display_template($template, $template_args); |
|
796 | + } |
|
797 | + |
|
798 | + |
|
799 | + public function venue_virtual_loc_metabox() |
|
800 | + { |
|
801 | + $template_args = array( |
|
802 | + '_venue' => $this->_cpt_model_obj, |
|
803 | + ); |
|
804 | + $template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php'; |
|
805 | + EEH_Template::display_template($template, $template_args); |
|
806 | + } |
|
807 | + |
|
808 | + |
|
809 | + protected function _restore_cpt_item($post_id, $revision_id) |
|
810 | + { |
|
811 | + $venue_obj = $this->_venue_model->get_one_by_ID($post_id); |
|
812 | + |
|
813 | + // meta revision restore |
|
814 | + $venue_obj->restore_revision($revision_id); |
|
815 | + } |
|
816 | + |
|
817 | + |
|
818 | + /** |
|
819 | + * Handles updates for venue cpts |
|
820 | + * |
|
821 | + * @param int $post_id ID of Venue CPT |
|
822 | + * @param object $post Post object (with "blessed" WP properties) |
|
823 | + * @return void |
|
824 | + */ |
|
825 | + protected function _insert_update_cpt_item($post_id, $post) |
|
826 | + { |
|
827 | + |
|
828 | + if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') { |
|
829 | + return;// get out we're not processing the saving of venues. |
|
830 | + } |
|
831 | + |
|
832 | + $wheres = array($this->_venue_model->primary_key_name() => $post_id); |
|
833 | + |
|
834 | + $venue_values = array( |
|
835 | + 'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : null, |
|
836 | + 'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] |
|
837 | + : null, |
|
838 | + 'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : null, |
|
839 | + 'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : null, |
|
840 | + 'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : null, |
|
841 | + 'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : null, |
|
842 | + 'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : null, |
|
843 | + 'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace( |
|
844 | + ',', |
|
845 | + '', |
|
846 | + $this->_req_data['vnu_capacity'] |
|
847 | + ) : EE_INF, |
|
848 | + 'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : null, |
|
849 | + 'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) |
|
850 | + ? $this->_req_data['vnu_virtual_phone'] : null, |
|
851 | + 'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] |
|
852 | + : null, |
|
853 | + 'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? true : false, |
|
854 | + 'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) |
|
855 | + ? $this->_req_data['vnu_google_map_link'] : null, |
|
856 | + ); |
|
857 | + |
|
858 | + // update venue |
|
859 | + $success = $this->_venue_model->update($venue_values, array($wheres)); |
|
860 | + |
|
861 | + // 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! |
|
862 | + $get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
863 | + $venue = $this->_venue_model->get_one(array($get_one_where)); |
|
864 | + |
|
865 | + // 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. |
|
866 | + $venue_update_callbacks = apply_filters( |
|
867 | + 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', |
|
868 | + array() |
|
869 | + ); |
|
870 | + |
|
871 | + $att_success = true; |
|
872 | + |
|
873 | + foreach ($venue_update_callbacks as $v_callback) { |
|
874 | + $_succ = call_user_func_array($v_callback, array($venue, $this->_req_data)); |
|
875 | + $att_success = ! $att_success ? $att_success |
|
876 | + : $_succ; // if ANY of these updates fail then we want the appropriate global error message |
|
877 | + } |
|
878 | + |
|
879 | + // any errors? |
|
880 | + if ($success && ! $att_success) { |
|
881 | + EE_Error::add_error( |
|
882 | + __( |
|
883 | + 'Venue Details saved successfully but something went wrong with saving attachments.', |
|
884 | + 'event_espresso' |
|
885 | + ), |
|
886 | + __FILE__, |
|
887 | + __FUNCTION__, |
|
888 | + __LINE__ |
|
889 | + ); |
|
890 | + } elseif ($success === false) { |
|
891 | + EE_Error::add_error( |
|
892 | + __('Venue Details did not save successfully.', 'event_espresso'), |
|
893 | + __FILE__, |
|
894 | + __FUNCTION__, |
|
895 | + __LINE__ |
|
896 | + ); |
|
897 | + } |
|
898 | + } |
|
899 | + |
|
900 | + |
|
901 | + public function trash_cpt_item($post_id) |
|
902 | + { |
|
903 | + $this->_req_data['VNU_ID'] = $post_id; |
|
904 | + $this->_trash_or_restore_venue('trash', false); |
|
905 | + } |
|
906 | + |
|
907 | + |
|
908 | + public function restore_cpt_item($post_id) |
|
909 | + { |
|
910 | + $this->_req_data['VNU_ID'] = $post_id; |
|
911 | + $this->_trash_or_restore_venue('draft', false); |
|
912 | + } |
|
913 | + |
|
914 | + |
|
915 | + public function delete_cpt_item($post_id) |
|
916 | + { |
|
917 | + $this->_req_data['VNU_ID'] = $post_id; |
|
918 | + $this->_delete_venue(false); |
|
919 | + } |
|
920 | + |
|
921 | + |
|
922 | + public function get_venue_object() |
|
923 | + { |
|
924 | + return $this->_cpt_model_obj; |
|
925 | + } |
|
926 | + |
|
927 | + |
|
928 | + protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = true) |
|
929 | + { |
|
930 | + $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : false; |
|
931 | + |
|
932 | + // loop thru venues |
|
933 | + if ($VNU_ID) { |
|
934 | + // clean status |
|
935 | + $venue_status = sanitize_key($venue_status); |
|
936 | + // grab status |
|
937 | + if (! empty($venue_status)) { |
|
938 | + $success = $this->_change_venue_status($VNU_ID, $venue_status); |
|
939 | + } else { |
|
940 | + $success = false; |
|
941 | + $msg = __( |
|
942 | + 'An error occurred. The venue could not be moved to the trash because a valid venue status was not not supplied.', |
|
943 | + 'event_espresso' |
|
944 | + ); |
|
945 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
946 | + } |
|
947 | + } else { |
|
948 | + $success = false; |
|
949 | + $msg = __( |
|
950 | + 'An error occurred. The venue could not be moved to the trash because a valid venue ID was not not supplied.', |
|
951 | + 'event_espresso' |
|
952 | + ); |
|
953 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
954 | + } |
|
955 | + $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
|
956 | + |
|
957 | + if ($redirect_after) { |
|
958 | + $this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default')); |
|
959 | + } |
|
960 | + } |
|
961 | + |
|
962 | + |
|
963 | + protected function _trash_or_restore_venues($venue_status = 'trash') |
|
964 | + { |
|
965 | + // clean status |
|
966 | + $venue_status = sanitize_key($venue_status); |
|
967 | + // grab status |
|
968 | + if (! empty($venue_status)) { |
|
969 | + $success = true; |
|
970 | + // determine the event id and set to array. |
|
971 | + $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
|
972 | + // loop thru events |
|
973 | + foreach ($VNU_IDs as $VNU_ID) { |
|
974 | + if ($VNU_ID = absint($VNU_ID)) { |
|
975 | + $results = $this->_change_venue_status($VNU_ID, $venue_status); |
|
976 | + $success = $results !== false ? $success : false; |
|
977 | + } else { |
|
978 | + $msg = sprintf( |
|
979 | + __( |
|
980 | + 'An error occurred. Venue #%d could not be moved to the trash because a valid venue ID was not not supplied.', |
|
981 | + 'event_espresso' |
|
982 | + ), |
|
983 | + $VNU_ID |
|
984 | + ); |
|
985 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
986 | + $success = false; |
|
987 | + } |
|
988 | + } |
|
989 | + } else { |
|
990 | + $success = false; |
|
991 | + $msg = __( |
|
992 | + 'An error occurred. The venue could not be moved to the trash because a valid venue status was not not supplied.', |
|
993 | + 'event_espresso' |
|
994 | + ); |
|
995 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
996 | + } |
|
997 | + // in order to force a pluralized result message we need to send back a success status greater than 1 |
|
998 | + $success = $success ? 2 : false; |
|
999 | + $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
|
1000 | + $this->_redirect_after_action($success, 'Venues', $action, array('action' => 'default')); |
|
1001 | + } |
|
1002 | + |
|
1003 | + |
|
1004 | + /** |
|
1005 | + * _trash_or_restore_venues |
|
1006 | + * |
|
1007 | + * //todo this is pretty much the same as the corresponding change_event_status method in Events_Admin_Page. We |
|
1008 | + * should probably abstract this up to the EE_Admin_Page_CPT (or even EE_Admin_Page) and make this a common method |
|
1009 | + * accepting a certain number of params. |
|
1010 | + * |
|
1011 | + * @access private |
|
1012 | + * @param int $VNU_ID |
|
1013 | + * @param string $venue_status |
|
1014 | + * @return void |
|
1015 | + */ |
|
1016 | + private function _change_venue_status($VNU_ID = 0, $venue_status = '') |
|
1017 | + { |
|
1018 | + // grab venue id |
|
1019 | + if (! $VNU_ID) { |
|
1020 | + $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
|
1021 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1022 | + return false; |
|
1023 | + } |
|
1024 | + |
|
1025 | + $this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
1026 | + |
|
1027 | + // clean status |
|
1028 | + $venue_status = sanitize_key($venue_status); |
|
1029 | + // grab status |
|
1030 | + if (! $venue_status) { |
|
1031 | + $msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso'); |
|
1032 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1033 | + return false; |
|
1034 | + } |
|
1035 | + |
|
1036 | + // was event trashed or restored ? |
|
1037 | + switch ($venue_status) { |
|
1038 | + case 'draft': |
|
1039 | + $action = 'restored from the trash'; |
|
1040 | + $hook = 'AHEE_venue_restored_from_trash'; |
|
1041 | + break; |
|
1042 | + case 'trash': |
|
1043 | + $action = 'moved to the trash'; |
|
1044 | + $hook = 'AHEE_venue_moved_to_trash'; |
|
1045 | + break; |
|
1046 | + default: |
|
1047 | + $action = 'updated'; |
|
1048 | + $hook = false; |
|
1049 | + } |
|
1050 | + // use class to change status |
|
1051 | + $this->_cpt_model_obj->set_status($venue_status); |
|
1052 | + $success = $this->_cpt_model_obj->save(); |
|
1053 | + |
|
1054 | + if ($success === false) { |
|
1055 | + $msg = sprintf(__('An error occurred. The venue could not be %s.', 'event_espresso'), $action); |
|
1056 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1057 | + return false; |
|
1058 | + } |
|
1059 | + if ($hook) { |
|
1060 | + do_action($hook); |
|
1061 | + } |
|
1062 | + return true; |
|
1063 | + } |
|
1064 | + |
|
1065 | + |
|
1066 | + /** |
|
1067 | + * @param bool $redirect_after |
|
1068 | + * @return void |
|
1069 | + */ |
|
1070 | + protected function _delete_venue($redirect_after = true) |
|
1071 | + { |
|
1072 | + // determine the venue id and set to array. |
|
1073 | + $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : null; |
|
1074 | + $VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID; |
|
1075 | + |
|
1076 | + |
|
1077 | + // loop thru venues |
|
1078 | + if ($VNU_ID) { |
|
1079 | + $success = $this->_delete_or_trash_venue($VNU_ID); |
|
1080 | + } else { |
|
1081 | + $success = false; |
|
1082 | + $msg = __( |
|
1083 | + 'An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', |
|
1084 | + 'event_espresso' |
|
1085 | + ); |
|
1086 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1087 | + } |
|
1088 | + if ($redirect_after) { |
|
1089 | + $this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default')); |
|
1090 | + } |
|
1091 | + } |
|
1092 | + |
|
1093 | + |
|
1094 | + protected function _delete_venues() |
|
1095 | + { |
|
1096 | + $success = true; |
|
1097 | + // determine the event id and set to array. |
|
1098 | + $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
|
1099 | + // loop thru events |
|
1100 | + foreach ($VNU_IDs as $VNU_ID) { |
|
1101 | + if ($VNU_ID = absint($VNU_ID)) { |
|
1102 | + $results = $this->_delete_or_trash_venue($VNU_ID); |
|
1103 | + $success = $results !== false ? $success : false; |
|
1104 | + } else { |
|
1105 | + $success = false; |
|
1106 | + $msg = __( |
|
1107 | + 'An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', |
|
1108 | + 'event_espresso' |
|
1109 | + ); |
|
1110 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1111 | + } |
|
1112 | + } |
|
1113 | + // in order to force a pluralized result message we need to send back a success status greater than 1 |
|
1114 | + $success = $success ? 2 : false; |
|
1115 | + $this->_redirect_after_action( |
|
1116 | + $success, |
|
1117 | + __('Venues', 'event_espresso'), |
|
1118 | + __('deleted', 'event_espresso'), |
|
1119 | + array('action' => 'default') |
|
1120 | + ); |
|
1121 | + } |
|
1122 | + |
|
1123 | + |
|
1124 | + // todo: put in parent |
|
1125 | + private function _delete_or_trash_venue($VNU_ID = false) |
|
1126 | + { |
|
1127 | + // grab event id |
|
1128 | + if (! $VNU_ID = absint($VNU_ID)) { |
|
1129 | + $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
|
1130 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1131 | + return false; |
|
1132 | + } |
|
1133 | + |
|
1134 | + |
|
1135 | + $venue = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
1136 | + // first need to remove all term relationships |
|
1137 | + $venue->_remove_relations('Term_Taxonomy'); |
|
1138 | + $success = $venue->delete_permanently(); |
|
1139 | + // did it all go as planned ? |
|
1140 | + if ($success) { |
|
1141 | + $msg = sprintf(__('Venue ID # %d has been deleted.', 'event_espresso'), $VNU_ID); |
|
1142 | + EE_Error::add_success($msg); |
|
1143 | + } else { |
|
1144 | + $msg = sprintf(__('An error occurred. Venue ID # %d could not be deleted.', 'event_espresso'), $VNU_ID); |
|
1145 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1146 | + return false; |
|
1147 | + } |
|
1148 | + do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted'); |
|
1149 | + return true; |
|
1150 | + } |
|
1151 | + |
|
1152 | + |
|
1153 | + |
|
1154 | + |
|
1155 | + /***********/ |
|
1156 | + /* QUERIES */ |
|
1157 | + |
|
1158 | + |
|
1159 | + public function get_venues($per_page = 10, $count = false) |
|
1160 | + { |
|
1161 | + |
|
1162 | + $_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
|
1163 | + |
|
1164 | + switch ($_orderby) { |
|
1165 | + case 'id': |
|
1166 | + $orderby = 'VNU_ID'; |
|
1167 | + break; |
|
1168 | + |
|
1169 | + case 'capacity': |
|
1170 | + $orderby = 'VNU_capacity'; |
|
1171 | + break; |
|
1172 | + |
|
1173 | + case 'city': |
|
1174 | + $orderby = 'VNU_city'; |
|
1175 | + break; |
|
1176 | + |
|
1177 | + default: |
|
1178 | + $orderby = 'VNU_name'; |
|
1179 | + } |
|
1180 | + |
|
1181 | + |
|
1182 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] |
|
1183 | + : 'ASC'; |
|
1184 | + |
|
1185 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
1186 | + ? $this->_req_data['paged'] : 1; |
|
1187 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
1188 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
1189 | + ? $this->_req_data['perpage'] : $per_page; |
|
1190 | + |
|
1191 | + |
|
1192 | + $offset = ($current_page - 1) * $per_page; |
|
1193 | + $limit = array($offset, $per_page); |
|
1194 | + |
|
1195 | + $category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 |
|
1196 | + ? $this->_req_data['category'] : null; |
|
1197 | + $where = array(); |
|
1198 | + |
|
1199 | + // only set initial status if it is in the incoming request. Otherwise the "all" view display's all statuses. |
|
1200 | + if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') { |
|
1201 | + $where['status'] = $this->_req_data['status']; |
|
1202 | + } |
|
1203 | + |
|
1204 | + if (isset($this->_req_data['venue_status'])) { |
|
1205 | + $where['status'] = $this->_req_data['venue_status']; |
|
1206 | + } |
|
1207 | + |
|
1208 | + |
|
1209 | + if ($category) { |
|
1210 | + $where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories'; |
|
1211 | + $where['Term_Taxonomy.term_id'] = $category; |
|
1212 | + } |
|
1213 | + |
|
1214 | + |
|
1215 | + if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
1216 | + $where['VNU_wp_user'] = get_current_user_id(); |
|
1217 | + } else { |
|
1218 | + if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
1219 | + $where['OR'] = array( |
|
1220 | + 'status*restrict_private' => array('!=', 'private'), |
|
1221 | + 'AND' => array( |
|
1222 | + 'status*inclusive' => array('=', 'private'), |
|
1223 | + 'VNU_wp_user' => get_current_user_id(), |
|
1224 | + ), |
|
1225 | + ); |
|
1226 | + } |
|
1227 | + } |
|
1228 | + |
|
1229 | + |
|
1230 | + if (isset($this->_req_data['s'])) { |
|
1231 | + $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1232 | + $where['OR'] = array( |
|
1233 | + 'VNU_name' => array('LIKE', $sstr), |
|
1234 | + 'VNU_desc' => array('LIKE', $sstr), |
|
1235 | + 'VNU_short_desc' => array('LIKE', $sstr), |
|
1236 | + 'VNU_address' => array('LIKE', $sstr), |
|
1237 | + 'VNU_address2' => array('LIKE', $sstr), |
|
1238 | + 'VNU_city' => array('LIKE', $sstr), |
|
1239 | + 'VNU_zip' => array('LIKE', $sstr), |
|
1240 | + 'VNU_phone' => array('LIKE', $sstr), |
|
1241 | + 'VNU_url' => array('LIKE', $sstr), |
|
1242 | + 'VNU_virtual_phone' => array('LIKE', $sstr), |
|
1243 | + 'VNU_virtual_url' => array('LIKE', $sstr), |
|
1244 | + 'VNU_google_map_link' => array('LIKE', $sstr), |
|
1245 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
1246 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1247 | + 'Event.EVT_phone' => array('LIKE', $sstr), |
|
1248 | + 'Event.EVT_external_URL' => array('LIKE', $sstr), |
|
1249 | + ); |
|
1250 | + } |
|
1251 | 1251 | |
1252 | 1252 | |
1253 | - $venues = $count |
|
1254 | - ? $this->_venue_model->count(array($where), 'VNU_ID') |
|
1255 | - : $this->_venue_model->get_all( |
|
1256 | - array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort) |
|
1257 | - ); |
|
1258 | - |
|
1259 | - return $venues; |
|
1260 | - } |
|
1261 | - |
|
1262 | - |
|
1263 | - |
|
1264 | - |
|
1265 | - /** Venue Category Stuff **/ |
|
1266 | - |
|
1267 | - /** |
|
1268 | - * set the _category property with the category object for the loaded page. |
|
1269 | - * |
|
1270 | - * @access private |
|
1271 | - * @return void |
|
1272 | - */ |
|
1273 | - private function _set_category_object() |
|
1274 | - { |
|
1275 | - if (isset($this->_category->id) && ! empty($this->_category->id)) { |
|
1276 | - return; |
|
1277 | - } // already have the category object so get out. |
|
1278 | - |
|
1279 | - // set default category object |
|
1280 | - $this->_set_empty_category_object(); |
|
1281 | - |
|
1282 | - // only set if we've got an id |
|
1283 | - if (! isset($this->_req_data['VEN_CAT_ID'])) { |
|
1284 | - return; |
|
1285 | - } |
|
1286 | - |
|
1287 | - $category_id = absint($this->_req_data['VEN_CAT_ID']); |
|
1288 | - $term = get_term($category_id, 'espresso_venue_categories'); |
|
1289 | - |
|
1290 | - |
|
1291 | - if (! empty($term)) { |
|
1292 | - $this->_category->category_name = $term->name; |
|
1293 | - $this->_category->category_identifier = $term->slug; |
|
1294 | - $this->_category->category_desc = $term->description; |
|
1295 | - $this->_category->id = $term->term_id; |
|
1296 | - $this->_category->parent = $term->parent; |
|
1297 | - } |
|
1298 | - } |
|
1299 | - |
|
1300 | - |
|
1301 | - private function _set_empty_category_object() |
|
1302 | - { |
|
1303 | - $this->_category = new stdClass(); |
|
1304 | - $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
1305 | - $this->_category->id = $this->_category->parent = 0; |
|
1306 | - } |
|
1307 | - |
|
1308 | - |
|
1309 | - protected function _category_list_table() |
|
1310 | - { |
|
1311 | - do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1312 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
1313 | - 'add_category', |
|
1314 | - 'add_category', |
|
1315 | - array(), |
|
1316 | - 'add-new-h2' |
|
1317 | - ); |
|
1318 | - $this->_search_btn_label = __('Venue Categories', 'event_espresso'); |
|
1319 | - $this->display_admin_list_table_page_with_sidebar(); |
|
1320 | - } |
|
1321 | - |
|
1322 | - |
|
1323 | - protected function _category_details($view) |
|
1324 | - { |
|
1325 | - |
|
1326 | - // load formatter helper |
|
1327 | - // load field generator helper |
|
1328 | - |
|
1329 | - $route = $view == 'edit' ? 'update_category' : 'insert_category'; |
|
1330 | - $this->_set_add_edit_form_tags($route); |
|
1331 | - |
|
1332 | - $this->_set_category_object(); |
|
1333 | - $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
1334 | - |
|
1335 | - $delete_action = 'delete_category'; |
|
1336 | - |
|
1337 | - $redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url); |
|
1338 | - |
|
1339 | - $this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect); |
|
1340 | - |
|
1341 | - // take care of contents |
|
1342 | - $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
|
1343 | - $this->display_admin_page_with_sidebar(); |
|
1344 | - } |
|
1345 | - |
|
1346 | - |
|
1347 | - protected function _category_details_content() |
|
1348 | - { |
|
1349 | - $editor_args['category_desc'] = array( |
|
1350 | - 'type' => 'wp_editor', |
|
1351 | - 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
|
1352 | - 'class' => 'my_editor_custom', |
|
1353 | - 'wpeditor_args' => array('media_buttons' => false), |
|
1354 | - ); |
|
1355 | - $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
1356 | - |
|
1357 | - $all_terms = get_terms( |
|
1358 | - array('espresso_venue_categories'), |
|
1359 | - array('hide_empty' => 0, 'exclude' => array($this->_category->id)) |
|
1360 | - ); |
|
1361 | - |
|
1362 | - // setup category select for term parents. |
|
1363 | - $category_select_values[] = array( |
|
1364 | - 'text' => __('No Parent', 'event_espresso'), |
|
1365 | - 'id' => 0, |
|
1366 | - ); |
|
1367 | - foreach ($all_terms as $term) { |
|
1368 | - $category_select_values[] = array( |
|
1369 | - 'text' => $term->name, |
|
1370 | - 'id' => $term->term_id, |
|
1371 | - ); |
|
1372 | - } |
|
1373 | - |
|
1374 | - $category_select = EEH_Form_Fields::select_input( |
|
1375 | - 'category_parent', |
|
1376 | - $category_select_values, |
|
1377 | - $this->_category->parent |
|
1378 | - ); |
|
1379 | - $template_args = array( |
|
1380 | - 'category' => $this->_category, |
|
1381 | - 'category_select' => $category_select, |
|
1382 | - 'unique_id_info_help_link' => $this->_get_help_tab_link('unique_id_info'), |
|
1383 | - 'category_desc_editor' => $_wp_editor['category_desc']['field'], |
|
1384 | - 'disable' => '', |
|
1385 | - 'disabled_message' => false, |
|
1386 | - ); |
|
1387 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
1388 | - return EEH_Template::display_template($template, $template_args, true); |
|
1389 | - } |
|
1390 | - |
|
1391 | - |
|
1392 | - protected function _delete_categories() |
|
1393 | - { |
|
1394 | - $cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] |
|
1395 | - : (array) $this->_req_data['category_id']; |
|
1396 | - |
|
1397 | - foreach ($cat_ids as $cat_id) { |
|
1398 | - $this->_delete_category($cat_id); |
|
1399 | - } |
|
1400 | - |
|
1401 | - // doesn't matter what page we're coming from... we're going to the same place after delete. |
|
1402 | - $query_args = array( |
|
1403 | - 'action' => 'category_list', |
|
1404 | - ); |
|
1405 | - $this->_redirect_after_action(0, '', '', $query_args); |
|
1406 | - } |
|
1407 | - |
|
1408 | - |
|
1409 | - protected function _delete_category($cat_id) |
|
1410 | - { |
|
1411 | - $cat_id = absint($cat_id); |
|
1412 | - wp_delete_term($cat_id, 'espresso_venue_categories'); |
|
1413 | - } |
|
1414 | - |
|
1415 | - |
|
1416 | - protected function _insert_or_update_category($new_category) |
|
1417 | - { |
|
1418 | - |
|
1419 | - $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(true); |
|
1420 | - $success = 0; // we already have a success message so lets not send another. |
|
1421 | - if ($cat_id) { |
|
1422 | - $query_args = array( |
|
1423 | - 'action' => 'edit_category', |
|
1424 | - 'VEN_CAT_ID' => $cat_id, |
|
1425 | - ); |
|
1426 | - } else { |
|
1427 | - $query_args = array('action' => 'add_category'); |
|
1428 | - } |
|
1429 | - $this->_redirect_after_action($success, '', '', $query_args, true); |
|
1430 | - } |
|
1431 | - |
|
1432 | - |
|
1433 | - private function _insert_category($update = false) |
|
1434 | - { |
|
1435 | - $cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : ''; |
|
1436 | - $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
1437 | - $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
1438 | - $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
1439 | - |
|
1440 | - if (empty($category_name)) { |
|
1441 | - $msg = __('You must add a name for the category.', 'event_espresso'); |
|
1442 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1443 | - return false; |
|
1444 | - } |
|
1445 | - |
|
1446 | - |
|
1447 | - $term_args = array( |
|
1448 | - 'name' => $category_name, |
|
1449 | - 'description' => $category_desc, |
|
1450 | - 'parent' => $category_parent, |
|
1451 | - ); |
|
1452 | - |
|
1453 | - $insert_ids = $update |
|
1454 | - ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) |
|
1455 | - : wp_insert_term( |
|
1456 | - $category_name, |
|
1457 | - 'espresso_venue_categories', |
|
1458 | - $term_args |
|
1459 | - ); |
|
1460 | - |
|
1461 | - if (! is_array($insert_ids)) { |
|
1462 | - $msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
|
1463 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1464 | - } else { |
|
1465 | - $cat_id = $insert_ids['term_id']; |
|
1466 | - $msg = sprintf(__('The category %s was successfully created', 'event_espresso'), $category_name); |
|
1467 | - EE_Error::add_success($msg); |
|
1468 | - } |
|
1469 | - |
|
1470 | - return $cat_id; |
|
1471 | - } |
|
1472 | - |
|
1473 | - |
|
1474 | - /** |
|
1475 | - * TODO handle category exports() |
|
1476 | - * |
|
1477 | - * @return file export |
|
1478 | - */ |
|
1479 | - protected function _categories_export() |
|
1480 | - { |
|
1481 | - |
|
1482 | - // todo: I don't like doing this but it'll do until we modify EE_Export Class. |
|
1483 | - $new_request_args = array( |
|
1484 | - 'export' => 'report', |
|
1485 | - 'action' => 'categories', |
|
1486 | - 'category_ids' => $this->_req_data['VEN_CAT_ID'], |
|
1487 | - ); |
|
1488 | - |
|
1489 | - $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
1490 | - |
|
1491 | - if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
1492 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
1493 | - $EE_Export = EE_Export::instance($this->_req_data); |
|
1494 | - $EE_Export->export(); |
|
1495 | - } |
|
1496 | - } |
|
1497 | - |
|
1498 | - |
|
1499 | - protected function _import_categories() |
|
1500 | - { |
|
1501 | - |
|
1502 | - require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
1503 | - EE_Import::instance()->import(); |
|
1504 | - } |
|
1505 | - |
|
1506 | - |
|
1507 | - public function get_categories($per_page = 10, $current_page = 1, $count = false) |
|
1508 | - { |
|
1509 | - |
|
1510 | - // testing term stuff |
|
1511 | - $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
1512 | - $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
1513 | - $limit = ($current_page - 1) * $per_page; |
|
1514 | - $where = array('taxonomy' => 'espresso_venue_categories'); |
|
1515 | - if (isset($this->_req_data['s'])) { |
|
1516 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1517 | - $where['OR'] = array( |
|
1518 | - 'Term.name' => array('LIKE', $sstr), |
|
1519 | - 'description' => array('LIKE', $sstr), |
|
1520 | - ); |
|
1521 | - } |
|
1522 | - |
|
1523 | - $query_params = array( |
|
1524 | - $where, |
|
1525 | - 'order_by' => array($orderby => $order), |
|
1526 | - 'limit' => $limit . ',' . $per_page, |
|
1527 | - 'force_join' => array('Term'), |
|
1528 | - ); |
|
1529 | - |
|
1530 | - $categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') |
|
1531 | - : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
1532 | - |
|
1533 | - return $categories; |
|
1534 | - } |
|
1535 | - |
|
1536 | - |
|
1537 | - /* end category stuff */ |
|
1538 | - /**************/ |
|
1253 | + $venues = $count |
|
1254 | + ? $this->_venue_model->count(array($where), 'VNU_ID') |
|
1255 | + : $this->_venue_model->get_all( |
|
1256 | + array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort) |
|
1257 | + ); |
|
1258 | + |
|
1259 | + return $venues; |
|
1260 | + } |
|
1261 | + |
|
1262 | + |
|
1263 | + |
|
1264 | + |
|
1265 | + /** Venue Category Stuff **/ |
|
1266 | + |
|
1267 | + /** |
|
1268 | + * set the _category property with the category object for the loaded page. |
|
1269 | + * |
|
1270 | + * @access private |
|
1271 | + * @return void |
|
1272 | + */ |
|
1273 | + private function _set_category_object() |
|
1274 | + { |
|
1275 | + if (isset($this->_category->id) && ! empty($this->_category->id)) { |
|
1276 | + return; |
|
1277 | + } // already have the category object so get out. |
|
1278 | + |
|
1279 | + // set default category object |
|
1280 | + $this->_set_empty_category_object(); |
|
1281 | + |
|
1282 | + // only set if we've got an id |
|
1283 | + if (! isset($this->_req_data['VEN_CAT_ID'])) { |
|
1284 | + return; |
|
1285 | + } |
|
1286 | + |
|
1287 | + $category_id = absint($this->_req_data['VEN_CAT_ID']); |
|
1288 | + $term = get_term($category_id, 'espresso_venue_categories'); |
|
1289 | + |
|
1290 | + |
|
1291 | + if (! empty($term)) { |
|
1292 | + $this->_category->category_name = $term->name; |
|
1293 | + $this->_category->category_identifier = $term->slug; |
|
1294 | + $this->_category->category_desc = $term->description; |
|
1295 | + $this->_category->id = $term->term_id; |
|
1296 | + $this->_category->parent = $term->parent; |
|
1297 | + } |
|
1298 | + } |
|
1299 | + |
|
1300 | + |
|
1301 | + private function _set_empty_category_object() |
|
1302 | + { |
|
1303 | + $this->_category = new stdClass(); |
|
1304 | + $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
1305 | + $this->_category->id = $this->_category->parent = 0; |
|
1306 | + } |
|
1307 | + |
|
1308 | + |
|
1309 | + protected function _category_list_table() |
|
1310 | + { |
|
1311 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1312 | + $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
1313 | + 'add_category', |
|
1314 | + 'add_category', |
|
1315 | + array(), |
|
1316 | + 'add-new-h2' |
|
1317 | + ); |
|
1318 | + $this->_search_btn_label = __('Venue Categories', 'event_espresso'); |
|
1319 | + $this->display_admin_list_table_page_with_sidebar(); |
|
1320 | + } |
|
1321 | + |
|
1322 | + |
|
1323 | + protected function _category_details($view) |
|
1324 | + { |
|
1325 | + |
|
1326 | + // load formatter helper |
|
1327 | + // load field generator helper |
|
1328 | + |
|
1329 | + $route = $view == 'edit' ? 'update_category' : 'insert_category'; |
|
1330 | + $this->_set_add_edit_form_tags($route); |
|
1331 | + |
|
1332 | + $this->_set_category_object(); |
|
1333 | + $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
1334 | + |
|
1335 | + $delete_action = 'delete_category'; |
|
1336 | + |
|
1337 | + $redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url); |
|
1338 | + |
|
1339 | + $this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect); |
|
1340 | + |
|
1341 | + // take care of contents |
|
1342 | + $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
|
1343 | + $this->display_admin_page_with_sidebar(); |
|
1344 | + } |
|
1345 | + |
|
1346 | + |
|
1347 | + protected function _category_details_content() |
|
1348 | + { |
|
1349 | + $editor_args['category_desc'] = array( |
|
1350 | + 'type' => 'wp_editor', |
|
1351 | + 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
|
1352 | + 'class' => 'my_editor_custom', |
|
1353 | + 'wpeditor_args' => array('media_buttons' => false), |
|
1354 | + ); |
|
1355 | + $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
1356 | + |
|
1357 | + $all_terms = get_terms( |
|
1358 | + array('espresso_venue_categories'), |
|
1359 | + array('hide_empty' => 0, 'exclude' => array($this->_category->id)) |
|
1360 | + ); |
|
1361 | + |
|
1362 | + // setup category select for term parents. |
|
1363 | + $category_select_values[] = array( |
|
1364 | + 'text' => __('No Parent', 'event_espresso'), |
|
1365 | + 'id' => 0, |
|
1366 | + ); |
|
1367 | + foreach ($all_terms as $term) { |
|
1368 | + $category_select_values[] = array( |
|
1369 | + 'text' => $term->name, |
|
1370 | + 'id' => $term->term_id, |
|
1371 | + ); |
|
1372 | + } |
|
1373 | + |
|
1374 | + $category_select = EEH_Form_Fields::select_input( |
|
1375 | + 'category_parent', |
|
1376 | + $category_select_values, |
|
1377 | + $this->_category->parent |
|
1378 | + ); |
|
1379 | + $template_args = array( |
|
1380 | + 'category' => $this->_category, |
|
1381 | + 'category_select' => $category_select, |
|
1382 | + 'unique_id_info_help_link' => $this->_get_help_tab_link('unique_id_info'), |
|
1383 | + 'category_desc_editor' => $_wp_editor['category_desc']['field'], |
|
1384 | + 'disable' => '', |
|
1385 | + 'disabled_message' => false, |
|
1386 | + ); |
|
1387 | + $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
1388 | + return EEH_Template::display_template($template, $template_args, true); |
|
1389 | + } |
|
1390 | + |
|
1391 | + |
|
1392 | + protected function _delete_categories() |
|
1393 | + { |
|
1394 | + $cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] |
|
1395 | + : (array) $this->_req_data['category_id']; |
|
1396 | + |
|
1397 | + foreach ($cat_ids as $cat_id) { |
|
1398 | + $this->_delete_category($cat_id); |
|
1399 | + } |
|
1400 | + |
|
1401 | + // doesn't matter what page we're coming from... we're going to the same place after delete. |
|
1402 | + $query_args = array( |
|
1403 | + 'action' => 'category_list', |
|
1404 | + ); |
|
1405 | + $this->_redirect_after_action(0, '', '', $query_args); |
|
1406 | + } |
|
1407 | + |
|
1408 | + |
|
1409 | + protected function _delete_category($cat_id) |
|
1410 | + { |
|
1411 | + $cat_id = absint($cat_id); |
|
1412 | + wp_delete_term($cat_id, 'espresso_venue_categories'); |
|
1413 | + } |
|
1414 | + |
|
1415 | + |
|
1416 | + protected function _insert_or_update_category($new_category) |
|
1417 | + { |
|
1418 | + |
|
1419 | + $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(true); |
|
1420 | + $success = 0; // we already have a success message so lets not send another. |
|
1421 | + if ($cat_id) { |
|
1422 | + $query_args = array( |
|
1423 | + 'action' => 'edit_category', |
|
1424 | + 'VEN_CAT_ID' => $cat_id, |
|
1425 | + ); |
|
1426 | + } else { |
|
1427 | + $query_args = array('action' => 'add_category'); |
|
1428 | + } |
|
1429 | + $this->_redirect_after_action($success, '', '', $query_args, true); |
|
1430 | + } |
|
1431 | + |
|
1432 | + |
|
1433 | + private function _insert_category($update = false) |
|
1434 | + { |
|
1435 | + $cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : ''; |
|
1436 | + $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
1437 | + $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
1438 | + $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
1439 | + |
|
1440 | + if (empty($category_name)) { |
|
1441 | + $msg = __('You must add a name for the category.', 'event_espresso'); |
|
1442 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1443 | + return false; |
|
1444 | + } |
|
1445 | + |
|
1446 | + |
|
1447 | + $term_args = array( |
|
1448 | + 'name' => $category_name, |
|
1449 | + 'description' => $category_desc, |
|
1450 | + 'parent' => $category_parent, |
|
1451 | + ); |
|
1452 | + |
|
1453 | + $insert_ids = $update |
|
1454 | + ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) |
|
1455 | + : wp_insert_term( |
|
1456 | + $category_name, |
|
1457 | + 'espresso_venue_categories', |
|
1458 | + $term_args |
|
1459 | + ); |
|
1460 | + |
|
1461 | + if (! is_array($insert_ids)) { |
|
1462 | + $msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
|
1463 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1464 | + } else { |
|
1465 | + $cat_id = $insert_ids['term_id']; |
|
1466 | + $msg = sprintf(__('The category %s was successfully created', 'event_espresso'), $category_name); |
|
1467 | + EE_Error::add_success($msg); |
|
1468 | + } |
|
1469 | + |
|
1470 | + return $cat_id; |
|
1471 | + } |
|
1472 | + |
|
1473 | + |
|
1474 | + /** |
|
1475 | + * TODO handle category exports() |
|
1476 | + * |
|
1477 | + * @return file export |
|
1478 | + */ |
|
1479 | + protected function _categories_export() |
|
1480 | + { |
|
1481 | + |
|
1482 | + // todo: I don't like doing this but it'll do until we modify EE_Export Class. |
|
1483 | + $new_request_args = array( |
|
1484 | + 'export' => 'report', |
|
1485 | + 'action' => 'categories', |
|
1486 | + 'category_ids' => $this->_req_data['VEN_CAT_ID'], |
|
1487 | + ); |
|
1488 | + |
|
1489 | + $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
1490 | + |
|
1491 | + if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
1492 | + require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
1493 | + $EE_Export = EE_Export::instance($this->_req_data); |
|
1494 | + $EE_Export->export(); |
|
1495 | + } |
|
1496 | + } |
|
1497 | + |
|
1498 | + |
|
1499 | + protected function _import_categories() |
|
1500 | + { |
|
1501 | + |
|
1502 | + require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
1503 | + EE_Import::instance()->import(); |
|
1504 | + } |
|
1505 | + |
|
1506 | + |
|
1507 | + public function get_categories($per_page = 10, $current_page = 1, $count = false) |
|
1508 | + { |
|
1509 | + |
|
1510 | + // testing term stuff |
|
1511 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
1512 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
1513 | + $limit = ($current_page - 1) * $per_page; |
|
1514 | + $where = array('taxonomy' => 'espresso_venue_categories'); |
|
1515 | + if (isset($this->_req_data['s'])) { |
|
1516 | + $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1517 | + $where['OR'] = array( |
|
1518 | + 'Term.name' => array('LIKE', $sstr), |
|
1519 | + 'description' => array('LIKE', $sstr), |
|
1520 | + ); |
|
1521 | + } |
|
1522 | + |
|
1523 | + $query_params = array( |
|
1524 | + $where, |
|
1525 | + 'order_by' => array($orderby => $order), |
|
1526 | + 'limit' => $limit . ',' . $per_page, |
|
1527 | + 'force_join' => array('Term'), |
|
1528 | + ); |
|
1529 | + |
|
1530 | + $categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') |
|
1531 | + : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
1532 | + |
|
1533 | + return $categories; |
|
1534 | + } |
|
1535 | + |
|
1536 | + |
|
1537 | + /* end category stuff */ |
|
1538 | + /**************/ |
|
1539 | 1539 | } |
@@ -15,16 +15,16 @@ discard block |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | |
18 | - protected function _set_tips_array() |
|
19 | - { |
|
20 | - $this->_qtipsa = array( |
|
21 | - 0 => array( |
|
22 | - 'content_id' => 'registration-trash-lock', |
|
23 | - 'target' => '.ee-lock-icon', |
|
24 | - 'content' => $this->_registration_trash_message(), |
|
25 | - ), |
|
26 | - /** removing status strips for now because they are triggered anywhere on the row. */ |
|
27 | - /**1 => array( |
|
18 | + protected function _set_tips_array() |
|
19 | + { |
|
20 | + $this->_qtipsa = array( |
|
21 | + 0 => array( |
|
22 | + 'content_id' => 'registration-trash-lock', |
|
23 | + 'target' => '.ee-lock-icon', |
|
24 | + 'content' => $this->_registration_trash_message(), |
|
25 | + ), |
|
26 | + /** removing status strips for now because they are triggered anywhere on the row. */ |
|
27 | + /**1 => array( |
|
28 | 28 | * 'content_id' => 'registration-status-' . EEM_Registration::status_id_approved, |
29 | 29 | * 'target' => '.reg-status-' . EEM_Registration::status_id_approved, |
30 | 30 | * 'content' => $this->_registration_status_legend(EEM_Registration::status_id_approved), |
@@ -74,37 +74,37 @@ discard block |
||
74 | 74 | * ) |
75 | 75 | * ) |
76 | 76 | * )/**/ |
77 | - ); |
|
78 | - } |
|
77 | + ); |
|
78 | + } |
|
79 | 79 | |
80 | 80 | |
81 | - private function _registration_trash_message() |
|
82 | - { |
|
83 | - return '<p>' |
|
84 | - . __( |
|
85 | - 'This lock-icon means that this registration cannot be trashed. Registrations that belong to a transaction that has payments cannot be trashed. If you wish to trash this registration then you must delete all payments attached to the related transaction first.', |
|
86 | - 'event_espresso' |
|
87 | - ) . '</p>'; |
|
88 | - } |
|
81 | + private function _registration_trash_message() |
|
82 | + { |
|
83 | + return '<p>' |
|
84 | + . __( |
|
85 | + 'This lock-icon means that this registration cannot be trashed. Registrations that belong to a transaction that has payments cannot be trashed. If you wish to trash this registration then you must delete all payments attached to the related transaction first.', |
|
86 | + 'event_espresso' |
|
87 | + ) . '</p>'; |
|
88 | + } |
|
89 | 89 | |
90 | 90 | |
91 | - /** |
|
92 | - * output the relevant ee-status-legend with the designated status highlighted. |
|
93 | - * |
|
94 | - * @param EEM_Registration constant $status What status is set (by class) |
|
95 | - * @return string The status legend with the related status highlighted |
|
96 | - */ |
|
97 | - private function _registration_status_legend($status) |
|
98 | - { |
|
91 | + /** |
|
92 | + * output the relevant ee-status-legend with the designated status highlighted. |
|
93 | + * |
|
94 | + * @param EEM_Registration constant $status What status is set (by class) |
|
95 | + * @return string The status legend with the related status highlighted |
|
96 | + */ |
|
97 | + private function _registration_status_legend($status) |
|
98 | + { |
|
99 | 99 | |
100 | - $status_array = array( |
|
101 | - 'approved_status' => EEM_Registration::status_id_approved, |
|
102 | - 'pending_status' => EEM_Registration::status_id_pending_payment, |
|
103 | - 'not_approved' => EEM_Registration::status_id_not_approved, |
|
104 | - 'declined_status' => EEM_Registration::status_id_declined, |
|
105 | - 'cancelled_status' => EEM_Registration::status_id_cancelled, |
|
106 | - ); |
|
100 | + $status_array = array( |
|
101 | + 'approved_status' => EEM_Registration::status_id_approved, |
|
102 | + 'pending_status' => EEM_Registration::status_id_pending_payment, |
|
103 | + 'not_approved' => EEM_Registration::status_id_not_approved, |
|
104 | + 'declined_status' => EEM_Registration::status_id_declined, |
|
105 | + 'cancelled_status' => EEM_Registration::status_id_cancelled, |
|
106 | + ); |
|
107 | 107 | |
108 | - return EEH_Template::status_legend($status_array, $status); |
|
109 | - } |
|
108 | + return EEH_Template::status_legend($status_array, $status); |
|
109 | + } |
|
110 | 110 | } |
@@ -84,7 +84,7 @@ |
||
84 | 84 | . __( |
85 | 85 | 'This lock-icon means that this registration cannot be trashed. Registrations that belong to a transaction that has payments cannot be trashed. If you wish to trash this registration then you must delete all payments attached to the related transaction first.', |
86 | 86 | 'event_espresso' |
87 | - ) . '</p>'; |
|
87 | + ).'</p>'; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 |
@@ -8,17 +8,17 @@ |
||
8 | 8 | <div id="titlewrap"> |
9 | 9 | <label class="hidden" id="attendee-first-name-text" for="ATT_fname"> |
10 | 10 | <?php _e( |
11 | - 'First Name:', |
|
12 | - 'event_espresso' |
|
13 | - ); ?></label> |
|
11 | + 'First Name:', |
|
12 | + 'event_espresso' |
|
13 | + ); ?></label> |
|
14 | 14 | <input type="text" class="smaller-text-field" name="ATT_fname" |
15 | 15 | value="<?php echo $attendee->get('ATT_fname'); ?>" id="ATT_fname" |
16 | 16 | placeholder="<?php _e('First Name', 'event_espresso'); ?>" required> |
17 | 17 | <label class="hidden" id="attendee-first-name-text" for="ATT_lname"> |
18 | 18 | <?php _e( |
19 | - 'Last Name:', |
|
20 | - 'event_espresso' |
|
21 | - ); ?></label> |
|
19 | + 'Last Name:', |
|
20 | + 'event_espresso' |
|
21 | + ); ?></label> |
|
22 | 22 | <input type="text" class="smaller-text-field" name="ATT_lname" |
23 | 23 | value="<?php echo $attendee->get('ATT_lname'); ?>" id="ATT_lname" |
24 | 24 | placeholder="<?php _e('Last Name', 'event_espresso'); ?>"> |
@@ -7,18 +7,18 @@ discard block |
||
7 | 7 | |
8 | 8 | <h3 class="admin-primary-mbox-h4 hdr-has-icon"><span class="dashicons dashicons-clipboard"></span> |
9 | 9 | <?php _e( |
10 | - 'Registration Items', |
|
11 | - 'event_espresso' |
|
12 | - ); ?></h3> |
|
10 | + 'Registration Items', |
|
11 | + 'event_espresso' |
|
12 | + ); ?></h3> |
|
13 | 13 | |
14 | 14 | <?php echo $line_item_table; ?> |
15 | 15 | |
16 | 16 | <a id="display-additional-registration-session-info" class="display-the-hidden smaller-text" |
17 | 17 | rel="additional-registration-session-info"> |
18 | 18 | <span class="dashicons dashicons-plus-alt"></span><?php _e( |
19 | - 'view additional registration session details', |
|
20 | - 'event_espresso' |
|
21 | - ); ?> |
|
19 | + 'view additional registration session details', |
|
20 | + 'event_espresso' |
|
21 | + ); ?> |
|
22 | 22 | </a> |
23 | 23 | |
24 | 24 | <div id="additional-registration-session-info-dv" class="hidden"> |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | <a id="hide-additional-registration-session-info" class="hide-the-displayed hidden smaller-text" |
27 | 27 | rel="additional-registration-session-info"> |
28 | 28 | <span class="dashicons dashicons-dismiss"></span><?php _e( |
29 | - 'hide additional registration session details', |
|
30 | - 'event_espresso' |
|
31 | - ); ?> |
|
29 | + 'hide additional registration session details', |
|
30 | + 'event_espresso' |
|
31 | + ); ?> |
|
32 | 32 | </a> |
33 | 33 | <br class="clear"/> |
34 | 34 |