public function searchIcePackAction() { $ice_pack_search = array(); $identity = App_Auth::getInstance(); $form = new Form_SearchIcePack(); $this->view->form = $form; $cold_chain = new Model_ColdChain(); if ($this->_request->isPost()) { if ($form->isValid($this->_request->getPost())) { $data = $form->getValues(); $data['warehouse'] = $this->_request->warehouse; $data['warehouse'] = $this->_request->warehouse; $data['office'] = $this->_request->office; $data['combo1'] = $this->_request->combo1; $cold_chain->form_values = $data; //Pagination $sort = $this->_getParam("sort", "asc"); $order = $this->_getParam("order", "make_name"); $result = $cold_chain->searchIcePacks($sort, $order); //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->paginator = $paginator; $this->view->sort = $sort; $this->view->order = $order; $this->view->counter = $counter; $form->office_id->setValue($data['office']); $form->combo1_id->setValue($data['combo1']); $form->warehouse_id->setValue($data['warehouse']); $form->model_id->setValue($data['ccm_model_id']); } } else { $form->placed_at->setValue(1); $form->office_id->setValue($identity->getUserLevel($identity->getIdentity())); $role_id = $this->_identity->getRoleId(); if ($role_id != 11) { $form->combo1_id->setValue($identity->getUserProvinceId()); } $form->warehouse_id->setValue($this->_identity->getWarehouseId()); } // $result = $makes->getAllMakes($order, $sort); $this->view->ice_pack_search = $result; $base_url = Zend_Registry::get('baseurl'); $this->view->inlineScript()->appendFile($base_url . '/js/all_level_combos.js'); $this->view->inlineScript()->appendFile($base_url . '/js/default/cold-chain/add-main.js'); }