PluginProbe
Booking Calendar / 11.7
Booking Calendar v11.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 / listing_actions / selected_bookings_approve.php

selected_bookings_approve.php in Booking Calendar 11.7, at includes/page-bookings/listing_actions/selected_bookings_approve.php

134 lines 5.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Class to Read All -- 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/print/_src/bookings_print.js -> function wpbc_print_dialog__show() { ... } .
13
14 /**
15 * Class WPBC_Listing_Actions__Set_Approve
16 */
17 class WPBC_Listing_Actions__Set_Approve{
18
19 const ACTION = 'set_booking_approved';
20
21 /**
22 * Get Action Button
23 *
24 * @return false|string
25 */
26 public static function get_option() {
27
28 // In some versions: if ( ! class_exists( 'wpdev_bk_personal' ) ) { return false; } .
29
30 if ( ! wpbc_is_user_can( self::ACTION, wpbc_get_current_user_id() ) ) {
31 return false;
32 }
33
34 $css_class = 'ul_dropdown_menu_li_action ';
35 $css_class .= 'hide_button_if_no_selection ';
36 $css_class .= 'ul_dropdown_menu_li_action_' . self::ACTION;
37
38 $el_id = 'ul_dropdown_menu_li_action_' . self::ACTION;
39
40 // Option Title.
41 $html = "<a href=\"javascript:void(0)\" class=\"" . esc_attr( $css_class ) . "\"
42 onclick=\"if ( ! wpbc_is_modal_accessible( '#wpbc_modal__set_booking_approved__section' ) ) {
43 return false;
44 }
45 jQuery( '.wpbc_modal__title__reason__booking_id' ).html( 'ID: ' + wpbc_get_selected_row_id() );
46 jQuery( '#wpbc_modal__set_booking_approved__section' ).wpbc_my_modal( 'show' );
47 jQuery( '#wpbc_modal__set_booking_approved__value' ).trigger( 'focus' );
48 \"
49 title=\"" . esc_attr( __( 'Approve selected bookings', 'booking' ) ) . "\"
50 >" .
51 esc_js( __( 'Approve', 'booking' ) ) .
52 ' <i class="menu_icon icon-1x wpbc_icn_done_all"></i>' .
53 '</a>';
54
55 return $html;
56 }
57
58
59 /**
60 * Get Template for Modal Window - Booking Cost Edit - Layout - Modal Window structure
61 *
62 * @return false|void
63 */
64 public static function template_for_modal() {
65
66 ?>
67 <span class="wpdevelop">
68 <div id="wpbc_modal__set_booking_approved__section" class="modal wpbc_popup_modal wpbc_modal_in_listing" tabindex="-1" role="dialog">
69 <div class="modal-dialog">
70 <div class="modal-content">
71 <div class="modal-header">
72 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
73 <h4 class="modal-title">
74 <span class="wpbc_modal__title__reason">
75 <?php
76 esc_html_e( 'Approve selected bookings', 'booking' );
77 ?>
78 </span>
79 <sup class="wpbc_modal__title__reason__booking_id wpbc_modal__booking_id__in_title"></sup>
80 </h4>
81 </div>
82 <div class="modal-body">
83 <label for="wpbc_modal__set_booking_approved__value" style="font-size: 14px;margin: 5px 0 10px;">
84 <?php
85 echo '<strong>' . esc_attr__( 'Enter the reason for the operation.', 'booking' ) . '</strong> (' . esc_attr__( 'Optional', 'booking' ) . ')';
86 ?>
87 </label>
88 <textarea id="wpbc_modal__set_booking_approved__value"
89 name="wpbc_modal__set_booking_approved__value" cols="87" rows="3"
90 placeholder="<?php echo esc_attr__( 'Optional', 'booking' ) . ' '; ?>"
91 ></textarea>
92 <input type="hidden" id="wpbc_modal__set_booking_approved__booking_id" value=""/>
93 <p class="help-block">
94 <?php
95 /* translators: 1: ... */
96 echo wp_kses_post( sprintf( __( 'In the %1$semail template%2$s, use the %3$s shortcode to display this text.', 'booking' ), '<a href="' . esc_url( wpbc_get_settings_url( true, false ) . '&tab=email&subtab=approved' ) . '">', '</a>', '<b>[reason]</b>' ) );
97 ?>
98 </p>
99 </div>
100 <div class="modal-footer">
101 <a id="wpbc_modal__set_booking_approved__button_send" class="button button-primary"
102 href="javascript:void(0);"
103 onclick="javascript: wpbc_ajx_booking_ajax_action_request( {
104 'booking_action' : '<?php echo esc_js( self::ACTION ); ?>',
105 'booking_id' : wpbc_get_selected_row_id(),
106 'reason_of_action' : jQuery( '#wpbc_modal__set_booking_approved__value' ).val(),
107 'ui_clicked_element_id': 'wpbc_modal__set_booking_approved__button_send'
108 } );
109 wpbc_button_enable_loading_icon( this );
110 jQuery( '.wpbc_modal__title__reason__booking_id' ).html('');
111 jQuery( '#wpbc_modal__set_booking_approved__value' ).val(''),
112 jQuery( '#wpbc_modal__set_booking_approved__section' ).wpbc_my_modal( 'hide' );
113 " >
114 <?php
115 esc_html_e( 'Approve', 'booking' );
116 ?>
117 </a>
118 <a href="javascript:void(0)" class="button button-secondary" data-dismiss="modal">
119 <?php
120 esc_html_e( 'Cancel', 'booking' );
121 ?>
122 </a>
123 </div>
124 </div><!-- /.modal-content -->
125 </div><!-- /.modal-dialog -->
126 </div><!-- /.modal -->
127 </span>
128 <?php
129 }
130 }
131
132 // Loads hidden modal template.
133 add_action( 'wpbc_hook_booking_template__hidden_templates', array( new WPBC_Listing_Actions__Set_Approve(), 'template_for_modal' ) );
134