/** Index page, listing all organisations */ public function indexAction() { $organisations = new Organisations(); $paginator = $organisations->getOrganisations((array) $this->_getAllParams()); $this->view->paginator = $paginator; $form = new OrganisationFilterForm(); $this->view->form = $form; $form->organisation->setValue($this->_getParam('organisation')); $form->contact->setValue($this->_getParam('contact')); $form->contactpersonID->setValue($this->_getParam('contactpersonID')); $form->county->setValue($this->_getParam('county')); if ($this->_request->isPost() && !is_null($this->_getParam('submit'))) { $formData = $this->_request->getPost(); if ($form->isValid($formData)) { $params = array_filter($formData); unset($params['submit']); unset($params['action']); unset($params['controller']); unset($params['module']); unset($params['page']); unset($params['csrf']); $where = array(); foreach ($params as $key => $value) { if (!is_null($value)) { $where[] = $key . '/' . urlencode(strip_tags($value)); } } $whereString = implode('/', $where); $query = $whereString; $this->_redirect(self::REDIRECT . 'index/' . $query . '/'); } else { $form->populate($formData); } } }