function wpbc_define_js_vars($where_to_load = 'both') { // Blank JS File ////////////////////////////////////////////////////////////////////////////////////////////////// wp_enqueue_script('wpbc-global-vars', WPDEV_BK_PLUGIN_URL . '/js/wpbc_vars' . (WP_BK_MIN ? '.min' : '') . '.js', array('jquery'), '1.0'); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Define JavaScripts Variables ////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// wp_localize_script('wpbc-global-vars', 'wpbc_global1', array('wpbc_ajaxurl' => admin_url('admin-ajax.php'), 'wpdev_bk_plugin_url' => plugins_url('', WPDEV_BK_FILE), 'wpdev_bk_today' => 'new Array( parseInt(' . intval(date_i18n('Y')) . '), parseInt(' . intval(date_i18n('m')) . '), parseInt(' . intval(date_i18n('d')) . '), parseInt(' . intval(date_i18n('H')) . '), parseInt(' . intval(date_i18n('i')) . ') )', 'visible_booking_id_on_page' => '[]', 'booking_max_monthes_in_calendar' => get_bk_option('booking_max_monthes_in_calendar'), 'user_unavilable_days' => '[' . (get_bk_option('booking_unavailable_day0') == 'On' ? '0,' : '') . (get_bk_option('booking_unavailable_day1') == 'On' ? '1,' : '') . (get_bk_option('booking_unavailable_day2') == 'On' ? '2,' : '') . (get_bk_option('booking_unavailable_day3') == 'On' ? '3,' : '') . (get_bk_option('booking_unavailable_day4') == 'On' ? '4,' : '') . (get_bk_option('booking_unavailable_day5') == 'On' ? '5,' : '') . (get_bk_option('booking_unavailable_day6') == 'On' ? '6,' : '') . '999]', 'wpdev_bk_edit_id_hash' => isset($_GET['booking_hash']) ? $_GET['booking_hash'] : '', 'wpdev_bk_plugin_filename' => WPDEV_BK_PLUGIN_FILENAME, 'bk_days_selection_mode' => get_bk_option('booking_type_of_day_selections') == 'range' ? get_bk_option('booking_range_selection_type') : get_bk_option('booking_type_of_day_selections'), 'wpdev_bk_personal' => class_exists('wpdev_bk_personal') ? '1' : '0', 'block_some_dates_from_today' => get_bk_option('booking_unavailable_days_num_from_today'), 'message_verif_requred' => esc_js(__('This field is required', 'booking')), 'message_verif_requred_for_check_box' => esc_js(__('This checkbox must be checked', 'booking')), 'message_verif_requred_for_radio_box' => esc_js(__('At least one option must be selected', 'booking')), 'message_verif_emeil' => esc_js(__('Incorrect email field', 'booking')), 'message_verif_same_emeil' => esc_js(__('Your emails do not the same', 'booking')), 'message_verif_selectdts' => esc_js(__('Please, select booking date(s) at Calendar.', 'booking')), 'parent_booking_resources' => '[]', 'new_booking_title' => esc_js(apply_bk_filter('wpdev_check_for_active_language', get_bk_option('booking_title_after_reservation'))), 'new_booking_title_time' => get_bk_option('booking_title_after_reservation_time'), 'type_of_thank_you_message' => esc_js(get_bk_option('booking_type_of_thank_you_message')), 'thank_you_page_URL' => wpbc_make_link_absolute(apply_bk_filter('wpdev_check_for_active_language', get_bk_option('booking_thank_you_page_URL'))), 'is_am_pm_inside_time' => strpos(get_bk_option('booking_time_format'), 'a') !== false || strpos(get_bk_option('booking_time_format'), 'A') !== false ? 'true' : 'false', 'is_booking_used_check_in_out_time' => 'false', 'wpbc_active_locale' => getBookingLocale())); do_action('wpbc_define_js_vars', $where_to_load); }
/** @see WP_Widget::widget */ function widget($args, $instance) { extract($args); $booking_widget_title = apply_filters('widget_title', $instance['booking_widget_title']); if (function_exists('icl_translate')) { $booking_widget_title = icl_translate('wpml_custom', 'wpbc_custom_widget_booking_title1', $booking_widget_title); } $booking_widget_show = $instance['booking_widget_show']; $booking_widget_type = $instance['booking_widget_type']; if (empty($booking_widget_type)) { $booking_widget_type = 1; } $booking_widget_calendar_count = $instance['booking_widget_calendar_count']; $booking_widget_last_field = $instance['booking_widget_last_field']; echo $before_widget; if (isset($_GET['booking_hash'])) { _e('You need to use special shortcode [bookingedit] for booking editing.', 'wpdev-booking'); echo $after_widget; return; } if ($booking_widget_title != '') { echo $before_title . htmlspecialchars_decode($booking_widget_title) . $after_title; } echo "<div class='widget_wpdev_booking months_num_in_row_1'>"; if ($booking_widget_show == 'booking_form') { // do_action('wpdev_bk_add_form', $booking_widget_type , $booking_widget_calendar_count); $my_booking_form_name = apply_bk_filter('wpdev_get_default_booking_form_for_resource', 'standard', $booking_widget_type); make_bk_action('wpdevbk_add_form', $booking_widget_type, $booking_widget_calendar_count, true, $my_booking_form_name); } else { do_action('wpdev_bk_add_calendar', $booking_widget_type, $booking_widget_calendar_count); } if ($booking_widget_last_field !== '') { echo '<br/>' . htmlspecialchars_decode($booking_widget_last_field); } echo "</div>"; echo $after_widget; }
function wpdev_bk_insert_new_booking() { make_bk_action('check_multiuser_params_for_client_side', $_POST["bktype"]); global $wpdb; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Define init variables //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $dates = $_POST["dates"]; $bktype = $_POST["bktype"]; $formdata = $_POST["form"]; $formdata = escape_any_xss($formdata); $is_send_emeils = 1; if (isset($_POST["is_send_emeils"])) { $is_send_emeils = $_POST["is_send_emeils"]; } $my_booking_id = 0; $my_booking_hash = ''; if (isset($_POST['my_booking_hash'])) { $my_booking_hash = $_POST['my_booking_hash']; if ($my_booking_hash != '') { $my_booking_id_type = false; $my_booking_id_type = apply_bk_filter('wpdev_booking_get_hash_to_id', false, $my_booking_hash); if ($my_booking_id_type !== false) { $my_booking_id = $my_booking_id_type[0]; $bktype = $my_booking_id_type[1]; } } } if (strpos($dates, ' - ') !== FALSE) { $dates = explode(' - ', $dates); $dates = createDateRangeArray($dates[0], $dates[1]); } /// CAPTCHA CHECKING ////////////////////////////////////////////////////////////////////////////////////// $the_answer_from_respondent = $_POST['captcha_user_input']; $prefix = $_POST['captcha_chalange']; if (!($the_answer_from_respondent == '' && $prefix == '')) { $captcha_instance = new wpdevReallySimpleCaptcha(); $correct = $captcha_instance->check($prefix, $the_answer_from_respondent); if (!$correct) { $word = $captcha_instance->generate_random_word(); $prefix = mt_rand(); $captcha_instance->generate_image($prefix, $word); $filename = $prefix . '.png'; $captcha_url = WPDEV_BK_PLUGIN_URL . '/js/captcha/tmp/' . $filename; $ref = substr($filename, 0, strrpos($filename, '.')); ?> <script type="text/javascript"> document.getElementById('captcha_input<?php echo $bktype; ?> ').value = ''; // chnage img document.getElementById('captcha_img<?php echo $bktype; ?> ').src = '<?php echo $captcha_url; ?> '; document.getElementById('wpdev_captcha_challenge_<?php echo $bktype; ?> ').value = '<?php echo $ref; ?> '; document.getElementById('captcha_msg<?php echo $bktype; ?> ').innerHTML = '<div style="height:20px;width:100%;text-align:center;margin:15px auto;"><?php echo __('Your entered code is incorrect', 'wpdev-booking'); ?> </div>'; document.getElementById('submiting<?php echo $bktype; ?> ').innerHTML =''; jQuery('#captcha_input<?php echo $bktype; ?> ') .fadeOut( 350 ).fadeIn( 300 ) .fadeOut( 350 ).fadeIn( 400 ) .animate( {opacity: 1}, 4000 ) ; // mark red border jQuery(".wpdev-help-message div") .css( {'color' : 'red'} ) .animate( {opacity: 1}, 10000 ) .fadeOut( 2000 ); // hide message document.getElementById('captcha_input<?php echo $bktype; ?> ').focus(); // make focus to elemnt </script> <?php die; } } ////////////////////////////////////////////////////////////////////////////////////////////////////////// $booking_form_show = get_form_content($formdata, $bktype); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $my_modification_date = "'" . date_i18n('Y-m-d H:i:s') . "'"; // Localize booking modification date $my_modification_date = 'NOW()'; // Server value modification date if ($my_booking_id > 0) { // Edit exist booking if (strpos($_SERVER['HTTP_REFERER'], 'wp-admin/admin.php?') !== false) { ?> <script type="text/javascript"> document.getElementById('ajax_working').innerHTML = '<div class="info_message ajax_message" id="ajax_message">\n\ <div style="float:left;"><?php echo __('Updating...', 'wpdev-booking'); ?> </div> \n\ <div style="float:left;width:80px;margin-top:-3px;">\n\ <img src="'+wpdev_bk_plugin_url+'/img/ajax-loader.gif">\n\ </div>\n\ </div>'; </script> <?php } $update_sql = "UPDATE " . $wpdb->prefix . "booking AS bk SET bk.form='{$formdata}', bk.booking_type={$bktype} , bk.modification_date=" . $my_modification_date . " WHERE bk.booking_id={$my_booking_id};"; if (false === $wpdb->query($wpdb->prepare($update_sql))) { ?> <script type="text/javascript"> document.getElementById('submiting<?php echo $bktype; ?> ').innerHTML = '<div style="height:20px;width:100%;text-align:center;margin:15px auto;"><?php bk_error('Error during updating exist booking in BD', __FILE__, __LINE__); ?> </div>'; </script> <?php die; } // Check if dates already aproved or no $slct_sql = "SELECT approved FROM " . $wpdb->prefix . "bookingdates WHERE booking_id IN ({$my_booking_id}) LIMIT 0,1"; $slct_sql_results = $wpdb->get_results($wpdb->prepare($slct_sql)); if (count($slct_sql_results) > 0) { $is_approved_dates = $slct_sql_results[0]->approved; } $delete_sql = "DELETE FROM " . $wpdb->prefix . "bookingdates WHERE booking_id IN ({$my_booking_id})"; if (false === $wpdb->query($wpdb->prepare($delete_sql))) { ?> <script type="text/javascript"> document.getElementById('submiting<?php echo $bktype; ?> ').innerHTML = '<div style="height:20px;width:100%;text-align:center;margin:15px auto;"><?php bk_error('Error during updating exist booking for deleting dates in BD', __FILE__, __LINE__); ?> </div>'; </script> <?php die; } $booking_id = (int) $my_booking_id; //Get ID of reservation } else { // Add new booking $sql_insertion = "INSERT INTO " . $wpdb->prefix . "booking (form, booking_type, modification_date) VALUES ('{$formdata}', {$bktype}, " . $my_modification_date . " )"; //debuge($formdata); if (false === $wpdb->query($wpdb->prepare($sql_insertion))) { ?> <script type="text/javascript"> document.getElementById('submiting<?php echo $bktype; ?> ').innerHTML = '<div style="height:20px;width:100%;text-align:center;margin:15px auto;"><?php bk_error('Error during inserting into BD', __FILE__, __LINE__); ?> </div>'; </script> <?php die; } // Make insertion into BOOKINGDATES $booking_id = (int) $wpdb->insert_id; //Get ID of reservation $is_approved_dates = '0'; $auto_approve_new_bookings_is_active = get_bk_option('booking_auto_approve_new_bookings_is_active'); if (trim($auto_approve_new_bookings_is_active) == 'On') { $is_approved_dates = '1'; } } $sdform = $_POST['form']; $my_dates = explode(",", $dates); $i = 0; foreach ($my_dates as $md) { $my_dates[$i] = trim($my_dates[$i]); $i++; } $start_end_time = get_times_from_bk_form($sdform, $my_dates, $bktype); $start_time = $start_end_time[0]; $end_time = $start_end_time[1]; $my_dates = $start_end_time[2]; make_bk_action('wpdev_booking_post_inserted', $booking_id, $bktype, str_replace('|', ',', $dates), array($start_time, $end_time)); $my_cost = apply_bk_filter('get_booking_cost_from_db', '', $booking_id); $i = 0; foreach ($my_dates as $md) { // Set in dates in such format: yyyy.mm.dd if ($md != '') { $md = explode('.', $md); $my_dates[$i] = $md[2] . '.' . $md[1] . '.' . $md[0]; } else { unset($my_dates[$i]); } // If some dates is empty so remove it // This situation can be if using several bk calendars and some calendars is not checked $i++; } sort($my_dates); // Sort dates $my_dates4emeil = ''; $i = 0; $insert = ''; $my_date_previos = ''; foreach ($my_dates as $my_date) { $i++; // Loop through all dates if (strpos($my_date, '.') !== false) { if (get_bk_option('booking_recurrent_time') !== 'On') { $my_date = explode('.', $my_date); if ($i == 1) { $date = sprintf("%04d-%02d-%02d %02d:%02d:%02d", $my_date[0], $my_date[1], $my_date[2], $start_time[0], $start_time[1], $start_time[2]); } elseif ($i == count($my_dates)) { $date = sprintf("%04d-%02d-%02d %02d:%02d:%02d", $my_date[0], $my_date[1], $my_date[2], $end_time[0], $end_time[1], $end_time[2]); } else { $date = sprintf("%04d-%02d-%02d %02d:%02d:%02d", $my_date[0], $my_date[1], $my_date[2], '00', '00', '00'); } $my_dates4emeil .= $date . ','; if (!empty($insert)) { $insert .= ', '; } $insert .= "('{$booking_id}', '{$date}', '{$is_approved_dates}' )"; } else { if ($my_date_previos == $my_date) { continue; } // escape for single day selections. $my_date_previos = $my_date; $my_date = explode('.', $my_date); $date = sprintf("%04d-%02d-%02d %02d:%02d:%02d", $my_date[0], $my_date[1], $my_date[2], $start_time[0], $start_time[1], $start_time[2]); $my_dates4emeil .= $date . ','; if (!empty($insert)) { $insert .= ', '; } $insert .= "('{$booking_id}', '{$date}', '{$is_approved_dates}' )"; $date = sprintf("%04d-%02d-%02d %02d:%02d:%02d", $my_date[0], $my_date[1], $my_date[2], $end_time[0], $end_time[1], $end_time[2]); $my_dates4emeil .= $date . ','; if (!empty($insert)) { $insert .= ', '; } $insert .= "('{$booking_id}', '{$date}', '{$is_approved_dates}' )"; } } } $my_dates4emeil = substr($my_dates4emeil, 0, -1); $my_dates4emeil_check_in_out = explode(',', $my_dates4emeil); $my_check_in_date = change_date_format($my_dates4emeil_check_in_out[0]); $my_check_out_date = change_date_format($my_dates4emeil_check_in_out[count($my_dates4emeil_check_in_out) - 1]); /* // This add 1 more day for check out day $my_check_out_date = $my_dates4emeil_check_in_out[ count($my_dates4emeil_check_in_out)-1 ]; $dt = trim($my_check_out_date); $dta = explode(' ',$dt); $dta = $dta[0]; $dta = explode('-',$dta); $my_check_out_date = date('Y-m-d H:i:s' , mktime(0, 0, 0, $dta[1], ($dta[2]+1), $dta[0] )); $my_check_out_date = change_date_format($my_check_out_date); /**/ if (!empty($insert)) { if (false === $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "bookingdates (booking_id, booking_date, approved) VALUES " . $insert))) { ?> <script type="text/javascript"> document.getElementById('submiting<?php echo $bktype; ?> ').innerHTML = '<div style="height:20px;width:100%;text-align:center;margin:15px auto;"><?php bk_error('Error during inserting into BD - Dates', __FILE__, __LINE__); ?> </div>'; </script> <?php die; } } if (function_exists('get_booking_title')) { $bk_title = get_booking_title($bktype); } else { $bk_title = ''; } if ($my_booking_id > 0) { // For editing exist booking $mail_sender = htmlspecialchars_decode(get_bk_option('booking_email_modification_adress')); $mail_subject = htmlspecialchars_decode(get_bk_option('booking_email_modification_subject')); $mail_body = htmlspecialchars_decode(get_bk_option('booking_email_modification_content')); $mail_subject = apply_bk_filter('wpdev_check_for_active_language', $mail_subject); $mail_body = apply_bk_filter('wpdev_check_for_active_language', $mail_body); if (function_exists('get_booking_title')) { $bk_title = get_booking_title($bktype); } else { $bk_title = ''; } $booking_form_show = get_form_content($formdata, $bktype); $mail_body_to_send = str_replace('[bookingtype]', $bk_title, $mail_body); if (get_bk_option('booking_date_view_type') == 'short') { $my_dates_4_send = get_dates_short_format(get_dates_str($booking_id)); } else { $my_dates_4_send = change_date_format(get_dates_str($booking_id)); } $mail_body_to_send = str_replace('[dates]', $my_dates_4_send, $mail_body_to_send); $mail_body_to_send = str_replace('[check_in_date]', $my_check_in_date, $mail_body_to_send); $mail_body_to_send = str_replace('[check_out_date]', $my_check_out_date, $mail_body_to_send); $mail_body_to_send = str_replace('[id]', $booking_id, $mail_body_to_send); $mail_body_to_send = str_replace('[content]', $booking_form_show['content'], $mail_body_to_send); if (!isset($denyreason)) { $denyreason = ''; } $mail_body_to_send = str_replace('[denyreason]', $denyreason, $mail_body_to_send); $mail_body_to_send = str_replace('[name]', $booking_form_show['name'], $mail_body_to_send); $mail_body_to_send = str_replace('[cost]', $my_cost, $mail_body_to_send); if (isset($booking_form_show['secondname'])) { $mail_body_to_send = str_replace('[secondname]', $booking_form_show['secondname'], $mail_body_to_send); } $mail_body_to_send = str_replace('[siteurl]', htmlspecialchars_decode('<a href="' . site_url() . '">' . site_url() . '</a>'), $mail_body_to_send); $mail_body_to_send = apply_bk_filter('wpdev_booking_set_booking_edit_link_at_email', $mail_body_to_send, $booking_id); $mail_subject = str_replace('[name]', $booking_form_show['name'], $mail_subject); if (isset($booking_form_show['secondname'])) { $mail_subject = str_replace('[secondname]', $booking_form_show['secondname'], $mail_subject); } $mail_recipient = $booking_form_show['email']; $mail_headers = "From: {$mail_sender}\n"; $mail_headers .= "Content-Type: text/html\n"; if (get_bk_option('booking_is_email_modification_adress') != 'Off') { // Send to the Visitor if (strpos($mail_recipient, '@blank.com') === false && strpos($mail_body_to_send, '*****@*****.**') === false) { if ($is_send_emeils != 0) { @wp_mail($mail_recipient, $mail_subject, $mail_body_to_send, $mail_headers); } } // Send to the Admin also $mail_recipient = htmlspecialchars_decode(get_bk_option('booking_email_reservation_adress')); $is_email_modification_send_copy_to_admin = get_bk_option('booking_is_email_modification_send_copy_to_admin'); if ($is_email_modification_send_copy_to_admin == 'On') { if (strpos($mail_recipient, '@blank.com') === false && strpos($mail_body_to_send, '*****@*****.**') === false) { if ($is_send_emeils != 0) { @wp_mail($mail_recipient, $mail_subject, $mail_body_to_send, $mail_headers); } } } } //debuge($_SERVER); if (strpos($_SERVER['HTTP_REFERER'], 'wp-admin/admin.php?') === false) { do_action('wpdev_new_booking', $booking_id, $bktype, str_replace('|', ',', $dates), array($start_time, $end_time), $sdform); } ?> <script type="text/javascript"> <?php if (strpos($_SERVER['HTTP_REFERER'], 'wp-admin/admin.php?') === false) { ?> //document.getElementById('submiting<?php echo $bktype; ?> ').innerHTML = '<div class=\"submiting_content\" ><?php echo get_bk_option('booking_title_after_reservation'); ?> </div>'; //jQuery('.submiting_content').fadeOut(<?php echo get_bk_option('booking_title_after_reservation_time'); ?> ); setReservedSelectedDates('<?php echo $bktype; ?> '); <?php } else { ?> document.getElementById('ajax_message').innerHTML = '<?php echo __('Updated successfully', 'wpdev-booking'); ?> '; jQuery('#ajax_message').fadeOut(1000); document.getElementById('submiting<?php echo $bktype; ?> ').innerHTML = '<div style="height:20px;width:100%;text-align:center;margin:15px auto;"><?php echo __('Updated successfully', 'wpdev-booking'); ?> </div>'; location.href='admin.php?page=<?php echo WPDEV_BK_PLUGIN_DIRNAME . '/' . WPDEV_BK_PLUGIN_FILENAME; ?> wpdev-booking&booking_type=<?php echo $bktype; ?> &booking_id_selection=<?php echo $my_booking_id; ?> '; <?php } ?> </script> <?php } else { if (count($my_dates) > 0) { //// For inserting NEW booking // Sending mail /////////////////////////////////////////////////////// $mail_sender = htmlspecialchars_decode(get_bk_option('booking_email_reservation_from_adress')); //'"'. 'Booking sender' . '" <' . $booking_form_show['email'].'>'; $mail_recipient = htmlspecialchars_decode(get_bk_option('booking_email_reservation_adress')); //'"Booking receipent" <' .get_option('admin_email').'>'; $mail_subject = htmlspecialchars_decode(get_bk_option('booking_email_reservation_subject')); $mail_body = htmlspecialchars_decode(get_bk_option('booking_email_reservation_content')); $mail_subject = apply_bk_filter('wpdev_check_for_active_language', $mail_subject); $mail_body = apply_bk_filter('wpdev_check_for_active_language', $mail_body); $mail_body = str_replace('[bookingtype]', $bk_title, $mail_body); if (get_bk_option('booking_date_view_type') == 'short') { $my_dates_4_send = get_dates_short_format($my_dates4emeil); } else { $my_dates_4_send = change_date_format($my_dates4emeil); } $mail_body = str_replace('[dates]', $my_dates_4_send, $mail_body); $mail_body = str_replace('[check_in_date]', $my_check_in_date, $mail_body); $mail_body = str_replace('[check_out_date]', $my_check_out_date, $mail_body); $mail_body = str_replace('[id]', $booking_id, $mail_body); $mail_body = str_replace('[content]', $booking_form_show['content'], $mail_body); $mail_body = str_replace('[name]', $booking_form_show['name'], $mail_body); $mail_body = str_replace('[cost]', $my_cost, $mail_body); $mail_body = str_replace('[siteurl]', htmlspecialchars_decode('<a href="' . site_url() . '">' . site_url() . '</a>'), $mail_body); $mail_body = str_replace('[moderatelink]', htmlspecialchars_decode('<a href="' . site_url() . '/wp-admin/admin.php?page=' . WPDEV_BK_PLUGIN_DIRNAME . '/' . WPDEV_BK_PLUGIN_FILENAME . 'wpdev-booking&booking_type=' . $bktype . '&moderate_id=' . $booking_id . '">' . __('here', 'wpdev-booking') . '</a>'), $mail_body); $mail_body = apply_bk_filter('wpdev_booking_set_booking_edit_link_at_email', $mail_body, $booking_id); if (isset($booking_form_show['secondname'])) { $mail_body = str_replace('[secondname]', $booking_form_show['secondname'], $mail_body); } $mail_subject = str_replace('[name]', $booking_form_show['name'], $mail_subject); if (isset($booking_form_show['secondname'])) { $mail_subject = str_replace('[secondname]', $booking_form_show['secondname'], $mail_subject); } $mail_headers = "From: {$mail_sender}\n"; $mail_headers .= "Content-Type: text/html\n"; if (strpos($mail_recipient, '[visitoremeil]') !== false) { $mail_recipient = str_replace('[visitoremeil]', $booking_form_show['email'], $mail_recipient); } if (get_bk_option('booking_is_email_reservation_adress') != 'Off') { if (strpos($mail_recipient, '@blank.com') === false && strpos($mail_body, '*****@*****.**') === false) { if ($is_send_emeils != 0) { @wp_mail($mail_recipient, $mail_subject, $mail_body, $mail_headers); } } } ///////////////////////////////////////////////////////////////////////// if (get_bk_option('booking_is_email_newbookingbyperson_adress') == 'On') { $mail_sender = htmlspecialchars_decode(get_bk_option('booking_email_newbookingbyperson_adress')); //'"'. 'Booking sender' . '" <' . $booking_form_show['email'].'>'; $mail_recipient = $booking_form_show['email']; $mail_subject = htmlspecialchars_decode(get_bk_option('booking_email_newbookingbyperson_subject')); $mail_body = htmlspecialchars_decode(get_bk_option('booking_email_newbookingbyperson_content')); $mail_subject = apply_bk_filter('wpdev_check_for_active_language', $mail_subject); $mail_body = apply_bk_filter('wpdev_check_for_active_language', $mail_body); $mail_body = str_replace('[bookingtype]', $bk_title, $mail_body); if (get_bk_option('booking_date_view_type') == 'short') { $my_dates_4_send = get_dates_short_format($my_dates4emeil); } else { $my_dates_4_send = change_date_format($my_dates4emeil); } $mail_body = str_replace('[dates]', $my_dates_4_send, $mail_body); $mail_body = str_replace('[check_in_date]', $my_check_in_date, $mail_body); $mail_body = str_replace('[check_out_date]', $my_check_out_date, $mail_body); $mail_body = str_replace('[id]', $booking_id, $mail_body); $mail_body = str_replace('[content]', $booking_form_show['content'], $mail_body); $mail_body = str_replace('[name]', $booking_form_show['name'], $mail_body); $mail_body = str_replace('[cost]', $my_cost, $mail_body); $mail_body = str_replace('[siteurl]', htmlspecialchars_decode('<a href="' . site_url() . '">' . site_url() . '</a>'), $mail_body); $mail_body = apply_bk_filter('wpdev_booking_set_booking_edit_link_at_email', $mail_body, $booking_id); if (isset($booking_form_show['secondname'])) { $mail_body = str_replace('[secondname]', $booking_form_show['secondname'], $mail_body); } $mail_subject = str_replace('[name]', $booking_form_show['name'], $mail_subject); if (isset($booking_form_show['secondname'])) { $mail_subject = str_replace('[secondname]', $booking_form_show['secondname'], $mail_subject); } $mail_headers = "From: {$mail_sender}\n"; $mail_headers .= "Content-Type: text/html\n"; if (strpos($mail_recipient, '[visitoremeil]') !== false) { $mail_recipient = str_replace('[visitoremeil]', $booking_form_show['email'], $mail_recipient); } if (strpos($mail_recipient, '@blank.com') === false) { if (strpos($mail_recipient, '@blank.com') === false && strpos($mail_body, '*****@*****.**') === false) { if ($is_send_emeils != 0) { @wp_mail($mail_recipient, $mail_subject, $mail_body, $mail_headers); } } } } } do_action('wpdev_new_booking', $booking_id, $bktype, str_replace('|', ',', $dates), array($start_time, $end_time), $sdform); ?> <script type="text/javascript"> setReservedSelectedDates('<?php echo $bktype; ?> '); </script> <?php } // ReUpdate booking resource TYPE if its needed here if (!empty($dates)) { // check to have dates not empty make_bk_action('wpdev_booking_reupdate_bk_type_to_childs', $booking_id, $bktype, str_replace('|', ',', $dates), array($start_time, $end_time), $sdform); } }
function wpdev_bk_insert_new_booking() { global $wpdb; make_bk_action('check_multiuser_params_for_client_side', $_POST["bktype"]); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Define init variables //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $dates = $_POST["dates"]; $bktype = intval($_POST["bktype"]); if ($bktype == 0) { // Error ?> <script type="text/javascript"> document.getElementById('submiting<?php echo $bktype; ?> ').innerHTML = '<div style="height:20px;width:100%;text-align:center;margin:15px auto;"><?php bk_error('Error od saving data into DB. Unknown booking resource.', __FILE__, __LINE__); ?> </div>'; </script> <?php die; } $formdata = $_POST["form"]; $formdata = escape_any_xss($formdata); $is_send_emeils = 1; if (isset($_POST["is_send_emeils"])) { $is_send_emeils = $_POST["is_send_emeils"]; } $my_booking_id = 0; $my_booking_hash = ''; if (function_exists('get_booking_title')) { $bk_title = get_booking_title($bktype); } else { $bk_title = ''; } if (isset($_POST['my_booking_hash'])) { $my_booking_hash = $_POST['my_booking_hash']; if ($my_booking_hash != '') { $my_booking_id_type = false; $my_booking_id_type = apply_bk_filter('wpdev_booking_get_hash_to_id', false, $my_booking_hash); if ($my_booking_id_type !== false) { $my_booking_id = $my_booking_id_type[0]; $bktype = $my_booking_id_type[1]; } } } if (strpos($dates, ' - ') !== FALSE) { $dates = explode(' - ', $dates); $dates = createDateRangeArray($dates[0], $dates[1]); } //debuge($_POST); /// CAPTCHA CHECKING ////////////////////////////////////////////////////////////////////////////////////// $the_answer_from_respondent = $_POST['captcha_user_input']; $prefix = $_POST['captcha_chalange']; if (!($the_answer_from_respondent == '' && $prefix == '')) { $captcha_instance = new wpdevReallySimpleCaptcha(); $correct = $captcha_instance->check($prefix, $the_answer_from_respondent); if (!$correct) { $word = $captcha_instance->generate_random_word(); $prefix = mt_rand(); $captcha_instance->generate_image($prefix, $word); $filename = $prefix . '.png'; $captcha_url = WPDEV_BK_PLUGIN_URL . '/js/captcha/tmp/' . $filename; $ref = substr($filename, 0, strrpos($filename, '.')); ?> <script type="text/javascript"> document.getElementById('captcha_input<?php echo $bktype; ?> ').value = ''; // chnage img document.getElementById('captcha_img<?php echo $bktype; ?> ').src = '<?php echo $captcha_url; ?> '; document.getElementById('wpdev_captcha_challenge_<?php echo $bktype; ?> ').value = '<?php echo $ref; ?> '; document.getElementById('captcha_msg<?php echo $bktype; ?> ').innerHTML = '<span class="alert" style="padding: 5px 5px 4px;vertical-align: middle;text-align:center;margin:5px;"><?php echo __('The code you entered is incorrect', 'wpdev-booking'); ?> </span>'; document.getElementById('submiting<?php echo $bktype; ?> ').innerHTML =''; jQuery('#captcha_input<?php echo $bktype; ?> ') .fadeOut( 350 ).fadeIn( 300 ) .fadeOut( 350 ).fadeIn( 400 ) .animate( {opacity: 1}, 4000 ) ; // mark red border jQuery("span.wpdev-help-message span.alert") .fadeIn( 1 ) //.css( {'color' : 'red'} ) .animate( {opacity: 1}, 10000 ) .fadeOut( 2000 ); // hide message document.getElementById('captcha_input<?php echo $bktype; ?> ').focus(); // make focus to elemnt jQuery('#booking_form_div<?php echo $bktype; ?> input[type=button]').prop("disabled", false); </script> <?php die; } } ////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $my_modification_date = "'" . date_i18n('Y-m-d H:i:s') . "'"; // Localize booking modification date //$my_modification_date = 'NOW()'; // Server value modification date if ($my_booking_id > 0) { // Edit exist booking if (strpos($_SERVER['HTTP_REFERER'], 'wp-admin/admin.php?') !== false) { ?> <script type="text/javascript"> document.getElementById('ajax_working').innerHTML = '<div class="updated ajax_message" id="ajax_message">\n\ <div style="float:left;"><?php echo __('Updating...', 'wpdev-booking'); ?> </div> \n\ <div class="wpbc_spin_loader">\n\ <img src="'+wpdev_bk_plugin_url+'/img/ajax-loader.gif">\n\ </div>\n\ </div>'; </script> <?php } $update_sql = "UPDATE {$wpdb->prefix}booking AS bk SET bk.form='{$formdata}', bk.booking_type={$bktype} , bk.modification_date={$my_modification_date} WHERE bk.booking_id={$my_booking_id};"; if (false === $wpdb->query($update_sql)) { ?> <script type="text/javascript"> document.getElementById('submiting<?php echo $bktype; ?> ').innerHTML = '<div style="height:20px;width:100%;text-align:center;margin:15px auto;"><?php bk_error('Error during updating exist booking in DB', __FILE__, __LINE__); ?> </div>'; </script> <?php die; } // Check if dates already aproved or no $slct_sql = "SELECT approved FROM {$wpdb->prefix}bookingdates WHERE booking_id IN ({$my_booking_id}) LIMIT 0,1"; $slct_sql_results = $wpdb->get_results($slct_sql); if (count($slct_sql_results) > 0) { $is_approved_dates = $slct_sql_results[0]->approved; } $delete_sql = "DELETE FROM {$wpdb->prefix}bookingdates WHERE booking_id IN ({$my_booking_id})"; if (false === $wpdb->query($delete_sql)) { ?> <script type="text/javascript"> document.getElementById('submiting<?php echo $bktype; ?> ').innerHTML = '<div style="height:20px;width:100%;text-align:center;margin:15px auto;"><?php bk_error('Error during updating exist booking for deleting dates in DB', __FILE__, __LINE__); ?> </div>'; </script> <?php die; } $booking_id = (int) $my_booking_id; //Get ID of reservation } else { // Add new booking $sql_insertion = "INSERT INTO {$wpdb->prefix}booking (form, booking_type, modification_date) VALUES ('{$formdata}', {$bktype}, {$my_modification_date} )"; if (false === $wpdb->query($sql_insertion)) { ?> <script type="text/javascript"> document.getElementById('submiting<?php echo $bktype; ?> ').innerHTML = '<div style="height:20px;width:100%;text-align:center;margin:15px auto;"><?php bk_error('Error during inserting into DB', __FILE__, __LINE__); ?> </div>'; </script> <?php die; } // Make insertion into BOOKINGDATES $booking_id = (int) $wpdb->insert_id; //Get ID of reservation $is_approved_dates = '0'; $auto_approve_new_bookings_is_active = get_bk_option('booking_auto_approve_new_bookings_is_active'); if (trim($auto_approve_new_bookings_is_active) == 'On') { $is_approved_dates = '1'; } } $my_dates = explode(",", $dates); $i = 0; foreach ($my_dates as $md) { $my_dates[$i] = trim($my_dates[$i]); $i++; } $start_end_time = get_times_from_bk_form($formdata, $my_dates, $bktype); $start_time = $start_end_time[0]; $end_time = $start_end_time[1]; $my_dates = $start_end_time[2]; make_bk_action('wpdev_booking_post_inserted', $booking_id, $bktype, str_replace('|', ',', $dates), array($start_time, $end_time)); $my_cost = apply_bk_filter('get_booking_cost_from_db', '', $booking_id); $i = 0; foreach ($my_dates as $md) { // Set in dates in such format: yyyy.mm.dd if ($md != '') { $md = explode('.', $md); $my_dates[$i] = $md[2] . '.' . (intval($md[1]) < 10 ? '0' . intval($md[1]) : $md[1]) . '.' . (intval($md[0]) < 10 ? '0' . intval($md[0]) : $md[0]); } else { unset($my_dates[$i]); } // If some dates is empty so remove it // This situation can be if using several bk calendars and some calendars is not checked $i++; } //debuge($my_dates); sort($my_dates); // Sort dates //debuge($my_dates); $my_dates4emeil = ''; $i = 0; $insert = ''; $my_date_previos = ''; foreach ($my_dates as $my_date) { $i++; // Loop through all dates if (strpos($my_date, '.') !== false) { if (get_bk_option('booking_recurrent_time') !== 'On') { $my_date = explode('.', $my_date); if ($i == 1) { if (!isset($start_time[0]) || empty($start_time[0])) { $start_time[0] = '00'; } if (!isset($start_time[1]) || empty($start_time[1])) { $start_time[1] = '00'; } if ($start_time[0] == '00' && $start_time[1] == '00') { $start_time[2] = '00'; } $date = sprintf("%04d-%02d-%02d %02d:%02d:%02d", $my_date[0], $my_date[1], $my_date[2], $start_time[0], $start_time[1], $start_time[2]); } elseif ($i == count($my_dates)) { if (!isset($end_time[0]) || empty($end_time[0])) { $end_time[0] = '00'; } if (!isset($end_time[1]) || empty($end_time[1])) { $end_time[1] = '00'; } if ($end_time[0] == '00' && $end_time[1] == '00') { $end_time[2] = '00'; } $date = sprintf("%04d-%02d-%02d %02d:%02d:%02d", $my_date[0], $my_date[1], $my_date[2], $end_time[0], $end_time[1], $end_time[2]); } else { $date = sprintf("%04d-%02d-%02d %02d:%02d:%02d", $my_date[0], $my_date[1], $my_date[2], '00', '00', '00'); } $my_dates4emeil .= $date . ','; if (!empty($insert)) { $insert .= ', '; } $insert .= "('{$booking_id}', '{$date}', '{$is_approved_dates}' )"; } else { if ($my_date_previos == $my_date) { continue; } // escape for single day selections. $my_date_previos = $my_date; $my_date = explode('.', $my_date); $date = sprintf("%04d-%02d-%02d %02d:%02d:%02d", $my_date[0], $my_date[1], $my_date[2], $start_time[0], $start_time[1], $start_time[2]); $my_dates4emeil .= $date . ','; if (!empty($insert)) { $insert .= ', '; } $insert .= "('{$booking_id}', '{$date}', '{$is_approved_dates}' )"; $date = sprintf("%04d-%02d-%02d %02d:%02d:%02d", $my_date[0], $my_date[1], $my_date[2], $end_time[0], $end_time[1], $end_time[2]); $my_dates4emeil .= $date . ','; if (!empty($insert)) { $insert .= ', '; } $insert .= "('{$booking_id}', '{$date}', '{$is_approved_dates}' )"; } } } $my_dates4emeil = substr($my_dates4emeil, 0, -1); $my_dates4emeil_check_in_out = explode(',', $my_dates4emeil); $my_check_in_date = change_date_format($my_dates4emeil_check_in_out[0]); $my_check_out_date = change_date_format($my_dates4emeil_check_in_out[count($my_dates4emeil_check_in_out) - 1]); // Save the sort date $sql_sort_date = "UPDATE {$wpdb->prefix}booking SET sort_date = '" . $my_dates4emeil_check_in_out[0] . "' WHERE booking_id = " . $booking_id . " "; $wpdb->query($sql_sort_date); if (!empty($insert)) { if (false === $wpdb->query("INSERT INTO {$wpdb->prefix}bookingdates (booking_id, booking_date, approved) VALUES " . $insert)) { ?> <script type="text/javascript"> document.getElementById('submiting<?php echo $bktype; ?> ').innerHTML = '<div style="height:20px;width:100%;text-align:center;margin:15px auto;"><?php bk_error('Error during inserting into BD - Dates', __FILE__, __LINE__); ?> </div>'; </script> <?php die; } } if ($my_booking_id > 0) { // For editing exist booking if ($is_send_emeils != 0) { sendModificationEmails($booking_id, $bktype, $formdata); } if (strpos($_SERVER['HTTP_REFERER'], 'wp-admin/admin.php?') === false) { do_action('wpdev_new_booking', $booking_id, $bktype, str_replace('|', ',', $dates), array($start_time, $end_time), $formdata); } ?> <script type="text/javascript"> <?php if (strpos($_SERVER['HTTP_REFERER'], 'wp-admin/admin.php?') === false) { ?> setReservedSelectedDates('<?php echo $bktype; ?> '); <?php } else { ?> document.getElementById('ajax_message').innerHTML = '<?php echo __('Updated successfully', 'wpdev-booking'); ?> '; jQuery('#ajax_message').fadeOut(1000); document.getElementById('submiting<?php echo $bktype; ?> ').innerHTML = '<div style="height:20px;width:100%;text-align:center;margin:15px auto;"><?php echo __('Updated successfully', 'wpdev-booking'); ?> </div>'; if ( jQuery('#wpdev_http_referer').length > 0 ) { location.href=jQuery('#wpdev_http_referer').val(); } else location.href='admin.php?page=<?php echo WPDEV_BK_PLUGIN_DIRNAME . '/' . WPDEV_BK_PLUGIN_FILENAME; ?> wpdev-booking&view_mode=vm_listing&tab=actions&wh_booking_id=<?php echo $my_booking_id; ?> '; <?php } ?> </script> <?php } else { // For inserting NEW booking if (count($my_dates) > 0) { if ($is_send_emeils != 0) { sendNewBookingEmails($booking_id, $bktype, $formdata); } } do_action('wpdev_new_booking', $booking_id, $bktype, str_replace('|', ',', $dates), array($start_time, $end_time), $formdata); /* // Start Mail Chimp Customization $booking_form_show = get_form_content ($formdata , $bktype ); if ( ( isset ($booking_form_show['subscribe_me'] )) && ( $booking_form_show['subscribe_me'] == 'yes') ) { if (file_exists(WPDEV_BK_PLUGIN_DIR. '/lib/MailChimp.class.php')) { // Include MailChimp class (You can download it from here https://github.com/drewm/mailchimp-api/ ) require_once(WPDEV_BK_PLUGIN_DIR. '/lib/MailChimp.class.php' ); $MailChimp = new MailChimp('key-my'); // You are need to specify here YOUR KEY !!!! $result = $MailChimp->call('lists/subscribe', array( 'id' => 'id' . $booking_id , 'email' => array('email'=>$booking_form_show['email']), 'merge_vars' => array('FNAME'=>$booking_form_show['name'], 'LNAME'=>$booking_form_show['secondname']), 'double_optin' => false, 'update_existing' => true, 'replace_interests' => false, 'send_welcome' => false, )); // print_r($result); } } // End Mail Chimp Customization /**/ $auto_approve_new_bookings_is_active = get_bk_option('booking_auto_approve_new_bookings_is_active'); if (trim($auto_approve_new_bookings_is_active) == 'On') { sendApproveEmails($booking_id, 1); } ?> <script type="text/javascript"> setReservedSelectedDates('<?php echo $bktype; ?> '); </script> <?php } // ReUpdate booking resource TYPE if its needed here if (!empty($dates)) { // check to have dates not empty make_bk_action('wpdev_booking_reupdate_bk_type_to_childs', $booking_id, $bktype, str_replace('|', ',', $dates), array($start_time, $end_time), $formdata); } }
function get_booking_info_4_tooltip($bk_id, $bookings, $booking_types, $title_in_day = '', $title = '', $title_hint = '') { $user = wp_get_current_user(); $user_bk_id = $user->ID; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Gathering data about the booking to show in the calendar !!! //////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Get it from the option settings $what_show_in_day_template = get_bk_option('booking_default_title_in_day_for_calendar_view_mode'); // '<span style="font-size:07px;">[id]</span>:[name]'; if ($title != '') { $title .= ' / '; } // Other Booking in the same day $title .= $bk_id; if ($title_in_day != '') { $title_in_day .= ','; } // Other Booking in the same day //$title_in_day .= $bk_id ; if (function_exists('get_title_for_showing_in_day')) { $title_in_day .= get_title_for_showing_in_day($bk_id, $bookings, $what_show_in_day_template); } else { $title_in_day .= $bk_id . ':' . $bookings[$bk_id]->form_data['_all_fields_']['name']; } if ($title_hint != '') { $title_hint .= ' <hr style="margin:10px 5px;" /> '; } // Other Booking in the same day $title_hint .= '<div class=\'booking-listing-collumn\' >'; if (function_exists('get_booking_title')) { if (isset($booking_types[$bookings[$bk_id]->booking_type])) { $bk_title = $booking_types[$bookings[$bk_id]->booking_type]->title; } else { $bk_title = get_booking_title($bookings[$bk_id]->booking_type); } $bk_title = '<span class=\'label label-resource label-info\'>' . $bk_title . '</span>'; } else { $bk_title = ''; } $title_hint .= '<span class=\'field-id\'>' . $bk_id . '</span>' . ' ' . $bk_title; if (class_exists('wpdev_bk_biz_s')) { $title_hint .= '<div style=\'float:right;\'>'; if (function_exists('wpdev_bk_get_payment_status_simple')) { $pay_status = wpdev_bk_get_payment_status_simple($bookings[$bk_id]->pay_status); $pay_status = '<span class=\'label label-payment-status payment-label-unknown\'><span style=\'font-size:07px;\'>' . __('Payment', 'wpdev-booking') . '</span> ' . $pay_status . '</span>'; } else { $pay_status = ''; } $title_hint .= ' ' . $pay_status; $currency = apply_bk_filter('get_currency_info'); $show_cost_value = wpdev_bk_cost_number_format($bookings[$bk_id]->cost); $title_hint .= ' <div class="cost-fields-group" style=\'float:right; margin:2px;\'>' . $currency . ' ' . $show_cost_value . '</div>'; $title_hint .= '</div>'; } $title_hint .= '<div>' . $bookings[$bk_id]->form_show . '</div>'; //$bookings[$bk_id]->form_data['name'].' ' . $bookings[$bk_id]->form_data['secondname'] ; //$title_hint .= ' '. $bookings[$bk_id]->remark; //BL $bk_dates_short_id = array(); if (count($bookings[$bk_id]->dates) > 0) { $bk_dates_short_id = isset($bookings[$bk_id]->dates_short_id) ? $bookings[$bk_id]->dates_short_id : array(); } // Array ([0] => [1] => .... [4] => 6... [11] => [12] => 8 ) $is_approved = 0; if (count($bookings[$bk_id]->dates) > 0) { $is_approved = $bookings[$bk_id]->dates[0]->approved; } $short_dates_content = wpdevbk_get_str_from_dates_short($bookings[$bk_id]->dates_short, $is_approved, $bk_dates_short_id, $booking_types); $short_dates_content = str_replace('"', "'", $short_dates_content); $title_hint .= '<div style=\'margin-top:5px;\'>' . $short_dates_content . '</div>'; // $reload_time = 2000; // setTimeout(function ( ) {location.reload(true);} ,'.$reload_time.'); /** $title_hint .= '<div style=\'text-align:right;\'>'; if ( class_exists('wpdev_bk_personal') ) { $bk_url_add = 'admin.php?page=' . WPDEV_BK_PLUGIN_DIRNAME . '/'. WPDEV_BK_PLUGIN_FILENAME . 'wpdev-booking-reservation' ; $bk_hash = (isset($bookings[$bk_id]->hash))?$bookings[$bk_id]->hash:''; $bk_booking_type = $bookings[$bk_id]->booking_type; $edit_booking_url = $bk_url_add . '&booking_type='.$bk_booking_type.'&booking_hash='.$bk_hash.'&parent_res=1' ; $title_hint .= '<a style=\'margin:-60px 20px 0 2px;position:absolute;right:0px;\' href=\''.$edit_booking_url .'\' onclick=\'\' ><i class=\'icon-edit\'></i><!--img src=\'' . WPDEV_BK_PLUGIN_URL .'/img/edit_type.png\' style=\'width:12px; height:13px;\'--></a>'; } $title_hint .= '<a style=\'margin:-40px 20px 0 0;position:absolute;right:0px;\' href=\'javascript:;\' onclick=\'javascript:approve_unapprove_booking('. $bk_id.',1, '. $user_bk_id .', "'. getBookingLocale() .'" , 1 );\' ><i class=\'icon-ok-circle\'></i><!--img src=\'' . WPDEV_BK_PLUGIN_URL .'/img/accept-24x24.gif\' style=\'width:14px; height:14px;\'--></a>'; $title_hint .= '<a style=\'margin:-22px 20px 0 0;position:absolute;right:0px;\' href=\'javascript:;\' onclick=\'javascript:approve_unapprove_booking('. $bk_id.',0, '. $user_bk_id .', "'. getBookingLocale() .'" , 1 );\' ><i class=\'icon-ban-circle\'></i><!--img src=\'' . WPDEV_BK_PLUGIN_URL .'/img/remove-16x16.png\' style=\'margin:0px 5px;width:15px; height:15px;\'--></a>'; $title_hint .= '<a href=\'javascript:;\' onclick=\'javascript:delete_booking('. $bk_id.', '. $user_bk_id .', "'. getBookingLocale() .'" , 1 );\' ><i class=\'icon-trash\'></i><!--img src=\'' . WPDEV_BK_PLUGIN_URL .'/img/delete_type.png\' style=\'width:13px; height:13px;\'--></a>'; $title_hint .= '</div>'; /**/ $is_approved = 0; if (!empty($bookings[$bk_id]->dates)) { $is_approved = $bookings[$bk_id]->dates[0]->approved; } $title .= '<div class=\'timeline_info_bk_actionsbar_' . $bk_id . '\' style=\'display: inline; line-height: 1em; padding: 10px; vertical-align: text-top;\'>'; if (class_exists('wpdev_bk_personal')) { $bk_url_add = 'admin.php?page=' . WPDEV_BK_PLUGIN_DIRNAME . '/' . WPDEV_BK_PLUGIN_FILENAME . 'wpdev-booking-reservation'; $bk_hash = isset($bookings[$bk_id]->hash) ? $bookings[$bk_id]->hash : ''; $bk_booking_type = $bookings[$bk_id]->booking_type; $edit_booking_url = $bk_url_add . '&booking_type=' . $bk_booking_type . '&booking_hash=' . $bk_hash . '&parent_res=1'; $title .= '<a class=\'button button-secondary\' style=\'margin-right:5px;\' href=\'' . $edit_booking_url . '\' onclick=\'\' ><i class=\'icon-edit\'></i></a>'; } $title .= '<a class=\'button button-secondary approve_bk_link ' . ($is_approved ? 'hidden_items' : '') . '\' style=\'margin-right:5px;\' href=\'javascript:;\' onclick=\'javascript:approve_unapprove_booking(' . $bk_id . ',1, ' . $user_bk_id . ', "' . getBookingLocale() . '" , 1 );\' ><i class=\'icon-ok-circle\'></i></a>'; $title .= '<a class=\'button button-secondary pending_bk_link ' . ($is_approved ? '' : 'hidden_items') . '\' style=\'margin-right:5px;\' href=\'javascript:;\' onclick=\'javascript:approve_unapprove_booking(' . $bk_id . ',0, ' . $user_bk_id . ', "' . getBookingLocale() . '" , 1 );\' ><i class=\'icon-ban-circle\'></i></a>'; $title .= '<a class=\'button button-secondary\' style=\'margin-right:5px;\' href=\'javascript:;\' onclick=\'javascript:delete_booking(' . $bk_id . ', ' . $user_bk_id . ', "' . getBookingLocale() . '" , 1 );\' ><i class=\'icon-trash\'></i></a>'; $title .= '</div>'; //cell_bk_id_10 time_section_in_day timeslots_in_this_day1 time_hour0 time_in_days_num_30 time_booked_in_day approved /** $title_hint .= '<div style=\'text-align:right;\'>'; $title_hint .= '<a style=\'margin:-40px 0 0 0;position:absolute;\' href=\'javascript:;\' onclick=\'javascript:approve_unapprove_booking('. $bk_id.',1, '. $user_bk_id .', "'. getBookingLocale() .'" , 1 );setTimeout(function ( ) {location.reload(true);} ,'.$reload_time.');\' ><img src=\'' . WPDEV_BK_PLUGIN_URL .'/img/accept-24x24.gif\' style=\'width:14px; height:14px;\'></a>'; // $title_hint .= ' <a href="javascript:void(0)" class="tooltip_bottom approve_bk_link '. ( ($is_approved)?' hidden_items ':'') .' " // onclick="javascript:approve_unapprove_booking('. $bk_id.',1, '. $user_bk_id. ', \''. getBookingLocale() .'\' , 1 );" // ><img src="' . WPDEV_BK_PLUGIN_URL .'/img/accept-24x24.gif" style="width:14px; height:14px;"></a>'; // $title_hint .= '<a style=\'margin:-22px 0 0 -6px;position:absolute;\' href=\'javascript:;\' onclick=\'javascript:approve_unapprove_booking('. $bk_id.',0, '. $user_bk_id .', "'. getBookingLocale() .'" , 1 );setTimeout(function ( ) {location.reload(true);} ,'.$reload_time.');\' ><img src=\'' . WPDEV_BK_PLUGIN_URL .'/img/remove-16x16.png\' style=\'margin:0px 5px;width:15px; height:15px;\'></a>'; // $title_hint .= '<a href="javascript:void(0)" class="tooltip_bottom pending_bk_link '. ( (! $is_approved)? ' hidden_items ':'' ) .' " // onclick="javascript:approve_unapprove_booking('. $bk_id .',0, '. $user_bk_id .', \''. getBookingLocale() .'\' , 1 );" // ><img src="' . WPDEV_BK_PLUGIN_URL .'/img/remove-16x16.png" style="width:15px; height:15px;"></a>'; // //if ( bk_are_you_sure(\''. esc_js(__('Do you really want to set booking as pending ?', 'wpdev-booking')) .'\') ) $title_hint .= '<a href=\'javascript:;\' onclick=\'javascript:delete_booking('. $bk_id.', '. $user_bk_id .', "'. getBookingLocale() .'" , 1 );setTimeout(function ( ) {location.reload(true);} ,'.$reload_time.');\' ><img src=\'' . WPDEV_BK_PLUGIN_URL .'/img/delete_type.png\' style=\'width:13px; height:13px;\'></a>'; //if ( bk_are_you_sure(\''. esc_js(__('Do you really want to delete this booking ?', 'wpdev-booking')) .'\') ) $title_hint .= '</div>'; /**/ $title_hint .= '</div>'; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// return array($title_in_day, $title, $title_hint, $is_approved); }
function get_booking_info_4_tooltip($bk_id, $bookings, $booking_types, $title_in_day = '', $title = '', $title_hint = '') { $user = wp_get_current_user(); $user_bk_id = $user->ID; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Gathering data about the booking to show in the calendar !!! //////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Get it from the option settings $what_show_in_day_template = get_bk_option('booking_default_title_in_day_for_calendar_view_mode'); // '<span style="font-size:07px;">[id]</span>:[name]'; if ($title != '') { $title .= ' / '; } // Other Booking in the same day $title .= $bk_id; if ($title_in_day != '') { $title_in_day .= ','; } // Other Booking in the same day //$title_in_day .= $bk_id ; if (function_exists('get_title_for_showing_in_day')) { $title_in_day .= get_title_for_showing_in_day($bk_id, $bookings, $what_show_in_day_template); } else { $title_in_day .= $bk_id . ':' . $bookings[$bk_id]->form_data['_all_fields_']['name']; } if ($title_hint != '') { $title_hint .= ' <hr style="margin:10px 5px;" /> '; } // Other Booking in the same day $title_hint .= '<div class=\'booking-listing-collumn\' >'; if (function_exists('get_booking_title')) { if (isset($booking_types[$bookings[$bk_id]->booking_type])) { $bk_title = $booking_types[$bookings[$bk_id]->booking_type]->title; } else { $bk_title = get_booking_title($bookings[$bk_id]->booking_type); } $bk_title = '<span class=\'label label-resource label-info\'>' . $bk_title . '</span>'; } else { $bk_title = ''; } $title_hint .= '<span class=\'field-id\'>' . $bk_id . '</span>' . ' ' . $bk_title; if (class_exists('wpdev_bk_biz_s')) { $title_hint .= '<div style=\'float:right;\'>'; if (function_exists('wpdev_bk_get_payment_status_simple')) { $pay_status = wpdev_bk_get_payment_status_simple($bookings[$bk_id]->pay_status); $pay_status = '<span class=\'label label-payment-status payment-label-unknown\'><span style=\'font-size:07px;\'>' . __('Payment', 'booking') . '</span> ' . $pay_status . '</span>'; } else { $pay_status = ''; } $title_hint .= ' ' . $pay_status; $currency = apply_bk_filter('get_currency_info'); $show_cost_value = wpdev_bk_cost_number_format($bookings[$bk_id]->cost); $title_hint .= ' <div class="cost-fields-group" style=\'float:right; margin:2px;\'>' . $currency . ' ' . $show_cost_value . '</div>'; $title_hint .= '</div>'; } $title_hint .= '<div>' . $bookings[$bk_id]->form_show . '</div>'; //$bookings[$bk_id]->form_data['name'].' ' . $bookings[$bk_id]->form_data['secondname'] ; //$title_hint .= ' '. $bookings[$bk_id]->remark; //BL $bk_dates_short_id = array(); if (count($bookings[$bk_id]->dates) > 0) { $bk_dates_short_id = isset($bookings[$bk_id]->dates_short_id) ? $bookings[$bk_id]->dates_short_id : array(); } // Array ([0] => [1] => .... [4] => 6... [11] => [12] => 8 ) $is_approved = 0; if (count($bookings[$bk_id]->dates) > 0) { $is_approved = $bookings[$bk_id]->dates[0]->approved; } $short_dates_content = wpdevbk_get_str_from_dates_short($bookings[$bk_id]->dates_short, $is_approved, $bk_dates_short_id, $booking_types); $short_dates_content = str_replace('"', "'", $short_dates_content); $title_hint .= '<div style=\'margin-top:5px;\'>' . $short_dates_content . '</div>'; $is_approved = 0; if (!empty($bookings[$bk_id]->dates)) { $is_approved = $bookings[$bk_id]->dates[0]->approved; } $title .= '<div class=\'timeline_info_bk_actionsbar_' . $bk_id . '\' style=\'display: inline; line-height: 1em; padding: 10px; vertical-align: text-top;\'>'; $is_can = true; //current_user_can( 'edit_posts' ); if ($is_can) { if (class_exists('wpdev_bk_personal')) { $bk_url_add = 'admin.php?page=' . WPDEV_BK_PLUGIN_DIRNAME . '/' . WPDEV_BK_PLUGIN_FILENAME . 'wpdev-booking-reservation'; $bk_hash = isset($bookings[$bk_id]->hash) ? $bookings[$bk_id]->hash : ''; $bk_booking_type = $bookings[$bk_id]->booking_type; $edit_booking_url = $bk_url_add . '&booking_type=' . $bk_booking_type . '&booking_hash=' . $bk_hash . '&parent_res=1'; $title .= '<a class=\'button button-secondary\' style=\'margin-right:5px;\' href=\'' . $edit_booking_url . '\' onclick=\'\' ><i class=\'icon-edit\'></i></a>'; } $title .= '<a class=\'button button-secondary approve_bk_link ' . ($is_approved ? 'hidden_items' : '') . '\' style=\'margin-right:5px;\' href=\'javascript:;\' onclick=\'javascript:approve_unapprove_booking(' . $bk_id . ',1, ' . $user_bk_id . ', "' . getBookingLocale() . '" , 1 );\' ><i class=\'icon-ok-circle\'></i></a>'; $title .= '<a class=\'button button-secondary pending_bk_link ' . ($is_approved ? '' : 'hidden_items') . '\' style=\'margin-right:5px;\' href=\'javascript:;\' onclick=\'javascript:approve_unapprove_booking(' . $bk_id . ',0, ' . $user_bk_id . ', "' . getBookingLocale() . '" , 1 );\' ><i class=\'icon-ban-circle\'></i></a>'; $title .= '<a class=\'button button-secondary\' style=\'margin-right:5px;\' href=\'javascript:;\' onclick=\'javascript:delete_booking(' . $bk_id . ', ' . $user_bk_id . ', "' . getBookingLocale() . '" , 1 );\' ><i class=\'icon-trash\'></i></a>'; } $title .= '</div>'; $title_hint .= '</div>'; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// return array($title_in_day, $title, $title_hint, $is_approved); }
function booking_listing_table($bookings, $booking_types) { //debuge($_REQUEST); $user = wp_get_current_user(); $user_bk_id = $user->ID; $bk_url_listing = 'admin.php?page=' . WPDEV_BK_PLUGIN_DIRNAME . '/' . WPDEV_BK_PLUGIN_FILENAME . 'wpdev-booking'; $bk_url_add = $bk_url_listing . '-reservation'; $bk_url_resources = $bk_url_listing . '-resources'; $bk_url_settings = $bk_url_listing . '-option'; $bk_admin_url = get_params_in_url(array('page_num', 'wh_booking_type')); $booking_date_view_type = get_bk_option('booking_date_view_type'); if ($booking_date_view_type == 'short') { $wide_days_class = ' hidden_items '; $short_days_class = ''; } else { $wide_days_class = ''; $short_days_class = ' hidden_items '; } $version = get_bk_version(); if ($version == 'free') { $is_free = true; } else { $is_free = false; } ?> <div id="listing_visible_bookings"> <?php if (count($bookings) > 0) { ?> <div class="row-fluid booking-listing-header"> <div class="booking-listing-collumn span1 wpbc_column_1" style="text-align: left;"> <input type="checkbox" onclick="javascript:setCheckBoxInTable(this.checked, 'booking_list_item_checkbox');"> <?php echo 'ID'; ?> </div> <div class="booking-listing-collumn span<?php echo $is_free ? '1' : '2'; ?> wpbc_column_2"><?php _e('Labels', 'wpdev-booking'); if (!$is_free) { echo ' / '; _e('Actions', 'wpdev-booking'); } ?> </div> <div class="booking-listing-collumn span<?php echo $is_free ? '5' : '6'; ?> wpbc_column_4"><?php _e('Booking Data', 'wpdev-booking'); ?> </div> <div class="booking-listing-collumn span3 wpbc_column_5"><?php _e('Booking Dates', 'wpdev-booking'); ?> <a href="javascript:void(0)" id="booking_dates_full" onclick="javascript: jQuery('#booking_dates_full').hide(); jQuery('#booking_dates_small').show(); jQuery('.booking_dates_small').hide(); jQuery('.booking_dates_full').show();" data-original-title="<?php _e('Show ALL dates of booking', 'wpdev-booking'); ?> " rel="tooltip" class="tooltip_top <?php echo $short_days_class; ?> "><i class="icon-resize-full" style=" margin-top: 2px;"></i></a> <a href="javascript:void(0)" id="booking_dates_small" onclick="javascript: jQuery('#booking_dates_small').hide(); jQuery('#booking_dates_full').show(); jQuery('.booking_dates_small').show(); jQuery('.booking_dates_full').hide();" data-original-title="<?php _e('Show only check in/out dates', 'wpdev-booking'); ?> " rel="tooltip" class="tooltip_top <?php echo $wide_days_class; ?> " ><i class="icon-resize-small" style=" margin-top: 2px;"></i></a> </div> <?php if ($is_free) { ?> <div class="booking-listing-collumn span2 wpbc_column_5"><?php _e('Actions', 'wpdev-booking'); ?> </div> <?php } ?> </div> <?php } else { echo '<center><h3>' . __('Nothing found!', 'wpdev-booking') . '</h3></center>'; } ?> <?php // P $print_data = apply_bk_filter('get_bklist_print_header', array(array())); $is_alternative_color = true; $id_of_new_bookings = array(); foreach ($bookings as $bk) { $is_selected_color = 0; //rand(0,1); $is_alternative_color = !$is_alternative_color; $booking_id = $bk->booking_id; // 100 $is_new = isset($bk->is_new) ? $bk->is_new : '0'; // 1 $bk_modification_date = isset($bk->modification_date) ? $bk->modification_date : ''; // 2012-02-29 16:01:58 $bk_form = $bk->form; // select-one^rangetime5^10:00 - 12:00~text^name5^Jonny~text^secondname5^Smith~email^ .... $bk_form_show = $bk->form_show; // First Name:Jonny Last Name:Smith Email:email@server.com Country:GB .... $bk_form_data = $bk->form_data; // Array ([name] => Jonny... [_all_] => Array ( [rangetime5] => 10:00 - 12:00 [name5] => Jonny ... ) .... ) $bk_dates = $bk->dates; // Array ( [0] => stdClass Object ( [booking_id] => 8 [booking_date] => 2012-04-16 10:00:01 [approved] => 0 [type_id] => ) $bk_dates_short = $bk->dates_short; // Array ( [0] => 2012-04-16 10:00:01 [1] => - [2] => 2012-04-20 12:00:02 [3] => , [4] => 2012-04-16 10:00:01 .... //P $bk_booking_type = isset($bk->booking_type) ? $bk->booking_type : '1'; // 3 if (!class_exists('wpdev_bk_personal')) { $bk_booking_type_name = '<span class="label_resource_not_exist">' . __('Default', 'wpdev-booking') . '</span>'; } else { if (isset($booking_types[$bk_booking_type])) { $bk_booking_type_name = $booking_types[$bk_booking_type]->title; // Default if (strlen($bk_booking_type_name) > 19) { //$bk_booking_type_name = substr($bk_booking_type_name, 0, 13) . ' ... ' . substr($bk_booking_type_name, -3 ); $bk_booking_type_name = '<span style="cursor:pointer;" rel="tooltip" class="tooltip_top" data-original-title="' . $bk_booking_type_name . '">' . substr($bk_booking_type_name, 0, 13) . ' ... ' . substr($bk_booking_type_name, -3) . '</span>'; } } else { $bk_booking_type_name = '<span class="label_resource_not_exist">' . __('Resource not exist', 'wpdev-booking') . '</span>'; } } $bk_hash = isset($bk->hash) ? $bk->hash : ''; // 99c9c2bd4fd0207e4376bdbf5ee473bc $bk_remark = isset($bk->remark) ? $bk->remark : ''; // //BS $bk_cost = isset($bk->cost) ? $bk->cost : ''; // 150.00 $bk_pay_status = isset($bk->pay_status) ? $bk->pay_status : ''; // 30800 $bk_pay_request = isset($bk->pay_request) ? $bk->pay_request : ''; // 0 $bk_status = isset($bk->status) ? $bk->status : ''; //BL $bk_dates_short_id = array(); if (count($bk->dates) > 0) { $bk_dates_short_id = isset($bk->dates_short_id) ? $bk->dates_short_id : array(); } // Array ([0] => [1] => .... [4] => 6... [11] => [12] => 8 ) $is_approved = 0; if (count($bk->dates) > 0) { $is_approved = $bk->dates[0]->approved; } //BS $is_paid = 0; $payment_status_titles_current = ''; if (class_exists('wpdev_bk_biz_s')) { if (is_payment_status_ok(trim($bk_pay_status))) { $is_paid = 1; } $payment_status_titles = get_payment_status_titles(); $payment_status_titles_current = array_search($bk_pay_status, $payment_status_titles); if ($payment_status_titles_current === FALSE) { $payment_status_titles_current = $bk_pay_status; } } if ($is_new == 1) { $id_of_new_bookings[] = $booking_id; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Get SHORT Dates showing data //////////////////////////////////////////////////////////////////////////////////////////////////// //$short_dates_content = wpdevbk_get_str_from_dates_short($bk_dates_short, $is_approved , $bk_dates_short_id , $booking_types ); $short_dates_content = ''; $dcnt = 0; foreach ($bk_dates_short as $dt) { if ($dt == '-') { $short_dates_content .= '<span class="date_tire"> - </span>'; } elseif ($dt == ',') { $short_dates_content .= '<span class="date_tire">, </span>'; } else { $short_dates_content .= '<a href="javascript:void(0)" class="field-booking-date '; if ($is_approved) { $short_dates_content .= ' approved'; } $short_dates_content .= '">'; $bk_date = wpdevbk_get_date_in_correct_format($dt); $short_dates_content .= $bk_date[0]; $short_dates_content .= '<sup class="field-booking-time">' . $bk_date[1] . '</sup>'; // BL if (class_exists('wpdev_bk_biz_l')) { if (!empty($bk_dates_short_id[$dcnt])) { $bk_booking_type_name_date = $booking_types[$bk_dates_short_id[$dcnt]]->title; // Default if (strlen($bk_booking_type_name_date) > 19) { $bk_booking_type_name_date = substr($bk_booking_type_name_date, 0, 13) . '...' . substr($bk_booking_type_name_date, -3); } $short_dates_content .= '<sup class="field-booking-time date_from_dif_type"> ' . $bk_booking_type_name_date . '</sup>'; } } $short_dates_content .= '</a>'; } $dcnt++; } // Get WIDE Dates showing data ///////////////////////////////////////////////////////////////////////////////////////////////////// $wide_dates_content = ''; $dates_count = count($bk_dates); $dcnt = 0; foreach ($bk_dates as $dt) { $dcnt++; $wide_dates_content .= '<a href="javascript:void(0)" class="field-booking-date '; if ($is_approved) { $wide_dates_content .= ' approved'; } $wide_dates_content .= ' ">'; $bk_date = wpdevbk_get_date_in_correct_format($dt->booking_date); $wide_dates_content .= $bk_date[0]; $wide_dates_content .= '<sup class="field-booking-time">' . $bk_date[1] . '</sup>'; // BL if (class_exists('wpdev_bk_biz_l')) { if ($dt->type_id != '' && isset($booking_types[$dt->type_id])) { $bk_booking_type_name_date = $booking_types[$dt->type_id]->title; // Default if (strlen($bk_booking_type_name_date) > 19) { $bk_booking_type_name_date = substr($bk_booking_type_name_date, 0, 13) . '...' . substr($bk_booking_type_name_date, -3); } $wide_dates_content .= '<sup class="field-booking-time date_from_dif_type"> ' . $bk_booking_type_name_date . '</sup>'; } } $wide_dates_content .= '</a>'; if ($dcnt < $dates_count) { $wide_dates_content .= '<span class="date_tire">, </span>'; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // BS $pay_print_status = ''; if (class_exists('wpdev_bk_biz_s')) { if ($is_paid) { $pay_print_status = __('Paid OK', 'wpdev-booking'); if ($payment_status_titles_current == 'Completed') { $pay_print_status = $payment_status_titles_current; } } else { if (is_numeric($bk_pay_status) || $bk_pay_status == '') { $pay_print_status = __('Unknown', 'wpdev-booking'); } else { $pay_print_status = $payment_status_titles_current; } } } ///// Print data ////////////////////////////////////////////////////////////////////////////// $print_data[] = apply_bk_filter('get_bklist_print_row', array(), $booking_id, $is_approved, $bk_form_show, $bk_booking_type_name, $is_paid, $pay_print_status, $booking_date_view_type == 'short' ? '<div class="booking_dates_small">' . $short_dates_content . '</div>' : '<div class="booking_dates_full">' . $wide_dates_content . '</div>', $bk_cost); ////////////////////////////////////////////////////////////////////////////////////////////// ?> <div id="booking_mark_<?php echo $booking_id; ?> " class="<?php if ($is_new != '1') { echo ' hidden_items '; } ?> new-label clearfix-height"> <a href="javascript:void(0)" class="tooltip_bottom approve_bk_link <?php //if ($is_approved) echo ' hidden_items '; ?> " onclick="javascript:mark_read_booking( '<?php echo $booking_id; ?> ' , 0, <?php echo $user_bk_id; ?> , '<?php echo getBookingLocale(); ?> ' );" data-original-title="<?php _e('Mark', 'wpdev-booking'); echo ' '; _e('Unread', 'wpdev-booking'); ?> " rel="tooltip" > <img src="<?php echo WPDEV_BK_PLUGIN_URL; ?> /img/label_new_blue.png" style="width:24px; height:24px;"></a> </div> <div id="booking_row_<?php echo $booking_id; ?> " class="row-fluid booking-listing-row clearfix-height<?php if ($is_alternative_color) { echo ' row_alternative_color '; } if ($is_selected_color) { echo ' row_selected_color '; } //if ($is_new) echo ' row_unread_color '; $date_format = get_bk_option('booking_date_format'); $time_format = get_bk_option('booking_time_format'); if (empty($date_format)) { $date_format = "m / d / Y, D"; } if (empty($time_format)) { $time_format = 'h:i a'; } $cr_date = date_i18n($date_format, mysql2date('U', $bk_modification_date)); $cr_time = date_i18n($time_format, mysql2date('U', $bk_modification_date)); ?> " > <div class="wpbc_column_1 booking-listing-collumn bktextcenter span1"> <input type="checkbox" class="booking_list_item_checkbox" onclick="javascript: if (jQuery(this).attr('checked') !== undefined ) { jQuery(this).parent().parent().addClass('row_selected_color'); } else {jQuery(this).parent().parent().removeClass('row_selected_color');}" <?php if ($is_selected_color) { echo ' checked="CHECKED" '; } ?> id="booking_id_selected_<?php echo $booking_id; ?> " name="booking_appr_<?php $booking_id; ?> " /><span class="wpbc_mobile_legend clear" style="margin:0 -5px 0 25px"><?php _e('ID', 'wpdev-booking'); ?> : </span><span class="field-id"><?php echo $booking_id; ?> </span> </div> <div class="wpbc_column_2 booking-listing-collumn bktextleft booking-labels span<?php echo $is_free ? '1' : '2'; ?> "> <?php make_bk_action('wpdev_bk_listing_show_resource_label', $bk_booking_type_name, $bk_admin_url . '&wh_booking_type=' . $bk_booking_type); ?> <?php make_bk_action('wpdev_bk_listing_show_payment_label', $is_paid, $pay_print_status, $payment_status_titles_current); ?> <span class="label label-pending <?php if ($is_approved) { echo ' hidden_items '; } ?> "><?php _e('Pending', 'wpdev-booking'); ?> </span> <span class="label label-approved <?php if (!$is_approved) { echo ' hidden_items '; } ?> "><?php _e('Approved', 'wpdev-booking'); ?> </span> </div> <div class="wpbc_column_3 booking-listing-collumn bktextjustify span<?php echo $is_free ? '5' : '6'; ?> "> <div style="text-align:left"><?php echo $bk_form_show; ?> </div> </div> <div class="wpbc_column_4 booking-listing-collumn bktextleft booking-dates span3"> <div class="booking_dates_small <?php echo $short_days_class; ?> "><?php echo $short_dates_content; ?> </div> <div class="booking_dates_full <?php echo $wide_days_class; ?> " ><?php echo $wide_dates_content; ?> </div> </div> <?php $edit_booking_url = $bk_url_add . '&booking_type=' . $bk_booking_type . '&booking_hash=' . $bk_hash . '&parent_res=1'; ?> <div class="wpbc_column_5 booking-listing-collumn booking-actions<?php echo $is_free ? '0 span2 bktextcenter' : ' bktextleft '; ?> "> <?php $is_can = true; //current_user_can( 'edit_posts' ); if ($is_can) { ?> <?php make_bk_action('wpdev_bk_listing_show_cost_btn', $booking_id, $bk_cost); ?> <div class="actions-fields-group"> <?php make_bk_action('wpdev_bk_listing_show_edit_btn', $booking_id, $edit_booking_url, $bk_remark, $bk_booking_type); ?> <a href="javascript:void(0)" class="tooltip_top approve_bk_link button-secondary button <?php if ($is_approved) { echo ' hidden_items '; } ?> " onclick="javascript:approve_unapprove_booking(<?php echo $booking_id; ?> ,1, <?php echo $user_bk_id; ?> , '<?php echo getBookingLocale(); ?> ' , 1 );" data-original-title="<?php _e('Approve', 'wpdev-booking'); ?> " rel="tooltip" ><i class="icon-ok-circle"></i><?php /** ?><img src="<?php echo WPDEV_BK_PLUGIN_URL; ?>/img/accept-24x24.gif" style="width:14px; height:14px;"><?php /**/ ?> </a><a href="javascript:void(0)" class="tooltip_top pending_bk_link button-secondary button <?php if (!$is_approved) { echo ' hidden_items '; } ?> " onclick="javascript:if ( bk_are_you_sure('<?php echo esc_js(__('Do you really want to set booking as pending ?', 'wpdev-booking')); ?> ') ) approve_unapprove_booking(<?php echo $booking_id; ?> ,0, <?php echo $user_bk_id; ?> , '<?php echo getBookingLocale(); ?> ' , 1 );" data-original-title="<?php _e('Reject', 'wpdev-booking'); ?> " rel="tooltip" ><i class="icon-ban-circle"></i><?php /** ?><img src="<?php echo WPDEV_BK_PLUGIN_URL; ?>/img/remove-16x16.png" style="width:15px; height:15px;"><?php /**/ ?> </a><a href="javascript:void(0)" onclick="javascript:if ( bk_are_you_sure('<?php echo esc_js(__('Do you really want to delete this booking ?', 'wpdev-booking')); ?> ') ) delete_booking(<?php echo $booking_id; ?> , <?php echo $user_bk_id; ?> , '<?php echo getBookingLocale(); ?> ' , 1 );" data-original-title="<?php _e('Delete', 'wpdev-booking'); ?> " rel="tooltip" class="tooltip_top button-secondary button" ><i class="icon-trash"></i><?php /** ?><img src="<?php echo WPDEV_BK_PLUGIN_URL; ?>/img/delete_type.png" style="width:13px; height:13px;"><?php /**/ ?> </a><?php make_bk_action('wpdev_bk_listing_show_print_btn', $booking_id); make_bk_action('wpdev_bk_listing_show_payment_status_btn', $booking_id); ?> <div class="field-date" style="<?php echo $is_free ? 'margin-top:5px;float: none;white-space: normal;' : ''; ?> "><span ><?php _e('Created', 'wpdev-booking'); ?> :</span> <span><?php echo $cr_date, ' ', $cr_time; ?> </span></div> </div> <?php } ?> </div> <?php make_bk_action('wpdev_bk_listing_show_edit_fields', $booking_id, $bk_remark); ?> <?php make_bk_action('wpdev_bk_listing_show_payment_status_cost_fields', $booking_id, $bk_pay_status); ?> </div> <?php } ?> </div> <?php //if ( wpbc_is_field_in_table_exists('booking','is_new') != 0 ) renew_NumOfNewBookings($id_of_new_bookings); // Update num status if supported ?> <?php make_bk_action('wpdev_bk_listing_show_change_booking_resources', $booking_types); ?> <?php if (function_exists('wpdevbk_generate_print_loyout')) { wpdevbk_generate_print_loyout($print_data); } }
function wpdev_bk_custom_button_dalog_structure_DIV() { ?> <div class="hidden"> <div id="wpdev_bk-dialog" style="width:90%;height:90%;"> <div class="wpdev_bk-dialog-content"> <div class="wpdev_bk-dialog-inputs"> <?php $is_can = apply_bk_filter('multiuser_is_user_can_be_here', true, 'only_super_admin'); if ($is_can) { make_bk_action('show_tabs_inside_insertion_popup_window'); } ?> <div id="popup_new_reservation" style="display:block;" class="booking_configuration_dialog"> <div id="popup_new_reservation_main_content"><?php if (get_bk_version() !== 'free') { $types_list = get_bk_types(false, false); ?> <div class="field"> <fieldset> <label for="calendar_type"><?php _e('Booking resource:', 'booking'); ?> </label> <select id="calendar_type" name="calendar_type"> <?php foreach ($types_list as $tl) { ?> <option value="<?php echo $tl->id; ?> " style="<?php if (isset($tl->parent)) { if ($tl->parent == 0) { echo 'font-weight:bold;'; } else { echo 'font-size:11px;padding-left:20px;'; } } ?> " ><?php echo $tl->title; ?> </option> <?php } ?> </select> <span class="description"><?php _e('Select booking resource', 'booking'); ?> </span> </fieldset> </div> <?php } ?> <?php if ($is_can || WP_BK_CUSTOM_FORMS_FOR_REGULAR_USERS) { make_bk_action('wpdev_show_bk_form_selection'); } ?> <div class="field"> <fieldset> <label for="calendar_count"><?php _e('Visible months:', 'booking'); ?> </label> <select id="calendar_count" name="calendar_count" > <option value="1" <?php if (get_bk_option('booking_client_cal_count') == '1') { echo ' selected="SELECTED" '; } ?> >1</option> <option value="2" <?php if (get_bk_option('booking_client_cal_count') == '2') { echo ' selected="SELECTED" '; } ?> >2</option> <option value="3" <?php if (get_bk_option('booking_client_cal_count') == '3') { echo ' selected="SELECTED" '; } ?> >3</option> <option value="4" <?php if (get_bk_option('booking_client_cal_count') == '4') { echo ' selected="SELECTED" '; } ?> >4</option> <option value="5" <?php if (get_bk_option('booking_client_cal_count') == '5') { echo ' selected="SELECTED" '; } ?> >5</option> <option value="6" <?php if (get_bk_option('booking_client_cal_count') == '6') { echo ' selected="SELECTED" '; } ?> >6</option> <option value="7" <?php if (get_bk_option('booking_client_cal_count') == '7') { echo ' selected="SELECTED" '; } ?> >7</option> <option value="8" <?php if (get_bk_option('booking_client_cal_count') == '8') { echo ' selected="SELECTED" '; } ?> >8</option> <option value="9" <?php if (get_bk_option('booking_client_cal_count') == '9') { echo ' selected="SELECTED" '; } ?> >9</option> <option value="10" <?php if (get_bk_option('booking_client_cal_count') == '10') { echo ' selected="SELECTED" '; } ?> >10</option> <option value="11" <?php if (get_bk_option('booking_client_cal_count') == '11') { echo ' selected="SELECTED" '; } ?> >11</option> <option value="12" <?php if (get_bk_option('booking_client_cal_count') == '12') { echo ' selected="SELECTED" '; } ?> >12</option> </select> <span class="description"><?php _e('Select number of month to show for calendar.', 'booking'); ?> </span> </fieldset> </div> <div class="field"> <fieldset> <label for="start_month_active"><?php _e('Start month:', 'booking'); ?> </label> <input id="start_month_active" name="start_month_active" type="checkbox" onchange="javascript:if(! this.checked){ jQuery('select.start_month').attr('disabled', 'disabled'); } else {jQuery('select.start_month').removeAttr('disabled');}" /> <?php $start_year = date('Y'); $start_month = date('m'); ?> <select class="start_month" id="year_start_month" disabled="DISABLED" name="year_start_month" style="width:65px;" > <?php for ($mi = $start_year; $mi < $start_year + 11; $mi++) { echo '<option value="' . $mi . '" >' . $mi . '</option>'; } ?> </select> / <select class="start_month" id="month_start_month" disabled="DISABLED" name="month_start_month" style="width:50px;" > <?php for ($mi = 1; $mi < 13; $mi++) { if ($mi < 10) { $mi = '0' . $mi; } echo '<option value="' . $mi . '" ' . ($start_month == $mi ? ' selected="SELECTED" ' : '') . ' >' . $mi . '</option>'; } ?> </select> <span class="description"><?php _e('Select start month of calendar', 'booking'); ?> </span> </fieldset> </div> <div class="field"> <fieldset> <div style="float:left;"> <label for="calendar_or_form"><?php _e('Show in the page:', 'booking'); ?> </label> </div> <div style="float:left;"> <select id="calendar_or_form" name="calendar_or_form" onchange=" javascript: if(this.value=='onlyform') document.getElementById('dates_for_form').style.display='block'; else document.getElementById('dates_for_form').style.display='none'; "> <option value="form"><?php _e('Booking form with calendar', 'booking'); ?> </option> <option value="calendar"><?php _e('Only availability calendar', 'booking'); ?> </option> <?php if (class_exists('wpdev_bk_biz_l')) { ?> <option value="onlyform"><?php _e('Only booking form', 'booking'); ?> </option><?php } ?> </select> </div> <div style="float:left;"> <?php if (class_exists('wpdev_bk_biz_l')) { ?> <span style="margin-left:5px;display:none;" id="dates_for_form"> <?php _e('for', 'booking'); ?> <select id="year_popup" name="year_popup" style="width:65px;" > <?php for ($mi = $start_year; $mi < $start_year + 11; $mi++) { echo '<option value="' . $mi . '" >' . $mi . '</option>'; } ?> </select> / <select id="month_popup" name="month_popup" style="width:50px;" > <?php for ($mi = 1; $mi < 13; $mi++) { if ($mi < 10) { $mi = '0' . $mi; } echo '<option value="' . $mi . '" ' . ($start_month == $mi ? ' selected="SELECTED" ' : '') . ' >' . $mi . '</option>'; } ?> </select> / <select id="day_popup" name="day_popup" style="width:50px;" > <?php for ($mi = 1; $mi < 32; $mi++) { if ($mi < 10) { $mi = '0' . $mi; } echo '<option value="' . $mi . '" >' . $mi . '</option>'; } ?> </select> <?php _e('date', 'booking'); ?> . </span><?php } ?> </div> <div class="clear"></div> <p class="description"><?php _e('Select to show the entire booking form or the availability calendar only.', 'booking'); ?> </p> </fieldset> </div> <?php make_bk_action('show_additional_arguments_for_shortcode'); ?> </div> <div style="height:1px;clear:both;width:100%;"></div> <div style="color:#21759B;cursor: pointer;font-weight: bold;float:left;" onclick="javascript: jQuery('.bk_show_options_parameter').toggle(1); jQuery('#togle_options_parameter').slideToggle('normal'); jQuery('#popup_new_reservation_main_content').slideToggle('normal');" style="text-decoration: none;font-weight: bold;font-size: 11px;"> <span class="bk_show_options_parameter">+ <span style="border-bottom:1px dashed #21759B;"><?php _e('Show advanced settings', 'booking'); ?> </span></span> <span class="bk_show_options_parameter" style="display:none;">- <span style="border-bottom:1px dashed #21759B;"><?php _e('Hide advanced settings', 'booking'); ?> </span></span> </div> <div class="bk_show_options_parameter description" style="color: #777777;float: right;width: 475px;"><?php printf(__('Setting advanced parameters of the calendar. %sLike width, height and structure %s', 'booking'), '<em>', '</em>'); if (class_exists('wpdev_bk_biz_m')) { printf(__('%s or minimum and fixed number of days selection for the specific day of week or season.%s', 'booking'), '<em>', '</em>'); } ?> </div> <div style="height:1px;clear:both;width:100%;"></div> <div class="field0" id="togle_options_parameter" style="display:none;margin:10px;"> <div class="bk_help_message" style="margin:5px 0px;"><?php printf(__('Please read more about the possible customizations of these %soptions%s %shere%s', 'booking'), '<strong>', '</strong>', '<a href="http://wpbookingcalendar.com/help/booking-calendar-shortcodes/" target="_blank">', '</a>'); ?> </div> <strong><span for="bookingcalendar_options"><?php _e('Options:', 'booking'); ?> </span></strong><br/> <textarea id="bookingcalendar_options" name="bookingcalendar_options" style="width:100%; height:50px;"></textarea> <span class="description" style="width:99%;"> <?php printf(__('Specify the full width of calendar, height of date cell and number of months in one row. ', 'booking')); ?> <br/> <div style="margin-left:35px;"> <strong><?php _e('Description', 'booking'); ?> : </strong> "<?php echo __('Calendar have 2 months in a row, the cell height is 30px and calendar full width 568px (possible to use percentage for width: 100%)', 'booking'); ?> "<br/> <strong><?php _e('Code Example', 'booking'); ?> : </strong> <?php echo '<code>{calendar months_num_in_row=2 width=568px cell_height=30px}</code>'; ?> </div><br/> <?php if (class_exists('wpdev_bk_biz_m')) { ?> <?php printf(__('Specify that during certain seasons (or days of week), the specific minimum number of days must be booked. ', 'booking')); ?> <br/> <div style="margin-left:35px;"> <strong><?php _e('Description', 'booking'); ?> : </strong> "<?php printf(__('Visitor can select only 4 days starting at Monday, 3 or 7 days – Friday, 2 days – Saturday, etc…', 'booking')); ?> "<br/> <strong><?php _e('Code Example', 'booking'); ?> : </strong> <?php echo '<code>{select-day condition="weekday" for="1" value="4"},{select-day condition="weekday" for="5" value="3,7"},{select-day condition="weekday" for="6" value="2"}</code>'; ?> </div> <?php } ?> </span> </div> </div> <?php make_bk_action('show_insertion_popup_shortcode_for_bookingedit'); ?> <input id="calendar_tag_name" name="calendar_tag_name" type="hidden" > <input id="calendar_tag_close" name="calendar_tag_close" type="hidden" > </div> </div> </div> </div> <?php }
function wpdev_bk_settings_general() { $is_can = apply_bk_filter('multiuser_is_user_can_be_here', true, 'only_super_admin'); if ($is_can === false) { return; } if (isset($_POST['start_day_weeek'])) { $booking_skin = $_POST['booking_skin']; $email_reservation_adress = htmlspecialchars(str_replace('\\"', '"', $_POST['email_reservation_adress'])); $email_reservation_adress = str_replace("\\'", "'", $email_reservation_adress); $bookings_num_per_page = $_POST['bookings_num_per_page']; $booking_sort_order = $_POST['booking_sort_order']; $booking_default_toolbar_tab = $_POST['booking_default_toolbar_tab']; $bookings_listing_default_view_mode = $_POST['bookings_listing_default_view_mode']; $booking_view_days_num = $_POST['booking_view_days_num']; //$booking_sort_order_direction = $_POST['booking_sort_order_direction']; $max_monthes_in_calendar = $_POST['max_monthes_in_calendar']; if (isset($_POST['admin_cal_count'])) { $admin_cal_count = $_POST['admin_cal_count']; } if (isset($_POST['client_cal_count'])) { $client_cal_count = $_POST['client_cal_count']; } $start_day_weeek = $_POST['start_day_weeek']; $new_booking_title = $_POST['new_booking_title']; $new_booking_title_time = $_POST['new_booking_title_time']; $type_of_thank_you_message = $_POST['type_of_thank_you_message']; //get_bk_option( 'booking_type_of_thank_you_message' ); //= 'message'; = 'page'; $thank_you_page_URL = wpbc_make_link_relative($_POST['thank_you_page_URL']); //get_bk_option( 'booking_thank_you_page_URL' ); //= 'message'; = 'page'; $booking_date_format = $_POST['booking_date_format']; $booking_date_view_type = $_POST['booking_date_view_type']; //$is_dif_colors_approval_pending = $_POST['is_dif_colors_approval_pending']; if (isset($_POST['is_use_hints_at_admin_panel'])) { $is_use_hints_at_admin_panel = $_POST['is_use_hints_at_admin_panel']; } $type_of_day_selections = $_POST['type_of_day_selections']; if (isset($_POST['is_delete_if_deactive'])) { $is_delete_if_deactive = $_POST['is_delete_if_deactive']; } // check if (isset($_POST['wpdev_copyright_adminpanel'])) { $wpdev_copyright_adminpanel = $_POST['wpdev_copyright_adminpanel']; } // check if (isset($_POST['booking_is_show_powered_by_notice'])) { $booking_is_show_powered_by_notice = $_POST['booking_is_show_powered_by_notice']; } // check if (isset($_POST['is_use_captcha'])) { $is_use_captcha = $_POST['is_use_captcha']; } // check if (isset($_POST['is_use_autofill_4_logged_user'])) { $is_use_autofill_4_logged_user = $_POST['is_use_autofill_4_logged_user']; } // check if (isset($_POST['unavailable_day0'])) { $unavailable_day0 = $_POST['unavailable_day0']; } if (isset($_POST['unavailable_day1'])) { $unavailable_day1 = $_POST['unavailable_day1']; } if (isset($_POST['unavailable_day2'])) { $unavailable_day2 = $_POST['unavailable_day2']; } if (isset($_POST['unavailable_day3'])) { $unavailable_day3 = $_POST['unavailable_day3']; } if (isset($_POST['unavailable_day4'])) { $unavailable_day4 = $_POST['unavailable_day4']; } if (isset($_POST['unavailable_day5'])) { $unavailable_day5 = $_POST['unavailable_day5']; } if (isset($_POST['unavailable_day6'])) { $unavailable_day6 = $_POST['unavailable_day6']; } $user_role_booking = $_POST['user_role_booking']; $user_role_addbooking = $_POST['user_role_addbooking']; $booking_user_role_settings = $_POST['user_role_settings']; if (isset($_POST['user_role_resources'])) { $user_role_resources = $_POST['user_role_resources']; } if (wpdev_bk_is_this_demo()) { $user_role_booking = 'subscriber'; $user_role_addbooking = 'subscriber'; $booking_user_role_settings = 'subscriber'; $user_role_resources = 'subscriber'; } //////////////////////////////////////////////////////////////////////////////////////////////////////////// update_bk_option('booking_user_role_booking', $user_role_booking); update_bk_option('booking_user_role_addbooking', $user_role_addbooking); if (isset($user_role_resources)) { update_bk_option('booking_user_role_resources', $user_role_resources); } update_bk_option('booking_user_role_settings', $booking_user_role_settings); update_bk_option('bookings_num_per_page', $bookings_num_per_page); update_bk_option('booking_sort_order', $booking_sort_order); update_bk_option('booking_default_toolbar_tab', $booking_default_toolbar_tab); update_bk_option('bookings_listing_default_view_mode', $bookings_listing_default_view_mode); update_bk_option('booking_view_days_num', $booking_view_days_num); //update_bk_option( 'booking_sort_order_direction',$booking_sort_order_direction); update_bk_option('booking_skin', $booking_skin); update_bk_option('booking_email_reservation_adress', $email_reservation_adress); if (get_bk_version() == 'free') { // Update admin from adresses at free version //update_bk_option( 'booking_email_reservation_from_adress', $email_reservation_adress ); update_bk_option('booking_email_approval_adress', $email_reservation_adress); update_bk_option('booking_email_deny_adress', $email_reservation_adress); } update_bk_option('booking_max_monthes_in_calendar', $max_monthes_in_calendar); if (!isset($admin_cal_count)) { $admin_cal_count = 2; } if (!isset($client_cal_count)) { $client_cal_count = 1; } if (1 * $admin_cal_count > 12) { $admin_cal_count = 12; } if (1 * $admin_cal_count < 1) { $admin_cal_count = 1; } update_bk_option('booking_admin_cal_count', $admin_cal_count); if (1 * $client_cal_count > 12) { $client_cal_count = 12; } if (1 * $client_cal_count < 1) { $client_cal_count = 1; } update_bk_option('booking_client_cal_count', $client_cal_count); update_bk_option('booking_start_day_weeek', $start_day_weeek); update_bk_option('booking_title_after_reservation', $new_booking_title); update_bk_option('booking_title_after_reservation_time', $new_booking_title_time); update_bk_option('booking_type_of_thank_you_message', $type_of_thank_you_message); update_bk_option('booking_thank_you_page_URL', $thank_you_page_URL); update_bk_option('booking_date_format', $booking_date_format); update_bk_option('booking_date_view_type', $booking_date_view_type); // if (isset( $is_dif_colors_approval_pending )) $is_dif_colors_approval_pending = 'On'; // else $is_dif_colors_approval_pending = 'Off'; // update_bk_option( 'booking_dif_colors_approval_pending' , $is_dif_colors_approval_pending ); if (isset($is_use_hints_at_admin_panel)) { $is_use_hints_at_admin_panel = 'On'; } else { $is_use_hints_at_admin_panel = 'Off'; } update_bk_option('booking_is_use_hints_at_admin_panel', $is_use_hints_at_admin_panel); if (!wpdev_bk_is_this_demo()) { // Do not allow to chnage it in the demo if (isset($_POST['is_not_load_bs_script_in_client'])) { $is_not_load_bs_script_in_client = 'On'; } else { $is_not_load_bs_script_in_client = 'Off'; } update_bk_option('booking_is_not_load_bs_script_in_client', $is_not_load_bs_script_in_client); if (isset($_POST['is_not_load_bs_script_in_admin'])) { $is_not_load_bs_script_in_admin = 'On'; } else { $is_not_load_bs_script_in_admin = 'Off'; } update_bk_option('booking_is_not_load_bs_script_in_admin', $is_not_load_bs_script_in_admin); } update_bk_option('booking_type_of_day_selections', $type_of_day_selections); //////////////////////////////////////////////////////////////////////////////////////////////////////////// $unavailable_days_num_from_today = $_POST['unavailable_days_num_from_today']; update_bk_option('booking_unavailable_days_num_from_today', $unavailable_days_num_from_today); if (isset($unavailable_day0)) { $unavailable_day0 = 'On'; } else { $unavailable_day0 = 'Off'; } update_bk_option('booking_unavailable_day0', $unavailable_day0); if (isset($unavailable_day1)) { $unavailable_day1 = 'On'; } else { $unavailable_day1 = 'Off'; } update_bk_option('booking_unavailable_day1', $unavailable_day1); if (isset($unavailable_day2)) { $unavailable_day2 = 'On'; } else { $unavailable_day2 = 'Off'; } update_bk_option('booking_unavailable_day2', $unavailable_day2); if (isset($unavailable_day3)) { $unavailable_day3 = 'On'; } else { $unavailable_day3 = 'Off'; } update_bk_option('booking_unavailable_day3', $unavailable_day3); if (isset($unavailable_day4)) { $unavailable_day4 = 'On'; } else { $unavailable_day4 = 'Off'; } update_bk_option('booking_unavailable_day4', $unavailable_day4); if (isset($unavailable_day5)) { $unavailable_day5 = 'On'; } else { $unavailable_day5 = 'Off'; } update_bk_option('booking_unavailable_day5', $unavailable_day5); if (isset($unavailable_day6)) { $unavailable_day6 = 'On'; } else { $unavailable_day6 = 'Off'; } update_bk_option('booking_unavailable_day6', $unavailable_day6); //////////////////////////////////////////////////////////////////////////////////////////////////////////// if (isset($is_delete_if_deactive)) { $is_delete_if_deactive = 'On'; } else { $is_delete_if_deactive = 'Off'; } update_bk_option('booking_is_delete_if_deactive', $is_delete_if_deactive); if (isset($booking_is_show_powered_by_notice)) { $booking_is_show_powered_by_notice = 'On'; } else { $booking_is_show_powered_by_notice = 'Off'; } update_bk_option('booking_is_show_powered_by_notice', $booking_is_show_powered_by_notice); if (isset($wpdev_copyright_adminpanel)) { $wpdev_copyright_adminpanel = 'On'; } else { $wpdev_copyright_adminpanel = 'Off'; } update_bk_option('booking_wpdev_copyright_adminpanel', $wpdev_copyright_adminpanel); //////////////////////////////////////////////////////////////////////////////////////////////////////////// if (isset($is_use_captcha)) { $is_use_captcha = 'On'; } else { $is_use_captcha = 'Off'; } update_bk_option('booking_is_use_captcha', $is_use_captcha); if (isset($is_use_autofill_4_logged_user)) { $is_use_autofill_4_logged_user = '******'; } else { $is_use_autofill_4_logged_user = '******'; } update_bk_option('booking_is_use_autofill_4_logged_user', $is_use_autofill_4_logged_user); //if (isset( $is_show_legend )) $is_show_legend = 'On'; //else $is_show_legend = 'Off'; //update_bk_option( 'booking_is_show_legend' , $is_show_legend ); } else { $booking_skin = get_bk_option('booking_skin'); $email_reservation_adress = get_bk_option('booking_email_reservation_adress'); $max_monthes_in_calendar = get_bk_option('booking_max_monthes_in_calendar'); $bookings_num_per_page = get_bk_option('bookings_num_per_page'); $booking_sort_order = get_bk_option('booking_sort_order'); $booking_default_toolbar_tab = get_bk_option('booking_default_toolbar_tab'); $bookings_listing_default_view_mode = get_bk_option('bookings_listing_default_view_mode'); $booking_view_days_num = get_bk_option('booking_view_days_num'); //$booking_sort_order_direction = get_bk_option( 'booking_sort_order_direction'); $admin_cal_count = get_bk_option('booking_admin_cal_count'); $new_booking_title = get_bk_option('booking_title_after_reservation'); $new_booking_title_time = get_bk_option('booking_title_after_reservation_time'); $type_of_thank_you_message = get_bk_option('booking_type_of_thank_you_message'); //= 'message'; = 'page'; $thank_you_page_URL = get_bk_option('booking_thank_you_page_URL'); //= 'message'; = 'page'; $booking_date_format = get_bk_option('booking_date_format'); $booking_date_view_type = get_bk_option('booking_date_view_type'); $client_cal_count = get_bk_option('booking_client_cal_count'); $start_day_weeek = get_bk_option('booking_start_day_weeek'); $is_use_hints_at_admin_panel = get_bk_option('booking_is_use_hints_at_admin_panel'); $is_not_load_bs_script_in_client = get_bk_option('booking_is_not_load_bs_script_in_client'); $is_not_load_bs_script_in_admin = get_bk_option('booking_is_not_load_bs_script_in_admin'); $type_of_day_selections = get_bk_option('booking_type_of_day_selections'); $is_delete_if_deactive = get_bk_option('booking_is_delete_if_deactive'); // check $wpdev_copyright_adminpanel = get_bk_option('booking_wpdev_copyright_adminpanel'); // check $booking_is_show_powered_by_notice = get_bk_option('booking_is_show_powered_by_notice'); // check $is_use_captcha = get_bk_option('booking_is_use_captcha'); // check $is_use_autofill_4_logged_user = get_bk_option('booking_is_use_autofill_4_logged_user'); // check $unavailable_days_num_from_today = get_bk_option('booking_unavailable_days_num_from_today'); $unavailable_day0 = get_bk_option('booking_unavailable_day0'); $unavailable_day1 = get_bk_option('booking_unavailable_day1'); $unavailable_day2 = get_bk_option('booking_unavailable_day2'); $unavailable_day3 = get_bk_option('booking_unavailable_day3'); $unavailable_day4 = get_bk_option('booking_unavailable_day4'); $unavailable_day5 = get_bk_option('booking_unavailable_day5'); $unavailable_day6 = get_bk_option('booking_unavailable_day6'); $user_role_booking = get_bk_option('booking_user_role_booking'); $user_role_addbooking = get_bk_option('booking_user_role_addbooking'); $user_role_resources = get_bk_option('booking_user_role_resources'); $booking_user_role_settings = get_bk_option('booking_user_role_settings'); } if (empty($type_of_thank_you_message)) { $type_of_thank_you_message = 'message'; } ?> <div class="clear" style="height:10px;"></div> <div class="wpdevbk-not-now"> <form name="post_option" action="" method="post" id="post_option" class="form-horizontal"> <div class="booking_settings_row" style="width:64%; float:left;margin-right:1%;"> <div class='meta-box'> <div <?php $my_close_open_win_id = 'bk_general_settings_main'; ?> id="<?php echo $my_close_open_win_id; ?> " class="postbox <?php if ('1' == get_user_option('booking_win_' . $my_close_open_win_id)) { echo 'closed'; } ?> " > <div title="<?php _e('Click to toggle', 'wpdev-booking'); ?> " class="handlediv" onclick="javascript:verify_window_opening(<?php echo get_bk_current_user_id(); ?> , '<?php echo $my_close_open_win_id; ?> ');"><br></div> <h3 class='hndle'><span><?php _e('Main', 'wpdev-booking'); ?> </span></h3> <div class="inside"> <table class="form-table"><tbody> <?php // make_bk_action('wpdev_bk_general_settings_a'); ?> <tr valign="top"> <th scope="row"><label for="email_reservation_adress" ><?php _e('Admin email', 'wpdev-booking'); ?> :</label></th> <td><input id="email_reservation_adress" name="email_reservation_adress" class="large-text" type="text" value="<?php echo $email_reservation_adress; ?> " /> <p class="description"><?php printf(__('Type default %sadmin email%s for booking confirmation', 'wpdev-booking'), '<b>', '</b>'); ?> </p> </td> </tr> <?php make_bk_action('wpdev_bk_general_settings_edit_booking_url'); ?> <?php do_action('settings_advanced_set_update_hash_after_approve'); ?> <tr valign="top"> <th scope="row"> <?php _e('Show / hide hints', 'wpdev-booking'); ?> : </th> <td> <fieldset> <label for="is_use_hints_at_admin_panel" > <input id="is_use_hints_at_admin_panel" type="checkbox" <?php if ($is_use_hints_at_admin_panel == 'On') { echo "checked"; } ?> value="<?php echo $is_use_hints_at_admin_panel; ?> " name="is_use_hints_at_admin_panel"/> <?php _e('Check this box if you want to show help hints on the admin panel.', 'wpdev-booking'); ?> </label> </fieldset> </td> </tr> <tr valign="top"><td colspan="2"><div style="border-bottom:1px solid #cccccc;"></div></td></tr> <tr valign="top"> <td colspan="2"> <div style="width:100%;"> <span style="color:#21759B;cursor: pointer;font-weight: bold;" onclick="javascript: jQuery('#togle_settings_javascriptloading').slideToggle('normal');jQuery('.bk_show_advanced_settings_js').toggle('normal');" style="text-decoration: none;font-weight: bold;font-size: 11px;"> <span class="bk_show_advanced_settings_js">+ <span style="border-bottom:1px dashed #21759B;"><?php _e('Show advanced settings of JavaScript loading', 'wpdev-booking'); ?> </span></span> <span class="bk_show_advanced_settings_js" style="display:none;">- <span style="border-bottom:1px dashed #21759B;"><?php _e('Hide advanced settings of JavaScript loading', 'wpdev-booking'); ?> </span></span> </span> </div> <table id="togle_settings_javascriptloading" style="display:none;" class="hided_settings_table"> <tr valign="top"> <th scope="row"> <?php _e('Disable Bootstrap loading on Front-End', 'wpdev-booking'); ?> : </th> <td> <fieldset> <label for="is_not_load_bs_script_in_client" > <input id="is_not_load_bs_script_in_client" type="checkbox" <?php if ($is_not_load_bs_script_in_client == 'On') { echo "checked"; } ?> value="<?php echo $is_not_load_bs_script_in_client; ?> " name="is_not_load_bs_script_in_client" onclick="javascript: if (this.checked) { var answer = confirm('<?php _e('Warning', 'wpdev-booking'); echo '! '; _e("You are need to be sure what you are doing. You are disable of loading some JavaScripts Do you really want to do this?", 'wpdev-booking'); ?> '); if ( answer){ this.checked = true; } else {this.checked = false;} }" /> <?php _e(' If your theme or some other plugin is load the BootStrap JavaScripts, you can disable loading of this script by this plugin.', 'wpdev-booking'); ?> </label> </fieldset> </td> </tr> <tr valign="top"> <th scope="row"> <?php _e('Disable Bootstrap loading on Back-End', 'wpdev-booking'); ?> : </th> <td> <fieldset> <label for="is_not_load_bs_script_in_admin" > <input id="is_not_load_bs_script_in_admin" type="checkbox" <?php if ($is_not_load_bs_script_in_admin == 'On') { echo "checked"; } ?> value="<?php echo $is_not_load_bs_script_in_admin; ?> " name="is_not_load_bs_script_in_admin" onclick="javascript: if (this.checked) { var answer = confirm('<?php _e('Warning', 'wpdev-booking'); echo '! '; _e("You are need to be sure what you are doing. You are disable of loading some JavaScripts Do you really want to do this?", 'wpdev-booking'); ?> '); if ( answer){ this.checked = true; } else {this.checked = false;} }" /> <?php _e(' If your theme or some other plugin is load the BootStrap JavaScripts, you can disable loading of this script by this plugin.', 'wpdev-booking'); ?> </label> </fieldset> </td> </tr> </table> </td> </tr> <tr valign="top"> <td colspan="2"> <div style="width:100%;"> <span style="color:#21759B;cursor: pointer;font-weight: bold;" onclick="javascript: jQuery('.bk_show_advanced_settings_powered').toggle('normal'); jQuery('#togle_settings_powered').slideToggle('normal');" style="text-decoration: none;font-weight: bold;font-size: 11px;"> <span class="bk_show_advanced_settings_powered">+ <span style="border-bottom:1px dashed #21759B;"><?php _e('Show settings of powered by notice', 'wpdev-booking'); ?> </span></span> <span class="bk_show_advanced_settings_powered" style="display:none;">- <span style="border-bottom:1px dashed #21759B;"><?php _e('Hide settings of powered by notice', 'wpdev-booking'); ?> </span></span> </span> </div> <table id="togle_settings_powered" style="display:none;" class="hided_settings_table"> <tr valign="top"> <th scope="row"> <?php _e('Powered by notice', 'wpdev-booking'); ?> :</th> <td> <fieldset> <label for="booking_is_show_powered_by_notice" > <input id="booking_is_show_powered_by_notice" type="checkbox" <?php if ($booking_is_show_powered_by_notice == 'On') { echo "checked"; } ?> value="<?php echo $booking_is_show_powered_by_notice; ?> " name="booking_is_show_powered_by_notice"/> <?php printf(__(' Turn On/Off powered by "Booking Calendar" notice under the calendar.', 'wpdev-booking'), 'wpbookingcalendar.com'); ?> </label> </fieldset> </td> </tr> <tr valign="top"> <th scope="row"> <?php _e('Copyright notice', 'wpdev-booking'); ?> : </th> <td> <fieldset> <label for="wpdev_copyright_adminpanel" > <input id="wpdev_copyright_adminpanel" type="checkbox" <?php if ($wpdev_copyright_adminpanel == 'On') { echo "checked"; } ?> value="<?php echo $wpdev_copyright_adminpanel; ?> " name="wpdev_copyright_adminpanel"/> <?php printf(__(' Turn On/Off version notice at footer of booking admin panel.', 'wpdev-booking'), 'wpbookingcalendar.com'); ?> </label> </fieldset> </td> </tr> </table> </td></tr> </tbody></table> </div></div></div> <div class='meta-box'> <div <?php $my_close_open_win_id = 'bk_general_settings_calendar'; ?> id="<?php echo $my_close_open_win_id; ?> " class="postbox <?php if ('1' == get_user_option('booking_win_' . $my_close_open_win_id)) { echo 'closed'; } ?> " > <div title="<?php _e('Click to toggle', 'wpdev-booking'); ?> " class="handlediv" onclick="javascript:verify_window_opening(<?php echo get_bk_current_user_id(); ?> , '<?php echo $my_close_open_win_id; ?> ');"><br></div> <h3 class='hndle'><span><?php _e('Calendar', 'wpdev-booking'); ?> </span></h3> <div class="inside"> <table class="form-table"><tbody> <tr valign="top"> <th scope="row"><label for="booking_skin" ><?php _e('Calendar Skin', 'wpdev-booking'); ?> :</label></th> <td> <?php $dir_list = wpdev_bk_dir_list(array('/css/skins/', '/inc/skins/')); ?> <select id="booking_skin" name="booking_skin" style="text-transform:capitalize;"> <?php foreach ($dir_list as $value) { if ($booking_skin == $value[1]) { $selected_item = 'selected="SELECTED"'; } else { $selected_item = ''; } if (strpos(str_replace(WPDEV_BK_PLUGIN_URL, '', $booking_skin), $value[0]) !== false) { $selected_item = 'selected="SELECTED"'; } echo '<option ' . $selected_item . ' value="' . $value[1] . '" >' . $value[2] . '</option>'; } ?> </select> <span class="description"><?php _e('Select the skin of the booking calendar', 'wpdev-booking'); ?> </span> </td> </tr> <tr valign="top"> <th scope="row"><label for="max_monthes_in_calendar" ><?php _e('Number of months', 'wpdev-booking'); ?> :</label></th> <td> <select id="max_monthes_in_calendar" name="max_monthes_in_calendar"> <?php for ($mm = 1; $mm < 12; $mm++) { ?> <option <?php if ($max_monthes_in_calendar == $mm . 'm') { echo "selected"; } ?> value="<?php echo $mm; ?> m"><?php echo $mm, ' '; _e('month(s)', 'wpdev-booking'); ?> </option> <?php } ?> <?php for ($mm = 1; $mm < 11; $mm++) { ?> <option <?php if ($max_monthes_in_calendar == $mm . 'y') { echo "selected"; } ?> value="<?php echo $mm; ?> y"><?php echo $mm, ' '; _e('year(s)', 'wpdev-booking'); ?> </option> <?php } ?> </select> <span class="description"><?php _e('Select the maximum number of months to show (scroll)', 'wpdev-booking'); ?> </span> </td> </tr> <tr valign="top"> <th scope="row"><label for="start_day_weeek" ><?php _e('Start Day of the week', 'wpdev-booking'); ?> :</label></th> <td> <select id="start_day_weeek" name="start_day_weeek"> <option <?php if ($start_day_weeek == '0') { echo "selected"; } ?> value="0"><?php _e('Sunday', 'wpdev-booking'); ?> </option> <option <?php if ($start_day_weeek == '1') { echo "selected"; } ?> value="1"><?php _e('Monday', 'wpdev-booking'); ?> </option> <option <?php if ($start_day_weeek == '2') { echo "selected"; } ?> value="2"><?php _e('Tuesday', 'wpdev-booking'); ?> </option> <option <?php if ($start_day_weeek == '3') { echo "selected"; } ?> value="3"><?php _e('Wednesday', 'wpdev-booking'); ?> </option> <option <?php if ($start_day_weeek == '4') { echo "selected"; } ?> value="4"><?php _e('Thursday', 'wpdev-booking'); ?> </option> <option <?php if ($start_day_weeek == '5') { echo "selected"; } ?> value="5"><?php _e('Friday', 'wpdev-booking'); ?> </option> <option <?php if ($start_day_weeek == '6') { echo "selected"; } ?> value="6"><?php _e('Saturday', 'wpdev-booking'); ?> </option> </select> <span class="description"><?php _e('Select your start day of the week', 'wpdev-booking'); ?> </span> </td> </tr> <tr valign="top"><td colspan="2" style="padding:10px 0px; "><div style="border-bottom:1px solid #cccccc;"></div></td></tr> <tr valign="top"> <th scope="row"><label for="unavailable_days_num_from_today" ><?php _e('Unavailable days from today', 'wpdev-booking'); ?> :</label></th> <td> <select id="unavailable_days_num_from_today" name="unavailable_days_num_from_today"> <?php for ($i = 0; $i < 32; $i++) { ?> <option <?php if ($unavailable_days_num_from_today == $i) { echo "selected"; } ?> value="<?php echo $i; ?> "><?php echo $i; ?> </option> <?php } ?> </select> <span class="description"><?php _e('Select number of unavailable days in calendar start from today.', 'wpdev-booking'); ?> </span> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Unavailable week days', 'wpdev-booking'); ?> :</th> <td> <label for="unavailable_day0" class="wpbc-single-checkbox"> <input id="unavailable_day0" name="unavailable_day0" <?php if ($unavailable_day0 == 'On') { echo "checked"; } ?> value="<?php echo $unavailable_day0; ?> " type="checkbox" /> <?php _e('Sunday', 'wpdev-booking'); ?> </label> <label for="unavailable_day1" class="wpbc-single-checkbox"> <input id="unavailable_day1" name="unavailable_day1" <?php if ($unavailable_day1 == 'On') { echo "checked"; } ?> value="<?php echo $unavailable_day1; ?> " type="checkbox" /> <?php _e('Monday', 'wpdev-booking'); ?> </label> <label for="unavailable_day2" class="wpbc-single-checkbox"> <input id="unavailable_day2" name="unavailable_day2" <?php if ($unavailable_day2 == 'On') { echo "checked"; } ?> value="<?php echo $unavailable_day2; ?> " type="checkbox" /> <?php _e('Tuesday', 'wpdev-booking'); ?> </label> <label for="unavailable_day3" class="wpbc-single-checkbox"> <input id="unavailable_day3" name="unavailable_day3" <?php if ($unavailable_day3 == 'On') { echo "checked"; } ?> value="<?php echo $unavailable_day3; ?> " type="checkbox" /> <?php _e('Wednesday', 'wpdev-booking'); ?> </label> <label for="unavailable_day4" class="wpbc-single-checkbox"> <input id="unavailable_day4" name="unavailable_day4" <?php if ($unavailable_day4 == 'On') { echo "checked"; } ?> value="<?php echo $unavailable_day4; ?> " type="checkbox" /> <?php _e('Thursday', 'wpdev-booking'); ?> </label> <label for="unavailable_day5" class="wpbc-single-checkbox"> <input id="unavailable_day5" name="unavailable_day5" <?php if ($unavailable_day5 == 'On') { echo "checked"; } ?> value="<?php echo $unavailable_day5; ?> " type="checkbox" /> <?php _e('Friday', 'wpdev-booking'); ?> </label> <label for="unavailable_day6" class="wpbc-single-checkbox"> <input id="unavailable_day6" name="unavailable_day6" <?php if ($unavailable_day6 == 'On') { echo "checked"; } ?> value="<?php echo $unavailable_day6; ?> " type="checkbox" /> <?php _e('Saturday', 'wpdev-booking'); ?> </label> <p class="description"><?php _e('Check unavailable days in calendars. This option will overwrite all other settings.', 'wpdev-booking'); ?> </p> </td> </tr> <tr valign="top"><td colspan="2" style="padding:10px 0px; "><div style="border-bottom:1px solid #cccccc;"></div></td></tr> <tr valign="top"> <th scope="row"><?php _e('Type of days selection in calendar', 'wpdev-booking'); ?> :</th> <td> <fieldset> <legend class="screen-reader-text"><span><?php _e('Type of days selection', 'wpdev-booking'); ?> </span></legend> <label for="type_of_day_selections_single"> <input value="single" <?php if ($type_of_day_selections == 'single' || empty($type_of_day_selections)) { echo 'checked="CHECKED"'; } ?> onclick="javascript: jQuery('#togle_settings_range_type_selection').slideUp('normal'); jQuery('.booking_time_advanced_config').slideUp('normal'); if ( jQuery('#range_selection_time_is_active').length > 0 ) { jQuery('#range_selection_time_is_active').attr('checked', false); } if ( jQuery('#booking_recurrent_time').length > 0 ) { jQuery('#booking_recurrent_time').attr('checked', false); } if ( jQuery('#togle_settings_range_times').length > 0 ) { jQuery('#togle_settings_range_times').slideUp('normal'); } if ( jQuery('#togle_settings_availble_for_cehck_in_out').length > 0 ) { jQuery('#togle_settings_availble_for_cehck_in_out').slideUp('normal'); } " name="type_of_day_selections" id="type_of_day_selections_single" type="radio" /> <span><?php _e('Single day', 'wpdev-booking'); ?> </span> </label><br /> <label for="type_of_day_selections_multiple"> <input value="multiple" <?php if ($type_of_day_selections == 'multiple') { echo 'checked="CHECKED"'; } ?> onclick="javascript: jQuery('#togle_settings_range_type_selection').slideUp('normal'); jQuery('.booking_time_advanced_config').slideDown('normal'); " name="type_of_day_selections" id="type_of_day_selections_multiple" type="radio" /> <span><?php _e('Multiple days', 'wpdev-booking'); ?> </span> </label><br /> <?php if (class_exists('wpdev_bk_biz_s')) { ?> <label for="type_of_day_selections_range"> <input value="range" <?php if ($type_of_day_selections == 'range') { echo 'checked="CHECKED"'; } ?> onclick="javascript: jQuery('#togle_settings_range_type_selection').slideDown('normal'); jQuery('.booking_time_advanced_config').slideDown('normal'); " name="type_of_day_selections" id="type_of_day_selections_range" type="radio" /> <span><?php _e('Range days', 'wpdev-booking'); ?> </span> </label> <?php } ?> </fieldset> </td> </tr> <?php do_action('settings_advanced_set_range_selections'); ?> <?php do_action('settings_advanced_set_fixed_time'); ?> <tr valign="top" class="booking_time_advanced_config" style="<?php if (get_bk_option('booking_type_of_day_selections') == 'single') { echo 'display:none;'; } ?> "> <td colspan="2" style="padding:0px 0px 10px; "><div style="border-bottom:1px solid #cccccc;"></div> </td> </tr> <?php do_action('settings_set_show_cost_in_tooltips'); ?> <?php do_action('settings_set_show_availability_in_tooltips'); ?> <?php do_action('settings_set_show_time_in_tooltips'); ?> </tbody></table> </div></div></div> <div class='meta-box'> <div <?php $my_close_open_win_id = 'bk_general_settings_form'; ?> id="<?php echo $my_close_open_win_id; ?> " class="postbox <?php if ('1' == get_user_option('booking_win_' . $my_close_open_win_id)) { echo 'closed'; } ?> " > <div title="<?php _e('Click to toggle', 'wpdev-booking'); ?> " class="handlediv" onclick="javascript:verify_window_opening(<?php echo get_bk_current_user_id(); ?> , '<?php echo $my_close_open_win_id; ?> ');"><br></div> <h3 class='hndle'><span><?php _e('Form', 'wpdev-booking'); ?> </span></h3> <div class="inside"> <table class="form-table"><tbody> <?php // Is using the BootStrap CSS ////////////////////////////////////////////////////////////////////////// if (isset($_POST['Submit'])) { if (isset($_POST['booking_form_is_using_bs_css'])) { $booking_form_is_using_bs_css = 'On'; } else { $booking_form_is_using_bs_css = 'Off'; } update_bk_option('booking_form_is_using_bs_css', $booking_form_is_using_bs_css); } $booking_form_is_using_bs_css = get_bk_option('booking_form_is_using_bs_css'); ?> <tr valign="top"> <th scope="row"><?php _e('CAPTCHA', 'wpdev-booking'); ?> :</th> <td><fieldset><label for="is_use_captcha"> <input id="is_use_captcha" type="checkbox" <?php if ($is_use_captcha == 'On') { echo "checked"; } ?> value="<?php echo $is_use_captcha; ?> " name="is_use_captcha"/> <?php _e('Check the box to activate CAPTCHA inside the booking form.', 'wpdev-booking'); ?> </label> </fieldset> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Auto-fill fields', 'wpdev-booking'); ?> :</th> <td><fieldset><label for="is_use_autofill_4_logged_user" > <input id="is_use_autofill_4_logged_user" type="checkbox" <?php if ($is_use_autofill_4_logged_user == 'On') { echo "checked"; } ?> value="<?php echo $is_use_autofill_4_logged_user; ?> " name="is_use_autofill_4_logged_user"/> <?php _e('Check the box to activate auto-fill form fields for logged in users.', 'wpdev-booking'); ?> </label> </fieldset> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Use CSS BootStrap', 'wpdev-booking'); ?> :</th> <td><fieldset><label for="booking_form_is_using_bs_css"> <input type="checkbox" name="booking_form_is_using_bs_css" id="booking_form_is_using_bs_css" <?php if ($booking_form_is_using_bs_css == 'On') { echo ' checked="checked" '; } ?> value="<?php echo $booking_form_is_using_bs_css; ?> " > <?php _e('Using BootStrap CSS for the form fields', 'wpdev-booking'); ?> </label> </fieldset> <p class="description"><strong><?php _e('Note', 'wpdev-booking'); ?> :</strong> <?php _e('You must not deactivate loading BootStrap files at main section of these settings!', 'wpdev-booking'); ?> </p> </td> </tr> <?php wpdev_bk_settings_legend_section(); /** ?> <tr valign="top"> <th scope="row"><label for="is_show_legend" ><?php _e('Show legend', 'wpdev-booking'); ?>:</label><br><?php _e('at booking calendar', 'wpdev-booking'); ?></th> <td><input id="is_show_legend" type="checkbox" <?php if ($is_show_legend == 'On') echo "checked"; ?> value="<?php echo $is_show_legend; ?>" name="is_show_legend"/> <span class="description"> <?php _e('Check this box to display a legend of dates below the booking calendar.', 'wpdev-booking');?></span> </td> </tr><?php /**/ ?> <tr valign="top" style="padding: 0px;"> <th scope="row"><?php _e('Action after booking is done', 'wpdev-booking'); ?> :</th> <td> <fieldset> <label for="type_of_thank_you_message_message"> <input <?php if ($type_of_thank_you_message == 'message') { echo 'checked="checked"'; } /**/ ?> value="message" type="radio" id="type_of_thank_you_message_message" name="type_of_thank_you_message" onclick="javascript: jQuery('#togle_settings_thank-you_page').slideUp('normal');jQuery('#togle_settings_thank-you_message').slideDown('normal');" /> <span><?php _e('Show "Thank You" message', 'wpdev-booking'); ?> </span> </label><br /> <label for="type_of_thank_you_message_page"> <input <?php if ($type_of_thank_you_message == 'page') { echo 'checked="checked"'; } /**/ ?> value="page" type="radio" id="type_of_thank_you_message_page" name="type_of_thank_you_message" onclick="javascript: jQuery('#togle_settings_thank-you_page').slideDown('normal');jQuery('#togle_settings_thank-you_message').slideUp('normal');" /> <span><?php _e('Redirect visitor to a new "Thank You" page', 'wpdev-booking'); ?> </span> </label> </fieldset> <?php if (class_exists('wpdev_bk_biz_s')) { ?> <p class="description"><strong><?php _e('Note', 'wpdev-booking'); ?> :</strong> <?php _e('This action will have no effect, if the payment form(s) is active!', 'wpdev-booking'); ?> </p> <?php } ?> </td> </tr> <tr valign="top" style="padding: 0px;"><td colspan="2" style="padding:0px;"> <div style="margin: -10px 0 10px 50px;"> <table id="togle_settings_thank-you_message" style="width:100%;<?php if ($type_of_thank_you_message != 'message') { echo 'display:none;'; } /**/ ?> " class="hided_settings_table"> <tr valign="top"> <th><label for="new_booking_title"><?php _e('Message title', 'wpdev-booking'); ?> :</label></th> <td> <input id="new_booking_title" class="large-text" type="text" value="<?php echo $new_booking_title; ?> " name="new_booking_title" /> <p class="description"><?php printf(__('Type title of message %safter booking has done by user%s', 'wpdev-booking'), '<b>', '</b>'); ?> </p> </td> </tr> <tr><td colspan="2" style="padding:0px;"><div style="margin-top:-15px;"><?php make_bk_action('show_additional_translation_shortcode_help'); ?> </div></td></tr> <tr> <th><label for="new_booking_title_time"><?php _e('Time of message showing', 'wpdev-booking'); ?> :</label></th> <td> <input id="new_booking_title_time" class="small-text" type="text" size="45" value="<?php echo $new_booking_title_time; ?> " name="new_booking_title_time" /> <p class="description"><?php printf(__('Set duration of time (milliseconds) to show this message', 'wpdev-booking'), '<b>', '</b>'); ?> </p> </td> </tr> </table> <table id="togle_settings_thank-you_page" style="width:100%;<?php if ($type_of_thank_you_message != 'page') { echo 'display:none;'; } /**/ ?> " class="hided_settings_table"> <tr valign="top"> <th scope="row"><label for="thank_you_page_URL" ><?php _e('URL of "thank you" page', 'wpdev-booking'); ?> :</label></th> <td> <fieldset> <code style="font-size:14px;"><?php echo get_option('siteurl'); ?> </code><input value="<?php echo $thank_you_page_URL; ?> " name="thank_you_page_URL" id="thank_you_page_URL" class="large-text" type="text" /> </fieldset> <p class="description"><?php printf(__('Type URL of %s"Thank You" page%s', 'wpdev-booking'), '<b>', '</b>'); ?> </p> </td> </tr> </table> </div> </td></tr> </tbody></table> </div></div></div> <div class='meta-box'> <div <?php $my_close_open_win_id = 'bk_general_settings_bktable'; ?> id="<?php echo $my_close_open_win_id; ?> " class="postbox <?php if ('1' == get_user_option('booking_win_' . $my_close_open_win_id)) { echo 'closed'; } ?> " > <div title="<?php _e('Click to toggle', 'wpdev-booking'); ?> " class="handlediv" onclick="javascript:verify_window_opening(<?php echo get_bk_current_user_id(); ?> , '<?php echo $my_close_open_win_id; ?> ');"><br></div> <h3 class='hndle'><span><?php _e('Listing of bookings', 'wpdev-booking'); ?> </span></h3> <div class="inside"> <table class="form-table"><tbody> <tr valign="top"> <th scope="row"><label for="bookings_listing_default_view_mode" ><?php _e('Default booking admin page', 'wpdev-booking'); ?> :</label></th> <td> <?php $wpdevbk_selectors = array(__('Bookings Listing', 'wpdev-booking') => 'vm_listing', __('Calendar Overview', 'wpdev-booking') => 'vm_calendar'); ?> <select id="bookings_listing_default_view_mode" name="bookings_listing_default_view_mode"> <?php foreach ($wpdevbk_selectors as $kk => $mm) { ?> <option <?php if ($bookings_listing_default_view_mode == strtolower($mm)) { echo "selected"; } ?> value="<?php echo strtolower($mm); ?> "><?php echo $kk; ?> </option> <?php } ?> </select> <span class="description"><?php _e('Select your default view mode of bookings at the booking listing page', 'wpdev-booking'); ?> </span> </td> </tr> <?php make_bk_action('wpdev_bk_general_settings_set_default_booking_resource'); ?> <tr valign="top"><td colspan="2"><div style="border-bottom:1px solid #cccccc;"></div></td></tr> <tr valign="top"> <th scope="row"><label for="booking_view_days_num" ><?php _e('Default calendar view mode', 'wpdev-booking'); ?> :</label></th> <td><?php if (class_exists('wpdev_bk_personal')) { $wpdevbk_selectors = array(__('Day', 'wpdev-booking') => '1', __('Week', 'wpdev-booking') => '7', __('Month', 'wpdev-booking') => '30', __('2 Months', 'wpdev-booking') => '60', __('3 Months', 'wpdev-booking') => '90', __('Year', 'wpdev-booking') => '365'); } else { $wpdevbk_selectors = array(__('Month', 'wpdev-booking') => '30', __('3 Months', 'wpdev-booking') => '90', __('Year', 'wpdev-booking') => '365'); } ?> <select id="booking_view_days_num" name="booking_view_days_num" onfocus="javascript:wpdev_bk_recheck_disabled_options();"> <?php foreach ($wpdevbk_selectors as $kk => $mm) { ?> <option <?php if ($booking_view_days_num == strtolower($mm)) { echo "selected"; } ?> value="<?php echo strtolower($mm); ?> "><?php echo $kk; ?> </option> <?php } ?> </select> <script type="text/javascript"> // Set the correct value of this selectbox, depend from the Matrix or Single Calendar Overview function wpdev_bk_recheck_disabled_options() { if ( jQuery('#default_booking_resource').length>0 ) { jQuery('#default_booking_resource').bind('change', function() { jQuery('#booking_view_days_num option:eq(2)').prop("selected", true); }); if ( jQuery('#default_booking_resource').val() == '' ) { //All resources selected jQuery('#booking_view_days_num option:eq(0)').prop("disabled", false); jQuery('#booking_view_days_num option:eq(1)').prop("disabled", false); jQuery('#booking_view_days_num option:eq(2)').prop("disabled", false); jQuery('#booking_view_days_num option:eq(3)').prop("disabled", false); jQuery('#booking_view_days_num option:eq(4)').prop("disabled", true); jQuery('#booking_view_days_num option:eq(5)').prop("disabled", true); } else { jQuery('#booking_view_days_num option:eq(0)').prop("disabled", true); jQuery('#booking_view_days_num option:eq(1)').prop("disabled", true); jQuery('#booking_view_days_num option:eq(2)').prop("disabled", false); jQuery('#booking_view_days_num option:eq(3)').prop("disabled", true); jQuery('#booking_view_days_num option:eq(4)').prop("disabled", false); jQuery('#booking_view_days_num option:eq(5)').prop("disabled", false); } } } </script> <span class="description"><?php _e('Select your default calendar view mode at booking calendar overview page', 'wpdev-booking'); ?> </span> </td> </tr> <?php make_bk_action('wpdev_bk_general_settings_set_default_title_in_day'); ?> <tr valign="top"><td colspan="2"><div style="border-bottom:1px solid #cccccc;"></div></td></tr> <tr valign="top"> <th scope="row"><label for="booking_default_toolbar_tab" ><?php _e('Default toolbar tab', 'wpdev-booking'); ?> :</label></th> <td> <?php $wpdevbk_selectors = array(__('Filter tab', 'wpdev-booking') => 'filter', __('Actions tab', 'wpdev-booking') => 'actions'); ?> <select id="booking_default_toolbar_tab" name="booking_default_toolbar_tab"> <?php foreach ($wpdevbk_selectors as $kk => $mm) { ?> <option <?php if ($booking_default_toolbar_tab == strtolower($mm)) { echo "selected"; } ?> value="<?php echo strtolower($mm); ?> "><?php echo $kk; ?> </option> <?php } ?> </select> <span class="description"><?php _e('Select your default opened tab in toolbar at booking listing page', 'wpdev-booking'); ?> </span> </td> </tr> <tr valign="top"> <th scope="row"><label for="bookings_num_per_page" ><?php _e('Bookings number per page', 'wpdev-booking'); ?> :</label></th> <td> <?php $order_array = array(5, 10, 20, 25, 50, 75, 100); ?> <select id="bookings_num_per_page" name="bookings_num_per_page"> <?php foreach ($order_array as $mm) { ?> <option <?php if ($bookings_num_per_page == strtolower($mm)) { echo "selected"; } ?> value="<?php echo strtolower($mm); ?> "><?php echo $mm; ?> </option> <?php } ?> </select> <span class="description"><?php _e('Select number of bookings per page in booking listing', 'wpdev-booking'); ?> </span> </td> </tr> <tr valign="top"> <th scope="row"><label for="booking_sort_order" ><?php _e('Bookings default order', 'wpdev-booking'); ?> :</label></th> <td><?php $order_array = array('ID'); $wpdevbk_selectors = array(__('ID', 'wpdev-booking') . ' ' . __('ASC', 'wpdev-booking') => '', __('ID', 'wpdev-booking') . ' ' . __('DESC', 'wpdev-booking') => 'booking_id_asc', __('Dates', 'wpdev-booking') . ' ' . __('ASC', 'wpdev-booking') => 'sort_date', __('Dates', 'wpdev-booking') . ' ' . __('DESC', 'wpdev-booking') => 'sort_date_asc'); if (class_exists('wpdev_bk_personal')) { $order_array[] = 'Resource'; $wpdevbk_selectors[__('Resource', 'wpdev-booking') . ' ' . __('ASC', 'wpdev-booking')] = 'booking_type'; $wpdevbk_selectors[__('Resource', 'wpdev-booking') . ' ' . __('DESC', 'wpdev-booking')] = 'booking_type_asc'; } if (class_exists('wpdev_bk_biz_s')) { $order_array[] = 'Cost'; $wpdevbk_selectors[__('Cost', 'wpdev-booking') . ' ' . __('ASC', 'wpdev-booking')] = 'cost'; $wpdevbk_selectors[__('Cost', 'wpdev-booking') . ' ' . __('DESC', 'wpdev-booking')] = 'cost_asc'; } ?> <select id="booking_sort_order" name="booking_sort_order"> <?php foreach ($wpdevbk_selectors as $kk => $mm) { ?> <option <?php if ($booking_sort_order == strtolower($mm)) { echo "selected"; } ?> value="<?php echo strtolower($mm); ?> "><?php echo $kk; ?> </option> <?php } ?> </select> <span class="description"><?php _e('Select your default order of bookings in the booking listing', 'wpdev-booking'); ?> </span> </td> </tr> <tr valign="top"><td colspan="2"><div style="border-bottom:1px solid #cccccc;"></div></td></tr> <tr valign="top"> <th scope="row"><label for="booking_date_format" ><?php _e('Date Format', 'wpdev-booking'); ?> :</label></th> <td> <fieldset> <?php $date_formats = array(__('F j, Y'), 'Y/m/d', 'm/d/Y', 'd/m/Y'); $custom = TRUE; foreach ($date_formats as $format) { echo "\t<label title='" . esc_attr($format) . "'>"; echo "<input type='radio' name='booking_date_format' value='" . esc_attr($format) . "'"; if (get_bk_option('booking_date_format') === $format) { echo " checked='checked'"; $custom = FALSE; } echo ' /> ' . date_i18n($format) . "</label> \n"; } echo '<div style="height:7px;"></div>'; echo '<label><input type="radio" name="booking_date_format" id="date_format_custom_radio" value="' . $booking_date_format . '"'; if ($custom) { echo ' checked="checked"'; } echo '/> ' . __('Custom', 'wpdev-booking') . ': </label>'; ?> <input id="booking_date_format_custom" class="regular-text" type="text" size="45" value="<?php echo $booking_date_format; ?> " name="booking_date_format_custom" style="line-height:35px;" onchange="javascript:document.getElementById('date_format_custom_radio').value = this.value;document.getElementById('date_format_custom_radio').checked=true;" /> <?php echo ' ' . date_i18n($booking_date_format) . "\n"; echo ' '; ?> <p class="description"><?php printf(__('Type your date format for emails and the booking table. %sDocumentation on date formatting%s', 'wpdev-booking'), '<a href="http://codex.wordpress.org/Formatting_Date_and_Time" target="_blank">', '</a>'); ?> </p> </fieldset> </td> </tr> <?php do_action('settings_advanced_set_time_format'); ?> <tr valign="top"> <th scope="row"><label for="booking_date_view_type" ><?php _e('Dates view', 'wpdev-booking'); ?> :</label></th> <td> <select id="booking_date_view_type" name="booking_date_view_type"> <option <?php if ($booking_date_view_type == 'short') { echo "selected"; } ?> value="short"><?php _e('Short days view', 'wpdev-booking'); ?> </option> <option <?php if ($booking_date_view_type == 'wide') { echo "selected"; } ?> value="wide"><?php _e('Wide days view', 'wpdev-booking'); ?> </option> </select> <span class="description"><?php _e('Select the default view for dates on the booking tables', 'wpdev-booking'); ?> </span> </td> </tr> </tbody></table> </div></div></div> <?php make_bk_action('wpdev_bk_general_settings_cost_section'); ?> <?php make_bk_action('wpdev_bk_general_settings_pending_auto_cancelation'); ?> <?php do_action('wpdev_bk_general_settings_advanced_section'); ?> </div> <div class="booking_settings_row" style="width:35%; float:left;"> <?php $version = get_bk_version(); if (wpdev_bk_is_this_demo()) { $version = 'free'; } //if ( ($version !== 'free') && ($version!== 'biz_l') ) { wpdev_bk_upgrade_window($version); } ?> <div class='meta-box'> <div <?php $my_close_open_win_id = 'bk_general_settings_info'; ?> id="<?php echo $my_close_open_win_id; ?> " class="gdrgrid postbox <?php if ('1' == get_user_option('booking_win_' . $my_close_open_win_id)) { echo 'closed'; } ?> " > <div title="<?php _e('Click to toggle', 'wpdev-booking'); ?> " class="handlediv" onclick="javascript:verify_window_opening(<?php echo get_bk_current_user_id(); ?> , '<?php echo $my_close_open_win_id; ?> ');"><br></div> <h3 class='hndle'><span><?php _e('Information', 'wpdev-booking'); ?> </span></h3> <div class="inside"> <?php make_bk_action('dashboard_bk_widget_show'); ?> </div> </div> </div> <?php if (false && !class_exists('wpdev_crm') && $version != 'free') { ?> <div class='meta-box'> <div <?php $my_close_open_win_id = 'bk_general_settings_recomended_plugins'; ?> id="<?php echo $my_close_open_win_id; ?> " class="gdrgrid postbox <?php if ('1' == get_user_option('booking_win_' . $my_close_open_win_id)) { echo 'closed'; } ?> " > <div title="<?php _e('Click to toggle', 'wpdev-booking'); ?> " class="handlediv" onclick="javascript:verify_window_opening(<?php echo get_bk_current_user_id(); ?> , '<?php echo $my_close_open_win_id; ?> ');"><br></div> <h3 class='hndle'><span><?php _e('Recommended WordPress Plugins', 'wpdev-booking'); ?> </span></h3> <div class="inside"> <h2 style="margin:10px;"><?php _e('Booking Manager - show all old bookings'); ?> </h2> <img src="<?php echo WPDEV_BK_PLUGIN_URL . '/img/users-48x48.png'; ?> " style="float:left; padding:0px 10px 10px 0px;"> <p style="margin:0px;"> <?php printf(__('This wordpress plugin is %sshow all approved and pending bookings from past%s. Show how many each customer is made bookings. Paid versions support %sexport to CSV, print layout, advanced filter%s. ', 'wpdev-booking'), '<strong>', '</strong>', '<strong>', '</strong>'); ?> <br/> </p> <p style="text-align:center;padding:10px 0px;"> <a href="http://wordpress.org/extend/plugins/booking-manager" class="button-primary" target="_blank">Download from wordpress</a> <a href="http://wpbookingmanager.com" class="button-primary" target="_blank">Demo site</a> </p> </div> </div> </div> <?php } ?> <div class='meta-box'> <div <?php $my_close_open_win_id = 'bk_general_settings_users_permissions'; ?> id="<?php echo $my_close_open_win_id; ?> " class="postbox <?php if ('1' == get_user_option('booking_win_' . $my_close_open_win_id)) { echo 'closed'; } ?> " > <div title="<?php _e('Click to toggle', 'wpdev-booking'); ?> " class="handlediv" onclick="javascript:verify_window_opening(<?php echo get_bk_current_user_id(); ?> , '<?php echo $my_close_open_win_id; ?> ');"><br></div> <h3 class='hndle'><span><?php _e('User permissions for plugin menu pages', 'wpdev-booking'); ?> </span></h3> <div class="inside"> <table class="form-table"><tbody> <tr valign="top"> <th scope="row"><label for="user_role_booking" ><?php _e('Bookings', 'wpdev-booking'); ?> :</label></th> <td> <select id="user_role_booking" name="user_role_booking"> <option <?php if ($user_role_booking == 'subscriber') { echo "selected"; } ?> value="subscriber" ><?php echo translate_user_role('Subscriber'); ?> </option> <option <?php if ($user_role_booking == 'administrator') { echo "selected"; } ?> value="administrator" ><?php echo translate_user_role('Administrator'); ?> </option> <option <?php if ($user_role_booking == 'editor') { echo "selected"; } ?> value="editor" ><?php echo translate_user_role('Editor'); ?> </option> <option <?php if ($user_role_booking == 'author') { echo "selected"; } ?> value="author" ><?php echo translate_user_role('Author'); ?> </option> <option <?php if ($user_role_booking == 'contributor') { echo "selected"; } ?> value="contributor" ><?php echo translate_user_role('Contributor'); ?> </option> </select> </td> </tr> <tr valign="top"> <th scope="row"><label for="user_role_addbooking" ><?php _e('Add booking', 'wpdev-booking'); ?> :</label></th> <td> <select id="user_role_addbooking" name="user_role_addbooking"> <option <?php if ($user_role_addbooking == 'subscriber') { echo "selected"; } ?> value="subscriber" ><?php echo translate_user_role('Subscriber'); ?> </option> <option <?php if ($user_role_addbooking == 'administrator') { echo "selected"; } ?> value="administrator" ><?php echo translate_user_role('Administrator'); ?> </option> <option <?php if ($user_role_addbooking == 'editor') { echo "selected"; } ?> value="editor" ><?php echo translate_user_role('Editor'); ?> </option> <option <?php if ($user_role_addbooking == 'author') { echo "selected"; } ?> value="author" ><?php echo translate_user_role('Author'); ?> </option> <option <?php if ($user_role_addbooking == 'contributor') { echo "selected"; } ?> value="contributor" ><?php echo translate_user_role('Contributor'); ?> </option> </select> </td> </tr> <?php if ($version !== 'free') { ?> <tr valign="top"> <th scope="row"><label for="user_role_resources" ><?php _e('Resources', 'wpdev-booking'); ?> :</label></th> <td> <select id="user_role_resources" name="user_role_resources"> <option <?php if ($user_role_resources == 'subscriber') { echo "selected"; } ?> value="subscriber" ><?php echo translate_user_role('Subscriber'); ?> </option> <option <?php if ($user_role_resources == 'administrator') { echo "selected"; } ?> value="administrator" ><?php echo translate_user_role('Administrator'); ?> </option> <option <?php if ($user_role_resources == 'editor') { echo "selected"; } ?> value="editor" ><?php echo translate_user_role('Editor'); ?> </option> <option <?php if ($user_role_resources == 'author') { echo "selected"; } ?> value="author" ><?php echo translate_user_role('Author'); ?> </option> <option <?php if ($user_role_resources == 'contributor') { echo "selected"; } ?> value="contributor" ><?php echo translate_user_role('Contributor'); ?> </option> </select> </td> </tr> <?php } ?> <tr valign="top"> <th scope="row"><label for="user_role_settings" ><?php _e('Settings', 'wpdev-booking'); ?> :</label></th> <td> <select id="user_role_settings" name="user_role_settings"> <option <?php if ($booking_user_role_settings == 'subscriber') { echo "selected"; } ?> value="subscriber" ><?php echo translate_user_role('Subscriber'); ?> </option> <option <?php if ($booking_user_role_settings == 'administrator') { echo "selected"; } ?> value="administrator" ><?php echo translate_user_role('Administrator'); ?> </option> <option <?php if ($booking_user_role_settings == 'editor') { echo "selected"; } ?> value="editor" ><?php echo translate_user_role('Editor'); ?> </option> <option <?php if ($booking_user_role_settings == 'author') { echo "selected"; } ?> value="author" ><?php echo translate_user_role('Author'); ?> </option> <option <?php if ($booking_user_role_settings == 'contributor') { echo "selected"; } ?> value="contributor" ><?php echo translate_user_role('Contributor'); ?> </option> </select> </td> </tr> <tr valign="top"> <td colspan="2"> <?php if (wpdev_bk_is_this_demo()) { ?> <div class="wpbc-error-message" style="text-align:left;"> <span class="wpbc-demo-alert-not-allow"><strong>Warning!</strong> Demo test version does not allow changes to these items.</span></div> <?php } ?> <p class="description"><?php _e('Select user access level for the menu pages of plugin', 'wpdev-booking'); ?> </p> </td> </tr> </tbody></table> </div></div></div> <div class='meta-box'> <div <?php $my_close_open_win_id = 'bk_general_settings_uninstall'; ?> id="<?php echo $my_close_open_win_id; ?> " class="postbox <?php if ('1' == get_user_option('booking_win_' . $my_close_open_win_id)) { echo 'closed'; } ?> " > <div title="<?php _e('Click to toggle', 'wpdev-booking'); ?> " class="handlediv" onclick="javascript:verify_window_opening(<?php echo get_bk_current_user_id(); ?> , '<?php echo $my_close_open_win_id; ?> ');"><br></div> <h3 class='hndle'><span><?php _e('Uninstall / deactivation', 'wpdev-booking'); ?> </span></h3> <div class="inside"> <table class="form-table"><tbody> <tr valign="top"> <th scope="row"><?php _e('Delete booking data, when plugin deactivated', 'wpdev-booking'); ?> :</th> <td> <fieldset> <label for="is_delete_if_deactive"> <input id="is_delete_if_deactive" type="checkbox" <?php if ($is_delete_if_deactive == 'On') { echo "checked"; } ?> value="<?php echo $is_delete_if_deactive; ?> " name="is_delete_if_deactive" onclick="javascript: if (this.checked) { var answer = confirm('<?php _e('Warning', 'wpdev-booking'); echo '! '; _e("If you check this option, all booking data will be deleted when you uninstall this plugin. Do you really want to do this?", 'wpdev-booking'); ?> '); if ( answer){ this.checked = true; } else {this.checked = false;} }" /> <?php _e('Check this box to delete all booking data when you uninstal this plugin.', 'wpdev-booking'); ?> </label> </fieldset> </td> </tr> </tbody></table> </div></div></div> <?php make_bk_action('wpdev_booking_technical_booking_section'); ?> </div> <div class="clear" style="height:10px;"></div> <input class="button-primary button" style="float:right;" type="submit" value="<?php _e('Save Changes', 'wpdev-booking'); ?> " name="Submit"/> <div class="clear" style="height:10px;"></div> </form> </div> <?php }
function wpbc_ajax_UPDATE_APPROVE() { global $wpdb; wpdev_check_nonce_in_admin_panel(); make_bk_action('check_multiuser_params_for_client_side_by_user_id', $_POST['user_id']); // Approve or Reject $is_approve_or_pending = $_POST["is_approve_or_pending"]; if ($is_approve_or_pending == 1) { $is_approve_or_pending = '1'; } else { $is_approve_or_pending = '0'; } $booking_id = $_POST["booking_id"]; $approved_id = explode('|', $booking_id); if (!isset($_POST["denyreason"])) { $_POST["denyreason"] = ''; } $denyreason = $_POST["denyreason"]; $is_send_emeils = $_POST["is_send_emeils"]; if (count($approved_id) > 0 && $approved_id !== false) { $approved_id_str = join(',', $approved_id); $approved_id_str = wpbc_clean_string_for_db($approved_id_str); if (false === $wpdb->query($wpdb->prepare("UPDATE {$wpdb->prefix}bookingdates SET approved = %s WHERE booking_id IN ({$approved_id_str})", $is_approve_or_pending))) { ?> <script type="text/javascript"> document.getElementById('ajax_message').innerHTML = '<div style="height:20px;width:100%;text-align:center;margin:15px auto;"><?php bk_error('Error during updating to DB', __FILE__, __LINE__); ?> </div>'; </script> <?php die; } renew_NumOfNewBookings(explode(',', $approved_id_str)); if ($is_approve_or_pending == '1') { sendApproveEmails($approved_id_str, $is_send_emeils, $denyreason); $all_bk_id_what_canceled = apply_bk_filter('cancel_pending_same_resource_bookings_for_specific_dates', false, $approved_id_str); } else { sendDeclineEmails($approved_id_str, $is_send_emeils, $denyreason); } ?> <script type="text/javascript"> <?php foreach ($approved_id as $bk_id) { if ($is_approve_or_pending == '1') { ?> set_booking_row_approved_in_timeline(<?php echo $bk_id; ?> ); set_booking_row_approved(<?php echo $bk_id; ?> ); set_booking_row_read(<?php echo $bk_id; ?> ); <?php } else { ?> set_booking_row_pending_in_timeline(<?php echo $bk_id; ?> ); set_booking_row_pending(<?php echo $bk_id; ?> ); <?php } ?> <?php } ?> document.getElementById('ajax_message').innerHTML = '<?php if ($is_approve_or_pending == '1') { echo esc_js(__('Set as Approved', 'booking')); } else { echo esc_js(__('Set as Pending', 'booking')); } ?> '; jQuery('#ajax_message').fadeOut(1000); </script> <?php } }
/** * Checking for bookings in the same session and prevention of the double booking * * @param type $bktype * @param type $formdata * @param type $str_dates__dd_mm_yyyy * @param type $start_time * @param type $end_time * @return true|false - free or unavailable */ function wpbc_check_if_dates_free($bktype, $formdata, $dates_in_diff_formats, $start_time, $end_time) { if (get_bk_option('booking_check_on_server_if_dates_free') == 'Off' || get_bk_option('booking_is_days_always_available') == 'On') { return true; } //TODO: Finish checking for parent booking resources // We need to get availabaility for the specific dates // We need to rewrite // function show_availability_at_calendar // for getting availability only for the specific dates // and then based on the availability approve or decline this current booking. if (class_exists('wpdev_bk_biz_l')) { $number_of_child_resources = apply_bk_filter('wpbc_get_number_of_child_resources', $bktype); if ($number_of_child_resources > 1) { // if this booking resources - parent, then do not chekc it, yet! return true; } } // $is_days_free = true; //////////////////////////////////////////////////////////////////////////// // Get Selected Dates Array in full format - all possible dates and times // //////////////////////////////////////////////////////////////////////////// //Example: // [0] => 2014-11-21 10:00:01 // [1] => 2014-11-21 12:00:02 // [2] => 2014-11-22 10:00:01 // [3] => 2014-11-22 12:00:02 $selected_dates_array = array(); $i = 0; //debuge('$dates_in_diff_formats["array]',$dates_in_diff_formats['array']) ; // if we selected only 1 day, system retur in this array 2 same dates. But in situation with recurenttime we need only one day if (get_bk_option('booking_recurrent_time') == 'On') { $dates_in_diff_formats['array'] = array_unique($dates_in_diff_formats['array']); } foreach ($dates_in_diff_formats['array'] as $my_date) { $i++; $my_date = explode('-', $my_date); // For start and end times we cut 10 seconds, so we can check for sure if this times inside of the booked times or not if (get_bk_option('booking_recurrent_time') !== 'On') { if ($i == 1) { $date = sprintf("%04d-%02d-%02d %02d:%02d:%02d", $my_date[0], $my_date[1], $my_date[2], $start_time[0], $start_time[1], $start_time[2]); $date = date('Y-m-d H:i:s', strtotime('+20 second', strtotime($date))); } elseif ($i == count($dates_in_diff_formats['array'])) { $date = sprintf("%04d-%02d-%02d %02d:%02d:%02d", $my_date[0], $my_date[1], $my_date[2], $end_time[0], $end_time[1], $end_time[2]); $date = date('Y-m-d H:i:s', strtotime('-20 second', strtotime($date))); } else { $date = sprintf("%04d-%02d-%02d %02d:%02d:%02d", $my_date[0], $my_date[1], $my_date[2], '00', '00', '00'); } $selected_dates_array[] = $date; } else { $date = sprintf("%04d-%02d-%02d %02d:%02d:%02d", $my_date[0], $my_date[1], $my_date[2], $start_time[0], $start_time[1], $start_time[2]); $date = date('Y-m-d H:i:s', strtotime('+20 second', strtotime($date))); $selected_dates_array[] = $date; $date = sprintf("%04d-%02d-%02d %02d:%02d:%02d", $my_date[0], $my_date[1], $my_date[2], $end_time[0], $end_time[1], $end_time[2]); $date = date('Y-m-d H:i:s', strtotime('-20 second', strtotime($date))); $selected_dates_array[] = $date; } } //////////////////////////////////////////////////////////////////////////// // SQL condition for getting any booked dates, which inside of selected dates intervals $dates_sql_where = ''; foreach ($dates_in_diff_formats['array'] as $selected_date) { $selected_date = explode('-', $selected_date); $my_check_in_date_sql = sprintf("%04d-%02d-%02d 00:00:00", $selected_date[0], $selected_date[1], $selected_date[2]); $my_check_out_date_sql = sprintf("%04d-%02d-%02d 23:59:59", $selected_date[0], $selected_date[1], $selected_date[2]); if (!empty($dates_sql_where)) { $dates_sql_where .= " OR "; } $dates_sql_where .= " ( dt.booking_date >= '{$my_check_in_date_sql}' AND dt.booking_date <= '{$my_check_out_date_sql}' ) "; } if (!empty($dates_sql_where)) { $dates_sql_where = " ({$dates_sql_where}) "; } //////////////////////////////////////////////////////////////////////////// /* // WE can not use this type of days condition for check in and check out dates, because user can select several not consecutive days $my_check_in_date = explode( '-', $dates_in_diff_formats['array'][0] ); $my_check_in_date_sql = sprintf( "%04d-%02d-%02d 00:00:00", $my_check_in_date[0], $my_check_in_date[1], $my_check_in_date[2] ); $my_check_out_date = explode( '-', $dates_in_diff_formats['array'][ ( count($dates_in_diff_formats['array']) - 1 ) ] ); $my_check_out_date_sql = sprintf( "%04d-%02d-%02d 23:59:59", $my_check_out_date[0], $my_check_out_date[1], $my_check_out_date[2] ); $dates_sql_where = " ( dt.booking_date >= '{$my_check_in_date_sql}' AND dt.booking_date <= '{$my_check_out_date_sql}' ) "; /**/ global $wpdb; // Checking only for approved bookings, if pending days available is active if (get_bk_option('booking_is_show_pending_days_as_available') == 'On') { $approved_only = ' dt.approved = 1 AND '; } else { $approved_only = ''; } // Get all booked dates //////////////////////////////////////////////////// $sql_req = "SELECT DISTINCT dt.booking_date\n \n FROM {$wpdb->prefix}bookingdates as dt\n\n INNER JOIN {$wpdb->prefix}booking as bk\n\n ON bk.booking_id = dt.booking_id\n\n WHERE {$approved_only} {$dates_sql_where} AND bk.booking_type IN ({$bktype})\n \n ORDER BY dt.booking_date"; $exist_dates_results = $wpdb->get_results($sql_req); //////////////////////////////////////////////////////////////////////////// if (count($exist_dates_results) == 0) { // We do not have here booked dates at all, so - TRUE return true; } //FixIn: 5.4.5 $is_dates_intersections = wpbc_check_dates_intersections($selected_dates_array, $exist_dates_results); if ($is_dates_intersections) { // Show Warning message and return FALSE /////////////////////////////// ?> <script type="text/javascript"> if ( jQuery('#submiting<?php echo $bktype; ?> ' ).length ) { // Disable spinning document.getElementById('submiting<?php echo $bktype; ?> ').innerHTML = ''; // Show Error message under the calendar showMessageUnderElement( '#date_booking<?php echo $bktype; ?> ', '<?php echo html_entity_decode('<strong>' . esc_js(__('Error!', 'booking')) . '</strong> ' . esc_js(__('Probably these date(s) just was booking by other visitor. Please reload this page and make booking again.', 'booking')), ENT_QUOTES); ?> ' , 'alert-error'); // Scroll to the calendar makeScroll('#calendar_booking<?php echo $bktype; ?> '); // Enable Submit button jQuery('#booking_form_div<?php echo $bktype; ?> input[type=button]').prop("disabled", false); } </script> <?php return false; } return true; }
function bookingresource_shortcode($attr) { $search_form = apply_bk_filter('wpbc_booking_resource_info', '', $attr); return $search_form; }
function wpbc_get_fields_list_in_booking_form_free() { $booking_form_fields_names = array("name", "secondname", "email", "phone", "details"); $booking_form_fields = array('num' => 1, 'listing' => array('labels' => array(), 'fields' => array()), 'name' => 'free'); $booking_form_fields['listing']['labels'][] = __('None', 'booking'); $booking_form_fields['listing']['fields'][] = ''; $booking_form_fields['listing']['fields_type'][] = 'text'; $key = 0; foreach ($booking_form_fields_names as $name) { $key++; if (get_bk_option("booking_form_field_active{$key}") != 'Off') { $booking_form_field_label = get_bk_option("booking_form_field_label{$key}"); $booking_form_field_label = apply_bk_filter('wpdev_check_for_active_language', $booking_form_field_label); $booking_form_fields['listing']['labels'][] = $booking_form_field_label; $booking_form_fields['listing']['fields'][] = $name; $booking_form_fields['listing']['fields_type'][] = 'text'; $booking_form_fields['num']++; } } if ($booking_form_fields['num'] == 0) { return false; } else { return $booking_form_fields; } }
function bookingselect_shortcode($attr) { $search_form = apply_bk_filter('wpdev_get_booking_select_form', '', $attr); return $search_form; }
function wp_admin_bar_bookings_menu() { global $wp_admin_bar; $current_user = wp_get_current_user(); $curr_user_role = get_bk_option('booking_user_role_booking'); $level = 10; if ($curr_user_role == 'administrator') { $level = 10; } else { if ($curr_user_role == 'editor') { $level = 7; } else { if ($curr_user_role == 'author') { $level = 2; } else { if ($curr_user_role == 'contributor') { $level = 1; } else { if ($curr_user_role == 'subscriber') { $level = 0; } } } } } $is_super_admin = apply_bk_filter('multiuser_is_user_can_be_here', false, 'only_super_admin'); if ($current_user->user_level < $level && !$is_super_admin || !is_admin_bar_showing()) { return; } $update_count = getNumOfNewBookings(); $title = __('Bookings', 'wpdev-booking'); $update_title = $title; if ($update_count > 0) { $update_count_title = " <span id='ab-updates' class='booking-count bk-update-count' >" . number_format_i18n($update_count) . "</span>"; //id='booking-count' $update_title .= $update_count_title; } $link_bookings = admin_url('admin.php') . "?page=" . WPDEV_BK_PLUGIN_DIRNAME . '/' . WPDEV_BK_PLUGIN_FILENAME . "wpdev-booking"; $link_settings = admin_url('admin.php') . "?page=" . WPDEV_BK_PLUGIN_DIRNAME . '/' . WPDEV_BK_PLUGIN_FILENAME . "wpdev-booking-option"; $wp_admin_bar->add_menu(array('id' => 'booking_options', 'title' => $update_title, 'href' => $link_bookings)); $curr_user_role_settings = get_bk_option('booking_user_role_settings'); $level = 10; if ($curr_user_role_settings == 'administrator') { $level = 10; } else { if ($curr_user_role_settings == 'editor') { $level = 7; } else { if ($curr_user_role_settings == 'author') { $level = 2; } else { if ($curr_user_role_settings == 'contributor') { $level = 1; } else { if ($curr_user_role_settings == 'subscriber') { $level = 0; } } } } } if ($current_user->user_level < $level && !$is_super_admin || !is_admin_bar_showing()) { return; } $wp_admin_bar->add_menu(array('parent' => 'booking_options', 'title' => __('Settings', 'wpdev-booking'), 'href' => $link_settings, 'id' => 'booking_settings')); }
private function get_formated_message($message, $message_type = 'updated', $inner_message_id = '') { // Recheck for any "lang" shortcodes for replacing to correct language $message = apply_bk_filter('wpdev_check_for_active_language', $message); // Escape any JavaScript from message $notice = html_entity_decode(esc_js($message), ENT_QUOTES); $notice .= '<a class="close tooltip_left" rel="tooltip" title="' . esc_js(__("Hide", 'wpdev-booking')) . '" data-dismiss="alert" href="javascript:void(0)" onclick="javascript:void(0)">×</a>'; // $my_close_open_alert_id = 'wpbc_system_message_id_'; // $notice .= '<a class="close tooltip_left" rel="tooltip" title="'. esc_js(__("Don't show the message anymore",'wpdev-booking')). '" data-dismiss="alert" href="javascript:void(0)" onclick="javascript:verify_window_opening('. get_bk_current_user_id() .', \''. $my_close_open_alert_id .'\');">×</a>'; if (!empty($inner_message_id)) { $inner_message_id = 'id="wpbc_inner_message_' . $inner_message_id . '"'; } $notice = '<div ' . $inner_message_id . ' class="wpbc_inner_message ' . $message_type . '">' . $notice . '</div>'; return $notice; }
public function createNewBookingsFromEvents($exist_bookings_guid = array()) { foreach ($this->events as $key => $event) { if (!in_array($event['sync_gid'], $exist_bookings_guid)) { $submit_array = $event['booking_submit_data']; //debuge($submit_array); $booking_id = apply_bk_filter('wpbc_add_new_booking_filter', $submit_array); $this->events[$key]['id'] = $booking_id; } else { unset($this->events[$key]); } } return $this->events; }