Exemplo n.º 1
0
 public function messagesAction()
 {
     /*--search---*/
     $search = trim($this->_getParam('search'));
     $where = "1=1";
     $this->view->linkArray = array();
     $this->view->search = "Search...";
     if ($search != "" && $search != "Search...") {
         $where = "user_message like '%{$search}%' || sys_message like '%{$search}%' ";
         $this->view->linkArray = array('search' => $search);
         $this->view->search = $search;
     }
     $this->view->page_size = $page_size = Zend_Registry::get('page_size');
     $page = $this->_getParam('page', 1);
     $model = new Application_Model_Message();
     $table = $model->getMapper()->getDbTable();
     $select = $table->select()->setIntegrityCheck(false)->from('message')->order('message_id ASC')->where($where);
     $select = $table->select()->setIntegrityCheck(false)->from(array("m" => 'message'))->join(array("mc" => 'message_category'), 'm.category_id=mc.message_category_id', array('category_name' => 'message_category_name'))->join(array("ms" => 'message_sevirity'), 'm.severity_id 	=ms.message_sevirity_id', array("sevirity_name" => "message_sevirity_name"))->join(array("mt" => 'message_type'), 'm.type_id=mt.message_type_id', array("type_name" => "message_type_name"))->order('message_id ASC')->where($where);
     //echo $sql = $select->__toString();
     $paginator = Base_Paginator::factory($select);
     $paginator->setItemCountPerPage($page_size);
     $paginator->setCurrentPageNumber($page);
     $this->view->totalItems = $paginator->getTotalItemCount();
     $this->view->paginator = $paginator;
 }