1 |
<?php
|
1 |
<?php
|
2 |
/*vim: set expandtab tabstop=4 shiftwidth=4: */
|
2 |
/*vim: set expandtab tabstop=4 shiftwidth=4: */
|
3 |
// +------------------------------------------------------------------------------------------------------+
|
3 |
// +------------------------------------------------------------------------------------------------------+
|
4 |
// | PHP version 4.1 |
|
4 |
// | PHP version 4.1 |
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
6 |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
|
6 |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
8 |
// | This library is free software; you can redistribute it and/or |
|
8 |
// | This library is free software; you can redistribute it and/or |
|
9 |
// | modify it under the terms of the GNU Lesser General Public |
|
9 |
// | modify it under the terms of the GNU Lesser General Public |
|
10 |
// | License as published by the Free Software Foundation; either |
|
10 |
// | License as published by the Free Software Foundation; either |
|
11 |
// | version 2.1 of the License, or (at your option) any later version. |
|
11 |
// | version 2.1 of the License, or (at your option) any later version. |
|
12 |
// | |
|
12 |
// | |
|
13 |
// | This library is distributed in the hope that it will be useful, |
|
13 |
// | This library is distributed in the hope that it will be useful, |
|
14 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
15 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
16 |
// | Lesser General Public License for more details. |
|
16 |
// | Lesser General Public License for more details. |
|
17 |
// | |
|
17 |
// | |
|
18 |
// | You should have received a copy of the GNU Lesser General Public |
|
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 |
|
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 |
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
22 |
// CVS : $Id: bazar.carte_google.php,v 1.9 2008-10-29 15:51:36 alexandre_tb Exp $
|
22 |
// CVS : $Id: bazar.carte_google.php,v 1.9 2008-10-29 15:51:36 alexandre_tb Exp $
|
23 |
/**
|
23 |
/**
|
24 |
*
|
24 |
*
|
25 |
*@package bazar
|
25 |
*@package bazar
|
26 |
//Auteur original :
|
26 |
//Auteur original :
|
27 |
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
|
27 |
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
|
28 |
//Autres auteurs :
|
28 |
//Autres auteurs :
|
29 |
*@copyright Tela-Satanica 2000-2007
|
29 |
*@copyright Tela-Satanica 2000-2007
|
30 |
*@version $Revision: 1.9 $
|
30 |
*@version $Revision: 1.9 $
|
31 |
// +------------------------------------------------------------------------------------------------------+
|
31 |
// +------------------------------------------------------------------------------------------------------+
|
32 |
*/
|
32 |
*/
|
33 |
|
33 |
|
34 |
// +------------------------------------------------------------------------------------------------------+
|
34 |
// +------------------------------------------------------------------------------------------------------+
|
35 |
// | ENTETE du PROGRAMME |
|
35 |
// | ENTETE du PROGRAMME |
|
36 |
// +------------------------------------------------------------------------------------------------------+
|
36 |
// +------------------------------------------------------------------------------------------------------+
|
37 |
|
37 |
|
38 |
|
38 |
|
39 |
include_once 'configuration/baz_config.inc.php';
|
39 |
include_once 'configuration/baz_config.inc.php';
|
40 |
include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazar.fonct.php';
|
40 |
include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazar.fonct.php';
|
41 |
// Inclusion d'une classe personnalise si elle existe
|
41 |
// Inclusion d'une classe personnalise si elle existe
|
42 |
|
42 |
|
43 |
// Le fichier de script de google map
|
43 |
// Le fichier de script de google map
|
44 |
GEN_stockerFichierScript('googleMapScript', 'http://maps.google.com/maps?file=api&v=2&key='.BAZ_GOOGLE_KEY);
|
44 |
//GEN_stockerFichierScript('googleMapScript', 'http://maps.google.com/maps?file=api&v=2&key='.BAZ_GOOGLE_KEY);
|
- |
|
45 |
GEN_stockerFichierScript('googleMapScript', "http://maps.googleapis.com/maps/api/js?sensor=false&key=".BAZ_GOOGLE_KEY);
|
45 |
|
46 |
|
46 |
// Le fichier jquery pour le date picker
|
47 |
// Le fichier jquery pour le date picker
|
47 |
//GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
|
48 |
//GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
|
48 |
//GEN_stockerFichierScript('jquery', 'http://code.jquery.com/jquery-latest.js');
|
49 |
//GEN_stockerFichierScript('jquery', 'http://code.jquery.com/jquery-latest.js');
|
49 |
GEN_stockerFichierScript('jquery_date_picker', 'api/js/jquery/ui.datepicker.js');
|
50 |
GEN_stockerFichierScript('jquery_date_picker', 'api/js/jquery/ui.datepicker.js');
|
50 |
GEN_stockerFichierScript('jquery_date_picker_fr', 'api/js/jquery/ui.datepicker-fr.js');
|
51 |
GEN_stockerFichierScript('jquery_date_picker_fr', 'api/js/jquery/ui.datepicker-fr.js');
|
51 |
|
52 |
|
52 |
GEN_stockerStyleExterne( 'jquery_date_picker_style', 'api/js/jquery/ui.datepicker.css');
|
53 |
GEN_stockerStyleExterne( 'jquery_date_picker_style', 'api/js/jquery/ui.datepicker.css');
|
53 |
|
54 |
|
54 |
|
55 |
|
55 |
if (defined('PAP_VERSION')) { //si on est dans Papyrus
|
56 |
if (defined('PAP_VERSION')) { //si on est dans Papyrus
|
56 |
GEN_stockerStyleExterne( 'bazar_interne', 'reseau/bazar/bazar.interne.css');
|
57 |
GEN_stockerStyleExterne( 'bazar_interne', 'reseau/bazar/bazar.interne.css');
|
57 |
}
|
58 |
}
|
58 |
$GLOBALS['_BAZAR_']['id_typeannonce']=$GLOBALS['_GEN_commun']['info_application']->id_nature;
|
59 |
$GLOBALS['_BAZAR_']['id_typeannonce']=$GLOBALS['_GEN_commun']['info_application']->id_nature;
|
59 |
$GLOBALS['_BAZAR_']['categorie_nature']=$GLOBALS['_GEN_commun']['info_application']->categorie_nature;
|
60 |
$GLOBALS['_BAZAR_']['categorie_nature']=$GLOBALS['_GEN_commun']['info_application']->categorie_nature;
|
60 |
// requete sur le bazar pour recuperer les evenements
|
61 |
// requete sur le bazar pour recuperer les evenements
|
61 |
|
62 |
|
62 |
$requete_where = '';
|
63 |
$requete_where = '';
|
63 |
foreach ($_POST as $cle => $valeur) {
|
64 |
foreach ($_POST as $cle => $valeur) {
|
64 |
if (preg_match ('/bazar_filtre_([0-9]+)/', $cle, $sousmotif)) {
|
65 |
if (preg_match ('/bazar_filtre_([0-9]+)/', $cle, $sousmotif)) {
|
65 |
$variable = $sousmotif[0] ;
|
66 |
$variable = $sousmotif[0] ;
|
66 |
if ($_POST[$variable] != '*') {
|
67 |
if ($_POST[$variable] != '*') {
|
67 |
$requete_where = ' and bfvl_ce_liste="'.$sousmotif[1].'" and bfvl_valeur="'.$_POST[$variable].'" ';
|
68 |
$requete_where = ' and bfvl_ce_liste="'.$sousmotif[1].'" and bfvl_valeur="'.$_POST[$variable].'" ';
|
68 |
} else {
|
69 |
} else {
|
69 |
$requete_where = ' and bfvl_ce_liste="'.$sousmotif[1].'" ';
|
70 |
$requete_where = ' and bfvl_ce_liste="'.$sousmotif[1].'" ';
|
70 |
}
|
71 |
}
|
71 |
} else {
|
72 |
} else {
|
72 |
|
73 |
|
73 |
}
|
74 |
}
|
74 |
}
|
75 |
}
|
75 |
|
76 |
|
76 |
if (isset($_POST['date_debut']) && $_POST['date_debut'] != '') {
|
77 |
if (isset($_POST['date_debut']) && $_POST['date_debut'] != '') {
|
77 |
|
78 |
|
78 |
$requete_date = '((bf_date_debut_evenement <= "'.date('Y-m-d', strtotime($_POST['date_fin'])).'" and bf_date_debut_evenement >="'.date('Y-m-d', strtotime($_POST['date_debut'])).'" )' .
|
79 |
$requete_date = '((bf_date_debut_evenement <= "'.date('Y-m-d', strtotime($_POST['date_fin'])).'" and bf_date_debut_evenement >="'.date('Y-m-d', strtotime($_POST['date_debut'])).'" )' .
|
79 |
' or (bf_date_fin_evenement >="'.date('Y-m-d', strtotime($_POST['date_debut'])).'" and bf_date_fin_evenement <="'.date('Y-m-d', strtotime($_POST['date_fin'])).'")' .
|
80 |
' or (bf_date_fin_evenement >="'.date('Y-m-d', strtotime($_POST['date_debut'])).'" and bf_date_fin_evenement <="'.date('Y-m-d', strtotime($_POST['date_fin'])).'")' .
|
80 |
' or bf_date_debut_evenement <= "'.date('Y-m-d', strtotime($_POST['date_debut'])).'" and bf_date_fin_evenement >= "'.date('Y-m-d', strtotime($_POST['date_fin'])).'") ';
|
81 |
' or bf_date_debut_evenement <= "'.date('Y-m-d', strtotime($_POST['date_debut'])).'" and bf_date_fin_evenement >= "'.date('Y-m-d', strtotime($_POST['date_fin'])).'") ';
|
81 |
} else {
|
82 |
} else {
|
82 |
$requete_date = '((bf_date_debut_validite_fiche <= now( ) AND bf_date_fin_validite_fiche >= now( ))
|
83 |
$requete_date = '((bf_date_debut_validite_fiche <= now( ) AND bf_date_fin_validite_fiche >= now( ))
|
83 |
OR (bf_date_fin_validite_fiche = "0000-00-00" AND date_add( bf_date_fin_evenement, INTERVAL 15 DAY ) > now( )) )';
|
84 |
OR (bf_date_fin_validite_fiche = "0000-00-00" AND date_add( bf_date_fin_evenement, INTERVAL 15 DAY ) > now( )) )';
|
84 |
}
|
85 |
}
|
85 |
|
86 |
|
86 |
$requete = 'SELECT blv_label,blv_valeur, bazar_fiche.*'.
|
87 |
$requete = 'SELECT blv_label,blv_valeur, bazar_fiche.*'.
|
87 |
' FROM bazar_fiche, bazar_fiche_valeur_liste , bazar_liste_valeurs'.
|
88 |
' FROM bazar_fiche, bazar_fiche_valeur_liste , bazar_liste_valeurs'.
|
88 |
' WHERE bf_statut_fiche =1 and bf_id_fiche=bfvl_ce_fiche'.
|
89 |
' WHERE bf_statut_fiche =1 and bf_id_fiche=bfvl_ce_fiche'.
|
89 |
' and bfvl_ce_liste=blv_ce_liste and bfvl_ce_liste=31 and bfvl_valeur=blv_valeur '.$requete_where.' and '.
|
90 |
' and bfvl_ce_liste=blv_ce_liste and bfvl_ce_liste=31 and bfvl_valeur=blv_valeur '.$requete_where.' and '.
|
90 |
$requete_date;
|
91 |
$requete_date;
|
91 |
$resultat = $GLOBALS['_BAZAR_']['db']->query ($requete);
|
92 |
$resultat = $GLOBALS['_BAZAR_']['db']->query ($requete);
|
92 |
|
93 |
|
93 |
if (DB::isError($resultat)) {
|
94 |
if (DB::isError($resultat)) {
|
94 |
return BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage().'<br />'.$resultat->getDebugInfo(), $requete);echo $requete;
|
95 |
return BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage().'<br />'.$resultat->getDebugInfo(), $requete);echo $requete;
|
95 |
}
|
96 |
}
|
96 |
|
97 |
|
97 |
// Le code complique avec ces 2 tableaux sert
|
98 |
// Le code complique avec ces 2 tableaux sert
|
98 |
// a ne pas mettre 2 points aux memes coordonnees
|
99 |
// a ne pas mettre 2 points aux memes coordonnees
|
99 |
// car dans ce cas la seul le second serait visible
|
100 |
// car dans ce cas la seul le second serait visible
|
100 |
|
101 |
|
101 |
$donnees = array();
|
102 |
$donnees = array();
|
102 |
|
103 |
|
103 |
if ($resultat->numRows() != 0) {
|
104 |
if ($resultat->numRows() != 0) {
|
104 |
$script_marker = '';
|
105 |
$script_marker = '';
|
105 |
$couleur_drapeau = array ( 1 => 'bleu', 2 => 'vert', 3 => 'orange', 4 => 'rose');
|
106 |
$couleur_drapeau = array ( 1 => 'bleu', 2 => 'vert', 3 => 'orange', 4 => 'rose');
|
- |
|
107 |
|
106 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
108 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
107 |
if ($ligne['bf_latitude'] == 0 && $ligne['bf_longitude'] == 0) continue;
|
109 |
if ($ligne['bf_latitude'] == 0 && $ligne['bf_longitude'] == 0) continue;
|
108 |
$cle = $ligne['bf_latitude'].'-'.$ligne['bf_longitude'];
|
110 |
$cle = $ligne['bf_latitude'].'-'.$ligne['bf_longitude'];
|
109 |
$donnees[$cle][] = $ligne;
|
111 |
$donnees[$cle][] = $ligne;
|
110 |
}
|
112 |
}
|
- |
|
113 |
|
111 |
foreach ($donnees as $valeur) {
|
114 |
foreach ($donnees as $valeur) {
|
112 |
// cas un : une seule entree pour le point de coordonnees
|
115 |
// cas un : une seule entree pour le point de coordonnees
|
113 |
if (count ($valeur) == 1) {
|
116 |
if (count ($valeur) == 1) {
|
114 |
$chaine = $valeur[0];
|
117 |
$chaine = $valeur[0];
|
115 |
|
118 |
|
116 |
$script_marker .= 'var icon = new GIcon(G_DEFAULT_ICON);
|
119 |
$script_marker .= 'var icon = {' .
|
117 |
icon.image = "reseau/bazar/images/drapeau_'.$couleur_drapeau[$chaine['blv_valeur']].'.png";'."\n".'
|
120 |
'url: "reseau/bazar/images/drapeau_'.$couleur_drapeau[$chaine['blv_valeur']].'.png",
|
118 |
icon.shadow = "http://www.google.com/mapfiles/shadow50.png";
|
- |
|
119 |
icon.iconSize = new GSize(16, 16);
|
121 |
size: new google.maps.Size(16,16),
|
120 |
icon.shadowSize = new GSize(16, 16);
|
- |
|
121 |
icon.iconAnchor = new GPoint(6, 16);
|
122 |
anchor: new google.maps.Point(6,16)'
|
122 |
icon.infoWindowAnchor = new GPoint(5, 1);'."\n";
|
123 |
. '};' . "\n";
|
- |
|
124 |
|
123 |
$script_marker .= "\t".'point = new GLatLng('.$chaine['bf_latitude'].','.$chaine['bf_longitude'].');'."\n"
|
125 |
$script_marker .= "\t".'point = new google.maps.LatLng('.$chaine['bf_latitude'].','.$chaine['bf_longitude'].');'."\n"
|
124 |
."\t".'map.addOverlay(createMarker(point, \''.'<div class="BAZ_cadre_map">'.
|
126 |
."\t".'createMarker(point, \''.'<div class="BAZ_cadre_map">'.
|
125 |
preg_replace ('/\n/', '', str_replace ("\r\n", '',
|
127 |
preg_replace ('/\n/', '', str_replace ("\r\n", '',
|
126 |
str_replace ("'", "\'", baz_voir_fiche(0, $chaine['bf_id_fiche'])))).'</div>\',icon));'."\n";
|
128 |
str_replace ("'", "\'", baz_voir_fiche(0, $chaine['bf_id_fiche'])))).'</div>\',icon, new google.maps.Size(5,1));'."\n";
|
- |
|
129 |
|
127 |
} else { // Cas 2 plusieurs entrees
|
130 |
} else { // Cas 2 plusieurs entrees
|
128 |
$tableau_id = array();
|
131 |
$tableau_id = array();
|
129 |
foreach ($valeur as $val) {
|
132 |
foreach ($valeur as $val) {
|
130 |
array_push ($tableau_id, $val['bf_id_fiche']);
|
133 |
array_push ($tableau_id, $val['bf_id_fiche']);
|
131 |
}
|
134 |
}
|
- |
|
135 |
|
132 |
$script_marker .= 'var icon = new GIcon();
|
136 |
$script_marker .= 'var icon = {' .
|
133 |
icon.image = "http://www.tela-botanica.org/reseau/bazar/images/drapeau_'.$couleur_drapeau[$chaine['blv_valeur']].'.png";
|
137 |
'url: "reseau/bazar/images/drapeau_'.$couleur_drapeau[$chaine['blv_valeur']].'.png",
|
134 |
icon.shadow = "http://www.google.com/mapfiles/shadow50.png";
|
- |
|
135 |
icon.iconSize = new GSize(16, 16);
|
138 |
size: new google.maps.Size(16,16),
|
136 |
icon.shadowSize = new GSize(37, 34);
|
- |
|
137 |
icon.iconAnchor = new GPoint(6, 34);
|
139 |
anchor: new google.maps.Point(6,3)'
|
138 |
icon.infoWindowAnchor = new GPoint(5, 1);';
|
140 |
. '};' . "\n";
|
- |
|
141 |
|
139 |
$script_marker .= "\t".'point = new GLatLng('.$val['bf_latitude'].','.$val['bf_longitude'].');'."\n"
|
142 |
$script_marker .= "\t".'point = new google.maps.LatLng('.$val['bf_latitude'].','.$val['bf_longitude'].');'."\n"
|
140 |
."\t".'map.addOverlay(createMarker(point, \''.'<div class="BAZ_cadre_map">'.
|
143 |
."\t".'createMarker(point, \''.'<div class="BAZ_cadre_map">'.
|
141 |
preg_replace ('/\n/', '', str_replace ("\r\n", '',
|
144 |
preg_replace ('/\n/', '', str_replace ("\r\n", '',
|
142 |
str_replace ("'", "\'", baz_voir_fiches(0, $tableau_id)))).'</div>\', icon));'."\n";
|
145 |
str_replace ("'", "\'", baz_voir_fiches(0, $tableau_id)))).'</div>\', icon, new google.maps.Size(5,1));'."\n";
|
143 |
}
|
146 |
}
|
144 |
}
|
147 |
}
|
145 |
} else {
|
148 |
} else {
|
146 |
$script_marker = '';
|
149 |
$script_marker = '';
|
147 |
}
|
150 |
}
|
148 |
|
151 |
|
149 |
$script = ' // Variables globales
|
152 |
$script = ' // Variables globales
|
150 |
var map = null;
|
153 |
var map = null;
|
151 |
// cette fonction peut d�j� �tre pr�sente
|
154 |
// cette fonction peut d�j� �tre pr�sente
|
152 |
if (typeof(addListener) != \'function\') {
|
155 |
if (typeof(addListener) != \'function\') {
|
153 |
// fonction portable pour ajout de listeners
|
156 |
// fonction portable pour ajout de listeners
|
154 |
function addListener(element, baseName, handler)
|
157 |
function addListener(element, baseName, handler)
|
155 |
{
|
158 |
{
|
156 |
if (element.addEventListener) {
|
159 |
if (element.addEventListener) {
|
157 |
element.addEventListener(baseName, handler, false) ;
|
160 |
element.addEventListener(baseName, handler, false) ;
|
158 |
} else if (element.attachEvent) {
|
161 |
} else if (element.attachEvent) {
|
159 |
element.attachEvent(\'on\'+baseName, handler) ;
|
162 |
element.attachEvent(\'on\'+baseName, handler) ;
|
160 |
}
|
163 |
}
|
161 |
}
|
164 |
}
|
162 |
}
|
165 |
}
|
163 |
addListener(window,\'load\',loadMap) ;';
|
166 |
addListener(window,\'load\',loadMap) ;';
|
- |
|
167 |
|
164 |
if (BAZ_GOOGLE_MAXIMISE_TAILLE) $script .= '
|
168 |
if (BAZ_GOOGLE_MAXIMISE_TAILLE) $script .= '
|
165 |
// Pour gerer la taille
|
169 |
// Pour gerer la taille
|
166 |
var winW = 630, winH = 560;
|
170 |
var winW = 630, winH = 560;
|
167 |
var deltaH = 220;
|
171 |
var deltaH = 220;
|
168 |
var deltaW = 270;
|
172 |
var deltaW = 270;
|
169 |
|
173 |
|
170 |
function setWinHW() {
|
174 |
function setWinHW() {
|
171 |
if (window.innerHeight) {
|
175 |
if (window.innerHeight) {
|
172 |
winW = window.innerWidth - deltaW;
|
176 |
winW = window.innerWidth - deltaW;
|
173 |
winH = window.innerHeight - deltaH;
|
177 |
winH = window.innerHeight - deltaH;
|
174 |
} else {
|
178 |
} else {
|
175 |
winW = document.documentElement.offsetWidth - 20 - deltaW;
|
179 |
winW = document.documentElement.offsetWidth - 20 - deltaW;
|
176 |
winH = document.documentElement.offsetHeight - 20 - deltaH ;
|
180 |
winH = document.documentElement.offsetHeight - 20 - deltaH ;
|
177 |
}
|
181 |
}
|
178 |
|
182 |
|
179 |
var me = document.getElementById("map");
|
183 |
var me = document.getElementById("map");
|
180 |
if (me != null) {
|
184 |
if (me != null) {
|
181 |
me.style.width= \'\' + winW + \'px\';
|
185 |
me.style.width= \'\' + winW + \'px\';
|
182 |
me.style.height= \'\' + winH + \'px\';
|
186 |
me.style.height= \'\' + winH + \'px\';
|
183 |
}
|
187 |
}
|
184 |
}
|
188 |
}
|
185 |
|
189 |
|
186 |
window.onresize = function () {
|
190 |
window.onresize = function () {
|
187 |
setWinHW();
|
191 |
setWinHW();
|
188 |
if (map) map.checkResize();
|
192 |
if (map) map.checkResize();
|
189 |
}';
|
193 |
}';
|
190 |
$script .= '
|
194 |
$script .= '
|
191 |
|
195 |
|
- |
|
196 |
function createMarker(point, chaine, icon, offset) {
|
- |
|
197 |
var marker = new google.maps.Marker({
|
- |
|
198 |
position: point,
|
- |
|
199 |
map: map,
|
- |
|
200 |
icon: icon
|
- |
|
201 |
});
|
- |
|
202 |
google.maps.event.addListener(marker, "click", function() {
|
- |
|
203 |
var infowindow = new google.maps.InfoWindow({
|
- |
|
204 |
content: chaine,
|
- |
|
205 |
pixelOffset: offset
|
- |
|
206 |
});
|
- |
|
207 |
infowindow.open(map, marker);
|
192 |
function createMarker(point, chaine, icon) {
|
- |
|
193 |
|
- |
|
194 |
var marker = new GMarker(point, icon);
|
- |
|
195 |
GEvent.addListener(marker, "click", function() {
|
- |
|
196 |
marker.openInfoWindowHtml(chaine);
|
208 |
});
|
197 |
});
|
209 |
|
198 |
return marker;
|
210 |
return marker;
|
199 |
}
|
211 |
}
|
200 |
function loadMap() {';
|
212 |
function loadMap() {';
|
201 |
if (BAZ_GOOGLE_MAXIMISE_TAILLE) $script .= '
|
213 |
if (BAZ_GOOGLE_MAXIMISE_TAILLE) $script .= '
|
202 |
setWinHW();';
|
214 |
setWinHW();';
|
203 |
$script .= '
|
215 |
$script .= '
|
204 |
if (GBrowserIsCompatible()) {
|
216 |
var optionsGoogleMapsv3 = {
|
205 |
map = new GMap2(document.getElementById("map"));
|
217 |
// On centre la carte sur le languedoc roussillon
|
- |
|
218 |
center: new google.maps.LatLng(' . BAZ_GOOGLE_CENTRE_LAT . ', ' . BAZ_GOOGLE_CENTRE_LON . '),
|
- |
|
219 |
zoom: ' . BAZ_GOOGLE_ALTITUDE . ',
|
- |
|
220 |
mapTypeId: "OSM",
|
206 |
map.addControl(new GSmallMapControl());
|
221 |
mapTypeControlOptions: {
|
- |
|
222 |
mapTypeIds: ["OSM",
|
- |
|
223 |
google.maps.MapTypeId.ROADMAP,
|
- |
|
224 |
google.maps.MapTypeId.HYBRID,
|
- |
|
225 |
google.maps.MapTypeId.SATELLITE,
|
207 |
map.addControl(new GMapTypeControl());
|
226 |
google.maps.MapTypeId.TERRAIN]
|
- |
|
227 |
},
|
208 |
map.addControl(new GScaleControl());
|
228 |
mapTypeControl: true,
|
209 |
map.enableContinuousZoom();
|
229 |
scaleControl: true
|
- |
|
230 |
};
|
210 |
|
231 |
|
- |
|
232 |
map = new google.maps.Map(document.getElementById("map"), optionsGoogleMapsv3);
|
211 |
// On centre la carte sur le languedoc roussillon
|
233 |
map.mapTypes.set("OSM", new google.maps.ImageMapType({
|
- |
|
234 |
getTileUrl: function(coord, zoom) {
|
212 |
center = new GLatLng('.BAZ_GOOGLE_CENTRE_LAT.', '.BAZ_GOOGLE_CENTRE_LON.');
|
235 |
return "http://osm.tela-botanica.org/tile/" + // cache de tuiles avec nginx
|
213 |
map.setCenter(center, '.BAZ_GOOGLE_ALTITUDE.');
|
236 |
zoom + "/" + coord.x + "/" + coord.y + ".png";
|
- |
|
237 |
},
|
- |
|
238 |
tileSize: new google.maps.Size(256, 256),
|
- |
|
239 |
isPng: true,
|
214 |
map.setMapType(G_HYBRID_MAP);' ;
|
240 |
alt: "OpenStreetMap",
|
- |
|
241 |
name: "OSM",
|
- |
|
242 |
maxZoom: 19
|
- |
|
243 |
}));';
|
- |
|
244 |
|
215 |
if (BAZ_GOOGLE_FOND_KML != '') {
|
245 |
if (BAZ_GOOGLE_FOND_KML != '') {
|
216 |
$script .= 'var geoXml = new GGeoXml("'.BAZ_GOOGLE_FOND_KML.'");';
|
246 |
$script .= 'geoXml = new google.maps.KmlLayer(' . BAZ_GOOGLE_FOND_KML . ');';
|
217 |
}
|
247 |
}
|
218 |
|
248 |
|
219 |
$script .= $script_marker;
|
249 |
$script .= $script_marker;
|
220 |
if (BAZ_GOOGLE_FOND_KML != '') {
|
250 |
if (BAZ_GOOGLE_FOND_KML != '') {
|
221 |
$script .= 'map.addOverlay(geoXml);';
|
251 |
$script .= 'geoXml.setMap(map);';
|
222 |
}
|
252 |
}
|
- |
|
253 |
|
223 |
$script .= '
|
254 |
$script .= '};';
|
224 |
}
|
- |
|
225 |
};
|
- |
|
226 |
';
|
- |
|
227 |
|
255 |
|
228 |
GEN_stockerCodeScript($script);
|
256 |
GEN_stockerCodeScript($script);
|
229 |
// On ajoute l attribut load a la balise body
|
257 |
// On ajoute l attribut load a la balise body
|
230 |
//GEN_AttributsBody('onload', 'load()');
|
258 |
//GEN_AttributsBody('onload', 'load()');
|
231 |
|
259 |
|
232 |
|
260 |
|
233 |
|
261 |
|
234 |
function afficherContenuCorps() {
|
262 |
function afficherContenuCorps() {
|
235 |
|
263 |
|
236 |
include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php';
|
264 |
include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php';
|
237 |
$modele = new bazarTemplate($GLOBALS['_BAZAR_']['db']);
|
265 |
$modele = new bazarTemplate($GLOBALS['_BAZAR_']['db']);
|
238 |
$html = $modele->getTemplate(BAZ_TEMPLATE_ACCUEIL_CARTE_GOOGLE, $GLOBALS['_BAZAR_']['langue'], $GLOBALS['_BAZAR_']['categorie_nature']);
|
266 |
$html = $modele->getTemplate(BAZ_TEMPLATE_ACCUEIL_CARTE_GOOGLE, $GLOBALS['_BAZAR_']['langue'], $GLOBALS['_BAZAR_']['categorie_nature']);
|
239 |
if (PEAR::isError($html)) return $html->getMessage();
|
267 |
if (PEAR::isError($html)) return $html->getMessage();
|
240 |
|
268 |
|
241 |
// nettoyage url
|
269 |
// nettoyage url
|
242 |
$GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ID_FICHE) ;
|
270 |
$GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ID_FICHE) ;
|
243 |
$GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ACTION) ;
|
271 |
$GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ACTION) ;
|
244 |
$html = bazar::getFormulaireFiltre($html) ;
|
272 |
$html = bazar::getFormulaireFiltre($html) ;
|
245 |
|
273 |
|
246 |
$res = str_replace ('{CARTE}', '<div id="map" style="width: '.BAZ_GOOGLE_IMAGE_LARGEUR.
|
274 |
$res = str_replace ('{CARTE}', '<div id="map" style="width: '.BAZ_GOOGLE_IMAGE_LARGEUR.
|
247 |
'px; height: '.BAZ_GOOGLE_IMAGE_HAUTEUR.'px"></div>', $html);
|
275 |
'px; height: '.BAZ_GOOGLE_IMAGE_HAUTEUR.'px"></div>', $html);
|
248 |
|
276 |
|
249 |
return $res;
|
277 |
return $res;
|
250 |
}
|
278 |
}
|
251 |
|
279 |
|
252 |
|
280 |
|
253 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
281 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
254 |
*
|
282 |
*
|
255 |
* $Log: not supported by cvs2svn $
|
283 |
* $Log: not supported by cvs2svn $
|
256 |
* Revision 1.5.2.3 2008-01-29 09:41:11 alexandre_tb
|
284 |
* Revision 1.5.2.3 2008-01-29 09:41:11 alexandre_tb
|
257 |
* utilisation des constantes BAZ_GOOGLE_FOND_KML
|
285 |
* utilisation des constantes BAZ_GOOGLE_FOND_KML
|
258 |
*
|
286 |
*
|
259 |
* Revision 1.5.2.2 2007-12-14 09:57:15 alexandre_tb
|
287 |
* Revision 1.5.2.2 2007-12-14 09:57:15 alexandre_tb
|
260 |
* utilisation des constantes de la carte google
|
288 |
* utilisation des constantes de la carte google
|
261 |
*
|
289 |
*
|
262 |
* Revision 1.5.2.1 2007-12-04 16:19:32 jp_milcent
|
290 |
* Revision 1.5.2.1 2007-12-04 16:19:32 jp_milcent
|
263 |
* Ajout de la prise en charge de l'applette body_attributs
|
291 |
* Ajout de la prise en charge de l'applette body_attributs
|
264 |
*
|
292 |
*
|
265 |
* Revision 1.5 2007-10-01 12:07:03 alexandre_tb
|
293 |
* Revision 1.5 2007-10-01 12:07:03 alexandre_tb
|
266 |
* utilisation de constantes du fichier de conf pour centrer la carte
|
294 |
* utilisation de constantes du fichier de conf pour centrer la carte
|
267 |
*
|
295 |
*
|
268 |
* Revision 1.4 2007-08-27 12:27:34 alexandre_tb
|
296 |
* Revision 1.4 2007-08-27 12:27:34 alexandre_tb
|
269 |
* mise en place d un icone personnalise
|
297 |
* mise en place d un icone personnalise
|
270 |
* et de l affichage de plusieurs donnees sur un meme point
|
298 |
* et de l affichage de plusieurs donnees sur un meme point
|
271 |
*
|
299 |
*
|
272 |
* Revision 1.3 2007-07-04 10:08:41 alexandre_tb
|
300 |
* Revision 1.3 2007-07-04 10:08:41 alexandre_tb
|
273 |
* Appel du template carte_google
|
301 |
* Appel du template carte_google
|
274 |
*
|
302 |
*
|
275 |
* Revision 1.2 2007-06-13 10:02:47 alexandre_tb
|
303 |
* Revision 1.2 2007-06-13 10:02:47 alexandre_tb
|
276 |
* le carte s adapte a la taille du conteneur
|
304 |
* le carte s adapte a la taille du conteneur
|
277 |
*
|
305 |
*
|
278 |
* Revision 1.1 2007-06-04 15:26:57 alexandre_tb
|
306 |
* Revision 1.1 2007-06-04 15:26:57 alexandre_tb
|
279 |
* version initiale
|
307 |
* version initiale
|
280 |
*
|
308 |
*
|
281 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
309 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
282 |
*/
|
310 |
*/
|
283 |
|
311 |
|