예제 #1
0
 /**
  * List threads of a user
  */
 public function listAction()
 {
     $lang = $this->lang;
     // first we check if user is logged, if not redir to login
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         // keep this url in zend session to redir after login
         $aNamespace = new Zend_Session_Namespace('Nolotiro');
         $aNamespace->redir = $this->getRequest()->getRequestUri();
         $this->_redirect($lang . '/auth/login');
     } else {
         $userid = $this->view->userid = $auth->getIdentity()->id;
         $this->view->username = $auth->getIdentity()->username;
         $m_message = new Model_Message();
         $this->view->list_threads = $m_message->getThreadsFromUser($userid);
         // paginator
         $page = $this->_getParam('page');
         $paginator = Zend_Paginator::factory($this->view->list_threads);
         $paginator->setDefaultScrollingStyle('Elastic');
         $paginator->setItemCountPerPage(10);
         $paginator->setCurrentPageNumber($page);
         $this->view->paginator = $paginator;
     }
 }