2 header('Content-Type: text/html; charset=UTF-8');
3 echo '<?xml version="1.0" encoding="UTF-8" ?>';
5 require ('constantes.php');
7 $dbconn = pg_connect("host=localhost port=5432 dbname=".$BD." user=appart password=soleil") or die('Connexion impossible : ' . pg_last_error());
8 pg_query("SET datestyle = 'SQL, DMY';");
13 require ('traitement_inputs.php');
20 <link rel
="stylesheet" href
="style.css" type
="text/css" />
21 <script type
="text/javascript" src
="script.js" ></script
>
22 <meta http
-equiv
="Content-Type" content
="text/html; charset=utf-8"/>
23 <meta http
-equiv
="content-type" content
="text/html; charset=utf-8"/>
24 <title
>Google Maps JavaScript API Example
</title
>
25 <script src
="http://maps.google.com/maps?file=api&v=2.82&key=ABQIAAAAQLBohykzX4xiepOOUu21GhS2JkdUHwPLqAOasxCB2_i_UFsNUhRbVpRM0k1S9wDSYhOD8Hj8bGnqag" type
="text/javascript"></script
>
27 <body onload
="rafraichirFormulaire(); loadGMap()" onunload
="GUnload()">
29 if (isset($erreur) && $erreur != '')
31 echo '<div id="erreur" >' . utf8_encode($erreur) . '</div>';
36 <div
class="menu" id
="appartements" >
37 <h1
><a href
="?">Appartements
</a
></h1
>
38 <a href
="index.php">detail
</a
> <a href
="list.php">liste
</a
>
41 <input type
="hidden" name
="action" value
="ajouter" />
42 <input type
="submit" value
="Nouveau" />
45 foreach ($statuts as $statut_num => $statut_nom)
47 echo "<h2>$statut_nom</h2>";
49 $result = pg_query("SELECT id, rue, date_visite FROM appart WHERE statut = $statut_num ORDER by statut, " . ($statut_num == '1'? 'date_visite' : 'id'));
50 while ($line = pg_fetch_array($result, null, PGSQL_ASSOC
))
52 echo '<a '.($id == $line['id'] ? 'class="courant"' : '').' href="?action=voir&id='.$line['id'].'">' . $line['id'] . '. ' . $line['rue'] .
53 ($statut_num == '1' ? '<p>' .$line['date_visite'] . '</p>' : '' ).
56 pg_free_result($result);
64 foreach ($sites as $nom_site => $url)
66 echo '<a href="'.$url.'" >'.$nom_site.'</a>';
72 <div id
="appartement" >
75 if ($action == "ajouter")
77 foreach($champs as $champ => $type)
78 $appartData[$champ] = $inputs[$champ];
82 $result = pg_query("SELECT * FROM appart WHERE id = $id");
83 $appartData = pg_fetch_array($result, null, PGSQL_ASSOC);
86 <form method="post
" action="index
.php
?id
=<?= $id ?>" >
87 <input id="modeFormulaire
" type="hidden
" name="mode
" value="<?= $action == 'ajouter' ? 'enEdition' : 'enConsultation' ?>" />
88 <h1>Appartement N°<?= $id ?></h1>
89 <button type="button
" id="boutonEditer
" onclick="editer();" >éditer</button>
90 <div id="boutonsEdition
" style="display
:none
">
91 <input type="submit
" name="action
" value="Supprimer
" onclick="return supprimer('<?= $appartData['id
'] ?>', '<?= $appartData['rue
'] ?>')" />
92 <input type="submit
" name="action
" value="Annuler
" />
93 <input type="submit
" name="action
" value="Mémoriser
" />
95 <table id="tableauFormulaire
">
96 <tr><th class="header1Label
"></th><th class="headerInput
"></th><th class="header2Label
"></th><th class="headerInput
"></th></tr>
102 <select id="editionStatut
" size="1" name="statut
" style="display
: none
">
104 foreach ($statuts as $num => $statut)
105 echo '<option '. ($appartData['statut'] == $num ? 'selected' : '') . ' value="' . $num .'">' . $statuts[$num] . '</option>';
108 <p id="consultationStatut
" style="display
: none
"><?= $statuts[$appartData['statut']] ?></p>
110 <td >Lien internet</td>
111 <td><input id="urlEdition
" style="display
:none
" type="text
" name="url
" value="<?= $appartData['url'] ?>" /><a style="display
:none
" id="urlConsultation
" href="<?= $appartData['url'] ?>">GO!</a></td>
114 <td >Prix + charges</td>
115 <td><input type="text
" class="short
" name="prix
" value="<?= $appartData['prix'] ?>" /> + <input type="text
" class="short
" name="prixcharges
" value="<?= $appartData['prixcharges'] ?>" /> = <bold><?= $appartData['prix'] + $appartData['prixcharges'] ?></bold></td>
116 <td rowspan="3" >Contact</td>
117 <td rowspan="3"><textarea name="contact
" rows="4"><?= $appartData['contact'] ?></textarea></td>
120 <td >Libre à partir du <span class="exemple
" >(ex: "1/08/2007")</span></td>
121 <td><input type="text
" name="date_libre
" value="<?= $appartData['date_libre'] ?>" /></td>
125 <td><input id="inputRue
" type="text
" name="rue
" value="<?= $appartData['rue'] ?>" /></td>
129 <td><input id="inputLocalite
" type="text
" name="localite
" value="<?= $appartData['localite'] ?>" /></td>
130 <td rowspan="5" >Description</td>
131 <td rowspan="5"><textarea rows="8" name="description
"><?= $appartData['description'] ?></textarea></td>
134 <td >Nombre de pièce</td>
135 <td><input type="text
" name="nbpiece
" value="<?= $appartData['nbpiece'] ?>" /></td>
139 <td><input type="text
" name="surface
" value="<?= $appartData['surface'] ?>" /></td>
143 <td><input type="text
" name="etage
" value="<?= $appartData['etage'] ?>" /></td>
146 <td >Dernière rénovation (année)</td>
147 <td><input type="text
" name="annee_construction
" value="<?= $appartData['annee_construction'] ?>" /></td>
150 <td colspan="2" >Points Positifs</td>
151 <td colspan="2" >Points négatifs</td>
154 <td colspan="2"><textarea rows="5" name="points_positifs
"><?= $appartData['points_positifs'] ?></textarea></td>
155 <td colspan="2"><textarea rows="5" name="points_negatifs
"><?= $appartData['points_negatifs'] ?></textarea></td>
163 <td >Date et heure de la visite <span class="exemple
" >(ex: "23/07/2007 14:23")</span></td>
164 <td colspan="3"><input type="text
" name="date_visite
" value="<?= $appartData['date_visite'] ?>" /></td>
167 <td >Indications</td>
168 <td colspan="3"><textarea rows="3" name="visite_indications
"><?= $appartData['visite_indications'] ?></textarea></td>
179 <td colspan="3"><input id="urlmapEdition
" style="display
:none
" type="text
" name="url_map
" value="<?= $appartData['url_map'] ?>" /><a style="display
:none
" id="urlmapConsultation
" href="<?= $appartData['url_map'] ?>">GO!</a></td>
184 <div id="map2
"></div>
190 pg_free_result($result);