Line 1... |
Line -... |
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 |
// +------------------------------------------------------------------------------------------------------+
|
- |
|
22 |
// CVS : $Id: carte_google.php,v 1.2 2008-09-17 14:18:12 alexandre_tb Exp $
|
- |
|
23 |
/**
|
- |
|
24 |
*
|
- |
|
25 |
*@package bazar
|
- |
|
26 |
//Auteur original :
|
- |
|
27 |
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
|
- |
|
28 |
//Autres auteurs :
|
- |
|
29 |
*@copyright Tela-Botanica 2000-2008
|
- |
|
30 |
*@version $Revision: 1.2 $
|
- |
|
31 |
// +------------------------------------------------------------------------------------------------------+
|
- |
|
32 |
*/
|
- |
|
33 |
|
- |
|
34 |
include_once PAP_CHEMIN_API_PEAR.'PEAR.php';
|
- |
|
35 |
|
- |
|
36 |
|
- |
|
37 |
class Bazar_carte_google extends PEAR {
|
- |
|
38 |
|
- |
|
39 |
var $option = array();
|
- |
|
40 |
|
- |
|
41 |
function Bazar_carte_google($options) {
|
- |
|
42 |
$this->options = $options;
|
- |
|
43 |
}
|
- |
|
44 |
|
- |
|
45 |
function toHTML($valeur) {
|
- |
|
46 |
if ($GLOBALS['pas_de_carte']) return;
|
- |
|
47 |
$html = '';
|
- |
|
48 |
$val = $this->options['nom_bdd'];
|
- |
|
49 |
$script = '
|
- |
|
50 |
// Variables globales
|
- |
|
51 |
var map = null;
|
- |
|
52 |
var geocoder = null;
|
- |
|
53 |
var lat = document.getElementById("latitude");
|
- |
|
54 |
var lon = document.getElementById("longitude");
|
- |
|
55 |
|
- |
|
56 |
function load() {
|
- |
|
57 |
if (GBrowserIsCompatible()) {
|
- |
|
58 |
|
- |
|
59 |
map = new GMap2(document.getElementById("map"), G_HYBRID_MAP);
|
- |
|
60 |
|
- |
|
61 |
map.addControl(new GSmallMapControl());
|
- |
|
62 |
map.addControl(new GMapTypeControl());
|
- |
|
63 |
map.addControl(new GScaleControl());
|
- |
|
64 |
map.enableContinuousZoom();
|
- |
|
65 |
|
- |
|
66 |
// On centre la carte sur le marqueur
|
- |
|
67 |
center = new GLatLng('.$GLOBALS['_BAZAR_']['ligne_resultat']['bf_latitude'].', '.$GLOBALS['_BAZAR_']['ligne_resultat']['bf_longitude'].');
|
- |
|
68 |
map.setCenter(center, 7);map.setMapType(G_HYBRID_MAP);
|
- |
|
69 |
point = new GLatLng('.$GLOBALS['_BAZAR_']['ligne_resultat']['bf_latitude'].', '.$GLOBALS['_BAZAR_']['ligne_resultat']['bf_longitude'].');
|
- |
|
70 |
marker = new GMarker(point, {draggable: true});
|
- |
|
71 |
map.addOverlay(marker);
|
- |
|
72 |
}
|
- |
|
73 |
};' ;
|
- |
|
74 |
GEN_stockerCodeScript($script);
|
- |
|
75 |
GEN_stockerFichierScript('googleMapScript', $this->options['nom_bdd']);
|
- |
|
76 |
// On ajoute l attribut load a la balise body
|
- |
|
77 |
GEN_AttributsBody('onload', 'load()');
|
- |
|
78 |
$html = '<div id="map" style="width: 400px; height: 300px"></div>';
|
- |
|
79 |
return $html;
|
- |
|
80 |
}
|
- |
|
81 |
}
|
- |
|
82 |
|
- |
|
83 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
- |
|
84 |
*
|
- |
|
85 |
* $Log: not supported by cvs2svn $
|
- |
|
86 |
* Revision 1.1.2.1 2008-04-16 12:35:25 alexandre_tb
|
- |
|
87 |
* version initiale
|
- |
|
88 |
*
|
- |
|
89 |
*
|
- |
|
90 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
- |
|
91 |
*/
|
- |
|
92 |
?>
|
- |
|
93 |
|
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 |
// +------------------------------------------------------------------------------------------------------+
|
- |
|
22 |
// CVS : $Id: carte_google.php,v 1.1.2.1 2008-04-16 12:35:25 alexandre_tb Exp $
|
- |
|
23 |
/**
|
- |
|
24 |
*
|
- |
|
25 |
*@package bazar
|
- |
|
26 |
//Auteur original :
|
- |
|
27 |
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
|
- |
|
28 |
//Autres auteurs :
|
- |
|
29 |
*@copyright Tela-Botanica 2000-2008
|
- |
|
30 |
*@version $Revision: 1.1.2.1 $
|
- |
|
31 |
// +------------------------------------------------------------------------------------------------------+
|
- |
|
32 |
*/
|
- |
|
33 |
|
- |
|
34 |
include_once PAP_CHEMIN_API_PEAR.'PEAR.php';
|
- |
|
35 |
|
- |
|
36 |
|
- |
|
37 |
class Bazar_carte_google extends PEAR {
|
- |
|
38 |
|
- |
|
39 |
var $option = array();
|
- |
|
40 |
|
- |
|
41 |
function Bazar_carte_google($options) {
|
- |
|
42 |
unset ($options['nom_bdd']); // fout la merde avec google maps v2
|
- |
|
43 |
$this->options = $options;
|
- |
|
44 |
}
|
- |
|
45 |
|
- |
|
46 |
function toHTML($valeur) {
|
- |
|
47 |
if ($GLOBALS['pas_de_carte']) return;
|
- |
|
48 |
$html = '';
|
- |
|
49 |
$val = $this->options['nom_bdd'];
|
- |
|
50 |
$script = '
|
- |
|
51 |
// Variables globales
|
- |
|
52 |
// cette fonction peut déjà être présente
|
- |
|
53 |
if (typeof(addListener) != \'function\') {
|
- |
|
54 |
// fonction portable pour ajout de listeners
|
- |
|
55 |
function addListener(element, baseName, handler)
|
- |
|
56 |
{
|
- |
|
57 |
if (element.addEventListener) {
|
- |
|
58 |
element.addEventListener(baseName, handler, false) ;
|
- |
|
59 |
} else if (element.attachEvent) {
|
- |
|
60 |
element.attachEvent(\'on\'+baseName, handler) ;
|
- |
|
61 |
}
|
- |
|
62 |
}
|
- |
|
63 |
}
|
- |
|
64 |
var map = null;
|
- |
|
65 |
addListener(window,\'load\',loadMap) ;
|
- |
|
66 |
var geocoder = null;
|
- |
|
67 |
var lat = document.getElementById("latitude");
|
- |
|
68 |
var lon = document.getElementById("longitude");
|
- |
|
69 |
|
- |
|
70 |
function loadMap() {
|
- |
|
71 |
var point = new google.maps.LatLng('.$GLOBALS['_BAZAR_']['ligne_resultat']['bf_latitude'].', '.$GLOBALS['_BAZAR_']['ligne_resultat']['bf_longitude'].');
|
- |
|
72 |
var optionsGoogleMapsv3 = {
|
- |
|
73 |
// On centre la carte sur le languedoc roussillon
|
- |
|
74 |
center: point,
|
- |
|
75 |
zoom: 7,
|
- |
|
76 |
mapTypeId: google.maps.MapTypeId.G_HYBRID_MAP,
|
- |
|
77 |
mapTypeControl: true,
|
- |
|
78 |
scaleControl: true
|
- |
|
79 |
};
|
- |
|
80 |
map = new google.maps.Map(document.getElementById("map"), optionsGoogleMapsv3);
|
- |
|
81 |
|
- |
|
82 |
marker = new google.maps.Marker({
|
- |
|
83 |
position: point,
|
- |
|
84 |
map: map
|
- |
|
85 |
});
|
- |
|
86 |
|
- |
|
87 |
};' ;
|
- |
|
88 |
GEN_stockerCodeScript($script);
|
- |
|
89 |
//GEN_stockerFichierScript('googleMapScript', $this->options['nom_bdd']);
|
- |
|
90 |
GEN_stockerFichierScript('googleMapScript', "http://maps.googleapis.com/maps/api/js?sensor=false&key=".BAZ_GOOGLE_KEY);
|
- |
|
91 |
// On ajoute l attribut load a la balise body
|
- |
|
92 |
//GEN_AttributsBody('onload', 'load()');
|
- |
|
93 |
$html = '<div id="map" style="width: 400px; height: 300px"></div>';
|
- |
|
94 |
return $html;
|
- |
|
95 |
}
|
- |
|
96 |
}
|
- |
|
97 |
|
- |
|
98 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
- |
|
99 |
*
|
- |
|
100 |
* $Log: not supported by cvs2svn $
|
- |
|
101 |
*
|
- |
|
102 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
- |
|
103 |
*/
|
- |
|
104 |
?>
|
- |
|
105 |
|