253 |
alexandre_ |
1 |
<?php
|
|
|
2 |
/*vim: set expandtab tabstop=4 shiftwidth=4: */
|
|
|
3 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
4 |
// | PHP version 4.1 |
|
|
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
6 |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
|
|
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
8 |
// | This library is free software; you can redistribute it and/or |
|
|
|
9 |
// | modify it under the terms of the GNU Lesser General Public |
|
|
|
10 |
// | License as published by the Free Software Foundation; either |
|
|
|
11 |
// | version 2.1 of the License, or (at your option) any later version. |
|
|
|
12 |
// | |
|
|
|
13 |
// | This library is distributed in the hope that it will be useful, |
|
|
|
14 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
15 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
|
|
16 |
// | Lesser General Public License for more details. |
|
|
|
17 |
// | |
|
|
|
18 |
// | You should have received a copy of the GNU Lesser General Public |
|
|
|
19 |
// | License along with this library; if not, write to the Free Software |
|
|
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
|
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
274 |
alexandre_ |
22 |
// CVS : $Id: bazar.carte_google.php,v 1.3 2007-07-04 10:08:41 alexandre_tb Exp $
|
253 |
alexandre_ |
23 |
/**
|
|
|
24 |
*
|
|
|
25 |
*@package bazar
|
|
|
26 |
//Auteur original :
|
|
|
27 |
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
|
|
|
28 |
//Autres auteurs :
|
|
|
29 |
*@copyright Tela-Botanica 2000-2007
|
274 |
alexandre_ |
30 |
*@version $Revision: 1.3 $
|
253 |
alexandre_ |
31 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
32 |
*/
|
|
|
33 |
|
|
|
34 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
35 |
// | ENTETE du PROGRAMME |
|
|
|
36 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
include_once 'configuration/baz_config.inc.php';
|
|
|
40 |
include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazar.fonct.php';
|
|
|
41 |
// Inclusion d'une classe personnalise si elle existe
|
|
|
42 |
|
|
|
43 |
GEN_stockerFichierScript('googleMapScript', 'http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAh5MiVKCtb2JEli5I8GRSIhRbQSKaqiLzq_1FqOv3C6TjQ0qw7BS-0YnGUkxsLmj6a2a1z7YsKC-pYg');
|
|
|
44 |
|
|
|
45 |
$GLOBALS['_BAZAR_']['id_typeannonce']=$GLOBALS['_GEN_commun']['info_application']->id_nature;
|
|
|
46 |
|
|
|
47 |
// requete sur le bazar pour recuperer les evenements
|
|
|
48 |
|
|
|
49 |
$requete = 'select * from bazar_fiche where ';
|
|
|
50 |
if ($GLOBALS['_BAZAR_']['id_typeannonce'] != '') $requete .= 'bf_ce_nature='.$GLOBALS['_BAZAR_']['id_typeannonce'] ;
|
|
|
51 |
$requete .= ' and bf_date_debut_validite_fiche<=now() and '.
|
|
|
52 |
'bf_date_fin_validite_fiche>=now() and bf_statut_fiche=1';
|
|
|
53 |
$resultat = $GLOBALS['_BAZAR_']['db']->query ($requete);
|
|
|
54 |
|
|
|
55 |
if ($resultat->numRows() != 0) {
|
|
|
56 |
$script_marker = '';
|
|
|
57 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
|
|
58 |
$id_marker = $ligne['bf_id_fiche'];
|
|
|
59 |
$script_marker .= "\t".'point = new GLatLng('.$ligne['bf_latitude'].','.$ligne['bf_longitude'].');'."\n"
|
|
|
60 |
."\t".'map.addOverlay(createMarker(point, \''.
|
|
|
61 |
preg_replace ('/\n/', '', str_replace ("'", "\'", baz_voir_fiche(0, $ligne['bf_id_fiche']))).'\'));'."\n";
|
|
|
62 |
}
|
|
|
63 |
} else {
|
|
|
64 |
$script_marker = '';
|
|
|
65 |
}
|
|
|
66 |
|
|
|
67 |
$script = '
|
|
|
68 |
// Variables globales
|
|
|
69 |
var map = null;
|
|
|
70 |
var lat = document.getElementById("latitude");
|
|
|
71 |
var lon = document.getElementById("longitude");
|
255 |
alexandre_ |
72 |
// Pour gerer la taille
|
|
|
73 |
var winW = 630, winH = 460;
|
|
|
74 |
var deltaH = 320;
|
|
|
75 |
var deltaW = 320;
|
253 |
alexandre_ |
76 |
|
255 |
alexandre_ |
77 |
function setWinHW() {
|
|
|
78 |
if (window.innerHeight) {
|
|
|
79 |
winW = window.innerWidth - deltaW;
|
|
|
80 |
winH = window.innerHeight - deltaH;
|
|
|
81 |
} else {
|
|
|
82 |
winW = document.documentElement.offsetWidth - 20 - deltaW;
|
|
|
83 |
winH = document.documentElement.offsetHeight - 20 - deltaH ;
|
|
|
84 |
}
|
|
|
85 |
|
|
|
86 |
var me = document.getElementById("map");
|
|
|
87 |
if (me != null) {
|
|
|
88 |
me.style.width= \'\' + winW + \'px\';
|
|
|
89 |
me.style.height= \'\' + winH + \'px\';
|
|
|
90 |
}
|
|
|
91 |
}
|
|
|
92 |
|
|
|
93 |
window.onresize = function () {
|
|
|
94 |
setWinHW();
|
|
|
95 |
if (map) map.checkResize();
|
|
|
96 |
}
|
|
|
97 |
|
253 |
alexandre_ |
98 |
function createMarker(point, chaine) {
|
|
|
99 |
var marker = new GMarker(point);
|
|
|
100 |
GEvent.addListener(marker, "click", function() {
|
|
|
101 |
marker.openInfoWindowHtml(chaine);
|
|
|
102 |
});
|
|
|
103 |
return marker;
|
|
|
104 |
}
|
|
|
105 |
function load() {
|
255 |
alexandre_ |
106 |
setWinHW();
|
253 |
alexandre_ |
107 |
if (GBrowserIsCompatible()) {
|
|
|
108 |
map = new GMap2(document.getElementById("map"));
|
|
|
109 |
map.addControl(new GSmallMapControl());
|
|
|
110 |
map.addControl(new GMapTypeControl());
|
|
|
111 |
map.addControl(new GScaleControl());
|
|
|
112 |
map.enableContinuousZoom();
|
|
|
113 |
|
|
|
114 |
// On centre la carte sur le languedoc roussillon
|
|
|
115 |
center = new GLatLng(43.84245116699036, 3.768310546875);
|
|
|
116 |
map.setCenter(center, 7);
|
|
|
117 |
|
|
|
118 |
' .
|
|
|
119 |
$script_marker.'
|
|
|
120 |
}
|
|
|
121 |
};
|
|
|
122 |
// Creates a marker at the given point with the given number label
|
|
|
123 |
|
|
|
124 |
';
|
|
|
125 |
GEN_stockerCodeScript($script);
|
|
|
126 |
|
|
|
127 |
function afficherContenuCorps() {
|
|
|
128 |
|
274 |
alexandre_ |
129 |
include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php';
|
|
|
130 |
$modele = new bazarTemplate($GLOBALS['_BAZAR_']['db']);
|
|
|
131 |
$html = $modele->getTemplate(BAZ_TEMPLATE_ACCUEIL_CARTE_GOOGLE, $GLOBALS['_BAZAR_']['langue']);
|
|
|
132 |
$res = str_replace ('{CARTE}', '<div id="map" style="width: 600px; height: 450px"></div>', $html);
|
|
|
133 |
|
253 |
alexandre_ |
134 |
return $res;
|
|
|
135 |
}
|
|
|
136 |
|
|
|
137 |
|
|
|
138 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
|
|
139 |
*
|
|
|
140 |
* $Log: not supported by cvs2svn $
|
274 |
alexandre_ |
141 |
* Revision 1.2 2007-06-13 10:02:47 alexandre_tb
|
|
|
142 |
* le carte s adapte a la taille du conteneur
|
|
|
143 |
*
|
255 |
alexandre_ |
144 |
* Revision 1.1 2007-06-04 15:26:57 alexandre_tb
|
|
|
145 |
* version initiale
|
|
|
146 |
*
|
253 |
alexandre_ |
147 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
|
|
148 |
*/
|