1 |
vpihour |
641 |
<?php |
2 |
|
|
/** |
3 |
|
|
* Ce script a pour objet de recuperer la liste des quartiers d'un arrondissement |
4 |
|
|
* |
5 |
|
|
* @package openfoncier |
6 |
|
|
* @version SVN : $Id$ |
7 |
|
|
*/ |
8 |
|
|
$DEBUG=1; |
9 |
|
|
require_once "../obj/utils.class.php"; |
10 |
|
|
|
11 |
|
|
// Identifiant de l'arrondissement |
12 |
|
|
(isset($_GET['idx']) ? $idx = $_GET['idx'] : $idx = ""); |
13 |
nhaye |
1062 |
(isset($_GET['tableName']) ? $tableName = $_GET['tableName'] : $tableName = ""); |
14 |
|
|
(isset($_GET['linkedField']) ? $linkedField = $_GET['linkedField'] : $linkedField = ""); |
15 |
|
|
(isset($_GET['nature']) ? $nature = $_GET['nature'] : $nature = ""); |
16 |
vpihour |
641 |
$f = new utils("nohtml"); |
17 |
|
|
$f->disableLog(); |
18 |
|
|
|
19 |
|
|
$sql = |
20 |
|
|
"SELECT |
21 |
nhaye |
1062 |
$tableName, libelle |
22 |
vpihour |
641 |
FROM |
23 |
nhaye |
1062 |
".DB_PREFIXE."$tableName"; |
24 |
vpihour |
641 |
|
25 |
|
|
if ( isset($idx) && $idx !== '' && $idx !== '*' && is_numeric($idx)){ |
26 |
|
|
|
27 |
|
|
/*Requête qui récupère les quartiers en fonction de leur arrondissement*/ |
28 |
|
|
$sql .= |
29 |
|
|
" WHERE |
30 |
nhaye |
1062 |
$linkedField = $idx "; |
31 |
|
|
if($nature != "") { |
32 |
|
|
$sql .= "AND demande_nature = 2 "; |
33 |
|
|
} else { |
34 |
|
|
$sql .= "AND demande_nature = 1 "; |
35 |
|
|
} |
36 |
|
|
$sql .= "ORDER BY |
37 |
vpihour |
641 |
libelle |
38 |
|
|
"; |
39 |
|
|
} |
40 |
|
|
|
41 |
|
|
$res = $f->db->query($sql); |
42 |
|
|
$f->isDatabaseError($res); |
43 |
|
|
|
44 |
|
|
$listData = ""; |
45 |
|
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
46 |
|
|
|
47 |
nhaye |
1062 |
$listData .= $row[$tableName]."_".$row['libelle'].";"; |
48 |
vpihour |
641 |
} |
49 |
|
|
|
50 |
|
|
echo json_encode($listData); |
51 |
|
|
?> |