Subversion Repositories Applications.bazar

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
386 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: 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
		$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
*
87
* +-- Fin du code ----------------------------------------------------------------------------------------+
88
*/
89
?>