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 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 sendPaymentRequestEmail($booking_id, $bktype, $formdata, $reason = '') { $mail_sender = htmlspecialchars_decode(get_bk_option('booking_email_payment_request_adress')); $mail_subject = htmlspecialchars_decode(get_bk_option('booking_email_payment_request_subject')); $mail_body = htmlspecialchars_decode(get_bk_option('booking_email_payment_request_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_to_send = $mail_body; $mail_subject_to_send = $mail_subject; if (function_exists('get_booking_title')) { $bk_title = get_booking_title($bktype); } else { $bk_title = ''; } $my_dates4emeil = get_dates_str($booking_id); 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); } $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]); $my_cost = apply_bk_filter('get_booking_cost_from_db', '', $booking_id); $my_cost = wpdev_bk_cost_number_format($my_cost); $booking_form_show = get_form_content($formdata, $bktype, '', array('booking_id' => $booking_id, 'id' => $booking_id, 'dates' => $my_dates_4_send, 'check_in_date' => $my_check_in_date, 'check_out_date' => $my_check_out_date, 'dates_count' => count($my_dates4emeil_check_in_out), 'cost' => $my_cost, 'siteurl' => htmlspecialchars_decode('<a href="' . home_url() . '">' . home_url() . '</a>'), 'resource_title' => apply_bk_filter('wpdev_check_for_active_language', $bk_title), 'bookingtype' => apply_bk_filter('wpdev_check_for_active_language', $bk_title), 'paymentreason' => $reason, 'remote_ip' => $_SERVER['REMOTE_ADDR'], 'user_agent' => $_SERVER['HTTP_USER_AGENT'], 'request_url' => $_SERVER['HTTP_REFERER'], 'current_date' => date_i18n(get_bk_option('booking_date_format')), 'current_time' => date_i18n(get_bk_option('booking_time_format')))); $mail_body_to_send = str_replace('[content]', $booking_form_show['content'], $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_to_send = replace_bk_shortcodes_in_form($mail_subject_to_send, $booking_form_show['_all_fields_'], true); $mail_body_to_send = replace_bk_shortcodes_in_form($mail_body_to_send, $booking_form_show['_all_fields_'], true); $mail_body_to_send = str_replace('\\n', '<br />', $mail_body_to_send); // Fix issue of showing /n instead of the new line $mail_recipients = $booking_form_show['email']; $mail_headers = "From: {$mail_sender}\nContent-Type: text/html\n"; if (strpos($mail_recipients, ',') !== false) { $mail_recipients = explode(';', $mail_recipients); } else { if (strpos($mail_recipients, ';') !== false) { $mail_recipients = explode(';', $mail_recipients); } else { $mail_recipients = array($mail_recipients); } } foreach ($mail_recipients as $mail_recipient) { $mail_recipient = wpbc_format_email_address($mail_recipient, $booking_form_show); if (strpos($mail_recipient, '@blank.com') === false && strpos($mail_body_to_send, '*****@*****.**') === false) { wpbc_wp_mail($mail_recipient, $mail_subject_to_send, $mail_body_to_send, $mail_headers); } if (WP_BK_STRICTLY_FROM_EMAILS) { $mail_headers_for_admin = $mail_headers; } else { $mail_headers_for_admin = "From: {$mail_recipient}\nContent-Type: text/html\n"; } // Send to the Admin also $is_email_payment_request_send_copy_to_admin = get_bk_option('booking_is_email_payment_request_send_copy_to_admin'); $mail_recipient = htmlspecialchars_decode(get_bk_option('booking_email_reservation_adress')); if ($is_email_payment_request_send_copy_to_admin == 'On') { if (strpos($mail_recipient, '@blank.com') === false && strpos($mail_body_to_send, '*****@*****.**') === false) { wpbc_wp_mail($mail_recipient, $mail_subject_to_send, $mail_body_to_send, $mail_headers_for_admin); } } } if (strpos($mail_recipient, '@blank.com') === false && strpos($mail_body_to_send, '*****@*****.**') === false) { return true; } else { return false; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }