| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
global $wpdb; |
| 6 |
|
| 7 |
$table = $wpdb->prefix.'wpbot_response_category'; |
| 8 |
|
| 9 |
$data = $wpdb->get_results($wpdb->prepare("select * from {$table}")); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare |
| 10 |
|
| 11 |
?> |
| 12 |
<style type="text/css"> |
| 13 |
table.qcdf_table { |
| 14 |
font-family: arial, sans-serif; |
| 15 |
border-collapse: collapse; |
| 16 |
width: 100%; |
| 17 |
} |
| 18 |
|
| 19 |
table.qcdf_table td, table.qcdf_table th { |
| 20 |
border: 1px solid #dddddd; |
| 21 |
text-align: left; |
| 22 |
padding: 8px; |
| 23 |
} |
| 24 |
|
| 25 |
table.qcdf_table tr:nth-child(even) { |
| 26 |
background-color: #dddddd; |
| 27 |
} |
| 28 |
.dfentity_wp_table{width: 600px; |
| 29 |
background: #fff; |
| 30 |
padding: 10px;} |
| 31 |
.dfentity_actions{width:600px;float:left;margin-left: 50px;padding: 10px;background:#fff} |
| 32 |
.dfentity_header_button{padding: 10px; |
| 33 |
background: #fff; |
| 34 |
margin-bottom: 21px; |
| 35 |
width: 1270px;} |
| 36 |
</style> |
| 37 |
<div class="qcwrap"> |
| 38 |
<div class="wp-chatbot-wrap"> |
| 39 |
|
| 40 |
|
| 41 |
<div class="wpbot_dashboard_header "> |
| 42 |
<h1>Manage STR Categories</h1> |
| 43 |
|
| 44 |
</div> |
| 45 |
|
| 46 |
<div class="wpbot_addons_section "> |
| 47 |
|
| 48 |
<a href="<?php echo esc_url( add_query_arg( 'opt', 'add', admin_url('admin.php?page=simple-text-response&action=manage-category') ) ); ?>" class="page-title-action button">Add New Category</a> |
| 49 |
|
| 50 |
<div class="wpbot_single_addon_wrapper2"> |
| 51 |
|
| 52 |
<div class="dfentity_wp_table"> |
| 53 |
<h2>Category List</h2> |
| 54 |
<hr> |
| 55 |
<?php |
| 56 |
|
| 57 |
if(!empty($data)): |
| 58 |
?> |
| 59 |
<table class="qcdf_table"> |
| 60 |
<tr> |
| 61 |
<th>Id</th> |
| 62 |
<th>Category Name</th> |
| 63 |
<th>Action</th> |
| 64 |
</tr> |
| 65 |
<?php foreach($data as $result): ?> |
| 66 |
<tr> |
| 67 |
<td><?php echo esc_html($result->id); ?></td> |
| 68 |
<td><?php echo esc_html($result->name); ?></td> |
| 69 |
<td> |
| 70 |
<a href="<?php echo esc_url( add_query_arg( 'id', $result->id, admin_url('admin.php?page=simple-text-response&action=manage-categories&opt=edit') ) ); ?>" class="page-title-action">Edit</a> |
| 71 |
| |
| 72 |
<a href="<?php echo esc_url( add_query_arg( 'id', $result->id, admin_url('admin.php?page=simple-text-response&action=manage-categories&opt=delete') ) ); ?>" class="page-title-action">Delete</a> |
| 73 |
|
| 74 |
</td> |
| 75 |
</tr> |
| 76 |
<?php endforeach; ?> |
| 77 |
</table> |
| 78 |
<?php else: ?> |
| 79 |
<p>No category found!</p> |
| 80 |
<?php endif; ?> |
| 81 |
|
| 82 |
</div> |
| 83 |
|
| 84 |
</div> |
| 85 |
|
| 86 |
<footer class="wp-chatbot-admin-footer"> |
| 87 |
<div class="row"> |
| 88 |
<div class="text-left col-sm-3 col-sm-offset-3"> |
| 89 |
|
| 90 |
</div> |
| 91 |
<div class="text-right col-sm-6"> |
| 92 |
<input type="submit" class="button button-primary" name="submit" id="submit" value="Save Settings"> |
| 93 |
</div> |
| 94 |
</div> |
| 95 |
<!-- row--> |
| 96 |
</footer> |
| 97 |
|
| 98 |
|
| 99 |
</div> |
| 100 |
</div> |
| 101 |
</div> |