PluginProbe
Booking Calendar / 11.3
Booking Calendar v11.3
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 / selected_bookings_delete.php

selected_bookings_delete.php in Booking Calendar 11.3, at includes/page-bookings/listing_actions/selected_bookings_delete.php

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