public function indexAction() { $form = new Form_Iadmin_Locations(); $locations = new Model_Locations(); $params = array(); if ($this->_request->isPost()) { if ($this->_request->getPost()) { $form_values = $this->_request->getPost(); // App_Controller_Functions::pr($form_values); $this->view->combos = $this->_request->getPost(); $form->province_id->setValue($form_values['combo1']); $form->district_id->setValue($form_values['combo2']); $form->parent_id->setValue($form_values['combo3']); if (!empty($form_values['location_level'])) { $params['location_level'] = $form_values['location_level']; } if (!empty($form_values['combo1'])) { $params['combo1'] = $form_values['combo1']; } if (!empty($form_values['combo2'])) { $params['combo2'] = $form_values['combo2']; } if (!empty($form_values['combo3'])) { $params['combo3'] = $form_values['combo3']; } if (!empty($form_values['not_used'])) { $params['used'] = $form_values['not_used']; } $sort = $this->_getParam("sort", "asc"); $order = $this->_getParam("order", "location"); $locations->form_values = $this->_request->getPost(); // App_Controller_Functions::pr($this->_request->getPost()); $result = $locations->getAllLocations($order, $sort); //Paginate the contest results // $paginator = Zend_Paginator::factory($result); // $page = $this->_getParam("page", 1); // $counter = $this->_getParam("counter", 10); // $paginator->setCurrentPageNumber((int) $page); // $paginator->setItemCountPerPage((int) $counter); $this->view->delete_location = $form_values['not_used']; $this->view->form = $form; $this->view->paginator = $result; $this->view->sort = $sort; $this->view->order = $order; // $this->view->counter = $counter; $this->view->pagination_params = $params; } } else { $locations->form_values = $this->_request->getParams(); $params = $this->_request->getParams(); $this->view->combos = $this->_request->getParams(); $form->province_id->setValue($this->_getParam('combo1')); $form->district_id->setValue($this->_getParam('combo2')); $form->parent_id->setValue($this->_getParam('combo3')); $this->view->delete_location = $this->_getParam('used'); $sort = $this->_getParam("sort", "asc"); $order = $this->_getParam("order", "location"); $result = $locations->getAllLocations($order, $sort); //Paginate the contest results // $paginator = Zend_Paginator::factory($result); // $page = $this->_getParam("page", 1); // $counter = $this->_getParam("counter", 10); // $paginator->setCurrentPageNumber((int) $page); // $paginator->setItemCountPerPage((int) $counter); $this->view->form = $form; $this->view->paginator = $result; $this->view->sort = $sort; $this->view->order = $order; // $this->view->counter = $counter; $this->view->pagination_params = $params; } $base_url = Zend_Registry::get('baseurl'); $this->view->inlineScript()->appendFile($base_url . '/js/locations_combos.js'); $this->view->inlineScript()->appendFile($base_url . '/js/locations_add_combos.js'); $this->view->headLink()->appendStylesheet($base_url . '/common/theme/scripts/plugins/tables/DataTables/media/css/DT_bootstrap.css'); }