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
|
$query = "SELECT * FROM marinterim_job_offers j JOIN marimmo_villes v ON j.job_ville = v.ville_id ";
$where = array();
if (!empty($_REQUEST['job_searched']))
{ $where[] = "j.job_intitule=:job_intitule ";
$param[':job_intitule'] = $_REQUEST['job_searched'];
}
if (!empty($_REQUEST['job_keyword']))
{ $where[] = " j.job_descriptif LIKE CONCAT('%', :job_descriptif, '%') " ;
$param[':job_descriptif'] = $_REQUEST['job_keyword'];
}
if (isset($_REQUEST['secteur_searched']) AND is_array($_REQUEST['secteur_searched']))
{// $secteur = array_map(array($marInterim,"quotes"),$_REQUEST['secteur_searched']);
$secteur_searched=implode(',',$_REQUEST['secteur_searched']);
$where[] = "j.job_secteur IN (:secteur_searched) " ;
$param[':job_secteur']= $secteur_searched;
}
if(!empty($_REQUEST['type_de_contrat']) AND count($_REQUEST['type_de_contrat']) > 0 )
{$type_de_contrat = count($_REQUEST["type_de_contrat"]) ? implode(",",$_REQUEST["type_de_contrat"]) : '';
$where[]= "j.job_contrat IN (:job_contrat) " ;
$param[':job_contrat']= $type_de_contrat;
}
if (isset($where))
{
$query.= ' WHERE ' . implode(' AND ', $where); // WHERE crite1 AND critere2 AND critere 3,
}
$query.= " ORDER BY j.job_date_insertion DESC";
var_dump('$query1='. $query);
$sth =$marInterim ->prepare($query);
$sth->execute($param);
$compte = $sth->fetchAll();
$nb_resultats = count($compte);
$errors['nb_resultats_recherche'] = $nb_resultats; // ok
/********************/
if ( !empty($_REQUEST['afficher_x_resultats']))
{ $per_page=trim($_REQUEST['afficher_x_resultats']);
$param[':per_page']= (int)$per_page;
}
else {$per_page=10;
$param[':per_page']= (int)$per_page;
}
/* Results per page */
$nb_pages = ceil($nb_resultats/$per_page);
$current_page = isset($_REQUEST['page']) && ($_REQUEST['page'] > 0) && ($_REQUEST['page'] <= $nb_pages) ? $_REQUEST['page'] : 1;
$start = ($current_page-1)*$per_page; $param[':start']= (int)$start;
$query2= $query." LIMIT :start,:per_page ";var_dump('$query2='. $query2);
$sth2 =$marInterim ->prepare($query2);
$sth2-> execute($param);
while($datos= $sth->fetch(PDO::FETCH_ASSOC))
{ $en_date_insertion=$datos['job_date_insertion'];
$explode_insertion= explode("-", $en_date_insertion);
$date_insertion_fr = $explode_insertion[2]."-".$explode_insertion[1]."-".$explode_insertion[0];
$job_id= $datos['job_id'];
$job_intitule= strtoupper($datos['job_intitule']);
$job_ville = $datos['ville_nom'];
$job_cp = $datos['cp'];
$errors['resultats_recherche'] = "
<div class='offers btns'>
<a class='link_vers_offre' href='job_offer_detail.php?job_id=$job_id'>
<table id='table_liste_des_offres'>
<tr>
<td class='liste_intitule'> " .$job_intitule." </td>
<td class='liste_ref'>Offre n°" .$job_id." du ".$date_insertion_fr ." </td>
<td class='liste_ville'> ".$job_cp. " ".$job_ville." </td>
</tr>
</table>
</a>
</div>
";
} |
Partager