1 |
<?php |
2 |
/** |
3 |
* Ce script a pour objet de recuperer la liste des pétionnaires correspondant aux critères de recherche |
4 |
* |
5 |
* @package openfoncier |
6 |
* @version SVN : $Id: findArchitecte.php 4418 2015-02-24 17:30:28Z tbenita $ |
7 |
*/ |
8 |
|
9 |
require_once "../obj/utils.class.php"; |
10 |
$f = new utils("nohtml"); |
11 |
$f->isAccredited(array("donnees_techniques","donnees_techniques_modifier","donnees_techniques_ajouter"), "OR"); |
12 |
//Récupération des valeurs envoyées |
13 |
$f->set_submitted_value(); |
14 |
// Donnees |
15 |
$nom = ($f->get_submitted_post_value("nom") != null) ? $f->get_submitted_post_value("nom") : ""; |
16 |
$nom = str_replace('*', '', $nom); |
17 |
$nom = html_entity_decode($nom, ENT_QUOTES); |
18 |
$nom = $f->db->escapeSimple($nom); |
19 |
|
20 |
$prenom = ($f->get_submitted_post_value("prenom") != null) ? $f->get_submitted_post_value("prenom") : ""; |
21 |
$prenom = str_replace('*', '', $prenom); |
22 |
$prenom = html_entity_decode($prenom, ENT_QUOTES); |
23 |
$prenom = $f->db->escapeSimple($prenom); |
24 |
|
25 |
$listData = ""; |
26 |
|
27 |
$f->disableLog(); |
28 |
|
29 |
$qres = $f->get_all_results_from_db_query( |
30 |
sprintf( |
31 |
'SELECT |
32 |
architecte AS value, |
33 |
TRIM(CONCAT_WS( |
34 |
\' \', |
35 |
nom, |
36 |
prenom, |
37 |
cp, |
38 |
ville |
39 |
)) AS content |
40 |
FROM |
41 |
%sarchitecte |
42 |
WHERE |
43 |
frequent IS TRUE |
44 |
%s |
45 |
%s', |
46 |
DB_PREFIXE, |
47 |
$nom != "" ? "AND nom ILIKE '%$nom%'": '', |
48 |
$prenom != "" ? "AND prenom ILIKE '%$prenom%'" : '' |
49 |
), |
50 |
array( |
51 |
'origin' => 'app/findArchitecte' |
52 |
) |
53 |
); |
54 |
$listData = array(); |
55 |
foreach ($qres['result'] as $row) { |
56 |
$listData[] = $row; |
57 |
} |
58 |
|
59 |
echo json_encode($listData); |
60 |
|
61 |
?> |