| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; // Exit if accessed directly |
| 4 |
} |
| 5 |
|
| 6 |
|
| 7 |
global $current_user, $wpscfunction; |
| 8 |
if (!($current_user->ID && $current_user->has_cap('wpsc_agent'))) { |
| 9 |
exit; |
| 10 |
} |
| 11 |
|
| 12 |
$ticket_id = isset($_POST['ticket_id']) ? sanitize_text_field($_POST['ticket_id']) : '' ; |
| 13 |
$thread_id = isset($_POST['thread_id']) ? sanitize_text_field($_POST['thread_id']) : '' ; |
| 14 |
|
| 15 |
$ticket_subject = $wpscfunction->get_ticket_fields($ticket_id,'ticket_subject'); |
| 16 |
$wpsc_appearance_modal_window = get_option('wpsc_modal_window'); |
| 17 |
|
| 18 |
ob_start(); |
| 19 |
|
| 20 |
?> |
| 21 |
|
| 22 |
<form id="create_ticket_thread"> |
| 23 |
|
| 24 |
<div class="form-group"> |
| 25 |
<label class="wpsc_ct_field_label" for="Subject"><?php _e('Subject','supportcandy');?></label> |
| 26 |
<input type="text" class="form-control" id="subject" name="subject" value="<?php echo esc_attr($ticket_subject)?>" /> |
| 27 |
</div> |
| 28 |
|
| 29 |
<input type="hidden" name="action" value="wpsc_tickets" /> |
| 30 |
<input type="hidden" name="setting_action" value="set_thread_ticket" /> |
| 31 |
<input type="hidden" name="ticket_id" value="<?php echo esc_attr($ticket_id) ?>" /> |
| 32 |
<input type="hidden" name="thread_id" value="<?php echo esc_attr($thread_id)?>" /> |
| 33 |
<input type="hidden" name="_ajax_nonce" value="<?php echo wp_create_nonce('set_thread_ticket')?>"> |
| 34 |
</form> |
| 35 |
|
| 36 |
<?php |
| 37 |
$body = ob_get_clean(); |
| 38 |
|
| 39 |
ob_start(); |
| 40 |
|
| 41 |
?> |
| 42 |
<div class="row"> |
| 43 |
<div class="pull-right"> |
| 44 |
<button type="button" class="btn wpsc_popup_close" style="background-color:<?php echo esc_attr($wpsc_appearance_modal_window['wpsc_close_button_bg_color'])?> !important;color:<?php echo esc_attr($wpsc_appearance_modal_window['wpsc_close_button_text_color'])?> !important;" onclick="wpsc_modal_close();"><?php _e('Close','supportcandy');?></button> |
| 45 |
<button type="button" class="btn wpsc_popup_action" style="width:140px;" onclick="javascript:wpsc_set_new_ticket_thread();"><?php _e('Create New Ticket','supportcandy');?></button> |
| 46 |
</div> |
| 47 |
</div> |
| 48 |
|
| 49 |
<?php |
| 50 |
$footer = ob_get_clean(); |
| 51 |
|
| 52 |
$output = array( |
| 53 |
'body' => $body, |
| 54 |
'footer' => $footer |
| 55 |
); |
| 56 |
|
| 57 |
wp_send_json($output); |
| 58 |
?> |