| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
global $wpdb; |
| 6 |
?> |
| 7 |
<style> |
| 8 |
.wpbot_dashboard_header { |
| 9 |
margin-right: unset !important; |
| 10 |
margin-left: unset !important; |
| 11 |
background: #32373c; |
| 12 |
color: #fff; |
| 13 |
text-align: center; |
| 14 |
border-radius: 5px 5px 0px 0px; |
| 15 |
} |
| 16 |
.wpbot_addons_section { |
| 17 |
margin-right: unset !important; |
| 18 |
margin-left: unset !important; |
| 19 |
margin-bottom: 10px; |
| 20 |
background: #32373c; |
| 21 |
padding-bottom: 20px; |
| 22 |
border-radius: 0px 0px 5px 5px; |
| 23 |
} |
| 24 |
.wpbot_single_addon_wrapper2 { |
| 25 |
background: #fff; |
| 26 |
padding: 20px; |
| 27 |
} |
| 28 |
.wp-chatbot-admin-header, .wp-chatbot-admin-footer { |
| 29 |
padding: 25px; |
| 30 |
} |
| 31 |
.wpbot_dashboard_header h1 { |
| 32 |
font-size: 30px; |
| 33 |
line-height: 100px; |
| 34 |
margin: 0px; |
| 35 |
color: #fff; |
| 36 |
} |
| 37 |
.container { |
| 38 |
width: 1170px; |
| 39 |
padding-right: 15px; |
| 40 |
padding-left: 15px; |
| 41 |
} |
| 42 |
</style> |
| 43 |
<div class="wrap"> |
| 44 |
|
| 45 |
<?php if(isset($_GET['action']) && $_GET['action']=='edit'): |
| 46 |
$hasEdit = false; |
| 47 |
if(isset($_GET['query']) && $_GET['query']!=''){ |
| 48 |
$hasEdit = true; |
| 49 |
$id = sanitize_text_field($_GET['query']); |
| 50 |
$table = $wpdb->prefix.'wpbot_response'; |
| 51 |
$data = $wpdb->get_row("select * from $table where 1 and id = '".$id."'"); |
| 52 |
|
| 53 |
} |
| 54 |
|
| 55 |
?> |
| 56 |
<div class="wp-chatbot-wrap"> |
| 57 |
<div class="wpbot_dashboard_header container"><h1><?php echo ($hasEdit?'Edit':'Add') ?> Response</h1></div> |
| 58 |
<form method="post" action=""> |
| 59 |
<div class="wpbot_addons_section container"> |
| 60 |
<div class="wpbot_single_addon_wrapper2"> |
| 61 |
<table class="form-table"> |
| 62 |
<tbody> |
| 63 |
<tr valign="top"> |
| 64 |
<th scope="row">Query</th> |
| 65 |
<td> |
| 66 |
<input type="text" name="qc_bot_str_query" value="<?php echo ($hasEdit?$data->query:''); ?>" style="width: 400px;" required /> |
| 67 |
<br><i>*Required. Add the query here.</i> |
| 68 |
</td> |
| 69 |
</tr> |
| 70 |
|
| 71 |
<tr valign="top"> |
| 72 |
<th scope="row">Response</th> |
| 73 |
<td> |
| 74 |
<textarea id="qlcd_wp_chatbot_stop_words" cols="130" rows="10" name="qc_bot_str_response" required><?php echo ($hasEdit?$data->response:''); ?></textarea> |
| 75 |
<br><i>*Required. Add the response here.</i> |
| 76 |
</td> |
| 77 |
</tr> |
| 78 |
<tr valign="top"> |
| 79 |
<th scope="row">Keyword</th> |
| 80 |
<td> |
| 81 |
<input type="text" name="qc_bot_str_keyword" value="<?php echo ($hasEdit?$data->keyword:''); ?>" style="width: 400px;" /> |
| 82 |
<br><i>Optional. Add multiple keyword or phrases as comma(,) seperated value. It will help to find the best match result.</i> |
| 83 |
</td> |
| 84 |
</tr> |
| 85 |
<tr valign="top" style="display:none"> |
| 86 |
<th scope="row">Intent</th> |
| 87 |
<td> |
| 88 |
<input type="text" name="qc_bot_str_intent" value="<?php echo ($hasEdit?$data->intent:''); ?>" style="width: 400px;" /> |
| 89 |
<br><i>Optional. Leave it empty if you do not need to use this response as a intent. This will add as a custom intent in every intent selection field in wpbot settings. Also the intent can be used as system command to trigger the response.</i> |
| 90 |
<?php if($hasEdit): ?> |
| 91 |
|
| 92 |
<input type="hidden" name="qc_bot_str_id" value="<?php echo ($data->id); ?>" /> |
| 93 |
|
| 94 |
<?php endif; ?> |
| 95 |
</td> |
| 96 |
</tr> |
| 97 |
|
| 98 |
</tbody> |
| 99 |
</table> |
| 100 |
</div> |
| 101 |
|
| 102 |
<footer class="wp-chatbot-admin-footer"> |
| 103 |
<div class="row"> |
| 104 |
<div class="text-left col-sm-3 col-sm-offset-3"> |
| 105 |
|
| 106 |
</div> |
| 107 |
<div class="text-right col-sm-6"> |
| 108 |
<input type="submit" class="button button-primary" name="submit" id="submit" value="Save Settings"> |
| 109 |
</div> |
| 110 |
</div> |
| 111 |
<!-- row--> |
| 112 |
</footer> |
| 113 |
|
| 114 |
|
| 115 |
</div></form> |
| 116 |
</div> |
| 117 |
<?php else: ?> |
| 118 |
|
| 119 |
<h1 class="wp-heading-inline"> |
| 120 |
Simple Text Responses</h1> |
| 121 |
<a href="<?php echo add_query_arg( 'action', 'edit', admin_url('admin.php?page=simple-text-response') ); ?>" class="page-title-action">Add New</a> |
| 122 |
<hr class="wp-header-end"> |
| 123 |
|
| 124 |
<div id="poststuff"> |
| 125 |
<div id="post-body" class="metabox-holder columns-2"> |
| 126 |
<div id="post-body-content"> |
| 127 |
<div class="meta-box-sortables ui-sortable"> |
| 128 |
<form method="post"> |
| 129 |
<?php |
| 130 |
$this->response_list->prepare_items(); |
| 131 |
$this->response_list->display(); ?> |
| 132 |
</form> |
| 133 |
</div> |
| 134 |
</div> |
| 135 |
</div> |
| 136 |
<br class="clear"> |
| 137 |
</div> |
| 138 |
<form method="post" action=""> |
| 139 |
<table class="form-table"> |
| 140 |
<tbody> |
| 141 |
<tr valign="top"> |
| 142 |
<th scope="row">Search Weight</th> |
| 143 |
<td> |
| 144 |
<input type="text" name="qc_bot_str_weight" value="<?php echo (get_option('qc_bot_str_weight')?get_option('qc_bot_str_weight'):'0.4'); ?>" style="width: 400px;" required /> |
| 145 |
<input type="submit" class="button button-primary" name="submit" id="submit" value="Save Settings"> |
| 146 |
<br><i>Please enter a value between 0 to 1.</i> |
| 147 |
|
| 148 |
</td> |
| 149 |
|
| 150 |
</tr> |
| 151 |
</tbody> |
| 152 |
</table> |
| 153 |
</form> |
| 154 |
|
| 155 |
<?php endif; ?> |
| 156 |
</div> |