示例#1
0
 public function indexAction()
 {
     if ($this->session->get('successfu_edite')) {
         $this->view->successfu_edite = true;
         $this->session->clear('successfu_edite');
     }
     $this->view->page_num = $page = $this->getRequest()->getRequest('page', 1);
     $data = array('start' => $page * JO_Registry::get('admin_limit') - JO_Registry::get('admin_limit'), 'limit' => JO_Registry::get('admin_limit'));
     $this->view->countries = array();
     $countries = Model_Countries::getCountries($data);
     if ($countries) {
         foreach ($countries as $country) {
             $this->view->countries[] = $country;
         }
     }
     $total_records = Model_Countries::getTotalCountries();
     $this->view->total_pages = ceil($total_records / JO_Registry::get('admin_limit'));
     $this->view->total_rows = $total_records;
     $pagination = new Model_Pagination();
     $pagination->setLimit(JO_Registry::get('admin_limit'));
     $pagination->setPage($page);
     $pagination->setTotal($total_records);
     $pagination->setUrl($this->getRequest()->getModule() . '/countries/?page={page}');
     $this->view->pagination = $pagination->render();
 }