Example #1
0
 /**
  * Index action method
  *
  * @return void
  */
 public function index()
 {
     $session = new Model\Session();
     $searchUsername = $this->request->getQuery('search_username');
     if ($session->hasPages($this->application->config()['pagination'], $searchUsername)) {
         $limit = $this->application->config()['pagination'];
         $pages = new Paginator($session->getCount($searchUsername), $limit);
         $pages->useInput(true);
     } else {
         $limit = null;
         $pages = null;
     }
     $this->prepareView('sessions/index.phtml');
     $this->view->title = 'Sessions';
     $this->view->pages = $pages;
     $this->view->queryString = $this->getQueryString('sort');
     $this->view->searchUsername = $searchUsername;
     $this->view->users = $session->getAllUsers();
     $this->view->sessions = $session->getAll($searchUsername, $limit, $this->request->getQuery('page'), $this->request->getQuery('sort'));
     $this->send();
 }