view->headLink()->appendStylesheet('/themes/default/styles/'.$this->getRequest()->getControllerName().'.css', 'all'); $auth = Zend_Auth::getInstance(); $user = $auth->getIdentity(); $field = new Fields(); $this->view->fields = $field; } public function resetAction() { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(); require_once('Scores/SessionCiblage.php'); $session = new SessionCiblage(); $session->resetFamille('geographique'); } public function completedAction() { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $request = $this->getRequest(); if($request->getParam('dep')) { $output = $this->completedDep($request->getParam('q')); } else if ($request->getParam('reg')) { $output = $this->completedReg($request->getParam('q')); } else if($request->getParam('vil')) { $output = $this->completedVil($request->getParam('q')); } echo json_encode($output); } protected function completedDep($q) { $table = new Table_Departements(); $sql = $table->select() ->where('libdep LIKE "'.$q.'%"'); $result = $table->fetchAll($sql); foreach ($result as $item) { $output[] = array( 'label' => $item->libdep . $separator . $item->numdep, 'value' => 'D'.$item->numdep ); } return ($output); } protected function completedVil($q) { $table = new Table_Codepostauxs(); $sql = $table->select()->where('Commune LIKE "'.$q.'%"'); $result = $table->fetchAll($sql); foreach ($result as $item) { $output[] = array( 'label' => $item->Commune . $separator . $item->Codepos, 'value' => $item->INSEE ); } return ($output); } protected function completedReg($q) { $table = new Table_Regions(); $sql = $table->select() ->where('NCCENR LIKE "%'.$q.'%"'); $result = $table->fetchAll($sql); foreach ($result as $item) { $output[] = array( 'label' => $item->NCCENR . $separator . $item->REGION, 'value' => 'R'.$item->REGION ); } return ($output); } }