Subversion Repositories Applications.bazar

Rev

Rev 479 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 479 Rev 490
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&amp;v=2&amp;key='.BAZ_GOOGLE_KEY);
44
//GEN_stockerFichierScript('googleMapScript', 'http://maps.google.com/maps?file=api&amp;v=2&amp;key='.BAZ_GOOGLE_KEY);
45
GEN_stockerFichierScript('googleMapScript', "http://maps.googleapis.com/maps/api/js?sensor=false&key=".BAZ_GOOGLE_KEY);
45
GEN_stockerFichierScript('googleMapScript', "http://maps.googleapis.com/maps/api/js?sensor=false&key=".BAZ_GOOGLE_KEY);
46
 
46
 
47
// Le fichier jquery pour le date picker
47
// Le fichier jquery pour le date picker
48
//GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
48
//GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
49
//GEN_stockerFichierScript('jquery', 'http://code.jquery.com/jquery-latest.js');
49
//GEN_stockerFichierScript('jquery', 'http://code.jquery.com/jquery-latest.js');
50
GEN_stockerFichierScript('jquery_date_picker', 'api/js/jquery/ui.datepicker.js');
50
GEN_stockerFichierScript('jquery_date_picker', 'api/js/jquery/ui.datepicker.js');
51
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');
52
 
52
 
53
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');
54
 
54
 
55
 
55
 
56
if (defined('PAP_VERSION')) { //si on est dans Papyrus
56
if (defined('PAP_VERSION')) { //si on est dans Papyrus
57
    GEN_stockerStyleExterne( 'bazar_interne', 'reseau/bazar/bazar.interne.css');
57
    GEN_stockerStyleExterne( 'bazar_interne', 'reseau/bazar/bazar.interne.css');
58
}
58
}
59
$GLOBALS['_BAZAR_']['id_typeannonce']=$GLOBALS['_GEN_commun']['info_application']->id_nature;
59
$GLOBALS['_BAZAR_']['id_typeannonce']=$GLOBALS['_GEN_commun']['info_application']->id_nature;
60
$GLOBALS['_BAZAR_']['categorie_nature']=$GLOBALS['_GEN_commun']['info_application']->categorie_nature;
60
$GLOBALS['_BAZAR_']['categorie_nature']=$GLOBALS['_GEN_commun']['info_application']->categorie_nature;
61
// requete sur le bazar pour recuperer les evenements
61
// requete sur le bazar pour recuperer les evenements
62
 
62
 
63
$requete_where = '';
63
$requete_where = '';
64
foreach ($_POST as $cle => $valeur) {
64
foreach ($_POST as $cle => $valeur) {
65
    if (preg_match ('/bazar_filtre_([0-9]+)/', $cle, $sousmotif)) {
65
    if (preg_match ('/bazar_filtre_([0-9]+)/', $cle, $sousmotif)) {
66
        $variable = $sousmotif[0] ;
66
        $variable = $sousmotif[0] ;
67
        if ($_POST[$variable] != '*') {
67
        if ($_POST[$variable] != '*') {
68
            $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].'" ';   
69
        } else {
69
        } else {
70
            $requete_where = ' and bfvl_ce_liste="'.$sousmotif[1].'" ';
70
            $requete_where = ' and bfvl_ce_liste="'.$sousmotif[1].'" ';
71
        }
71
        }
72
    } else {
72
    } else {
73
       
73
       
74
    }
74
    }
75
}
75
}
76
 
76
 
77
if (isset($_POST['date_debut']) && $_POST['date_debut'] != '') {
77
if (isset($_POST['date_debut']) && $_POST['date_debut'] != '') {
78
   
78
   
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
    $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'])).'" )' .
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_fin_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
                    ' 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'])).'")  ';
82
} else {
82
} else {
83
    $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( ))
84
    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( )) )';
85
}
85
}
86
 
86
 
87
$requete = 'SELECT blv_label,blv_valeur, bazar_fiche.*'.
87
$requete = 'SELECT blv_label,blv_valeur, bazar_fiche.*'.
88
 ' FROM bazar_fiche, bazar_fiche_valeur_liste , bazar_liste_valeurs'.
