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_trash.php

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

143 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 To_Trash -- 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__To_Trash
14 */
15 class WPBC_Listing_Actions__To_Trash{
16
17 const ACTION = 'move_booking_to_trash';
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__move_booking_to_trash__section' ) ) {
41 return false;
42 }
43 jQuery( '.wpbc_modal__title__reason__booking_id' ).html( 'ID: ' + wpbc_get_selected_row_id() );
44 jQuery( '#wpbc_modal__move_booking_to_trash__section' ).wpbc_my_modal( 'show' );
45 jQuery( '#wpbc_modal__move_booking_to_trash__value' ).trigger( 'focus' );
46 \"
47 title=\"" . esc_attr( __( 'Move selected bookings to trash', 'booking' ) ) . "\"
48 >" .
49 // esc_js( __( 'Move to trash', 'booking' ) ) .
50 esc_js( __( 'Reject - move to trash', 'booking' ) ) .
51 ' <i class="menu_icon icon-1x wpbc_icn_delete_outline"></i>' .
52 '</a>';
53
54 return $html;
55 }
56
57
58 /**
59 * Get Template for Modal Window - Booking Cost Edit - Layout - Modal Window structure
60 *
61 * @return false|void
62 */
63 public static function template_for_modal() {
64
65 ?>
66 <span class="wpdevelop">
67 <div id="wpbc_modal__move_booking_to_trash__section" class="modal wpbc_popup_modal wpbc_modal_in_listing" tabindex="-1" role="dialog">
68 <div class="modal-dialog">
69 <div class="modal-content">
70 <div class="modal-header">
71 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
72 <h4 class="modal-title">
73 <span class="wpbc_modal__title__reason">
74 <?php
75 esc_html_e( 'Trash / Reject', 'booking' );
76 ?>
77 </span>
78 <sup class="wpbc_modal__title__reason__booking_id wpbc_modal__booking_id__in_title"></sup>
79 </h4>
80 </div>
81 <div class="modal-body">
82 <label for="wpbc_modal__move_booking_to_trash__value" style="font-size: 14px;margin: 5px 0 10px;">
83 <?php
84 echo '<strong>' . esc_attr__( 'Enter the reason for the operation.', 'booking' ) . '</strong> (' . esc_attr__( 'Optional', 'booking' ) . ')';
85 ?>
86 </label>
87 <textarea id="wpbc_modal__move_booking_to_trash__value"
88 name="wpbc_modal__move_booking_to_trash__value" cols="87" rows="3"
89 placeholder="<?php echo esc_attr__( 'Optional', 'booking' ) . ' '; ?>"
90 ></textarea>
91 <input type="hidden" id="wpbc_modal__move_booking_to_trash__booking_id" value=""/>
92 <p class="help-block">
93 <?php
94 /* translators: 1: ... */
95 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=trash' ) . '">', '</a>', '<b>[reason]</b>' ) );
96 ?>
97 </p>
98 </div>
99 <div class="modal-footer">
100 <a id="wpbc_modal__move_booking_to_trash__button_send" class="button button-primary"
101 href="javascript:void(0);"
102 onclick="javascript: wpbc_ajx_booking_ajax_action_request( {
103 'booking_action' : '<?php echo esc_js( self::ACTION ); ?>',
104 'booking_id' : ( '' !== jQuery( '#wpbc_modal__move_booking_to_trash__booking_id').val() )
105 ? jQuery( '#wpbc_modal__move_booking_to_trash__booking_id').val()
106 : wpbc_get_selected_row_id(),
107 'reason_of_action' : jQuery( '#wpbc_modal__move_booking_to_trash__value' ).val(),
108 'ui_clicked_element_id': 'wpbc_modal__move_booking_to_trash__button_send'
109 } );
110 wpbc_button_enable_loading_icon( this );
111 jQuery( '.wpbc_modal__title__reason__booking_id' ).html('');
112 jQuery( '#wpbc_modal__move_booking_to_trash__value' ).val(''),
113 jQuery( '#wpbc_modal__move_booking_to_trash__section' ).wpbc_my_modal( 'hide' );
114 " >
115 <?php
116 esc_html_e( 'Trash / Reject', 'booking' );
117 ?>
118 </a>
119 <a href="javascript:void(0)" class="button button-secondary" data-dismiss="modal">
120 <?php
121 esc_html_e( 'Cancel', 'booking' );
122 ?>
123 </a>
124 </div>
125 </div><!-- /.modal-content -->
126 </div><!-- /.modal-dialog -->
127 </div><!-- /.modal -->
128 <script type="text/javascript">
129 // Remove booking ID from hidden input
130 jQuery( '#wpbc_modal__move_booking_to_trash__section' ).on( 'hide.wpbc.modal', function (event) {
131 // var modal = jQuery( this );
132 // modal.find( '.modal-body input[type="hidden"]' ).val( '' );
133 jQuery( '#wpbc_modal__move_booking_to_trash__booking_id').val( '' );
134 } );
135 </script>
136 </span>
137 <?php
138 }
139 }
140
141 // Loads hidden modal template.
142 add_action( 'wpbc_hook_booking_template__hidden_templates', array( new WPBC_Listing_Actions__To_Trash(), 'template_for_modal' ) );
143