public function indexAction()
 {
     $mapsForm = new MapsForm();
     $mapsForm->addElementsForm();
     $mapsForm->setDecorators(array('FormElements', 'Form'));
     $mapsForm->removeDecorator('form');
     $this->view->fieldsetinputs = $mapsForm;
     $values = $this->_request->getParams();
     $arrayDepartment = array();
     $arrayUniqueDepartment = array();
     $arrayCovenant = array();
     $arrayCollection = array();
     $arrayPriorityexploded = array();
     $arrayPriority = array();
     $dtstartqry = null;
     $dtendqry = null;
     if (isset($values['cddepartment']) && ($values['cddepartment'] != '0' && $values['cddepartment'] != '')) {
         $arrayDepartment = explode(',', $values['cddepartment']);
     }
     if (isset($values['cdcovenant']) && ($values['cdcovenant'] != '0' && $values['cdcovenant'] != '')) {
         $arrayCovenant = explode(',', $values['cdcovenant']);
     }
     if (isset($values['collection']) && ($values['collection'] != '0' && $values['collection'] != '')) {
         $arrayCollection = explode(',', $values['collection']);
     }
     if (isset($values['fgpriority']) && ($values['fgpriority'] != '0' && $values['fgpriority'] != '')) {
         $arrayPriorityexploded = explode(',', $values['fgpriority']);
         foreach ($arrayPriorityexploded as $priority) {
             if ($priority == 'Normal') {
                 $arrayPriority[] = 0;
             } else {
                 if ($priority == 'Urgente') {
                     $arrayPriority[] = 1;
                 }
             }
         }
     }
     if (isset($values['dtstartqry']) && ($values['dtstartqry'] != '0' && $values['dtstartqry'] != '')) {
         $dtstartqry = new Zend_Date($values['dtstartqry'], 'dd-MM-YYYY');
         $dtstartqry = $dtstartqry->toString('YYYY-MM-dd');
     } else {
         $dtstartqry = date("Y-m-d");
     }
     if (isset($values['dtendqry']) && ($values['dtendqry'] != '0' && $values['dtendqry'] != '')) {
         $dtendqry = new Zend_Date($values['dtendqry'], 'dd-MM-YYYY');
         $dtendqry = $dtendqry->toString('YYYY-MM-dd');
     }
     if (!($arrayDepartment == null && $arrayCovenant == null && $arrayCollection == null && $arrayPriorityexploded == null && $arrayPriority == null && $dtstartqry == null && $dtendqry == null)) {
         $requestExaminationSampleModel = new RequestexaminationsampleModel();
         $requestModel = new RequestModel();
         $mapdataReturn = $requestExaminationSampleModel->fetchAll($requestExaminationSampleModel->getMapData($arrayDepartment, $arrayCovenant, $arrayCollection, $arrayPriority, $dtstartqry, $dtendqry));
         foreach ($mapdataReturn as $maprequests) {
             $departments = $requestModel->fetchAll($requestModel->getRequestDepartments($maprequests['cdrequest']));
             foreach ($departments as $uniqueDepartment) {
                 $arrayUniqueDepartment[] = $uniqueDepartment['cddepartment'];
             }
         }
         $arrayUniqueDepartment = array_unique($arrayUniqueDepartment);
         $this->view->mapdata = $mapdataReturn;
         $this->view->departments = $arrayUniqueDepartment;
         $this->view->searchparams = json_encode($values);
     }
 }