Class bkap_booking_box_class
Class for Booking meta box
Author: Tyche Softwares
Class: bkap_booking_box_class
Located at booking-box.php
Methods summary
public static
|
#
bkap_process_bookings_box( integer $post_id, array $post )
This function updates the booking settings for each product in the wp_postmeta table in the database. It will be called when update / publish button clicked on admin side. |
public static
|
|
public static
|
|
public static
|
|
public static
|
#
bkap_save_button( str $save_fn )
This function will print a save button in each of the tabs. It needs the callback JS function as the parameter |
public static
|
#
bkap_get_weekdays_html( integer $product_id, boolean $lockout = false, boolean $price = true, array $booking_settings = array() )
The function adds the html for the Weekdays UI which allows the admin to enable/disable weekdays, set lockout and price for the same. |
public static
|
#
bkap_get_specific_html( integer $product_id, array $booking_settings )
Adds the specific dates availability checkbox and the table for the same. |
public static
|
#
bkap_get_specific_heading_html( $product_id )
Prints the table headers for the 'Set Availability by Dates/Months' which allows the admin to enable/disable weekdays, set lockout and price for the same. |
public static
|
#
bkap_get_specific_default_row_html( integer $product_id, array $booking_settings )
Prints the default row for the 'Set Availability by Dates/Months' which allows the admin to enable/disable weekdays, set lockout and price for the same. This row is used to add new rows to the table. |
public static
|
#
bkap_get_specific_row_to_display_html( integer $product_id, array $booking_settings )
Prints the existing data for the 'Set Availability by Dates/Months' which allows the admin to enable/disable weekdays, set lockout and price for the same. |
public static
|
|
public static
|
#
bkap_get_pagination_for_time_slots( integer $bkap_per_page_time_slots, integer $bkap_total_time_slots_number, integer $bkap_total_pages, string $bkap_encode_booking_times )
Create pagination links for the Time Slots table. |
public static
|
#
bkap_get_date_time_html( integer $product_id, array $booking_settings = array() )
Displays the Time Slots data in the Availability tab. |
public static
|
#
bkap_get_daydate_and_time_heading( integer $product_id, array $booking_settings, string $bkap_display_time_slots_pagination, integer $bkap_per_page_time_slots, integer $bkap_total_time_slots_number, integer $bkap_total_pages, string $bkap_encode_booking_times )
Displays the table headers for the Time Slots table in Booking meta box->Availability tab. |
public static
|
#
bkap_get_daydate_and_time_table_base_data( integer $product_id, array $booking_settings )
Add the default row for the time slots table. This row is used to add other data when the New icon is clicked. |
public static
|
#
bkap_save_settings( )
This function saves the data from the tabs. Different save buttons are present in each tab. They all will call this function, which will check the data present and save the same. |
public
|
#
setup_data( integer $product_id, stdClass $clean_booking_options, stdClass $clean_settings_data, $ranges_array, $clean_gcal_data, $clean_fixed_block_data, $clean_price_range_data )
Creates the data to be saved in the DB when either the Save button is clicked from one of the tabs or the product is Published/Updated. |
public
array
|
#
create_date_list( str $dates_string )
Receives a string which contains a list of dates and the number of recurring years. It splits it into an array where the date is the key and the number of years is the value |
public
array
|
#
create_specific_price_list( string $dates_string )
Creates and returns an array of specific dates with their prices |
public
array
|
#
create_range_data( string $range_string )
Returns an array of the custom ranges data. This includes the Ranges setup using 'Custom Range' as well as 'Range of Months'. |
public
|
#
update_single_post_meta( integer $product_id, array $booking_options, array $settings_data, array $block_ranges, $gcal_data )
Updates the individual booking settings data in the post meta table. |
public
|
#
update_serialized_post_meta( integer $product_id, array $booking_options, array $settings_data, array $block_ranges, $gcal_data )
Updates the 'woocommerce_booking_settings' record in postmeta table for the product. |
public
|
#
update_bkap_history_only_days( integer $product_id, array $settings_data )
Updates the Booking History table for Only Days Booking Type |
public
|
#
update_bkap_history_date_time( integer $product_id, array $settings_data )
Updates the Booking History table for Date & Time Booking Type |
public
|
#
bkap_delete_specific_range( )
Called when a record from the Set Availability by Dates/Months Table in Booking meta box->Availability tab needs to be deleted. |
public
|
#
delete_ranges( integer $product_id, string $record_type, string $start, string $end )
Deletes a record from the Set Availability by Dates/Months Table in Booking meta box->Availability tab. |
public
integer
|
#
get_range_key( array $range, string $start, string $end )
Returns the array key from a given range if a match is found. |
public
|
#
delete_single_range( integer $product_id, string $range_name, integer $key )
Deletes a given array record from the individual booking settings in postmeta. |
public
|
#
delete_serialized_range( integer $product_id, string $name, integer $key )
Deletes a record from a given range in the serialized booking settings i.e. woocommerce_booking_settings in postmeta table. |
public
|
#
delete_specific_date( integer $product_id, string $date )
Updates a specific date record to inactive status in booking history table for a given date. |
public
|
#
delete_special_price( integer $product_id, string $date )
Deletes the special price record from post meta for a given specific date. |
public static
|
#
bkap_delete_date_time( )
Deletes the Date/Day and Time Slot from the Date & Time table in the Availability settings |
public
|
#
delete_serialized_time_settings( integer $product_id, string $day_value, string $from_time, string $to_time )
Deletes the time slot from the serialized post meta record i.e. woocommerce_booking_settings in postmeta table. |
public
|
#
delete_individual_time_settings( integer $product_id, string $day_value, string $from_time, string $to_time )
Deletes the time slot from the _bkap_time_settings post meta record in postmeta table. |
public
array
|
#
unset_time_array( array $existing_settings, string $day_value, string $from_time, string $to_time )
Unsets the time slots record which needs to be removed from the list of time slots present for the product. |
public
|
#
delete_booking_history( integer $product_id, string $day_value, string $from_time = '', string $to_time = '' )
Updates the Booking History table. Removes/Inactivates the desired records for the deleted time slot. |