Pagination refactoring

This commit is contained in:
Frederic Guillot
2015-01-18 17:59:41 -05:00
parent 74e4a7b064
commit 7c1c14cf64
21 changed files with 772 additions and 656 deletions

View File

@@ -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,
)));
}