PluginProbe
Booking Calendar / 10.10
Booking Calendar v10.10
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 10.11.3 All 202 releases
booking / core / admin / page-new.php

page-new.php in Booking Calendar 10.10, at core/admin/page-new.php

152 lines 8.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php /**
2 * @version 1.0
3 * @package Booking Calendar
4 * @category Content of Add New Booking
5 * @author wpdevelop
6 *
7 * @web-site https://wpbookingcalendar.com/
8 * @email info@wpbookingcalendar.com
9 *
10 * @modified 2015-10-31
11 */
12
13 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
15
16 /**
17 * Show Content
18 * Update Content
19 * Define Slug
20 * Define where to show
21 */
22 class WPBC_Page_AddNewBooking extends WPBC_Page_Structure {
23
24
25 public function in_page() {
26 return 'wpbc-new';
27 }
28
29 public function tabs() {
30
31 $tabs = array();
32 $tabs[ 'add-booking' ] = array(
33 'title' => __('Add booking','booking') // Title of TAB
34 , 'hint' => __('Add booking', 'booking') // Hint
35 , 'page_title' => __('Add booking', 'booking') // Title of Page
36 , 'link' => '' // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link
37 , 'position' => '' // 'left' || 'right' || ''
38 , 'css_classes' => '' // CSS class(es)
39 , 'icon' => '' // Icon - link to the real PNG img
40 , 'font_icon' => 'wpbc-bi-calendar-plus' // CSS definition of forn Icon
41 , 'default' => true // Is this tab activated by default or not: true || false.
42 , 'disabled' => false // Is this tab disbaled: true || false.
43 , 'hided' => true // Is this tab hided: true || false.
44 , 'subtabs' => array()
45 );
46
47 return $tabs;
48 }
49
50
51 public function content() {
52
53 do_action( 'wpbc_hook_add_booking_page_header', 'add_booking'); // Define Notices Section and show some static messages, if needed
54
55 if ( ! wpbc_is_mu_user_can_be_here( 'activated_user' ) ) return false; // Check if MU user activated, otherwise show Warning message.
56
57 if ( ! wpbc_set_default_resource_to__get() ) return false; // Define default booking resources for $_ GET and check if booking resource belong to user
58
59 ?><span class="wpdevelop"><?php // BS UI CSS Class
60
61 wpbc_js_for_bookings_page(); // JavaScript functions
62
63 //wpbc_welcome_panel(); // Welcome Panel (links)
64
65
66 // T o o l b a r s /////////////////////////////////////////////////
67 wpbc_add_new_booking_toolbar();
68
69 ?></span><!-- wpdevelop class --><?php
70
71 ?><div class="clear" style="height:40px;"></div><?php
72
73 ?><div class="add_booking_page_content" style="width:100%;margin-bottom:100px;"><?php
74
75 // Previously we defined booking resources to $_GET
76 $bk_type = isset( $_GET['booking_type'] ) ? intval( $_GET['booking_type'] ) : 1; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
77
78 // do_action( 'wpdev_bk_add_form', $bk_type, get_bk_option( 'booking_client_cal_count' ) );
79
80 $saved_user_calendar_params = $this->get_saved_user_calendar_options();
81
82 make_bk_action( 'wpdevbk_add_form'
83 , $bk_type // $bk_type =1
84 , $saved_user_calendar_params['months_number'] // get_bk_option( 'booking_client_cal_count' ) // $cal_count = 1
85 , 1 // $is_echo = 1
86 , 'standard' // $my_booking_form = 'standard'
87 , '' // $my_selected_dates_without_calendar = ''
88 , false // $start_month_calendar = false
89 , '{calendar' . $saved_user_calendar_params['options_param'] . '}' // $bk_otions=array()
90 ); // FixIn: 6.0.1.6.
91
92 ?></div><?php
93
94
95 ?><hr /><?php
96 wpbc_toolbar_is_send_emails_btn_duplicated();
97
98
99 wpbc_bs_javascript_popover(); // JS Popover
100
101 do_action( 'wpbc_hook_add_booking_page_footer', 'add_booking' );
102 }
103
104
105 /**
106 * Get Calendar Options of specific User
107 *
108 * @return array (number of months, options parameter
109 */
110 function get_saved_user_calendar_options() {
111
112 // Get possible saved previous "Custom User Calendar data"
113 $user_calendar_options = get_user_option( 'booking_custom_' . 'add_booking_calendar_options', wpbc_get_current_user_id() );
114
115 if ( $user_calendar_options === false ) { // Default, if no saved previously.
116 $user_calendar_options = array();
117 $user_calendar_options['calendar_months_count'] = 1;
118 $user_calendar_options['calendar_months_num_in_1_row'] = 0 ;
119 $user_calendar_options['calendar_width'] = '';
120 $user_calendar_options['calendar_widthunits'] = 'px';
121 $user_calendar_options['calendar_cell_height'] = '';
122 $user_calendar_options['calendar_cell_heightunits'] = 'px';
123 } else {
124 $user_calendar_options = maybe_unserialize( $user_calendar_options );
125 }
126
127 if ( ! empty( $user_calendar_options['calendar_months_count'] ) )
128 $selected_calendar_months_count = intval ( $user_calendar_options['calendar_months_count'] );
129 else $selected_calendar_months_count = 1;
130
131 if ( ! empty( $user_calendar_options['calendar_months_num_in_1_row'] ) )
132 $option_months_num_in_row = ' months_num_in_row=' . intval ( $user_calendar_options['calendar_months_num_in_1_row'] );
133 else $option_months_num_in_row = '';
134
135 if ( ! empty( $user_calendar_options['calendar_width'] ) ) {
136 $unit_value = ( esc_attr( $user_calendar_options['calendar_widthunits'] ) == 'percent' ) ? '%' : esc_attr( $user_calendar_options['calendar_widthunits'] );
137 $option_width = ' width=' . intval( $user_calendar_options['calendar_width'] ) . $unit_value;
138 $option_width .= ' strong_width=' . intval( $user_calendar_options['calendar_width'] ) . $unit_value; // FixIn: 9.3.1.6.
139 } else $option_width = '';
140
141 if ( ! empty( $user_calendar_options['calendar_cell_height'] ) ) {
142 $unit_value = ( esc_attr( $user_calendar_options['calendar_cell_heightunits'] ) == 'percent' ) ? '%' : esc_attr( $user_calendar_options['calendar_cell_heightunits'] );
143 $option_cell_height = ' cell_height=' . intval( $user_calendar_options['calendar_cell_height'] ) . $unit_value;
144 } else $option_cell_height = '';
145
146
147 return array( 'months_number'=> $selected_calendar_months_count, 'options_param' => $option_months_num_in_row . $option_width . $option_cell_height );
148 }
149
150 }
151 add_action('wpbc_menu_created', array( new WPBC_Page_AddNewBooking() , '__construct') ); // Executed after creation of Menu
152