PluginProbe
Booking Calendar / 11.5
Booking Calendar v11.5
11.8.4 11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 All 204 releases
booking / includes / page-bookings / listing_actions / import_google_calendar.php

import_google_calendar.php in Booking Calendar 11.5, at includes/page-bookings/listing_actions/import_google_calendar.php

170 lines 6.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Class to Import_Google_Calendar -- Option for "Bulk Actions - Dropdown Menu"
4 *
5 * @package Support functions.
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit; // Exit, if accessed directly.
10 }
11
12 // JavaScript: in ../includes/page-bookings/_src/bookings__actions.js -> function wpbc_ajx_booking__ui_click__import_google_calendar() { ... } .
13
14 /**
15 * Class WPBC_Listing_Actions__Import_Google_Calendar
16 */
17 class WPBC_Listing_Actions__Import_Google_Calendar{
18
19 const ACTION = 'import_google_calendar';
20
21 /**
22 * Get Action Option
23 *
24 * @return false|string
25 */
26 public static function get_option() {
27
28 if ( ! wpbc_is_user_can( self::ACTION, wpbc_get_current_user_id() ) ) {
29 return false;
30 }
31
32 $booking_gcal_feed = get_bk_option( 'booking_gcal_feed' );
33 $is_this_btn_disabled = ( ( ! class_exists( 'wpdev_bk_personal' ) ) && ( empty( $booking_gcal_feed ) ) ) ? true : false;
34
35
36 $css_class = 'ul_dropdown_menu_li_action ';
37 $css_class .= 'ul_dropdown_menu_li_action_' . self::ACTION;
38
39 // Option Title.
40 $html = "<a href=\"javascript:void(0)\" class=\"" . esc_attr( $css_class ) . "\"
41 onclick=\"if ( 'function' === typeof( jQuery('#wpbc_modal__import_google_calendar__section').wpbc_my_modal ) ) {
42 jQuery('#wpbc_modal__import_google_calendar__section').wpbc_my_modal('show');
43 } else {
44 alert( 'Warning! wpbc_my_modal module has not found. Please, recheck about any conflicts by deactivating other plugins.');
45 }\"
46 title=\"" . esc_attr( __( 'Import Google Calendar Events', 'booking' ) ) . "\"
47 >" .
48 esc_js( __( 'Import Google Calendar', 'booking' ) ) .
49 ' ' .
50 ' <i class="menu_icon icon-1x wpbc-bi-google"></i>'.
51 // "<span class='hint_value_instead_icon'>{{{data['parsed_fields']['currency_symbol']}}} {{data['parsed_fields']['cost']}}</span>" .
52 '</a>';
53
54 return $html;
55
56 // onclick=\"wpbc_ajx_booking_send_search_request_with_params({ '" . esc_attr( self::ID ) . "': '{$option_value}' }); \" //.
57 }
58
59
60 /**
61 * Get Template for Modal Window
62 *
63 * @return false|void
64 */
65 public static function template_for_modal() {
66
67
68 $booking_gcal_feed = get_bk_option( 'booking_gcal_feed' );
69 $is_this_btn_disabled = false;
70
71 if ( ( ! class_exists( 'wpdev_bk_personal' ) ) && ( empty( $booking_gcal_feed ) ) ) {
72 $is_this_btn_disabled = true;
73 $settigns_link = wpbc_get_settings_url() . '&tab=sync&subtab=gcal';
74 } else {
75 $booking_gcal_events_from = get_bk_option( 'booking_gcal_events_from' );
76 $booking_gcal_events_from_offset = get_bk_option( 'booking_gcal_events_from_offset' );
77 $booking_gcal_events_from_offset_type = get_bk_option( 'booking_gcal_events_from_offset_type' );
78
79 $booking_gcal_events_until = get_bk_option( 'booking_gcal_events_until' );
80 $booking_gcal_events_until_offset = get_bk_option( 'booking_gcal_events_until_offset' );
81 $booking_gcal_events_until_offset_type = get_bk_option( 'booking_gcal_events_until_offset_type' );
82
83 $booking_gcal_events_max = get_bk_option( 'booking_gcal_events_max' );
84 // $booking_gcal_timezone = get_bk_option( 'booking_gcal_timezone'); .
85 }
86
87 ?>
88 <span class="wpdevelop">
89 <div id="wpbc_modal__import_google_calendar__section" class="wpbc_modal__import_google_calendar__section modal wpbc_popup_modal wpbc_modal_in_listing" tabindex="-1" role="dialog">
90 <div class="modal-dialog">
91 <div class="modal-content">
92 <div class="modal-header">
93 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
94 <h4 class="modal-title">
95 <?php
96 if ( $is_this_btn_disabled ) {
97 esc_html_e( 'Warning!', 'booking' );
98 } else {
99 esc_html_e( 'Retrieve Google Calendar Events ', 'booking' );
100 }
101 ?>
102 <sup class="wpbc_modal__import_google_calendar__booking_id wpbc_modal__booking_id__in_title"></sup>
103 </h4>
104 </div>
105 <div class="modal-body">
106 <?php
107 if ( $is_this_btn_disabled ) {
108 ?>
109 <label class="help-block" style="display:block;">
110 <?php
111 esc_html_e( 'Please configure settings for import Google Calendar events', 'booking' );
112 echo '<a href="' . esc_url( $settigns_link ) . '">' . esc_html__( 'here', 'booking' ) . '</a>';
113 ?>
114 </label>
115 <?php
116 } else {
117 ?>
118 <table class="visibility_gcal_feeds_settings form-table0 settings-table0 table">
119 <tbody>
120 <?php
121 if ( function_exists( 'wpbc_gcal_settings_content_field_selection_booking_resources' ) ) {
122 wpbc_gcal_settings_content_field_selection_booking_resources();
123 } else {
124 ?>
125 <input type="hidden" name="wpbc_booking_resource" id="wpbc_booking_resource" value=""/>
126 <?php
127 }
128 wpbc_gcal_settings_content_field_from( $booking_gcal_events_from, $booking_gcal_events_from_offset, $booking_gcal_events_from_offset_type );
129 wpbc_gcal_settings_content_field_until( $booking_gcal_events_until, $booking_gcal_events_until_offset, $booking_gcal_events_until_offset_type );
130 wpbc_gcal_settings_content_field_max_feeds( $booking_gcal_events_max );
131 ?>
132 </tbody>
133 </table>
134 <?php
135 }
136 ?>
137 </div>
138 <div class="modal-footer">
139 <?php
140 if ( $is_this_btn_disabled ) {
141 echo '<a href="' . esc_url( $settigns_link ) . '" class="button button-primary">' . esc_html__( 'Configure', 'booking' ) . '</a>';
142 } else {
143 ?>
144 <a id="wpbc_modal__import_google_calendar__button_send" class="button button-primary"
145 href="javascript:void(0);"
146 onclick="javascript: wpbc_ajx_booking__ui_click__import_google_calendar();
147 jQuery('#wpbc_modal__import_google_calendar__section').wpbc_my_modal('hide');
148 "
149 >
150 <?php
151 esc_html_e( 'Import Google Calendar Events', 'booking' );
152 ?>
153 </a>
154 <?php } ?>
155 <a href="javascript:void(0)" class="button button-secondary" data-dismiss="modal">
156 <?php
157 esc_html_e( 'Cancel', 'booking' );
158 ?>
159 </a>
160 </div>
161 </div><!-- /.modal-content -->
162 </div><!-- /.modal-dialog -->
163 </div><!-- /.modal -->
164 </span>
165 <?php
166 }
167 }
168
169 // Loads hidden template.
170 add_action( 'wpbc_hook_booking_template__hidden_templates', array( new WPBC_Listing_Actions__Import_Google_Calendar(), 'template_for_modal' ) );