Archived
1
0
Fork 0

app/controllers/UserController.php: adding activity action

This commit is contained in:
Henrik Hautakoski 2018-04-01 11:04:33 +02:00
parent 3f99105588
commit 5890337179
2 changed files with 43 additions and 1 deletions

View file

@ -3,7 +3,8 @@
namespace App\Controller;
use App\Controller\ControllerBase,
App\Form\UserSettings as UserSettingsForm;
App\Form\UserSettings as UserSettingsForm,
App\Model\Data\ActivityLog;
class UserController extends ControllerBase
{
@ -34,4 +35,14 @@ class UserController extends ControllerBase
$this->view->form = $form;
}
public function activityAction($page = 1)
{
$user = $this->_getAuth()->getUser();
$paginator = ActivityLog::getPaginationList($user->getId(), $page);
$this->view->page = $paginator->getPaginate();
$this->view->pagination_url = '/user/activity/';
}
}

View file

@ -0,0 +1,31 @@
<div class="section">
<h3>Activity Log</h3>
<table class="table table-condensed table-striped table-hover">
<thead>
<tr>
<th>Date</th>
<th>Ip</th>
<th>Message</th>
</tr>
</thead>
<tbody>
{% for item in page.items %}
<tr>
<td>{{ item.getTimestamp() }}</td>
<td>{{ item.getIp() }}</td>
<td>{{ item.getMessage() }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<nav class="text-center" aria-label="Page navigation">
{{ partial('pagination') }}
</nav>
</div>