| 1 |
<?php |
| 2 |
/** |
| 3 |
* Class to Set_As_Unread -- 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__Set_As_Unread |
| 14 |
*/ |
| 15 |
class WPBC_Listing_Actions__Set_As_Unread{ |
| 16 |
|
| 17 |
const ACTION = 'set_booking_as_unread'; |
| 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__set_booking_as_unread__section' ) ) { |
| 41 |
return false; |
| 42 |
} |
| 43 |
jQuery( '.wpbc_modal__title__reason__booking_id' ).html( 'ID: ' + wpbc_get_selected_row_id() ); |
| 44 |
jQuery( '#wpbc_modal__set_booking_as_unread__section' ).wpbc_my_modal( 'show' ); |
| 45 |
jQuery( '#wpbc_modal__set_booking_as_unread__value' ).trigger( 'focus' ); |
| 46 |
\" |
| 47 |
title=\"" . esc_attr( __( 'Mark as Unread selected bookings', 'booking' ) ) . "\" |
| 48 |
>" . |
| 49 |
esc_js( __( 'Mark as unread', 'booking' ) ) . |
| 50 |
' <i class="menu_icon icon-1x wpbc-bi-circle-square"></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__set_booking_as_unread__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">×</span></button> |
| 71 |
<h4 class="modal-title"> |
| 72 |
<span class="wpbc_modal__title__reason"> |
| 73 |
<?php |
| 74 |
esc_html_e( 'Mark as Unread 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__set_booking_as_unread__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__set_booking_as_unread__value" |
| 87 |
name="wpbc_modal__set_booking_as_unread__value" cols="87" rows="3" |
| 88 |
placeholder="<?php echo esc_attr__( 'Optional', 'booking' ) . ' '; ?>" |
| 89 |
></textarea> |
| 90 |
<input type="hidden" id="wpbc_modal__set_booking_as_unread__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=trash' ) . '">', '</a>', '<b>[reason]</b>' ) ); |
| 95 |
?> |
| 96 |
</p> |
| 97 |
</div--> |
| 98 |
<div class="modal-footer"> |
| 99 |
<a id="wpbc_modal__set_booking_as_unread__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' : wpbc_get_selected_row_id(), |
| 104 |
'reason_of_action' : '', // jQuery( '#wpbc_modal__set_booking_as_unread__value' ).val(), |
| 105 |
'ui_clicked_element_id': 'wpbc_modal__set_booking_as_unread__button_send' |
| 106 |
} ); |
| 107 |
wpbc_button_enable_loading_icon( this ); |
| 108 |
jQuery( '.wpbc_modal__title__reason__booking_id' ).html(''); |
| 109 |
jQuery( '#wpbc_modal__set_booking_as_unread__value' ).val(''), |
| 110 |
jQuery( '#wpbc_modal__set_booking_as_unread__section' ).wpbc_my_modal( 'hide' ); |
| 111 |
" > |
| 112 |
<?php |
| 113 |
esc_html_e( 'Mark as unread', 'booking' ); |
| 114 |
?> |
| 115 |
</a> |
| 116 |
<a href="javascript:void(0)" class="button button-secondary" data-dismiss="modal"> |
| 117 |
<?php |
| 118 |
esc_html_e( 'Cancel', 'booking' ); |
| 119 |
?> |
| 120 |
</a> |
| 121 |
</div> |
| 122 |
</div><!-- /.modal-content --> |
| 123 |
</div><!-- /.modal-dialog --> |
| 124 |
</div><!-- /.modal --> |
| 125 |
</span> |
| 126 |
<?php |
| 127 |
} |
| 128 |
} |
| 129 |
|
| 130 |
// Loads hidden modal template. |
| 131 |
add_action( 'wpbc_hook_booking_template__hidden_templates', array( new WPBC_Listing_Actions__Set_As_Unread(), 'template_for_modal' ) ); |
| 132 |
|