PluginProbe
Booking Calendar / 11.7
Booking Calendar v11.7
11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 10.11.2 10.11.3 10.11.4 All 201 releases
booking / includes / _functions / admin_top_bar.php

admin_top_bar.php in Booking Calendar 11.7, at includes/_functions/admin_top_bar.php

334 lines 10.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @version 1.0
4 * @package Booking Calendar
5 * @subpackage Admin Top Bar
6 * @category Functions
7 *
8 * @author wpdevelop
9 * @link https://wpbookingcalendar.com/
10 * @email info@wpbookingcalendar.com
11 *
12 * @modified 2024-09-03
13 */
14
15 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
16
17 // =====================================================================================================================
18 // == Admin Top Bar ==
19 // =====================================================================================================================
20
21
22
23 function wpbc_add__booking_menu__in__admin_top_bar(){
24
25 global $wp_admin_bar;
26
27 $current_user = wpbc_get_current_user();
28
29 $curr_user_role = get_bk_option( 'booking_user_role_booking' );
30 $level = 10;
31 if ($curr_user_role == 'administrator') $level = 10;
32 else if ($curr_user_role == 'editor') $level = 7;
33 else if ($curr_user_role == 'author') $level = 2;
34 else if ($curr_user_role == 'contributor') $level = 1;
35 else if ($curr_user_role == 'subscriber') $level = 0;
36
37 $is_super_admin = apply_bk_filter('multiuser_is_user_can_be_here', false, 'only_super_admin');
38 if ( ( ($current_user->user_level < $level) && (! $is_super_admin) ) || !is_admin_bar_showing() ) return;
39
40
41 $update_title = wpbc_get_svg_logo_for_html() . '&nbsp;' . 'Booking Calendar';
42
43 $is_user_activated = apply_bk_filter( 'multiuser_is_current_user_active', true ); // FixIn: 6.0.1.17.
44 $update_count = wpbc_db_get_number_new_bookings();
45 if ( ( $update_count > 0 ) && ( $is_user_activated ) ) {
46 $update_title .= "&nbsp;<span class='booking-count bk-update-count' style='background: #f0f0f1;color: #2c3338;display: inline;padding: 2px 5px;font-weight: 600;border-radius: 10px;'>" . number_format_i18n( $update_count ) . '</span>';
47 }
48
49 $link_bookings = wpbc_get_bookings_url();
50 $link_res = wpbc_get_resources_url();
51 $link_settings = wpbc_get_settings_url();
52
53 // FixIn: 9.8.15.9.
54 $wp_admin_bar->add_menu(
55 array(
56 'id' => 'wpbc_bar',
57 'title' => $update_title ,
58 'href' => wpbc_get_bookings_url()
59 )
60 );
61
62 $wp_admin_bar->add_menu(
63 array(
64 'id' => 'wpbc_bar_bookings',
65 'title' => __( 'Bookings', 'booking' ),
66 'href' => wpbc_get_bookings_url(),
67 'parent' => 'wpbc_bar',
68 )
69 );
70 $wp_admin_bar->add_menu(
71 array(
72 'id' => 'wpbc_bar_booking_listing',
73 'title' => __( 'Booking Listing', 'booking' ),
74 'href' => wpbc_get_bookings_url() . '&tab=vm_booking_listing',
75 'parent' => 'wpbc_bar_bookings',
76 )
77 );
78 $wp_admin_bar->add_menu(
79 array(
80 'id' => 'wpbc_bar_calendar_overview',
81 'title' => __( 'Timeline View', 'booking' ),
82 'href' => wpbc_get_bookings_url() . '&tab=vm_calendar',
83 'parent' => 'wpbc_bar_bookings',
84 )
85 );
86
87
88 $curr_user_role_settings = get_bk_option( 'booking_user_role_settings' );
89 $level = 10;
90 if ($curr_user_role_settings == 'administrator') $level = 10;
91 else if ($curr_user_role_settings == 'editor') $level = 7;
92 else if ($curr_user_role_settings == 'author') $level = 2;
93 else if ($curr_user_role_settings == 'contributor') $level = 1;
94 else if ($curr_user_role_settings == 'subscriber') $level = 0;
95
96 if ( ( ($current_user->user_level < $level) && (! $is_super_admin) ) || !is_admin_bar_showing() ) return;
97
98 // Booking > Add booking page
99 $wp_admin_bar->add_menu(
100 array(
101 'id' => 'wpbc_bar_new',
102 'title' => __( 'Add booking', 'booking' ),
103 'href' => wpbc_get_new_booking_url(),
104 'parent' => 'wpbc_bar',
105 )
106 );
107
108 // Booking > Availability page
109 $wp_admin_bar->add_menu(
110 array(
111 'id' => 'wpbc_bar_availability',
112 'title' => __( 'Availability', 'booking' ),
113 'href' => wpbc_get_availability_url(),
114 'parent' => 'wpbc_bar',
115 )
116 );
117 $wp_admin_bar->add_menu(
118 array(
119 'id' => 'wpbc_bar_days_availability',
120 'title' => __( 'Days Availability', 'booking' ),
121 'href' => wpbc_get_availability_url() ,
122 'parent' => 'wpbc_bar_availability'
123 )
124 );
125 $wp_admin_bar->add_menu(
126 array(
127 'id' => 'wpbc_bar_time_slots_availability',
128 'title' => __( 'Time Slots Availability', 'booking' ),
129 'href' => function_exists( 'wpbc_get_time_slots_availability_url' ) ? wpbc_get_time_slots_availability_url() : admin_url( 'admin.php?page=wpbc-availability&tab=time_slots_availability' ),
130 'parent' => 'wpbc_bar_availability'
131 )
132 );
133 if ( wpbc_is_mu_user_can_be_here( 'only_super_admin' ) )
134 $wp_admin_bar->add_menu(
135 array(
136 'id' => 'wpbc_bar_general_availability',
137 'title' => __( 'General Availability', 'booking' ),
138 'href' => function_exists( 'wpbc_get_general_availability_url' ) ? wpbc_get_general_availability_url() : admin_url( 'admin.php?page=wpbc-availability&tab=general_availability' ),
139 'parent' => 'wpbc_bar_availability'
140 )
141 );
142
143 if ( class_exists( 'wpdev_bk_biz_m' ) ){
144 $wp_admin_bar->add_menu(
145 array(
146 'id' => 'wpbc_bar_seasons_availability',
147 'title' => __( 'Season Availability', 'booking' ),
148 'href' => wpbc_get_availability_url() . '&tab=season_availability',
149 'parent' => 'wpbc_bar_availability'
150 )
151 );
152
153 $wp_admin_bar->add_menu(
154 array(
155 'id' => 'wpbc_bar_seasons_filters',
156 'title' => __( 'Seasons', 'booking' ),
157 'href' => wpbc_get_availability_url() . '',
158 'parent' => 'wpbc_bar_availability'
159 )
160 );
161 }
162
163 // Booking > Prices page
164 if ( class_exists( 'wpdev_bk_biz_m' ) ){
165
166 $wp_admin_bar->add_menu(
167 array(
168 'id' => 'wpbc_bar_prices',
169 'title' => __( 'Prices', 'booking' ),
170 'href' => wpbc_get_price_url(),
171 'parent' => 'wpbc_bar',
172 )
173 );
174 $wp_admin_bar->add_menu(
175 array(
176 'id' => 'wpbc_bar_daily_costs',
177 'title' => __('Daily Costs','booking'),
178 'href' => wpbc_get_price_url() . '&tab=cost',
179 'parent' => 'wpbc_bar_prices',
180 )
181 );
182 $wp_admin_bar->add_menu(
183 array(
184 'id' => 'wpbc_bar_cost_advanced',
185 'title' => __('Form Options Costs','booking'),
186 'href' => wpbc_get_price_url() . '&tab=cost_advanced',
187 'parent' => 'wpbc_bar_prices',
188 )
189 );
190 if ( class_exists( 'wpdev_bk_biz_l' ) ){
191 $wp_admin_bar->add_menu(
192 array(
193 'id' => 'wpbc_bar_coupons',
194 'title' => __('Discount Coupons','booking'),
195 'href' => wpbc_get_price_url() . '&tab=coupons',
196 'parent' => 'wpbc_bar_prices',
197 )
198 );
199 }
200 $wp_admin_bar->add_menu(
201 array(
202 'id' => 'wpbc_bar_seasons_costs',
203 'title' => __( 'Seasons', 'booking' ),
204 'href' => wpbc_get_price_url() . '',
205 'parent' => 'wpbc_bar_prices'
206 )
207 );
208 $wp_admin_bar->add_menu(
209 array(
210 'id' => 'wpbc_bar_costs_payment_gateways',
211 'title' => __( 'Payment Setup', 'booking' ),
212 'href' => wpbc_get_settings_url() . '&tab=payment',
213 'parent' => 'wpbc_bar_prices'
214 )
215 );
216
217 }
218
219 //Booking > Resources page
220 $wp_admin_bar->add_menu(
221 array(
222 'id' => 'wpbc_bar_resources',
223 'title' => ( ( class_exists( 'wpdev_bk_personal' ) ) ? __( 'Resources', 'booking' ) : __( 'Resource', 'booking' ) ),
224 'href' => $link_res,
225 'parent' => 'wpbc_bar',
226 )
227 );
228 $wp_admin_bar->add_menu(
229 array(
230 'id' => 'wpbc_bar_resources_general',
231 'title' => ( ( class_exists( 'wpdev_bk_personal' ) ) ? __( 'Resources', 'booking' ) : __( 'Resource', 'booking' ) ),
232 'href' => $link_res,
233 'parent' => 'wpbc_bar_resources',
234 )
235 );
236
237 if ( class_exists( 'wpdev_bk_biz_l' ) )
238 $wp_admin_bar->add_menu(
239 array(
240 'id' => 'wpbc_bar_resources_searchable',
241 'title' => __( 'Search Resources Setup', 'booking' ),//__( 'Searchable Resources', 'booking' ),//__( 'Search Availability', 'booking' ),
242 'href' => $link_res . '&tab=searchable_resources',
243 'parent' => 'wpbc_bar_resources'
244 )
245 );
246
247 // if ($is_super_admin)
248 // if ( class_exists( 'wpdev_bk_biz_l' ) )
249 // $wp_admin_bar->add_menu(
250 // array(
251 // 'id' => 'wpbc_bar_resources_search',
252 // 'title' => __( 'Search Form / Results', 'booking' ),
253 // 'href' => $link_settings . '&tab=search',
254 // 'parent' => 'wpbc_bar_resources'
255 // )
256 // );
257
258
259 //Booking > Settings General page
260
261 $wp_admin_bar->add_menu(
262 array(
263 'id' => 'wpbc_bar_settings',
264 'title' => __( 'Settings', 'booking' ),
265 'href' => wpbc_get_settings_url(),
266 'parent' => 'wpbc_bar',
267 )
268 );
269
270 if ($is_super_admin)
271 $wp_admin_bar->add_menu(
272 array(
273 'id' => 'wpbc_bar_settings_general',
274 'title' => __( 'General', 'booking' ),
275 'href' => $link_settings,
276 'parent' => 'wpbc_bar_settings'
277 )
278 );
279 $wp_admin_bar->add_menu(
280 array(
281 'id' => 'wpbc_bar_settings_form',
282 'title' => __( 'Booking Form', 'booking' ),
283 'href' => $link_settings . '&tab=builder_booking_form',
284 'parent' => 'wpbc_bar_settings'
285 )
286 );
287 $wp_admin_bar->add_menu(
288 array(
289 'id' => 'wpbc_bar_settings_email',
290 'title' => __( 'Emails', 'booking' ),
291 'href' => $link_settings . '&tab=email',
292 'parent' => 'wpbc_bar_settings'
293 )
294 );
295 $wp_admin_bar->add_menu(
296 array(
297 'id' => 'wpbc_bar_settings_sync',
298 'title' => __( 'Sync', 'booking' ), //FixIn: 8.0
299 'href' => $link_settings . '&tab=sync',
300 'parent' => 'wpbc_bar_settings'
301 )
302 );
303 if ( class_exists( 'wpdev_bk_biz_s' ) )
304 $wp_admin_bar->add_menu(
305 array(
306 'id' => 'wpbc_bar_settings_payment',
307 'title' => __( 'Payment Setup', 'booking' ),
308 'href' => $link_settings . '&tab=payment',
309 'parent' => 'wpbc_bar_settings'
310 )
311 );
312
313 if ( ( class_exists( 'wpdev_bk_biz_l' ) ) && ( wpbc_is_mu_user_can_be_here( 'only_super_admin' ) ) )
314 $wp_admin_bar->add_menu(
315 array(
316 'id' => 'wpbc_bar_settings_search',
317 'title' => __( 'Search Form / Results', 'booking' ),
318 'href' => $link_settings . '&tab=search',
319 'parent' => 'wpbc_bar_settings'
320 )
321 );
322 if ( class_exists( 'wpdev_bk_multiuser' ) )
323 if ($is_super_admin)
324 $wp_admin_bar->add_menu(
325 array(
326 'id' => 'wpbc_bar_settings_users',
327 'title' => __( 'Users', 'booking' ),
328 'href' => $link_settings . '&tab=users',
329 'parent' => 'wpbc_bar_settings'
330 )
331 );
332 }
333 add_action( 'admin_bar_menu', 'wpbc_add__booking_menu__in__admin_top_bar', 70 ); // Add - TOP Bar - in admin menu
334