diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-10-25 15:44:38 -0400 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-10-25 15:44:38 -0400 |
commit | 45b5e8b879c1135398790cf988434188aa062cd4 (patch) | |
tree | 61b4db2e7bda95141a17b9f86f414a46aed24fde /app/Controller/User.php | |
parent | 471736bf8c9304606f183cd6b688b1fae64eea70 (diff) |
Add pagination for users page
Diffstat (limited to 'app/Controller/User.php')
-rw-r--r-- | app/Controller/User.php | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/app/Controller/User.php b/app/Controller/User.php index 834b2379..e757fa84 100644 --- a/app/Controller/User.php +++ b/app/Controller/User.php @@ -121,16 +121,31 @@ class User extends Base */ public function index() { - $users = $this->user->getAll(); - $nb_users = count($users); + $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(); $this->response->html( $this->template->layout('user_index', array( 'projects' => $this->project->getList(), - 'users' => $users, 'nb_users' => $nb_users, + 'users' => $users, 'menu' => 'users', - 'title' => t('Users').' ('.$nb_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(), + ), ))); } |