| 1 |
<?php |
| 2 |
/** |
| 3 |
* The template for Messages Management. |
| 4 |
* |
| 5 |
* This is the template that table, search layout |
| 6 |
* |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; // Exit if accessed directly. |
| 11 |
} |
| 12 |
|
| 13 |
?> |
| 14 |
|
| 15 |
<!-- This file should primarily consist of HTML with a little bit of PHP. --> |
| 16 |
|
| 17 |
<div class="wrap wdk-wrap"> |
| 18 |
|
| 19 |
<h1 class="wp-heading-inline"><?php echo __('Messages Management', 'wpdirectorykit'); ?></h1> |
| 20 |
<?php |
| 21 |
$success_message = NULL; |
| 22 |
if(isset($_GET['custom_message'])) |
| 23 |
$success_message = esc_html(urldecode($_GET['custom_message'])); |
| 24 |
|
| 25 |
$form->messages('class="alert alert-danger"', $success_message); |
| 26 |
?> |
| 27 |
<form method="GET" action="<?php echo esc_url(wmvc_current_edit_url()); ?>" novalidate="novalidate"> |
| 28 |
<div class="tablenav top"> |
| 29 |
<div class="alignleft actions"> |
| 30 |
<input type="hidden" name="page" value="wdk_messages" /> |
| 31 |
<label class="screen-reader-text" for="search"><?php echo __('Filter by keyword', 'wpdirectorykit'); ?></label> |
| 32 |
<input type="text" name="search" id="search" class="postform left" value="<?php echo esc_attr(wmvc_show_data('search', $db_data, '')); ?>" placeholder="<?php echo __('Filter by keyword', 'wpdirectorykit'); ?>" /> |
| 33 |
|
| 34 |
<label class="screen-reader-text" for="user_id_editor"><?php echo esc_html__('Filter by user', 'wpdirectorykit'); ?></label> |
| 35 |
<?php echo wmvc_select_option('user_id_editor', $users, wmvc_show_data('user_id_editor', $db_data, ''), NULL, __('User', 'wpdirectorykit')); ?> |
| 36 |
|
| 37 |
|
| 38 |
<label class="screen-reader-text" for="order_by"><?php echo __('Order By', 'wpdirectorykit'); ?></label> |
| 39 |
<?php echo wmvc_select_option('order_by', $order_by, wmvc_show_data('order_by', $db_data, ''), NULL, __('Order by', 'wpdirectorykit')); ?> |
| 40 |
|
| 41 |
<input type="submit" name="filter_action" id="post-query-submit" class="button" value="<?php echo __('Filter', 'wpdirectorykit'); ?>"> |
| 42 |
</div> |
| 43 |
<?php echo wmvc_xss_clean($pagination_output); ?> |
| 44 |
<br class="clear"> |
| 45 |
</div> |
| 46 |
</form> |
| 47 |
|
| 48 |
<form method="GET" action="<?php echo esc_url(wmvc_current_edit_url()); ?>" novalidate="novalidate"> |
| 49 |
<table class="wp-list-table widefat fixed striped table-view-list pages"> |
| 50 |
<thead> |
| 51 |
<tr> |
| 52 |
<td id="cb" class="manage-column column-cb check-column"><label class="screen-reader-text" for="cb-select-all-1"><?php echo __('Select All', 'wpdirectorykit'); ?></label><input id="cb-select-all-1" type="checkbox"></td> |
| 53 |
<th style="width:50px;"><?php echo __('#ID', 'wpdirectorykit'); ?></th> |
| 54 |
<th><?php echo __('Email From', 'wpdirectorykit'); ?></th> |
| 55 |
<th><?php echo __('To User', 'wpdirectorykit'); ?></th> |
| 56 |
<th><?php echo __('Date', 'wpdirectorykit'); ?></th> |
| 57 |
<th><?php echo __('Message', 'wpdirectorykit'); ?></th> |
| 58 |
<th class="actions_column"><?php echo __('Actions', 'wpdirectorykit'); ?></th> |
| 59 |
</tr> |
| 60 |
</thead> |
| 61 |
<?php if (count($messages) == 0) : ?> |
| 62 |
<tr class="no-items"> |
| 63 |
<td class="colspanchange" colspan="7"><?php echo __('No Messages found.', 'wpdirectorykit'); ?></td> |
| 64 |
</tr> |
| 65 |
<?php endif; ?> |
| 66 |
<?php foreach ($messages as $item) : ?> |
| 67 |
<tr> |
| 68 |
<th scope="row" class="check-column"> |
| 69 |
<input id="cb-select-<?php echo wmvc_show_data('idmessage', $item, '-'); ?>" type="checkbox" name="post[]" value="<?php echo wmvc_show_data('idmessage', $item, '-'); ?>"> |
| 70 |
<div class="locked-indicator"> |
| 71 |
<span class="locked-indicator-icon" aria-hidden="true"></span> |
| 72 |
<span class="screen-reader-text"><?php echo __('Is Locked', 'wpdirectorykit'); ?></span> |
| 73 |
</div> |
| 74 |
</th> |
| 75 |
<td> |
| 76 |
<?php echo wmvc_show_data('idmessage', $item, '-'); ?> |
| 77 |
</td> |
| 78 |
<td> |
| 79 |
<strong> |
| 80 |
<a class="row-title" href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk_messages&function=edit&id=" . wmvc_show_data('idmessage', $item, '-')); ?>"><?php echo wmvc_show_data('email_sender', $item, '-'); ?></a> |
| 81 |
<?php if(!wmvc_show_data('is_readed', $item, 0)): ?> |
| 82 |
<span class="label label-success"><?php echo esc_html__('Unread', 'wpdirectorykit'); ?></span> |
| 83 |
<?php else: ?> |
| 84 |
<span class="label label-info"><?php echo esc_html__('I read it', 'wpdirectorykit'); ?></span> |
| 85 |
<?php endif; ?> |
| 86 |
</strong> |
| 87 |
<div class="row-actions"> |
| 88 |
<span class="edit"><a href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk_messages&function=edit&id=" . wmvc_show_data('idmessage', $item, '-')); ?>"><?php echo __('Edit', 'wpdirectorykit'); ?></a> | </span> |
| 89 |
<span class="trash "><a href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk_messages&function=delete&paged=".esc_attr($paged)."&id=" . wmvc_show_data('idmessage', $item, '-')."&_wpnonce=".wp_create_nonce( 'wdk-messages-delete_'.wmvc_show_data('idmessage', $item, '-')));?>" class="submitdelete question_sure" title="<?php echo esc_attr__('Remove', 'wpdirectorykit');?>" ><?php echo __('Delete', 'wpdirectorykit'); ?></a></span> |
| 90 |
</div> |
| 91 |
</td> |
| 92 |
<td> |
| 93 |
<?php echo wmvc_show_data('display_name', $item); ?> |
| 94 |
</td> |
| 95 |
<td> |
| 96 |
<?php echo wdk_get_date(wmvc_show_data('message_date', $item), false); ?> |
| 97 |
</td> |
| 98 |
<td> |
| 99 |
<?php echo wp_trim_words(wmvc_show_data('message', $item, '-'), 10); ?> |
| 100 |
</td> |
| 101 |
<td class="actions_column"> |
| 102 |
<a href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk_messages&function=edit&id=" . wmvc_show_data('idmessage', $item, '-')); ?>" title="<?php echo esc_attr__('Edit','wpdirectorykit');?>"><span class="dashicons dashicons-edit"></span></a> |
| 103 |
<a class="question_sure" href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk_messages&function=delete&paged=".esc_attr($paged)."&id=" . wmvc_show_data('idmessage', $item, '-')."&_wpnonce=".wp_create_nonce( 'wdk-messages-delete_'.wmvc_show_data('idmessage', $item, '-')));?>" title="<?php echo esc_attr__('Remove','wpdirectorykit');?>"><span class="dashicons dashicons-no"></span></a> |
| 104 |
</td> |
| 105 |
</tr> |
| 106 |
<?php endforeach; ?> |
| 107 |
<tfoot> |
| 108 |
<tr> |
| 109 |
<td id="cb" class="manage-column column-cb check-column"><label class="screen-reader-text" for="cb-select-all-1"><?php echo __('Select All', 'wpdirectorykit'); ?></label><input id="cb-select-all-1" type="checkbox"></td> |
| 110 |
<th style="width:50px;"><?php echo __('#ID', 'wpdirectorykit'); ?></th> |
| 111 |
<th><?php echo __('Email From', 'wpdirectorykit'); ?></th> |
| 112 |
<th><?php echo __('To User', 'wpdirectorykit'); ?></th> |
| 113 |
<th><?php echo __('Date', 'wpdirectorykit'); ?></th> |
| 114 |
<th><?php echo __('Message', 'wpdirectorykit'); ?></th> |
| 115 |
<th class="actions_column"><?php echo __('Actions', 'wpdirectorykit'); ?></th> |
| 116 |
</tr> |
| 117 |
</tfoot> |
| 118 |
</table> |
| 119 |
<div class="tablenav bottom"> |
| 120 |
<div class="alignleft actions bulkactions"> |
| 121 |
<?php wp_nonce_field( 'wdk-messages-bulk', '_wpnonce'); ?> |
| 122 |
<label for="bulk-action-selector-bottom" class="screen-reader-text"><?php echo __('Select bulk action', 'wpdirectorykit'); ?></label> |
| 123 |
<select name="action" id="bulk-action-selector-bottom"> |
| 124 |
<option value="-1"><?php echo __('Bulk actions', 'wpdirectorykit'); ?></option> |
| 125 |
<option value="delete" class="hide-if-no-js"><?php echo __('Delete', 'wpdirectorykit'); ?></option> |
| 126 |
</select> |
| 127 |
<input type="hidden" name="page" value="wdk_messages" /> |
| 128 |
<input type="submit" id="table_action" class="button action" name="table_action" value="<?php echo esc_attr__('Apply', 'wpdirectorykit'); ?>"> |
| 129 |
</div> |
| 130 |
|
| 131 |
<?php echo wmvc_xss_clean($pagination_output); ?> |
| 132 |
<br class="clear"> |
| 133 |
</div> |
| 134 |
</form> |
| 135 |
</div> |
| 136 |
|
| 137 |
<script> |
| 138 |
// Generate table |
| 139 |
jQuery(document).ready(function($) { |
| 140 |
$('.question_sure').on('click', function() { |
| 141 |
return confirm("<?php echo esc_js(__('Are you sure? Selected item will be completely removed!', 'wpdirectorykit')); ?>"); |
| 142 |
}); |
| 143 |
}); |
| 144 |
</script> |
| 145 |
|
| 146 |
<?php $this->view('general/footer', $data); ?> |