Archived
1
0
Fork 0

Adding backend/LogController::index()

This commit is contained in:
Henrik Hautakoski 2019-12-01 19:24:52 +01:00
parent 778c7127b3
commit 5fb9880a1b
No known key found for this signature in database
GPG key ID: 96765B12FEAC4745
3 changed files with 58 additions and 0 deletions

View file

@ -64,3 +64,6 @@ router:
backend-user-list:
pattern: '/admin/user/list/{page:([0-9]+)}'
path: backend::user::index
backend-log:
pattern: '/admin/log{page:/?([0-9]+)?}'
path: backend::log::index

View file

@ -0,0 +1,21 @@
<?php
namespace App\Controller\Backend;
use App\Model\Data\ActivityLog;
class LogController extends \Phalcon\Mvc\Controller
{
public function onConstruct()
{
$this->view->setLayout('side-menu');
}
public function indexAction($page = 1)
{
$paginator = ActivityLog::getAllPaginationList($page);
$this->view->page = $paginator->getPaginate();
$this->view->pagination_url = '/admin/log/';
}
}

View file

@ -0,0 +1,34 @@
<h1>Activity Log</h1>
<table class="table table-condensed table-striped table-hover">
<thead>
<tr>
<th>Date</th>
<th>Ip</th>
<th>User</th>
<th>Message</th>
</tr>
</thead>
<tbody>
{% for item in page.items %}
<tr>
<td>{{ item.getTimestamp() }}</td>
<td>{{ item.getIp() }}</td>
<td>
{% if item.getUser() %}
{{ item.getUser().getId() }}:{{ item.getUser().getUsername() }}
{% else %}
-
{% endif %}
</td>
<td>{{ item.getMessage() }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<nav class="text-center" aria-label="Page navigation">
{{ partial('pagination') }}
</nav>