/[openfoncier]/trunk/app/listData.php
ViewVC logotype

Annotation of /trunk/app/listData.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1119 - (hide annotations)
Fri Dec 21 16:49:30 2012 UTC (12 years, 1 month ago) by nhaye
File size: 1283 byte(s)
Correction de mise en page et suppression de variables inutiles.

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 nhaye 1119
9     require_once "../obj/utils.class.php";
10    
11     // Identifiant de l'arrondissement
12     (isset($_GET['idx']) ? $idx = $_GET['idx'] : $idx = "");
13     (isset($_GET['tableName']) ? $tableName = $_GET['tableName'] : $tableName = "");
14     (isset($_GET['linkedField']) ? $linkedField = $_GET['linkedField'] : $linkedField = "");
15     (isset($_GET['nature']) ? $nature = $_GET['nature'] : $nature = "");
16     $f = new utils("nohtml");
17     $f->disableLog();
18    
19     $sql =
20     "SELECT
21     $tableName, libelle
22     FROM
23     ".DB_PREFIXE."$tableName";
24    
25     if ( isset($idx) && $idx !== '' && $idx !== '*' && is_numeric($idx)){
26 vpihour 641
27 nhaye 1119 /*Requête qui récupère les quartiers en fonction de leur arrondissement*/
28     $sql .=
29     " WHERE
30     $linkedField = $idx ";
31     if($nature != "") {
32     $sql .= "AND demande_nature = 2 ";
33     } else {
34     $sql .= "AND demande_nature = 1 ";
35 vpihour 641 }
36 nhaye 1119 $sql .= "ORDER BY
37     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 vpihour 641
47 nhaye 1119 $listData .= $row[$tableName]."_".$row['libelle'].";";
48     }
49    
50     echo json_encode($listData);
51    
52 vpihour 641 ?>

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26