PluginProbe
SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent / 2.3.1
SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent v2.3.1
3.5.4 3.5.3 3.5.2 3.5.1 3.4.9 3.5.0 3.4.8 3.4.7 trunk 2.3.1 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6
supportcandy / includes / admin / settings / get_edit_ticket_widget.php

get_edit_ticket_widget.php in SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent 2.3.1, at includes/admin/settings/get_edit_ticket_widget.php

68 lines 3.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit; // Exit if accessed directly
4 }
5
6 global $current_user;
7 if (!($current_user->ID && $current_user->has_cap('manage_options'))) {exit;}
8
9
10 $ticket_widget_id = isset($_POST) && isset($_POST['ticket_widget_id']) ? intval($_POST['ticket_widget_id']) : 0;
11 if (!$ticket_widget_id) {exit;}
12 $ticket_widget = get_term_by('id', $ticket_widget_id, 'wpsc_ticket_widget');
13 $ticket_widget_name = get_term_meta($ticket_widget_id, 'wpsc_label', true);
14 $agent_role = get_option('wpsc_agent_role');
15 ob_start();
16 ?>
17 <form id="wpsc_frm_general_settings" method="post">
18 <div class="form-group">
19 <label for="wpsc_ticket_widget_name"><?php _e('Edit Ticket Widget','supportcandy');?></label>
20 <p class="help-block"><?php _e('Title','supportcandy');?></p>
21 <input id="wpsc_ticket_widget_name" class="form-control" name="wpsc_ticket_widget_name" value="<?php echo esc_attr($ticket_widget_name);?>" />
22 </div>
23
24 <div class="form-group">
25 <label for="wpsc_ticket_widget_type"><?php _e('Type','supportcandy');?></label>
26 <p class="help-block"><?php _e('Show/hide ticket widget in open ticket.','supportcandy');?></p>
27 <select class="form-control" name="wpsc_ticket_widget_type" id="wpsc_ticket_widget_type">
28 <?php
29 $wpsc_ticket_widget_type = get_term_meta( $ticket_widget->term_id, 'wpsc_ticket_widget_type', true);
30 $selected = $wpsc_ticket_widget_type == '1' ? 'selected="selected"' : '';
31 echo '<option '.esc_attr($selected).' value="1">'.__('Enable','supportcandy').'</option>';
32 $selected = $wpsc_ticket_widget_type == '0' ? 'selected="selected"' : '';
33 echo '<option '.esc_attr($selected).' value="0">'.__('Disable','supportcandy').'</option>';
34 ?>
35 </select>
36 </div>
37
38 <div class="form-group" >
39 <?php
40 $wpsc_ticket_widget_role = get_term_meta( $ticket_widget->term_id, 'wpsc_ticket_widget_role', true);
41 ?>
42 <label for="wpsc_ticket_widget_role"><?php _e('Role','supportcandy');?></label>
43 <p class="help-block"><?php _e('Selected users can see the widget.','supportcandy');?></p>
44 <div class="row" >
45 <?php foreach ( $agent_role as $key => $role ) {
46 $checked = in_array($key,$wpsc_ticket_widget_role) ? 'checked="checked"':'';
47 ?>
48 <div class="col-sm-4" style="margin-bottom:10px; display:flex;">
49 <div style="width:25px;"><input id="wpsc_ticket_widget_role" type="checkbox" <?php echo esc_attr($checked)?> name="ticket_widget_role" value="<?php echo esc_attr($key) ?>" /></div>
50 <div style="padding-top:3px;"><?php echo esc_attr($role['label'])?></div>
51 </div>
52 <?php
53 }
54 ?>
55 <div class="col-sm-4" style="margin-bottom:10px; display:flex;">
56 <div style="width:25px;"><input id="wpsc_ticket_widget_role" type="checkbox" <?php echo in_array('customer',$wpsc_ticket_widget_role)?'checked="checked"':''?> name="ticket_widget_role" value="<?php echo 'customer'?>" /></div>
57 <div style="padding-top:3px;"><?php _e('Customer','supportcandy')?></div>
58 </div>
59 </div>
60 </div>
61 <?php do_action('wpsc_get_edit_ticket_widget');?>
62
63 <button type="submit" class="btn btn-success" onclick="javascript:wpsc_set_edit_ticket_widget(<?php echo esc_attr($ticket_widget_id)?>,event);"><?php _e('Save Changes','supportcandy');?></button>
64 <button type="cancel" class="btn btn-default" onclick="javascript:wpsc_get_ticket_widget_settings()"><?php _e('Cancel','supportcandy');?></button>
65 <img class="wpsc_submit_wait" style="display:none;" src="<?php echo esc_url(WPSC_PLUGIN_URL.'asset/images/[email protected]');?>">
66 <input type="hidden" name="action" value="settings.php" />
67 <input type="hidden" name="setting_action" value="wpsc_set_edit_ticket_widget" />
68 </form>