public function indexAction() { // action body //create sesesion $session_search_user = new Zend_Session_Namespace('search_user'); if (empty($session_search_user->limit)) { $session_search_user->limit = Application_Form_FrmNavigation::getLimit(); $session_search_user->active = -1; $session_search_user->user_type = -1; $session_search_user->txtsearch = ''; $session_search_user->lock(); } //start page nevigation $limit = $session_search_user->limit; $start = $this->getRequest()->getParam('limit_satrt', 0); $db_user = new Application_Model_DbTable_DbUsers(); $this->view->activelist = $this->activelist; $this->view->active = $session_search_user->active; $this->view->user_typelist = $this->user_typelist; $this->view->user_type = $session_search_user->user_type; if ($this->getRequest()->isPost()) { $user_seach_data = $this->getRequest()->getPost(); //set session when submit $session_search_user->unlock(); $session_search_user->limit = $user_seach_data['rows_per_page']; $session_search_user->active = $user_seach_data['active']; $session_search_user->user_type = $user_seach_data['user_type']; $session_search_user->txtsearch = $user_seach_data['txtsearch']; $session_search_user->lock(); //set value for display $this->view->txtsearch = $user_seach_data['txtsearch']; $this->view->active = $user_seach_data['active']; $this->view->user_type = $user_seach_data['user_type']; $limit = $user_seach_data['rows_per_page']; $users = $db_user->getUserListBy($user_seach_data, $start, $limit); $record_count = $db_user->getUserListTotal($user_seach_data); } else { if ($session_search_user->active > -1 || $session_search_user->user_type > -1 || !empty($session_search_user->txtsearch)) { $user_seach_data = array('active' => $session_search_user->active, 'user_type' => $session_search_user->user_type, 'txtsearch' => $session_search_user->txtsearch); $users = $db_user->getUserListBy($user_seach_data, $start, $limit); $record_count = $db_user->getUserListTotal($user_seach_data); } else { $users = $db_user->getUserList($start, $limit); $record_count = $db_user->getUserListTotal(); } } $result = array(); $row_num = $start; foreach ($users as $i => $user) { $result[$i] = array('num' => ++$row_num, 'name' => $user['name'], 'id' => $user['id'], 'user_name' => $user['user_name'], 'active' => $this->activelist[$user['active']], 'user_type' => $this->user_typelist[$user['user_type']]); } $this->view->userlist = Zend_Json::encode($result); $page = new Application_Form_FrmNavigation(self::REDIRECT_URL, $start, $limit, $record_count); $page->init(self::REDIRECT_URL, $start, $limit, $record_count); $this->view->nevigation = $page->navigationPage(); $this->view->rows_per_page = $page->getRowsPerPage($limit, 'frmlist_users'); $this->view->result_row = $page->getResultRows(); }