88
 ' FROM bazar_fiche, bazar_fiche_valeur_liste , bazar_liste_valeurs'.
89
 ' 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'.
90
 ' 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 '.
91
 $requete_date;
91
 $requete_date;
92
$resultat = $GLOBALS['_BAZAR_']['db']->query ($requete);
92
$resultat = $GLOBALS['_BAZAR_']['db']->query ($requete);
93
 
93
 
94
if (DB::isError($resultat)) {
94
if (DB::isError($resultat)) {
95
	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;
96
}
96
}
97
 
97
 
98
// Le code complique avec ces 2 tableaux sert
98
// Le code complique avec ces 2 tableaux sert
99
// a ne pas mettre 2 points aux memes coordonnees
99
// a ne pas mettre 2 points aux memes coordonnees
100
// car dans ce cas la seul le second serait visible
100
// car dans ce cas la seul le second serait visible
101
 
101
 
102
$donnees = array();
102
$donnees = array();
103
 
103
 
104
if ($resultat->numRows() != 0) {
104
if ($resultat->numRows() != 0) {
105
    $script_marker = '';
105
    $script_marker = '';
106
    $couleur_drapeau = array ( 1 => 'bleu', 2 => 'vert', 3 => 'orange', 4 => 'rose');
106
    $couleur_drapeau = array ( 1 => 'bleu', 2 => 'vert', 3 => 'orange', 4 => 'rose');
107
 
107
 
108
    while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
108
    while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
109
        if ($ligne['bf_latitude'] == 0 && $ligne['bf_longitude'] == 0) continue;
109
        if ($ligne['bf_latitude'] == 0 && $ligne['bf_longitude'] == 0) continue;
110
        $cle = $ligne['bf_latitude'].'-'.$ligne['bf_longitude'];
110
        $cle = $ligne['bf_latitude'].'-'.$ligne['bf_longitude'];
111
        $donnees[$cle][] = $ligne;
111
        $donnees[$cle][] = $ligne;
112
    }
112
    }
113
 
113
 
