1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
| public function rechercheAction()
{
$this->_helper->layout->setLayout('layout_ville');
/*************Récupration des Parametres de la requete****************/
$lang = $this->_getParam('lang');
$registry = new Zend_Registry();
$db=$registry->get('db');
$translate = $registry->get('translator');
$ville= $this->_request->getParam('lieu') ;
$categorie= $this->_request->getParam('categorie') ;
/*********************************/
$translate->removeCache();
SessionHandler::langCookie($lang, $translate);
/**********************Informations ville*****************************/
$req=$db-> select() -> from('ville', array('ville_id','ville_meteo'))->where('ville_nom=?',$ville)->query()->fetch();
$ville_id=$req->ville_id;
$ville_meteo=$req->ville_meteo;
/***********************Sliders***************************************/
$sliderRows = $db->fetchAll($db ->select()->from(array('s' => 'slider'))
->join(array('v' => 'ville'),'s.ville_id = v.ville_id')
->where('s.ville_id = ?', $ville_id)
);
/**********************les menus top et bottom******************************/
$categRows=$db ->fetchAll($db -> select() -> from('categorie', array('categorie_id','categorie_titre','width'))->where('parent_id = ?','0'));
$count=count($categRows);
/**********************Requête de recherche********************************/
$req1=$db -> select() -> from('categorie', 'categorie_id')->where('categorie_titre = ?',$categorie)->query()->fetch();
if($req1)
{
$categ_id=$req1->categorie_id;
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
$select=$db->fetchAll($db ->select()->from(array('e' => 'etablissement'))
->where('e.ville_id = ?', $ville_id)
->where('e.categorie_id = ?', $categ_id)
);
$paginator = Zend_Paginator::factory($select);
$paginator->setCurrentPageNumber($this->_getParam('page',1));
$paginator->setItemCountPerPage(2);
/******************Préparation des paramêtres de view********************/
$this->view->translate = $translate;
$this->_setParam('lang', $translate->getLocale());
$this->view->paginator = $paginator;
$this->view->select=$select;
}
else
{
$this->view->translate = $translate;
$this->_setParam('lang', $translate->getLocale());
$this->view->erreur="Aucun resultat n est trouve";
}
$this->_setParam('ville',$ville);
$this->view->ville=$ville;
$this->view->ville_id = $ville_id;
$this->view->ville_meteo=$ville_meteo;
$this->view->sliderRows=$sliderRows;
$this->view->categRows=$categRows;
$this->view->count=$count;
}
} |
Partager