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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
| $_SESSION['search-category']=$_POST['search-category'];
$_SESSION['search-city']=$_POST['search-city'];
$search_category = ( isset($_POST['search-category'] )? $_POST['search-category'] : ( isset($_SESSION['search-category']) )? $_SESSION['search-category'] : '' );
$search_city = ( isset($_POST['search-city'] )? $_POST['search-city'] : ( isset($_SESSION['search-city']) )? $_SESSION['search-city'] : '' );
$body.='
<form action="" method="post">
</fieldset>
<div class="inner-form">
<div class="input-field first-wrap">
<input id="search-category" name="search-category" type="text" placeholder="mairie, gendarmerie..." onfocus="this.placeholder=\'\'" onblur="this.placeholder=\'mairie, gendarmerie...\'" />
</div>
<div class="input-field second-wrap">
<input id="search-city" name="search-city" type="text" placeholder="code postal..." onfocus="this.placeholder=\'\'" onblur="this.placeholder=\'code postal...\'" />
</div>
<div class="input-field third-wrap">
<input type="submit" value="Rechercher" class="btn-search">
</div>
</div>
</form>
</div>
<div style="padding:30px;">
';
if (is_numeric($search_city))
{
$nbElements=$managerServicePublic->countBySearchByCp($search_category,$search_city);
}
else
{
$nbElements=$managerServicePublic->countBySearchByVille($search_category,$search_city);
}
$PaginationFinal = new Pagination();
$PaginationFinal->setCurrentPage($_GET['page']);
$PaginationFinal->setInnerLinks(12);
$PaginationFinal->setNbElementsInPage(12);
$PaginationFinal->setNbMaxElements($nbElements);
$paginationFinal = $PaginationFinal->renderBootstrapPagination();
$page = (!empty($_GET['page']) ? $_GET['page'] : 1);
$debut = ($page - 1) * 12;
/*affichage apres recherche formulaire*/
if(isset($_POST['search_category']))
{
$lstAll=$managerServicePublic->getListBySearch($debut,12,$search_category,$search_city);
if(!empty($lstAll))
{
/*si tableau pas vide*/
foreach($managerServicePublic->getListBySearch($debut,12,$search_category,$search_city) as $lstAll)
{
$body.='
<div class="col-md-3">
<div class="list-mig-like-com com-mar-bot-30">
<p style="color:white;font-size:1.0em;">'.$lstAll->getNomServicePublic().'</p>
<p style="color:white;font-size:1.0em;">'.$lstAll->getCodePostal().'</p>
</div>
</div>
</a>
</div>
';
}
$body.='
<br /><br />
<div class="center">
'.$paginationFinal.'
</div>
<br />';
} |
Partager