114
    foreach ($donnees as $valeur) {
114
    foreach ($donnees as $valeur) {
115
        // cas un : une seule entree pour le point de coordonnees
115
        // cas un : une seule entree pour le point de coordonnees
116
        if (count ($valeur) == 1) {
116
        if (count ($valeur) == 1) {
117
            $chaine = $valeur[0];
117
            $chaine = $valeur[0];
118
 
118
 
119
			$script_marker .= 'var icon = {' .
119
			$script_marker .= 'var icon = {' .
120
				'url: "reseau/bazar/images/drapeau_'.$couleur_drapeau[$chaine['blv_valeur']].'.png",
120
				'url: "reseau/bazar/images/drapeau_'.$couleur_drapeau[$chaine['blv_valeur']].'.png",
121
				size: new google.maps.Size(16,16),
121
				size: new google.maps.Size(16,16),
122
				anchor: new google.maps.Point(6,16)'
122
				anchor: new google.maps.Point(6,16)'
123
			. '};' . "\n";
123
			. '};' . "\n";
124
 
124
 
125
              $script_marker .= "\t".'point = new google.maps.LatLng('.$chaine['bf_latitude'].','.$chaine['bf_longitude'].');'."\n"
125
              $script_marker .= "\t".'point = new google.maps.LatLng('.$chaine['bf_latitude'].','.$chaine['bf_longitude'].');'."\n"
126
                ."\t".'createMarker(point, \''.'<div class="BAZ_cadre_map">'.
126
                ."\t".'createMarker(point, \''.'<div class="BAZ_cadre_map">'.
127
                preg_replace ('/\n/', '', str_replace ("\r\n", '',
127
                preg_replace ('/\n/', '', str_replace ("\r\n", '',
128
                    str_replace ("'", "\'", baz_voir_fiche(0, $chaine['bf_id_fiche'])))).'</div>\',icon, new google.maps.Size(5,1));'."\n";
128
                    str_replace ("'", "\'", baz_voir_fiche(0, $chaine['bf_id_fiche'])))).'</div>\',icon, new google.maps.Size(5,1));'."\n";
129
 
129
 
130
        } else { // Cas 2 plusieurs entrees
130
        } else { // Cas 2 plusieurs entrees
131
            $tableau_id = array();
131
            $tableau_id = array();
132
            foreach ($valeur as $val) {
132
            foreach ($valeur as $val) {
133
                array_push ($tableau_id, $val['bf_id_fiche']);
133
                array_push ($tableau_id, $val['bf_id_fiche']);
134
            }
134
            }
135
 
135
 
136
			$script_marker .= 'var icon = {' .
136
			$script_marker .= 'var icon = {' .
137
				'url: "reseau/bazar/images/drapeau_'.$couleur_drapeau[$chaine['blv_valeur']].'.png",
137
				'url: "reseau/bazar/images/drapeau_'.$couleur_drapeau[$chaine['blv_valeur']].'.png",
138
				size: new google.maps.Size(16,16),
138
				size: new google.maps.Size(16,16),
139
				anchor: new google.maps.Point(6,3)'
139
				anchor: new google.maps.Point(6,3)'
140
			. '};' . "\n";
140
			. '};' . "\n";
141
 
141
 
142
            $script_marker .= "\t".'point = new google.maps.LatLng('.$val['bf_latitude'].','.$val['bf_longitude'].');'."\n"
142
            $script_marker .= "\t".'point = new google.maps.LatLng('.$val['bf_latitude'].','.$val['bf_longitude'].');'."\n"
143
                ."\t".'createMarker(point, \''.'<div class="BAZ_cadre_map">'.
143
                ."\t".'createMarker(point, \''.'<div class="BAZ_cadre_map">'.
144
                preg_replace ('/\n/', '', str_replace ("\r\n", '',
144
                preg_replace ('/\n/', '', str_replace ("\r\n", '',
145
                    str_replace ("'", "\'", baz_voir_fiches(0, $tableau_id)))).'</div>\', icon, new google.maps.Size(5,1));'."\n";
145
                    str_replace ("'", "\'", baz_voir_fiches(0, $tableau_id)))).'</div>\', icon, new google.maps.Size(5,1));'."\n";
146
        }
146
        }
147
    }
147
    }
148
} else {
148
} else {
149
    $script_marker = '';
149
    $script_marker = '';
150
}
150
}
151
 
151
 
152
$script = '    // Variables globales
152
$script = '    // Variables globales
153
    var map = null;
153
    var map = null;
154
    // cette fonction peut d�j� �tre pr�sente
154
    // cette fonction peut d�j� �tre pr�sente
