1427 |
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 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
22 |
// CVS : $Id: carto_google.php,v 1.1 2007-06-01 13:39:14 alexandre_tb Exp $
|
|
|
23 |
/**
|
|
|
24 |
* Cartographie google du bottin
|
|
|
25 |
*
|
|
|
26 |
*@package bottin
|
|
|
27 |
//Auteur original :
|
|
|
28 |
*@author Alexandre Granier <alexandre@tela-botanica.org>
|
|
|
29 |
//Autres auteurs :
|
|
|
30 |
*@copyright Tela-Botanica 2000-2007
|
|
|
31 |
*@version $Revision: 1.1 $ $Date: 2007-06-01 13:39:14 $
|
|
|
32 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
33 |
*/
|
|
|
34 |
|
|
|
35 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
36 |
// | ENTETE du PROGRAMME |
|
|
|
37 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
38 |
|
|
|
39 |
include_once 'configuration/bottin.config.inc.php';
|
|
|
40 |
include_once INS_CHEMIN_APPLI.'bibliotheque/bottin.fonct.php';
|
|
|
41 |
// Inclusion d'une classe personnalise si elle existe
|
|
|
42 |
if (file_exists (INS_CHEMIN_APPLI.'bibliotheque/inscription.class.local.php')) {
|
|
|
43 |
include_once INS_CHEMIN_APPLI.'bibliotheque/inscription.class.local.php' ;
|
|
|
44 |
} else {
|
|
|
45 |
include_once INS_CHEMIN_APPLI.'bibliotheque/inscription.class.php';
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
$GLOBALS['ins_config']['ic_google_key'] = 'http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAh5MiVKCtb2JEli5I8GRSIhRbQSKaqiLzq_1FqOv3C6TjQ0qw7BS-0YnGUkxsLmj6a2a1z7YsKC-pYg';
|
|
|
49 |
GEN_stockerFichierScript('googleMapScript', $GLOBALS['ins_config']['ic_google_key']);
|
|
|
50 |
|
|
|
51 |
|
|
|
52 |
|
|
|
53 |
// requete sur l annuaire pour recuperer des coordoonnees
|
|
|
54 |
|
|
|
55 |
$requete = 'select * from annuaire where a_est_structure=1';
|
|
|
56 |
$resultat = $GLOBALS['ins_db']->query ($requete);
|
|
|
57 |
|
|
|
58 |
if ($resultat->numRows() != 0) {
|
|
|
59 |
$script_marker = '';
|
|
|
60 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
|
|
61 |
$id_marker = $ligne['a_id'];
|
|
|
62 |
$script_marker .= "\t".'point = new GLatLng('.$ligne['a_latitude'].','.$ligne['a_longitude'].');'."\n"
|
|
|
63 |
."\t".'map.addOverlay(createMarker(point, \''.preg_replace ('/\n/', '', info ($ligne['a_id'])).'\'));'."\n";
|
|
|
64 |
|
|
|
65 |
}
|
|
|
66 |
}
|
|
|
67 |
|
|
|
68 |
$script = '
|
|
|
69 |
// Variables globales
|
|
|
70 |
var map = null;
|
|
|
71 |
var lat = document.getElementById("latitude");
|
|
|
72 |
var lon = document.getElementById("longitude");
|
|
|
73 |
|
|
|
74 |
function createMarker(point, chaine) {
|
|
|
75 |
var marker = new GMarker(point);
|
|
|
76 |
GEvent.addListener(marker, "click", function() {
|
|
|
77 |
marker.openInfoWindowHtml(chaine);
|
|
|
78 |
});
|
|
|
79 |
return marker;
|
|
|
80 |
}
|
|
|
81 |
function load() {
|
|
|
82 |
if (GBrowserIsCompatible()) {
|
|
|
83 |
map = new GMap2(document.getElementById("map"));
|
|
|
84 |
map.addControl(new GSmallMapControl());
|
|
|
85 |
map.addControl(new GMapTypeControl());
|
|
|
86 |
map.addControl(new GScaleControl());
|
|
|
87 |
map.enableContinuousZoom();
|
|
|
88 |
|
|
|
89 |
// On centre la carte sur le languedoc roussillon
|
|
|
90 |
center = new GLatLng(43.84245116699036, 3.768310546875);
|
|
|
91 |
map.setCenter(center, 7);
|
|
|
92 |
|
|
|
93 |
' .
|
|
|
94 |
$script_marker.'
|
|
|
95 |
}
|
|
|
96 |
};
|
|
|
97 |
// Creates a marker at the given point with the given number label
|
|
|
98 |
|
|
|
99 |
';
|
|
|
100 |
GEN_stockerCodeScript($script);
|
|
|
101 |
|
|
|
102 |
function afficherContenuCorps() {
|
|
|
103 |
|
|
|
104 |
$res = '<div id="map" style="width: 600px; height: 450px"></div>';
|
|
|
105 |
return $res;
|
|
|
106 |
}
|
|
|
107 |
|
|
|
108 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
|
|
109 |
*
|
|
|
110 |
* $Log: not supported by cvs2svn $
|
|
|
111 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
|
|
112 |
*/
|