summaryrefslogtreecommitdiff
path: root/app/Controller/User.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-01-18 17:59:41 -0500
committerFrederic Guillot <fred@kanboard.net>2015-01-18 17:59:41 -0500
commit7c1c14cf64b59f211b9d505112797cb855e5b604 (patch)
tree79622c17096b386ca599c3f804a9d6d5513a8d7d /app/Controller/User.php
parent74e4a7b0642b18d9aaa71dd72359495c5dc99107 (diff)
Pagination refactoring
Diffstat (limited to 'app/Controller/User.php')
-rw-r--r--app/Controller/User.php28
1 files changed, 8 insertions, 20 deletions
diff --git a/app/Controller/User.php b/app/Controller/User.php
index 7fddf705..a02da7a9 100644
--- a/app/Controller/User.php
+++ b/app/Controller/User.php
@@ -115,31 +115,19 @@ class User extends Base
*/
public function index()
{
- $direction = $this->request->getStringParam('direction', 'ASC');
- $order = $this->request->getStringParam('order', 'username');
- $offset = $this->request->getIntegerParam('offset', 0);
- $limit = 25;
-
- $users = $this->user->paginate($offset, $limit, $order, $direction);
- $nb_users = $this->user->count();
+ $paginator = $this->paginator
+ ->setUrl('user', 'index')
+ ->setMax(30)
+ ->setOrder('username')
+ ->setQuery($this->user->getQuery())
+ ->calculate();
$this->response->html(
$this->template->layout('user/index', array(
'board_selector' => $this->projectPermission->getAllowedProjects($this->userSession->getId()),
'projects' => $this->project->getList(),
- 'nb_users' => $nb_users,
- 'users' => $users,
- 'title' => t('Users').' ('.$nb_users.')',
- 'pagination' => array(
- 'controller' => 'user',
- 'action' => 'index',
- 'direction' => $direction,
- 'order' => $order,
- 'total' => $nb_users,
- 'offset' => $offset,
- 'limit' => $limit,
- 'params' => array(),
- ),
+ 'title' => t('Users').' ('.$paginator->getTotal().')',
+ 'paginator' => $paginator,
)));
}