PluginProbe
Booking Calendar / 10.15.7
Booking Calendar v10.15.7
11.9 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 All 205 releases
booking / includes / page-bookings / booking_action / change_resource.php

change_resource.php in Booking Calendar 10.15.7, at includes/page-bookings/booking_action/change_resource.php

154 lines 5.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Class Change Resource of the Booking - Option for "Actions Dropdown Menu"
4 *
5 * @package Support functions.
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit; // Exit, if accessed directly.
10 }
11
12 /**
13 * Class WPBC_Action_Change_Resource
14 */
15 class WPBC_Action_Change_Resource {
16
17 const ACTION = 'change_booking_resource';
18
19 /**
20 * Get Action Button
21 *
22 * @return false|string
23 */
24 public static function get_button() {
25
26 if ( ! class_exists( 'wpdev_bk_personal' ) ) {
27 return false;
28 }
29 if ( ! wpbc_is_user_can( self::ACTION, wpbc_get_current_user_id() ) ) {
30 return false;
31 }
32
33 // Change booking resource.
34 $html = "<a class='ul_dropdown_menu_li_action ul_dropdown_menu_li_action_" . esc_js( self::ACTION ) . "'
35 href=\"javascript:void(0)\"
36 onclick=\"wpbc_boo_listing__click__change_booking_resource( {{data['parsed_fields']['booking_id']}}, {{data['parsed_fields']['resource_id']}} );\"
37 >" .
38 esc_js( __( 'Change resource', 'booking' ) ) .
39 "<i class='menu_icon icon-1x wpbc_icn_shuffle'></i>" .
40 '</a>';
41
42 return $html;
43 }
44
45
46 /**
47 * Get Template for Modal Window - Booking Cost Edit - Layout - Modal Window structure
48 *
49 * @return false|void
50 */
51 public static function template_for_modal() {
52
53 if ( ! class_exists( 'wpdev_bk_personal' ) ) {
54 return false;
55 }
56
57 ?>
58 <span class="wpdevelop">
59 <div id="wpbc_modal__change_booking_resource__section" class="modal wpbc_popup_modal wpbc_modal_in_listing" tabindex="-1" role="dialog">
60 <div class="modal-dialog">
61 <div class="modal-content">
62 <div class="modal-header">
63 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
64 <h4 class="modal-title">
65 <?php
66 esc_html_e( 'Change resource', 'booking' );
67 ?>
68 <sup class="wpbc_modal__change_booking_resource__booking_id wpbc_modal__booking_id__in_title"></sup>
69 </h4>
70 </div>
71 <div class="modal-body">
72 <div id="section_in_in_modal__change_booking_resource"></div>
73 <label class="help-block">
74 <?php
75 esc_html_e( 'Select the new booking resource for booking', 'booking' );
76 ?>
77 </label>
78 <input type="hidden" id="wpbc_modal__change_booking_resource__booking_id" value=""/>
79 </div>
80 <div class="modal-footer">
81 <a id="wpbc_modal__change_booking_resource__button_send" class="button button-primary"
82 href="javascript:void(0);"
83 onclick="javascript: wpbc_ajx_booking_ajax_action_request( {
84 'booking_action' : '<?php echo esc_js( self::ACTION ); ?>',
85 'booking_id' : jQuery( '#wpbc_modal__change_booking_resource__booking_id' ).val(),
86 'selected_resource_id' : jQuery( '#wpbc_modal__change_booking_resource__resource_id' ).val(),
87 'ui_clicked_element_id': 'wpbc_modal__change_booking_resource__button_send'
88 } );
89 wpbc_button_enable_loading_icon( this );
90 jQuery( '#wpbc_modal__change_booking_resource__section' ).wpbc_my_modal( 'hide' );" >
91 <?php
92 esc_html_e( 'Change resource', 'booking' );
93 ?>
94 </a>
95 <a href="javascript:void(0)" class="button button-secondary" data-dismiss="modal">
96 <?php
97 esc_html_e( 'Cancel', 'booking' );
98 ?>
99 </a>
100 </div>
101 </div><!-- /.modal-content -->
102 </div><!-- /.modal-dialog -->
103 </div><!-- /.modal -->
104 </span>
105 <?php
106 }
107
108
109
110 /**
111 * Get Template for Modal Window - Booking Cost Edit - Layout - Modal Window structure
112 *
113 * @return false|void
114 */
115 public static function hidden_template() {
116
117 // Template.
118 ?>
119 <script type="text/html" id="tmpl-wpbc_ajx__modal__change_booking_resource">
120 <select id="wpbc_modal__change_booking_resource__resource_id"
121 name="wpbc_modal__change_booking_resource__resource_id"
122 class="wpbc_ui_control wpbc_ui_select change_booking_resource_selectbox">
123 <#
124 _.each( data.ajx_booking_resources, function ( p_resource, p_resource_id, p_data ){
125 #><option value="{{p_resource.booking_type_id}}" style="<#
126 if( undefined != p_resource.parent ) {
127 if( '0' == p_resource.parent ) {
128 #>font-weight:600;<#
129 } else {
130 #>font-size:0.95em;padding-left:20px;<#
131 }
132 }
133 #>"
134 ><#
135 if( undefined != p_resource.parent ) {
136 if( '0' != p_resource.parent ) {
137 #>&nbsp;&nbsp;&nbsp;<#
138 }
139 }
140 #>{{p_resource.title}}</option><#
141 });
142 #>
143 </select>
144 </script>
145 <?php
146 }
147 }
148
149 // Loads hidden modal template.
150 add_action( 'wpbc_hook_booking_template__hidden_templates', array( new WPBC_Action_Change_Resource(), 'template_for_modal' ) );
151
152 // Loads hidden template.
153 add_action( 'wpbc_hook_booking_template__hidden_templates', array( new WPBC_Action_Change_Resource(), 'hidden_template' ) );
154