public function spatialAction() { $form = new FindFilterForm(); $this->view->form = $form; if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) { if ($form->isValid($form->getValues())) { $params = array('bbox' => $form->getValue('bbox'), 'objectType' => $form->getValue('objecttype'), 'broadperiod' => $form->getValue('broadperiod')); $this->process($params); } else { $form->populate($form->getValues()); } } }
/** Display a list of objects recorded with pagination */ public function indexAction() { $sort = $this->_getParam('sort') ? $this->_getParam('sort') : 'finds.created DESC'; $this->view->params = $this->_getAllParams(); $findslist = $this->_finds->getAllFinds($sort, $this->_getAllParams(), $this->getRole()); $data = array('pageNumber' => $findslist->getCurrentPageNumber(), 'total' => number_format($findslist->getTotalItemCount(), 0), 'itemsReturned' => $findslist->getCurrentItemCount(), 'totalPages' => number_format($findslist->getTotalItemCount() / $findslist->getCurrentItemCount(), 0)); $this->view->data = $data; $findsjson = array(); foreach ($findslist as $k => $v) { $findsjson[$k] = $v; } $this->view->objects = array('object' => $findsjson); $contexts = array('json'); if (!in_array($this->_cs->getCurrentContext(), $contexts)) { $this->view->paginator = $findslist; $form = new FindFilterForm(); $this->view->form = $form; $form->old_findID->setValue($this->_getParam('old_findID')); $form->objecttype->setValue($this->_getParam('objecttype')); $form->broadperiod->setValue($this->_getParam('broadperiod')); $form->county->setValue($this->_getParam('county')); if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) { if ($form->isValid($form->getValues())) { $params = array_filter($form->getValues()); $params = $this->array_cleanup($params); $this->_flashMessenger->addMessage('Your search is complete'); $this->_helper->Redirector->gotoSimple('index', 'artefacts', 'database', $params); } else { $form->populate($formData); } } } }