PluginProbe
Booking Calendar / 10.10.1
Booking Calendar v10.10.1
11.8.3 11.8.2 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 All 203 releases
booking / includes / _functions / admin_top_bar.php

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

333 lines 10.4 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_count = wpbc_db_get_number_new_bookings();
42
43 $title = 'Booking Calendar';//__('Booking Calendar' ,'booking'); // FixIn: 9.1.3.3.
44 $update_title = ''// '<img src="'.WPBC_PLUGIN_URL .'/assets/img/icon-16x16.png" style="height: 16px;vertical-align: sub;" />&nbsp;'
45 . $title;
46
47
48
49 $is_user_activated = apply_bk_filter('multiuser_is_current_user_active', true ); // FixIn: 6.0.1.17.
50 if ( ( $update_count > 0) && ( $is_user_activated ) ) {
51 $update_count_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;'>"
52 . number_format_i18n($update_count)
53 . "</span>" ; //id='booking-count'
54 $update_title .= $update_count_title;
55 }
56
57 $link_bookings = wpbc_get_bookings_url();
58 $link_res = wpbc_get_resources_url();
59 $link_settings = wpbc_get_settings_url();
60
61 // FixIn: 9.8.15.9.
62 $wp_admin_bar->add_menu(
63 array(
64 'id' => 'wpbc_bar',
65 'title' => $update_title ,
66 'href' => wpbc_get_bookings_url()
67 )
68 );
69
70 $wp_admin_bar->add_menu(
71 array(
72 'id' => 'wpbc_bar_bookings',
73 'title' => __( 'Bookings', 'booking' ),
74 'href' => wpbc_get_bookings_url(),
75 'parent' => 'wpbc_bar',
76 )
77 );
78 $wp_admin_bar->add_menu(
79 array(
80 'id' => 'wpbc_bar_booking_listing',
81 'title' => __( 'Booking Listing', 'booking' ),
82 'href' => wpbc_get_bookings_url() . '&view_mode=vm_listing',
83 'parent' => 'wpbc_bar_bookings',
84 )
85 );
86 $wp_admin_bar->add_menu(
87 array(
88 'id' => 'wpbc_bar_calendar_overview',
89 'title' => __( 'Timeline View', 'booking' ),
90 'href' => wpbc_get_bookings_url() . '&view_mode=vm_calendar',
91 'parent' => 'wpbc_bar_bookings',
92 )
93 );
94
95
96 $curr_user_role_settings = get_bk_option( 'booking_user_role_settings' );
97 $level = 10;
98 if ($curr_user_role_settings == 'administrator') $level = 10;
99 else if ($curr_user_role_settings == 'editor') $level = 7;
100 else if ($curr_user_role_settings == 'author') $level = 2;
101 else if ($curr_user_role_settings == 'contributor') $level = 1;
102 else if ($curr_user_role_settings == 'subscriber') $level = 0;
103
104 if ( ( ($current_user->user_level < $level) && (! $is_super_admin) ) || !is_admin_bar_showing() ) return;
105
106 // Booking > Add booking page
107 $wp_admin_bar->add_menu(
108 array(
109 'id' => 'wpbc_bar_new',
110 'title' => __( 'Add booking', 'booking' ),
111 'href' => wpbc_get_new_booking_url(),
112 'parent' => 'wpbc_bar',
113 )
114 );
115
116 // Booking > Availability page
117 $wp_admin_bar->add_menu(
118 array(
119 'id' => 'wpbc_bar_availability',
120 'title' => __( 'Availability', 'booking' ),
121 'href' => wpbc_get_availability_url(),
122 'parent' => 'wpbc_bar',
123 )
124 );
125 $wp_admin_bar->add_menu(
126 array(
127 'id' => 'wpbc_bar_days_availability',
128 'title' => __( 'Days Availability', 'booking' ),
129 'href' => wpbc_get_availability_url() ,
130 'parent' => 'wpbc_bar_availability'
131 )
132 );
133 if ( class_exists( 'wpdev_bk_biz_m' ) ){
134 $wp_admin_bar->add_menu(
135 array(
136 'id' => 'wpbc_bar_seasons_availability',
137 'title' => __( 'Season Availability', 'booking' ),
138 'href' => wpbc_get_availability_url() . '&tab=season_availability',
139 'parent' => 'wpbc_bar_availability'
140 )
141 );
142
143 $wp_admin_bar->add_menu(
144 array(
145 'id' => 'wpbc_bar_seasons_filters',
146 'title' => __( 'Seasons', 'booking' ),
147 'href' => wpbc_get_availability_url() . '&tab=filter',
148 'parent' => 'wpbc_bar_availability'
149 )
150 );
151 }
152 if ( wpbc_is_mu_user_can_be_here( 'only_super_admin' ) )
153 $wp_admin_bar->add_menu(
154 array(
155 'id' => 'wpbc_bar_general_availability',
156 'title' => __( 'General Availability', 'booking' ),
157 'href' => wpbc_get_settings_url() . '&scroll_to_section=wpbc_general_settings_availability_tab',
158 'parent' => 'wpbc_bar_availability'
159 )
160 );
161
162 // Booking > Prices page
163 if ( class_exists( 'wpdev_bk_biz_m' ) ){
164
165 $wp_admin_bar->add_menu(
166 array(
167 'id' => 'wpbc_bar_prices',
168 'title' => __( 'Prices', 'booking' ),
169 'href' => wpbc_get_price_url(),
170 'parent' => 'wpbc_bar',
171 )
172 );
173 $wp_admin_bar->add_menu(
174 array(
175 'id' => 'wpbc_bar_daily_costs',
176 'title' => __('Daily Costs','booking'),
177 'href' => wpbc_get_price_url() . '&tab=cost',
178 'parent' => 'wpbc_bar_prices',
179 )
180 );
181 $wp_admin_bar->add_menu(
182 array(
183 'id' => 'wpbc_bar_cost_advanced',
184 'title' => __('Form Options Costs','booking'),
185 'href' => wpbc_get_price_url() . '&tab=cost_advanced',
186 'parent' => 'wpbc_bar_prices',
187 )
188 );
189 if ( class_exists( 'wpdev_bk_biz_l' ) ){
190 $wp_admin_bar->add_menu(
191 array(
192 'id' => 'wpbc_bar_coupons',
193 'title' => __('Discount Coupons','booking'),
194 'href' => wpbc_get_price_url() . '&tab=coupons',
195 'parent' => 'wpbc_bar_prices',
196 )
197 );
198 }
199 $wp_admin_bar->add_menu(
200 array(
201 'id' => 'wpbc_bar_seasons_costs',
202 'title' => __( 'Seasons', 'booking' ),
203 'href' => wpbc_get_price_url() . '&tab=filter',
204 'parent' => 'wpbc_bar_prices'
205 )
206 );
207 $wp_admin_bar->add_menu(
208 array(
209 'id' => 'wpbc_bar_costs_payment_gateways',
210 'title' => __( 'Payment Setup', 'booking' ),
211 'href' => wpbc_get_settings_url() . '&tab=payment',
212 'parent' => 'wpbc_bar_prices'
213 )
214 );
215
216 }
217
218 //Booking > Resources page
219 $wp_admin_bar->add_menu(
220 array(
221 'id' => 'wpbc_bar_resources',
222 'title' => ( ( class_exists( 'wpdev_bk_personal' ) ) ? __( 'Resources', 'booking' ) : __( 'Resource', 'booking' ) ),
223 'href' => $link_res,
224 'parent' => 'wpbc_bar',
225 )
226 );
227 $wp_admin_bar->add_menu(
228 array(
229 'id' => 'wpbc_bar_resources_general',
230 'title' => ( ( class_exists( 'wpdev_bk_personal' ) ) ? __( 'Resources', 'booking' ) : __( 'Resource', 'booking' ) ),
231 'href' => $link_res,
232 'parent' => 'wpbc_bar_resources',
233 )
234 );
235
236 if ( class_exists( 'wpdev_bk_biz_l' ) )
237 $wp_admin_bar->add_menu(
238 array(
239 'id' => 'wpbc_bar_resources_searchable',
240 'title' => __( 'Search Resources Setup', 'booking' ),//__( 'Searchable Resources', 'booking' ),//__( 'Search Availability', 'booking' ),
241 'href' => $link_res . '&tab=searchable_resources',
242 'parent' => 'wpbc_bar_resources'
243 )
244 );
245
246 // if ($is_super_admin)
247 // if ( class_exists( 'wpdev_bk_biz_l' ) )
248 // $wp_admin_bar->add_menu(
249 // array(
250 // 'id' => 'wpbc_bar_resources_search',
251 // 'title' => __( 'Search Form / Results', 'booking' ),
252 // 'href' => $link_settings . '&tab=search',
253 // 'parent' => 'wpbc_bar_resources'
254 // )
255 // );
256
257
258 //Booking > Settings General page
259
260 $wp_admin_bar->add_menu(
261 array(
262 'id' => 'wpbc_bar_settings',
263 'title' => __( 'Settings', 'booking' ),
264 'href' => wpbc_get_settings_url(),
265 'parent' => 'wpbc_bar',
266 )
267 );
268
269 if ($is_super_admin)
270 $wp_admin_bar->add_menu(
271 array(
272 'id' => 'wpbc_bar_settings_general',
273 'title' => __( 'General', 'booking' ),
274 'href' => $link_settings,
275 'parent' => 'wpbc_bar_settings'
276 )
277 );
278 $wp_admin_bar->add_menu(
279 array(
280 'id' => 'wpbc_bar_settings_form',
281 'title' => __( 'Booking Form', 'booking' ),
282 'href' => $link_settings . '&tab=form',
283 'parent' => 'wpbc_bar_settings'
284 )
285 );
286 $wp_admin_bar->add_menu(
287 array(
288 'id' => 'wpbc_bar_settings_email',
289 'title' => __( 'Emails', 'booking' ),
290 'href' => $link_settings . '&tab=email',
291 'parent' => 'wpbc_bar_settings'
292 )
293 );
294 $wp_admin_bar->add_menu(
295 array(
296 'id' => 'wpbc_bar_settings_sync',
297 'title' => __( 'Sync', 'booking' ), //FixIn: 8.0
298 'href' => $link_settings . '&tab=sync',
299 'parent' => 'wpbc_bar_settings'
300 )
301 );
302 if ( class_exists( 'wpdev_bk_biz_s' ) )
303 $wp_admin_bar->add_menu(
304 array(
305 'id' => 'wpbc_bar_settings_payment',
306 'title' => __( 'Payment Setup', 'booking' ),
307 'href' => $link_settings . '&tab=payment',
308 'parent' => 'wpbc_bar_settings'
309 )
310 );
311
312 if ( ( class_exists( 'wpdev_bk_biz_l' ) ) && ( wpbc_is_mu_user_can_be_here( 'only_super_admin' ) ) )
313 $wp_admin_bar->add_menu(
314 array(
315 'id' => 'wpbc_bar_settings_search',
316 'title' => __( 'Search Form / Results', 'booking' ),
317 'href' => $link_settings . '&tab=search',
318 'parent' => 'wpbc_bar_settings'
319 )
320 );
321 if ( class_exists( 'wpdev_bk_multiuser' ) )
322 if ($is_super_admin)
323 $wp_admin_bar->add_menu(
324 array(
325 'id' => 'wpbc_bar_settings_users',
326 'title' => __( 'Users', 'booking' ),
327 'href' => $link_settings . '&tab=users',
328 'parent' => 'wpbc_bar_settings'
329 )
330 );
331 }
332 add_action( 'admin_bar_menu', 'wpbc_add__booking_menu__in__admin_top_bar', 70 ); // Add - TOP Bar - in admin menu
333