155
	if (typeof(addListener) != \'function\') {
155
	if (typeof(addListener) != \'function\') {
156
		// fonction portable pour ajout de listeners
156
		// fonction portable pour ajout de listeners
157
		function addListener(element, baseName, handler)
157
		function addListener(element, baseName, handler)
158
		{
158
		{
159
			if (element.addEventListener) {
159
			if (element.addEventListener) {
160
				element.addEventListener(baseName, handler, false) ;
160
				element.addEventListener(baseName, handler, false) ;
161
			} else if (element.attachEvent) {
161
			} else if (element.attachEvent) {
162
				element.attachEvent(\'on\'+baseName, handler) ;
162
				element.attachEvent(\'on\'+baseName, handler) ;
163
			}
163
			}
164
		}
164
		}
165
	}		
165
	}		
166
	addListener(window,\'load\',loadMap) ;';
166
	addListener(window,\'load\',loadMap) ;';
167
 
167
 
168
if (BAZ_GOOGLE_MAXIMISE_TAILLE) $script .= '
168
if (BAZ_GOOGLE_MAXIMISE_TAILLE) $script .= '
169
    // Pour gerer la taille  
169
    // Pour gerer la taille  
170
    var winW = 630, winH = 560;
170
    var winW = 630, winH = 560;
171
    var deltaH = 220;
171
    var deltaH = 220;
172
    var deltaW = 270;
172
    var deltaW = 270;
173
 
173
 
174
    function setWinHW() {
174
    function setWinHW() {
175
	if (window.innerHeight) {
175
	if (window.innerHeight) {
176
			winW = window.innerWidth  - deltaW;
176
			winW = window.innerWidth  - deltaW;
177
			winH = window.innerHeight - deltaH;
177
			winH = window.innerHeight - deltaH;
178
        } else {
178
        } else {
179
			winW = document.documentElement.offsetWidth  - 20 - deltaW;
179
			winW = document.documentElement.offsetWidth  - 20 - deltaW;
180
			winH = document.documentElement.offsetHeight - 20 - deltaH ; 
180
			winH = document.documentElement.offsetHeight - 20 - deltaH ; 
181
        }
181
        }
182
 
182
 
183
	var me = document.getElementById("map");
183
	var me = document.getElementById("map");
184
	if (me != null) {
184
	if (me != null) {
185
	    me.style.width= \'\' + winW + \'px\';
185
	    me.style.width= \'\' + winW + \'px\';
186
	    me.style.height= \'\' + winH + \'px\';
186
	    me.style.height= \'\' + winH + \'px\';
187
        }
187
        }
188
    }
188
    }
189
 
189
 
190
    window.onresize = function () {
190
    window.onresize = function () {
191
	setWinHW();
191
	setWinHW();
192
	if (map)  map.checkResize();
192
	if (map)  map.checkResize();
193
    }';
193
    }';
194
$script .= '
194
$script .= '
195
    
195
    
196
    function createMarker(point, chaine, icon, offset) {
196
    function createMarker(point, chaine, icon, offset) {
197
		var marker = new google.maps.Marker({
197
		var marker = new google.maps.Marker({
198
			position: point,
198
			position: point,
199
			map: map,
199
			map: map,
200
			icon: icon
200
			icon: icon
201
		});
201
		});
202
		google.maps.event.addListener(marker, "click", function() {
202
		google.maps.event.addListener(marker, "click", function() {
203
	    	var infowindow = new google.maps.InfoWindow({
203
	    	var infowindow = new google.maps.InfoWindow({
204
				content: chaine,
204
				content: chaine,
205
				pixelOffset: offset
205
				pixelOffset: offset
206
			});
206
			});
207
			infowindow.open(map, marker);
207
			infowindow.open(map, marker);
208
		});
208
		});
209
 
209
 
210
	  	return marker;
210
	  	return marker;
211
	}
211
	}
212
    function loadMap() {';
212
    function loadMap() {';
213
if (BAZ_GOOGLE_MAXIMISE_TAILLE) $script .= '
213
if (BAZ_GOOGLE_MAXIMISE_TAILLE) $script .= '
214
    setWinHW();';
214
    setWinHW();';
215
$script .= '
215
$script .= '
216
    var optionsGoogleMapsv3 = {
216
    var optionsGoogleMapsv3 = {
217
		// On centre la carte sur le languedoc roussillon
217
		// On centre la carte sur le languedoc roussillon
218
		center: new google.maps.LatLng(' . BAZ_GOOGLE_CENTRE_LAT . ', ' . BAZ_GOOGLE_CENTRE_LON . '),
218
		center: new google.maps.LatLng(' . BAZ_GOOGLE_CENTRE_LAT . ', ' . BAZ_GOOGLE_CENTRE_LON . '),
219
		zoom: ' . BAZ_GOOGLE_ALTITUDE . ',
219
		zoom: ' . BAZ_GOOGLE_ALTITUDE . ',
220
		mapTypeId: "OSM",
220
		mapTypeId: "OSM",
221
		mapTypeControlOptions: {
221
		mapTypeControlOptions: {
222
			mapTypeIds: ["OSM", 
222
			mapTypeIds: ["OSM", 
223
				google.maps.MapTypeId.ROADMAP,
223
				google.maps.MapTypeId.ROADMAP,
224
				google.maps.MapTypeId.HYBRID,
224
				google.maps.MapTypeId.HYBRID,
225
				google.maps.MapTypeId.SATELLITE,
225
				google.maps.MapTypeId.SATELLITE,
226
				google.maps.MapTypeId.TERRAIN]
226
				google.maps.MapTypeId.TERRAIN]
227
		},
227
		},
228
		mapTypeControl: true,
228
		mapTypeControl: true,
229
		scaleControl: true
229
		scaleControl: true
230
	};
230
	};
231
 
231
 
232
    map = new google.maps.Map(document.getElementById("map"), optionsGoogleMapsv3);
232
    map = new google.maps.Map(document.getElementById("map"), optionsGoogleMapsv3);
233
	map.mapTypes.set("OSM", new google.maps.ImageMapType({
233
	map.mapTypes.set("OSM", new google.maps.ImageMapType({
234
		getTileUrl: function(coord, zoom) {
234
		getTileUrl: function(coord, zoom) {
235
			return "http://osm.tela-botanica.org/tile/" + // cache de tuiles avec nginx
235
			return "http://osm.tela-botanica.org/tile/" + // cache de tuiles avec nginx
236
			zoom + "/" + coord.x + "/" + coord.y + ".png";
236
			zoom + "/" + coord.x + "/" + coord.y + ".png";
237
		},
237
		},
238
		tileSize: new google.maps.Size(256, 256),
238
		tileSize: new google.maps.Size(256, 256),
239
		isPng: true,
239
		isPng: true,
240
		alt: "OpenStreetMap",
240
		alt: "OpenStreetMap",
241
		name: "OSM",
241
		name: "OSM",
242
		maxZoom: 19
242
		maxZoom: 19
243
	}));';
243
	}));
-
 
244
 
-
 
245
	var mention = \'<div id="origine-donnees">Tuiles : <a href="http://www.openstreetmap.fr" target="_blank">OsmFr</a><br/>\';
-
 
246
    mention += \'Carte : <a href="http://www.openstreetmap.org/copyright" target="_blank">© les contributeurs d\\\'OpenStreetMap</a></div>\';
-
 
247
    $("#map").append(mention);
-
 
248
 
-
 
249
    // ecouteur sur changement de fond
-
 
250
    google.maps.event.addListener( map, \'maptypeid_changed\', function() { 
-
 
251
        if (map.getMapTypeId() == "OSM") {
-
 
252
            $("#origine-donnees").show();
-
 
253
        } else {
-
 
254
            $("#origine-donnees").hide();
-
 
255
        }
-
 
256
    });';
244
 
257
 
245
if (BAZ_GOOGLE_FOND_KML != '') {
258
if (BAZ_GOOGLE_FOND_KML != '') {
246
		$script .= 'geoXml = new google.maps.KmlLayer(' . BAZ_GOOGLE_FOND_KML . ');';
259
		$script .= 'geoXml = new google.maps.KmlLayer(' . BAZ_GOOGLE_FOND_KML . ');';
247
	}
260
	}
248
 
261
 
249
	$script .= $script_marker;
262
	$script .= $script_marker;
250
	if (BAZ_GOOGLE_FOND_KML != '') {
263
	if (BAZ_GOOGLE_FOND_KML != '') {
251
		$script .= 'geoXml.setMap(map);';
264
		$script .= 'geoXml.setMap(map);';
252
	}
265
	}
253
 
266
 
254
$script .= '};';
267
$script .= '};';
255
 
268
 
256
GEN_stockerCodeScript($script);
269
GEN_stockerCodeScript($script);
257
// On ajoute l attribut load a la balise body
270
// On ajoute l attribut load a la balise body
258
//GEN_AttributsBody('onload', 'load()');
271
//GEN_AttributsBody('onload', 'load()');
259
 
272
 
260
 
273
 
261
 
274
 
262
function afficherContenuCorps() {
275
function afficherContenuCorps() {
263
	
276
	
264
	include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php';
277
	include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php';
265
    $modele = new bazarTemplate($GLOBALS['_BAZAR_']['db']);
278
    $modele = new bazarTemplate($GLOBALS['_BAZAR_']['db']);
266
    $html = $modele->getTemplate(BAZ_TEMPLATE_ACCUEIL_CARTE_GOOGLE, $GLOBALS['_BAZAR_']['langue'], $GLOBALS['_BAZAR_']['categorie_nature']);
279
    $html = $modele->getTemplate(BAZ_TEMPLATE_ACCUEIL_CARTE_GOOGLE, $GLOBALS['_BAZAR_']['langue'], $GLOBALS['_BAZAR_']['categorie_nature']);
267
    if (PEAR::isError($html)) return $html->getMessage();
280
    if (PEAR::isError($html)) return $html->getMessage();
268
    
281
    
269
    // nettoyage url 
282
    // nettoyage url 
270
    $GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ID_FICHE) ;
283
    $GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ID_FICHE) ;
271
    $GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ACTION) ;
284
    $GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ACTION) ;
272
    $html = bazar::getFormulaireFiltre($html) ;
285
    $html = bazar::getFormulaireFiltre($html) ;
273
   
286
   
274
	$res = str_replace ('{CARTE}', '<div id="map" style="width: '.BAZ_GOOGLE_IMAGE_LARGEUR.
287
	$res = str_replace ('{CARTE}', '<div id="map" style="width: '.BAZ_GOOGLE_IMAGE_LARGEUR.
275
							'px; height: '.BAZ_GOOGLE_IMAGE_HAUTEUR.'px"></div>', $html);
288
							'px; height: '.BAZ_GOOGLE_IMAGE_HAUTEUR.'px"></div>', $html);
276
 
289
 
277
	return $res;
290
	return $res;
278
}
291
}
279
 
292
 
280
 
293
 
281
/* +--Fin du code ----------------------------------------------------------------------------------------+
294
/* +--Fin du code ----------------------------------------------------------------------------------------+
282
*
295
*
283
* $Log: not supported by cvs2svn $
296
* $Log: not supported by cvs2svn $
284
* Revision 1.5.2.3  2008-01-29 09:41:11  alexandre_tb
297
* Revision 1.5.2.3  2008-01-29 09:41:11  alexandre_tb
285
* utilisation des constantes BAZ_GOOGLE_FOND_KML
298
* utilisation des constantes BAZ_GOOGLE_FOND_KML
286
*
299
*
287
* Revision 1.5.2.2  2007-12-14 09:57:15  alexandre_tb
300
* Revision 1.5.2.2  2007-12-14 09:57:15  alexandre_tb
288
* utilisation des constantes de la carte google
301
* utilisation des constantes de la carte google
289
*
302
*
290
* Revision 1.5.2.1  2007-12-04 16:19:32  jp_milcent
303
* Revision 1.5.2.1  2007-12-04 16:19:32  jp_milcent
291
* Ajout de la prise en charge de l'applette body_attributs
304
* Ajout de la prise en charge de l'applette body_attributs
292
*
305
*
293
* Revision 1.5  2007-10-01 12:07:03  alexandre_tb
306
* Revision 1.5  2007-10-01 12:07:03  alexandre_tb
294
* utilisation de constantes du fichier de conf pour centrer la carte
307
* utilisation de constantes du fichier de conf pour centrer la carte
295
*
308
*
296
* Revision 1.4  2007-08-27 12:27:34  alexandre_tb
309
* Revision 1.4  2007-08-27 12:27:34  alexandre_tb
297
* mise en place d un icone personnalise
310
* mise en place d un icone personnalise
298
* et de l affichage de plusieurs donnees sur un meme point
311
* et de l affichage de plusieurs donnees sur un meme point
299
*
312
*
300
* Revision 1.3  2007-07-04 10:08:41  alexandre_tb
313
* Revision 1.3  2007-07-04 10:08:41  alexandre_tb
301
* Appel du template carte_google
314
* Appel du template carte_google
302
*
315
*
303
* Revision 1.2  2007-06-13 10:02:47  alexandre_tb
316
* Revision 1.2  2007-06-13 10:02:47  alexandre_tb
304
* le carte s adapte a la taille du conteneur
317
* le carte s adapte a la taille du conteneur
305
*
318
*
306
* Revision 1.1  2007-06-04 15:26:57  alexandre_tb
319
* Revision 1.1  2007-06-04 15:26:57  alexandre_tb
307
* version initiale
320
* version initiale
308
*
321
*
309
* +-- Fin du code ----------------------------------------------------------------------------------------+
322
* +-- Fin du code ----------------------------------------------------------------------------------------+
310
*/
323
*/