| 1 |
<?php /** |
| 2 |
* @version 1.0 |
| 3 |
* @package Booking Calendar |
| 4 |
* @category Simple Booking Form Setup |
| 5 |
* @author wpdevelop |
| 6 |
* |
| 7 |
* @web-site https://wpbookingcalendar.com/ |
| 8 |
* @email info@wpbookingcalendar.com |
| 9 |
* |
| 10 |
* @modified 2024-08-16 |
| 11 |
*/ |
| 12 |
|
| 13 |
if ( ! defined( 'ABSPATH' ) ) { |
| 14 |
exit; // Exit if accessed directly. |
| 15 |
} |
| 16 |
|
| 17 |
/** |
| 18 |
* Get 'Blank Visual Structure' of booking form |
| 19 |
* |
| 20 |
* It can be imported from very old Free version, if such options exist in plugin DB, otherwise it is blank template |
| 21 |
* |
| 22 |
* @return array |
| 23 |
*/ |
| 24 |
function wpbc_simple_form__visual__get_default_form() { |
| 25 |
$visual_form_structure = array(); |
| 26 |
// Calendar. |
| 27 |
$visual_form_structure[] = array( |
| 28 |
'type' => 'calendar', |
| 29 |
'name' => 'calendar', |
| 30 |
'obligatory' => 'On', |
| 31 |
'if_exist_required' => 'On', |
| 32 |
'label' => '', // __('Select date', 'booking') //. |
| 33 |
); |
| 34 |
// Time - Slots. |
| 35 |
$time_slots_arr = array( |
| 36 |
'09:00 - 10:00', |
| 37 |
'10:00 - 11:00', |
| 38 |
'11:00 - 12:00', |
| 39 |
'12:00 - 13:00', |
| 40 |
'13:00 - 14:00', |
| 41 |
'14:00 - 15:00', |
| 42 |
'15:00 - 16:00', |
| 43 |
'16:00 - 17:00', |
| 44 |
'17:00 - 18:00', |
| 45 |
'18:00 - 19:00', |
| 46 |
); |
| 47 |
$time_slots_str = ''; |
| 48 |
foreach ( $time_slots_arr as $time_slot_v ) { |
| 49 |
$time_slots_str .= wpbc_time_slot_in_format( $time_slot_v ) . '@@' . $time_slot_v . "\r\n"; |
| 50 |
} |
| 51 |
$time_slots_str .= 'Full Day@@00:00 - 24:00'; |
| 52 |
|
| 53 |
$visual_form_structure[] = array( |
| 54 |
'type' => 'selectbox', |
| 55 |
'name' => 'rangetime', |
| 56 |
'obligatory' => 'Off', |
| 57 |
'active' => 'On', |
| 58 |
'required' => 'On', |
| 59 |
'if_exist_required' => 'On', |
| 60 |
'label' => __( 'Time Slots', 'booking' ), |
| 61 |
'value' => $time_slots_str, |
| 62 |
); |
| 63 |
// First Name. |
| 64 |
$visual_form_structure[] = array( |
| 65 |
'type' => 'text', |
| 66 |
'name' => 'name', |
| 67 |
'obligatory' => 'Off', |
| 68 |
'active' => empty( get_bk_option( 'booking_form_field_active1' ) ) ? 'On' : get_bk_option( 'booking_form_field_active1' ), |
| 69 |
'required' => empty( get_bk_option( 'booking_form_field_required1' ) ) ? 'On' : get_bk_option( 'booking_form_field_required1' ), |
| 70 |
'label' => empty( get_bk_option( 'booking_form_field_label1' ) ) ? __( 'First Name', 'booking' ) : get_bk_option( 'booking_form_field_label1' ), |
| 71 |
); |
| 72 |
// Second Name. |
| 73 |
$visual_form_structure[] = array( |
| 74 |
'type' => 'text', |
| 75 |
'name' => 'secondname', |
| 76 |
'obligatory' => 'Off', |
| 77 |
'active' => empty( get_bk_option( 'booking_form_field_active2' ) ) ? 'On' : get_bk_option( 'booking_form_field_active2' ), |
| 78 |
'required' => empty( get_bk_option( 'booking_form_field_required2' ) ) ? 'On' : get_bk_option( 'booking_form_field_required2' ), |
| 79 |
'label' => empty( get_bk_option( 'booking_form_field_label2' ) ) ? __( 'Second Name', 'booking' ) : get_bk_option( 'booking_form_field_label2' ), |
| 80 |
); |
| 81 |
// Email. |
| 82 |
$visual_form_structure[] = array( |
| 83 |
'type' => 'email', |
| 84 |
'name' => 'email', |
| 85 |
'obligatory' => 'On', |
| 86 |
'active' => 'On', |
| 87 |
'required' => 'On', |
| 88 |
'label' => empty( get_bk_option( 'booking_form_field_label3' ) ) ? __( 'Email', 'booking' ) : get_bk_option( 'booking_form_field_label3' ), |
| 89 |
); |
| 90 |
// Visitors. |
| 91 |
$visual_form_structure[] = array( |
| 92 |
'type' => 'selectbox', |
| 93 |
'name' => 'visitors', |
| 94 |
'obligatory' => 'Off', |
| 95 |
'active' => empty( get_bk_option( 'booking_form_field_active6' ) ) ? 'On' : get_bk_option( 'booking_form_field_active6' ), |
| 96 |
'required' => empty( get_bk_option( 'booking_form_field_required6' ) ) ? 'Off' : get_bk_option( 'booking_form_field_required6' ), |
| 97 |
'label' => empty( get_bk_option( 'booking_form_field_label6' ) ) ? __( 'Visitors', 'booking' ) : get_bk_option( 'booking_form_field_label6' ), |
| 98 |
'value' => ( empty( get_bk_option( 'booking_form_field_values6' ) ) ? ( '1' . "\r\n" . '2' . "\r\n" . '3' . "\r\n" . '4' ) : get_bk_option( 'booking_form_field_values6' ) ), |
| 99 |
); |
| 100 |
// Phone. |
| 101 |
$visual_form_structure[] = array( |
| 102 |
'type' => 'text', |
| 103 |
'name' => 'phone', |
| 104 |
'obligatory' => 'Off', |
| 105 |
'active' => empty( get_bk_option( 'booking_form_field_active4' ) ) ? 'On' : get_bk_option( 'booking_form_field_active4' ), |
| 106 |
'required' => empty( get_bk_option( 'booking_form_field_required4' ) ) ? 'Off' : get_bk_option( 'booking_form_field_required4' ), |
| 107 |
'label' => empty( get_bk_option( 'booking_form_field_label4' ) ) ? __( 'Phone', 'booking' ) : get_bk_option( 'booking_form_field_label4' ), |
| 108 |
); |
| 109 |
// Details - textarea. |
| 110 |
$visual_form_structure[] = array( |
| 111 |
'type' => 'textarea', |
| 112 |
'name' => 'details', |
| 113 |
'obligatory' => 'Off', |
| 114 |
'active' => empty( get_bk_option( 'booking_form_field_active5' ) ) ? 'On' : get_bk_option( 'booking_form_field_active5' ), |
| 115 |
'required' => empty( get_bk_option( 'booking_form_field_required5' ) ) ? 'Off' : get_bk_option( 'booking_form_field_required5' ), |
| 116 |
'label' => empty( get_bk_option( 'booking_form_field_label5' ) ) ? __( 'Details', 'booking' ) : get_bk_option( 'booking_form_field_label5' ), |
| 117 |
); |
| 118 |
// CAPTCHA. |
| 119 |
$visual_form_structure[] = array( |
| 120 |
'type' => 'captcha', |
| 121 |
'name' => 'captcha', |
| 122 |
'obligatory' => 'Off', |
| 123 |
'active' => ( 'On' === get_bk_option( 'booking_is_use_captcha' ) ) ? 'On' : 'Off', |
| 124 |
'required' => 'On', |
| 125 |
'if_exist_required' => 'On', |
| 126 |
'label' => '', |
| 127 |
); |
| 128 |
// Submit. |
| 129 |
$visual_form_structure[] = array( |
| 130 |
'type' => 'submit', |
| 131 |
'name' => 'submit', |
| 132 |
'obligatory' => 'On', |
| 133 |
'active' => 'On', |
| 134 |
'required' => 'On', |
| 135 |
'if_exist_required' => 'On', |
| 136 |
'label' => empty( get_bk_option( 'booking_send_button_title' ) ) ? __( 'Send', 'booking' ) |
| 137 |
: get_bk_option( 'booking_send_button_title' ), |
| 138 |
); |
| 139 |
|
| 140 |
return $visual_form_structure; |
| 141 |
} |
| 142 |
|
| 143 |
/** |
| 144 |
* Get 'Blank Visual Structure' of booking form |
| 145 |
* |
| 146 |
* It can be imported from very old Free version, if such options exist in plugin DB, otherwise it is blank template |
| 147 |
* |
| 148 |
* @return array |
| 149 |
*/ |
| 150 |
function wpbc_simple_form__visual__get_default_form__times_30min() { |
| 151 |
|
| 152 |
$visual_form_structure = array(); |
| 153 |
|
| 154 |
// Calendar. |
| 155 |
$visual_form_structure[] = array( |
| 156 |
'type' => 'calendar', |
| 157 |
'name' => 'calendar', |
| 158 |
'obligatory' => 'On', |
| 159 |
'if_exist_required' => 'On', |
| 160 |
'label' => __( 'Select date', 'booking' ), |
| 161 |
); |
| 162 |
// Time - Slots. |
| 163 |
$time_slots_arr = array( |
| 164 |
'09:00 - 09:30', |
| 165 |
'09:30 - 10:00', |
| 166 |
'10:00 - 10:30', |
| 167 |
'10:30 - 11:00', |
| 168 |
'11:00 - 11:30', |
| 169 |
'11:30 - 12:00', |
| 170 |
'12:00 - 12:30', |
| 171 |
'12:30 - 13:00', |
| 172 |
'13:00 - 13:30', |
| 173 |
'13:30 - 14:00', |
| 174 |
'14:00 - 14:30', |
| 175 |
'14:30 - 15:00', |
| 176 |
'15:00 - 15:30', |
| 177 |
'15:30 - 16:00', |
| 178 |
'16:00 - 16:30', |
| 179 |
'16:30 - 17:00', |
| 180 |
'17:00 - 17:30', |
| 181 |
'17:30 - 18:00', |
| 182 |
); |
| 183 |
$formated_times_arr = array(); |
| 184 |
foreach ( $time_slots_arr as $time_slot_v ) { |
| 185 |
$formated_times_arr[] = wpbc_time_slot_in_format( $time_slot_v ) . '@@' . $time_slot_v; // . "\r\n";//. |
| 186 |
} |
| 187 |
$time_slots_str = implode( "\r\n", $formated_times_arr ); |
| 188 |
// $time_slots_str .= 'Full Day@@00:00 - 24:00'; //. |
| 189 |
|
| 190 |
$visual_form_structure[] = array( |
| 191 |
'type' => 'selectbox', |
| 192 |
'name' => 'rangetime', |
| 193 |
'obligatory' => 'Off', |
| 194 |
'active' => 'On', |
| 195 |
'required' => 'On', |
| 196 |
'if_exist_required' => 'On', |
| 197 |
'label' => __( 'Select Time', 'booking' ), |
| 198 |
'value' => $time_slots_str, |
| 199 |
); |
| 200 |
|
| 201 |
// First Name. |
| 202 |
$visual_form_structure[] = array( |
| 203 |
'type' => 'text', |
| 204 |
'name' => 'name', |
| 205 |
'obligatory' => 'Off', |
| 206 |
'active' => empty( get_bk_option( 'booking_form_field_active1' ) ) ? 'On' : get_bk_option( 'booking_form_field_active1' ), |
| 207 |
'required' => empty( get_bk_option( 'booking_form_field_required1' ) ) ? 'On' : get_bk_option( 'booking_form_field_required1' ), |
| 208 |
'label' => empty( get_bk_option( 'booking_form_field_label1' ) ) ? __( 'First Name', 'booking' ) : get_bk_option( 'booking_form_field_label1' ), |
| 209 |
); |
| 210 |
// Second Name. |
| 211 |
$visual_form_structure[] = array( |
| 212 |
'type' => 'text', |
| 213 |
'name' => 'secondname', |
| 214 |
'obligatory' => 'Off', |
| 215 |
'active' => empty( get_bk_option( 'booking_form_field_active2' ) ) ? 'On' : get_bk_option( 'booking_form_field_active2' ), |
| 216 |
'required' => empty( get_bk_option( 'booking_form_field_required2' ) ) ? 'On' : get_bk_option( 'booking_form_field_required2' ), |
| 217 |
'label' => empty( get_bk_option( 'booking_form_field_label2' ) ) ? __( 'Second Name', 'booking' ) : get_bk_option( 'booking_form_field_label2' ), |
| 218 |
); |
| 219 |
// Email. |
| 220 |
$visual_form_structure[] = array( |
| 221 |
'type' => 'email', |
| 222 |
'name' => 'email', |
| 223 |
'obligatory' => 'On', |
| 224 |
'active' => 'On', |
| 225 |
'required' => 'On', |
| 226 |
'label' => empty( get_bk_option( 'booking_form_field_label3' ) ) ? __( 'Email', 'booking' ) : get_bk_option( 'booking_form_field_label3' ), |
| 227 |
); |
| 228 |
// Visitors. |
| 229 |
$visual_form_structure[] = array( |
| 230 |
'type' => 'selectbox', |
| 231 |
'name' => 'visitors', |
| 232 |
'obligatory' => 'Off', |
| 233 |
'active' => empty( get_bk_option( 'booking_form_field_active6' ) ) ? 'On' : get_bk_option( 'booking_form_field_active6' ), |
| 234 |
'required' => empty( get_bk_option( 'booking_form_field_required6' ) ) ? 'Off' : get_bk_option( 'booking_form_field_required6' ), |
| 235 |
'label' => empty( get_bk_option( 'booking_form_field_label6' ) ) ? __( 'Visitors', 'booking' ) : get_bk_option( 'booking_form_field_label6' ), |
| 236 |
'value' => ( empty( get_bk_option( 'booking_form_field_values6' ) ) ? ( '1' . "\r\n" . '2' . "\r\n" . '3' . "\r\n" . '4' ) : get_bk_option( 'booking_form_field_values6' ) ), |
| 237 |
); |
| 238 |
// Phone. |
| 239 |
$visual_form_structure[] = array( |
| 240 |
'type' => 'text', |
| 241 |
'name' => 'phone', |
| 242 |
'obligatory' => 'Off', |
| 243 |
'active' => empty( get_bk_option( 'booking_form_field_active4' ) ) ? 'On' : get_bk_option( 'booking_form_field_active4' ), |
| 244 |
'required' => empty( get_bk_option( 'booking_form_field_required4' ) ) ? 'Off' : get_bk_option( 'booking_form_field_required4' ), |
| 245 |
'label' => empty( get_bk_option( 'booking_form_field_label4' ) ) ? __( 'Phone', 'booking' ) : get_bk_option( 'booking_form_field_label4' ), |
| 246 |
); |
| 247 |
// Details - textarea. |
| 248 |
$visual_form_structure[] = array( |
| 249 |
'type' => 'textarea', |
| 250 |
'name' => 'details', |
| 251 |
'obligatory' => 'Off', |
| 252 |
'active' => empty( get_bk_option( 'booking_form_field_active5' ) ) ? 'On' : get_bk_option( 'booking_form_field_active5' ), |
| 253 |
'required' => empty( get_bk_option( 'booking_form_field_required5' ) ) ? 'Off' : get_bk_option( 'booking_form_field_required5' ), |
| 254 |
'label' => empty( get_bk_option( 'booking_form_field_label5' ) ) ? __( 'Details', 'booking' ) : get_bk_option( 'booking_form_field_label5' ), |
| 255 |
); |
| 256 |
// CAPTCHA. |
| 257 |
$visual_form_structure[] = array( |
| 258 |
'type' => 'captcha', |
| 259 |
'name' => 'captcha', |
| 260 |
'obligatory' => 'Off', |
| 261 |
'active' => ( 'On' === get_bk_option( 'booking_is_use_captcha' ) ) ? 'On' : 'Off', |
| 262 |
'required' => 'On', |
| 263 |
'if_exist_required' => 'On', |
| 264 |
'label' => '', |
| 265 |
); |
| 266 |
// Submit. |
| 267 |
$visual_form_structure[] = array( |
| 268 |
'type' => 'submit', |
| 269 |
'name' => 'submit', |
| 270 |
'obligatory' => 'On', |
| 271 |
'active' => 'On', |
| 272 |
'required' => 'On', |
| 273 |
'if_exist_required' => 'On', |
| 274 |
'label' => empty( get_bk_option( 'booking_send_button_title' ) ) ? __( 'Send', 'booking' ) : get_bk_option( 'booking_send_button_title' ), |
| 275 |
); |
| 276 |
|
| 277 |
return $visual_form_structure; |
| 278 |
} |
| 279 |
|
| 280 |
/** |
| 281 |
* Get 'Blank Visual Structure' of booking form |
| 282 |
* |
| 283 |
* It can be imported from very old Free version, if such options exist in plugin DB, otherwise it is blank template |
| 284 |
* |
| 285 |
* @return array |
| 286 |
*/ |
| 287 |
function wpbc_simple_form__visual__get_default_form__without_times() { |
| 288 |
$visual_form_structure = array(); |
| 289 |
// Calendar. |
| 290 |
$visual_form_structure[] = array( |
| 291 |
'type' => 'calendar', |
| 292 |
'name' => 'calendar', |
| 293 |
'obligatory' => 'On', |
| 294 |
'if_exist_required' => 'On', |
| 295 |
'label' => '', //__('Select date', 'booking') //. |
| 296 |
); |
| 297 |
// First Name. |
| 298 |
$visual_form_structure[] = array( |
| 299 |
'type' => 'text', |
| 300 |
'name' => 'name', |
| 301 |
'obligatory' => 'Off', |
| 302 |
'active' => empty( get_bk_option( 'booking_form_field_active1' ) ) ? 'On' |
| 303 |
: get_bk_option( 'booking_form_field_active1' ), |
| 304 |
'required' => empty( get_bk_option( 'booking_form_field_required1' ) ) ? 'On' |
| 305 |
: get_bk_option( 'booking_form_field_required1' ), |
| 306 |
'label' => empty( get_bk_option( 'booking_form_field_label1' ) ) ? __( 'First Name', 'booking' ) |
| 307 |
: get_bk_option( 'booking_form_field_label1' ), |
| 308 |
); |
| 309 |
// Second Name. |
| 310 |
$visual_form_structure[] = array( |
| 311 |
'type' => 'text', |
| 312 |
'name' => 'secondname', |
| 313 |
'obligatory' => 'Off', |
| 314 |
'active' => empty( get_bk_option( 'booking_form_field_active2' ) ) ? 'On' : get_bk_option( 'booking_form_field_active2' ), |
| 315 |
'required' => empty( get_bk_option( 'booking_form_field_required2' ) ) ? 'On' : get_bk_option( 'booking_form_field_required2' ), |
| 316 |
'label' => empty( get_bk_option( 'booking_form_field_label2' ) ) ? __( 'Second Name', 'booking' ) : get_bk_option( 'booking_form_field_label2' ), |
| 317 |
); |
| 318 |
// Email. |
| 319 |
$visual_form_structure[] = array( |
| 320 |
'type' => 'email', |
| 321 |
'name' => 'email', |
| 322 |
'obligatory' => 'On', |
| 323 |
'active' => 'On', |
| 324 |
'required' => 'On', |
| 325 |
'label' => empty( get_bk_option( 'booking_form_field_label3' ) ) ? __( 'Email', 'booking' ) : get_bk_option( 'booking_form_field_label3' ), |
| 326 |
); |
| 327 |
// Visitors. |
| 328 |
$visual_form_structure[] = array( |
| 329 |
'type' => 'selectbox', |
| 330 |
'name' => 'visitors', |
| 331 |
'obligatory' => 'Off', |
| 332 |
'active' => empty( get_bk_option( 'booking_form_field_active6' ) ) ? 'On' : get_bk_option( 'booking_form_field_active6' ), |
| 333 |
'required' => empty( get_bk_option( 'booking_form_field_required6' ) ) ? 'Off' : get_bk_option( 'booking_form_field_required6' ), |
| 334 |
'label' => empty( get_bk_option( 'booking_form_field_label6' ) ) ? __( 'Visitors', 'booking' ) : get_bk_option( 'booking_form_field_label6' ), |
| 335 |
'value' => ( empty( get_bk_option( 'booking_form_field_values6' ) ) ? ( '1' . "\r\n" . '2' . "\r\n" . '3' . "\r\n" . '4' ) : get_bk_option( 'booking_form_field_values6' ) ), |
| 336 |
); |
| 337 |
// Phone. |
| 338 |
$visual_form_structure[] = array( |
| 339 |
'type' => 'text', |
| 340 |
'name' => 'phone', |
| 341 |
'obligatory' => 'Off', |
| 342 |
'active' => empty( get_bk_option( 'booking_form_field_active4' ) ) ? 'On' : get_bk_option( 'booking_form_field_active4' ), |
| 343 |
'required' => empty( get_bk_option( 'booking_form_field_required4' ) ) ? 'Off' : get_bk_option( 'booking_form_field_required4' ), |
| 344 |
'label' => empty( get_bk_option( 'booking_form_field_label4' ) ) ? __( 'Phone', 'booking' ) : get_bk_option( 'booking_form_field_label4' ), |
| 345 |
); |
| 346 |
// Details - textarea. |
| 347 |
$visual_form_structure[] = array( |
| 348 |
'type' => 'textarea', |
| 349 |
'name' => 'details', |
| 350 |
'obligatory' => 'Off', |
| 351 |
'active' => empty( get_bk_option( 'booking_form_field_active5' ) ) ? 'On' : get_bk_option( 'booking_form_field_active5' ), |
| 352 |
'required' => empty( get_bk_option( 'booking_form_field_required5' ) ) ? 'Off' : get_bk_option( 'booking_form_field_required5' ), |
| 353 |
'label' => empty( get_bk_option( 'booking_form_field_label5' ) ) ? __( 'Details', 'booking' ) : get_bk_option( 'booking_form_field_label5' ), |
| 354 |
); |
| 355 |
// CAPTCHA. |
| 356 |
$visual_form_structure[] = array( |
| 357 |
'type' => 'captcha', |
| 358 |
'name' => 'captcha', |
| 359 |
'obligatory' => 'Off', |
| 360 |
'active' => ( 'On' === get_bk_option( 'booking_is_use_captcha' ) ) ? 'On' : 'Off', |
| 361 |
'required' => 'On', |
| 362 |
'if_exist_required' => 'On', |
| 363 |
'label' => '', |
| 364 |
); |
| 365 |
// Submit. |
| 366 |
$visual_form_structure[] = array( |
| 367 |
'type' => 'submit', |
| 368 |
'name' => 'submit', |
| 369 |
'obligatory' => 'On', |
| 370 |
'active' => 'On', |
| 371 |
'required' => 'On', |
| 372 |
'if_exist_required' => 'On', |
| 373 |
'label' => empty( get_bk_option( 'booking_send_button_title' ) ) ? __( 'Send', 'booking' ) : get_bk_option( 'booking_send_button_title' ), |
| 374 |
); |
| 375 |
|
| 376 |
return $visual_form_structure; |
| 377 |
} |
| 378 |
|
| 379 |
|
| 380 |
/** |
| 381 |
* Get 'Visual Structure' of booking form for "Service duraton" (time) and Start time - Wizard form |
| 382 |
* |
| 383 |
* @return array |
| 384 |
*/ |
| 385 |
function wpbc_simple_form__visual__get_default_form__service_duration_a() { |
| 386 |
|
| 387 |
$visual_form_structure = array(); |
| 388 |
|
| 389 |
// Calendar. |
| 390 |
$visual_form_structure[] = array( |
| 391 |
'type' => 'calendar', |
| 392 |
'name' => 'calendar', |
| 393 |
'obligatory' => 'On', |
| 394 |
'if_exist_required' => 'On', |
| 395 |
'label' => __( 'Select date', 'booking' ), |
| 396 |
); |
| 397 |
|
| 398 |
// Duration Time - Service Duration. |
| 399 |
$duration_time_slots_arr = array( |
| 400 |
'Service A (15 min)@@00:15', |
| 401 |
'Service B (20 min)@@00:20', |
| 402 |
'Service C (30 min)@@00:30', |
| 403 |
'Service D (1 hour)@@01:00', |
| 404 |
'Service E (2 hours)@@02:00', |
| 405 |
); |
| 406 |
$duration_time_slots_str = implode( "\r\n", $duration_time_slots_arr ); |
| 407 |
$visual_form_structure[] = array( |
| 408 |
'type' => 'selectbox', |
| 409 |
'name' => 'durationtime', |
| 410 |
'obligatory' => 'Off', |
| 411 |
'active' => 'On', |
| 412 |
'required' => 'On', |
| 413 |
'if_exist_required' => 'On', |
| 414 |
'label' => __( 'Select Service', 'booking' ), |
| 415 |
'value' => $duration_time_slots_str, |
| 416 |
); |
| 417 |
// Start Time. |
| 418 |
$starttime_slots_arr = array( |
| 419 |
'10:00', |
| 420 |
'10:30', |
| 421 |
'11:00', |
| 422 |
'11:30', |
| 423 |
'12:00', |
| 424 |
'12:30', |
| 425 |
'13:00', |
| 426 |
'13:30', |
| 427 |
'14:00', |
| 428 |
'14:30', |
| 429 |
'15:00', |
| 430 |
'15:30', |
| 431 |
'16:00', |
| 432 |
'16:30', |
| 433 |
'17:00', |
| 434 |
'17:30', |
| 435 |
'18:00', |
| 436 |
); |
| 437 |
|
| 438 |
$formated_times_arr = array(); |
| 439 |
foreach ( $starttime_slots_arr as $time_slot_v ) { |
| 440 |
$formated_times_arr[] = wpbc_time_in_format( $time_slot_v ) . '@@' . $time_slot_v; |
| 441 |
} |
| 442 |
$time_slots_str = implode( "\r\n", $formated_times_arr ); |
| 443 |
|
| 444 |
$visual_form_structure[] = array( |
| 445 |
'type' => 'selectbox', |
| 446 |
'name' => 'starttime', |
| 447 |
'obligatory' => 'Off', |
| 448 |
'active' => 'On', |
| 449 |
'required' => 'On', |
| 450 |
'if_exist_required' => 'On', |
| 451 |
'label' => __( 'Select Start Time', 'booking' ), |
| 452 |
'value' => $time_slots_str, |
| 453 |
); |
| 454 |
|
| 455 |
// First Name. |
| 456 |
$visual_form_structure[] = array( |
| 457 |
'type' => 'text', |
| 458 |
'name' => 'name', |
| 459 |
'obligatory' => 'Off', |
| 460 |
'active' => empty( get_bk_option( 'booking_form_field_active1' ) ) ? 'On' : get_bk_option( 'booking_form_field_active1' ), |
| 461 |
'required' => empty( get_bk_option( 'booking_form_field_required1' ) ) ? 'On' : get_bk_option( 'booking_form_field_required1' ), |
| 462 |
'label' => empty( get_bk_option( 'booking_form_field_label1' ) ) ? __( 'First Name', 'booking' ) : get_bk_option( 'booking_form_field_label1' ), |
| 463 |
); |
| 464 |
// Second Name. |
| 465 |
$visual_form_structure[] = array( |
| 466 |
'type' => 'text', |
| 467 |
'name' => 'secondname', |
| 468 |
'obligatory' => 'Off', |
| 469 |
'active' => empty( get_bk_option( 'booking_form_field_active2' ) ) ? 'On' : get_bk_option( 'booking_form_field_active2' ), |
| 470 |
'required' => empty( get_bk_option( 'booking_form_field_required2' ) ) ? 'On' : get_bk_option( 'booking_form_field_required2' ), |
| 471 |
'label' => empty( get_bk_option( 'booking_form_field_label2' ) ) ? __( 'Second Name', 'booking' ) : get_bk_option( 'booking_form_field_label2' ), |
| 472 |
); |
| 473 |
// Email. |
| 474 |
$visual_form_structure[] = array( |
| 475 |
'type' => 'email', |
| 476 |
'name' => 'email', |
| 477 |
'obligatory' => 'On', |
| 478 |
'active' => 'On', |
| 479 |
'required' => 'On', |
| 480 |
'label' => empty( get_bk_option( 'booking_form_field_label3' ) ) ? __( 'Email', 'booking' ) : get_bk_option( 'booking_form_field_label3' ), |
| 481 |
); |
| 482 |
// Visitors. |
| 483 |
$visual_form_structure[] = array( |
| 484 |
'type' => 'selectbox', |
| 485 |
'name' => 'visitors', |
| 486 |
'obligatory' => 'Off', |
| 487 |
'active' => empty( get_bk_option( 'booking_form_field_active6' ) ) ? 'On' : get_bk_option( 'booking_form_field_active6' ), |
| 488 |
'required' => empty( get_bk_option( 'booking_form_field_required6' ) ) ? 'Off' : get_bk_option( 'booking_form_field_required6' ), |
| 489 |
'label' => empty( get_bk_option( 'booking_form_field_label6' ) ) ? __( 'Visitors', 'booking' ) : get_bk_option( 'booking_form_field_label6' ), |
| 490 |
'value' => ( empty( get_bk_option( 'booking_form_field_values6' ) ) ? ( '1' . "\r\n" . '2' . "\r\n" . '3' . "\r\n" . '4' ) : get_bk_option( 'booking_form_field_values6' ) ), |
| 491 |
); |
| 492 |
// Phone. |
| 493 |
$visual_form_structure[] = array( |
| 494 |
'type' => 'text', |
| 495 |
'name' => 'phone', |
| 496 |
'obligatory' => 'Off', |
| 497 |
'active' => empty( get_bk_option( 'booking_form_field_active4' ) ) ? 'On' : get_bk_option( 'booking_form_field_active4' ), |
| 498 |
'required' => empty( get_bk_option( 'booking_form_field_required4' ) ) ? 'Off' : get_bk_option( 'booking_form_field_required4' ), |
| 499 |
'label' => empty( get_bk_option( 'booking_form_field_label4' ) ) ? __( 'Phone', 'booking' ) : get_bk_option( 'booking_form_field_label4' ), |
| 500 |
); |
| 501 |
// Details - textarea. |
| 502 |
$visual_form_structure[] = array( |
| 503 |
'type' => 'textarea', |
| 504 |
'name' => 'details', |
| 505 |
'obligatory' => 'Off', |
| 506 |
'active' => empty( get_bk_option( 'booking_form_field_active5' ) ) ? 'On' : get_bk_option( 'booking_form_field_active5' ), |
| 507 |
'required' => empty( get_bk_option( 'booking_form_field_required5' ) ) ? 'Off' : get_bk_option( 'booking_form_field_required5' ), |
| 508 |
'label' => empty( get_bk_option( 'booking_form_field_label5' ) ) ? __( 'Details', 'booking' ) : get_bk_option( 'booking_form_field_label5' ), |
| 509 |
); |
| 510 |
// CAPTCHA. |
| 511 |
$visual_form_structure[] = array( |
| 512 |
'type' => 'captcha', |
| 513 |
'name' => 'captcha', |
| 514 |
'obligatory' => 'Off', |
| 515 |
'active' => ( 'On' === get_bk_option( 'booking_is_use_captcha' ) ) ? 'On' : 'Off', |
| 516 |
'required' => 'On', |
| 517 |
'if_exist_required' => 'On', |
| 518 |
'label' => '', |
| 519 |
); |
| 520 |
// Submit. |
| 521 |
$visual_form_structure[] = array( |
| 522 |
'type' => 'submit', |
| 523 |
'name' => 'submit', |
| 524 |
'obligatory' => 'On', |
| 525 |
'active' => 'On', |
| 526 |
'required' => 'On', |
| 527 |
'if_exist_required' => 'On', |
| 528 |
'label' => empty( get_bk_option( 'booking_send_button_title' ) ) ? __( 'Send', 'booking' ) : get_bk_option( 'booking_send_button_title' ), |
| 529 |
); |
| 530 |
|
| 531 |
return $visual_form_structure; |
| 532 |
} |
| 533 |
|