| 1 |
<table class="form-table logtivity-table"> |
| 2 |
<thead> |
| 3 |
<tr> |
| 4 |
<th>Action</th> |
| 5 |
<th>Context</th> |
| 6 |
<th>User</th> |
| 7 |
<th colspan="2">Date</th> |
| 8 |
</tr> |
| 9 |
</thead> |
| 10 |
<tbody> |
| 11 |
|
| 12 |
<?php if (count($logs)): ?> |
| 13 |
<?php foreach ($logs as $key => $log): ?> |
| 14 |
|
| 15 |
<tr> |
| 16 |
<td><?php echo sanitize_text_field($log->action) ?></td> |
| 17 |
<td><?php echo sanitize_text_field($log->context) ?></td> |
| 18 |
<td> |
| 19 |
<div style="margin-bottom: 5px;"><?php echo sanitize_text_field($log->action_username ?? $log->action_user_id) ?></div> |
| 20 |
<?php echo sanitize_text_field($log->ip_address) ?> |
| 21 |
</td> |
| 22 |
<td> |
| 23 |
<?php echo sanitize_text_field(date('M d Y', strtotime($log->occurred_at))) ?> - <?php echo sanitize_text_field(date('H:i:s', strtotime($log->occurred_at))); ?> |
| 24 |
</td> |
| 25 |
<td> |
| 26 |
<button class="button js-logtivity-view-log">View</button> |
| 27 |
<div style="display: none;" class="js-modal-content"> |
| 28 |
<?php echo logtivity_view('_log-show', [ |
| 29 |
'log' => $log |
| 30 |
]) ?> |
| 31 |
</div> |
| 32 |
</td> |
| 33 |
</tr> |
| 34 |
|
| 35 |
<?php endforeach ?> |
| 36 |
<?php else: ?> |
| 37 |
<?php if (isset($message)): ?> |
| 38 |
<tr> |
| 39 |
<td colspan="6"><?php echo sanitize_text_field($message) ?></td> |
| 40 |
</tr> |
| 41 |
<?php else: ?> |
| 42 |
<tr> |
| 43 |
<td colspan="6">No results found.</td> |
| 44 |
</tr> |
| 45 |
<?php endif ?> |
| 46 |
<?php endif ?> |
| 47 |
|
| 48 |
</tbody> |
| 49 |
</table> |
| 50 |
|
| 51 |
<?php if ($meta->current_page): ?> |
| 52 |
|
| 53 |
<div data-current-page="<?php echo $meta->current_page ?>" data-last-page="<?php echo $meta->last_page ?>" style="text-align: center; padding: 20px"> |
| 54 |
|
| 55 |
<button <?php echo ( $meta->current_page == 1 ? 'disabled' : ''); ?> class="js-logtivity-pagination button-primary" data-page="<?php echo sanitize_text_field($meta->current_page - 1) ?>">Previous</button> |
| 56 |
|
| 57 |
<button <?php echo ( ! $hasNextPage ? 'disabled' : ''); ?> class="js-logtivity-pagination button-primary" data-page="<?php echo sanitize_text_field($meta->current_page + 1) ?>">Next</button> |
| 58 |
|
| 59 |
</div> |
| 60 |
<?php endif ?> |
| 61 |
|
| 62 |
<div class="logtivity-modal"> |
| 63 |
<div class="logtivity-modal-dialog"> |
| 64 |
<div class="logtivity-modal-content"> |
| 65 |
<!-- Populated with JS --> |
| 66 |
</div> |
| 67 |
</div> |
| 68 |
</div> |