Subversion Repositories Applications.bazar

Rev

Rev 411 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1                                                                                      |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or                                        |
// | modify it under the terms of the GNU Lesser General Public                                           |
// | License as published by the Free Software Foundation; either                                         |
// | version 2.1 of the License, or (at your option) any later version.                                   |
// |                                                                                                      |
// | This library is distributed in the hope that it will be useful,                                      |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
// | Lesser General Public License for more details.                                                      |
// |                                                                                                      |
// | You should have received a copy of the GNU Lesser General Public                                     |
// | License along with this library; if not, write to the Free Software                                  |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: carte_google.php,v 1.1.2.1 2008-04-16 12:35:25 alexandre_tb Exp $
/**
* 
*@package bazar
//Auteur original :
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
//Autres auteurs :
*@copyright     Tela-Botanica 2000-2008
*@version       $Revision: 1.1.2.1 $
// +------------------------------------------------------------------------------------------------------+
*/

include_once PAP_CHEMIN_API_PEAR.'PEAR.php';


class Bazar_carte_google extends PEAR {
        
        var $option = array();
        
        function Bazar_carte_google($options) {
                $this->options = $options;
        }
        
        function toHTML($valeur) {
                if ($GLOBALS['pas_de_carte']) return;
                $html = '';
                $val = $this->options['nom_bdd'];
        $script = '
    // Variables globales
    // cette fonction peut déjà être présente
        if (typeof(addListener) != \'function\') {
                // fonction portable pour ajout de listeners
                function addListener(element, baseName, handler)
                {
                        if (element.addEventListener) {
                                element.addEventListener(baseName, handler, false) ;
                        } else if (element.attachEvent) {
                                element.attachEvent(\'on\'+baseName, handler) ;
                        }
                }
        }
    var map = null;
    addListener(window,\'load\',loadMap) ;      
        var geocoder = null;
        var lat = document.getElementById("latitude");
    var lon = document.getElementById("longitude");
    
    function load() {
    if (GBrowserIsCompatible()) {
          
      map = new GMap2(document.getElementById("map"), G_HYBRID_MAP);
      
      map.addControl(new GSmallMapControl());
          map.addControl(new GMapTypeControl());
          map.addControl(new GScaleControl());
          map.enableContinuousZoom();
        
          // On centre la carte sur le marqueur
          center = new GLatLng('.$GLOBALS['_BAZAR_']['ligne_resultat']['bf_latitude'].', '.$GLOBALS['_BAZAR_']['ligne_resultat']['bf_longitude'].');
      map.setCenter(center, 7);map.setMapType(G_HYBRID_MAP);
      point = new GLatLng('.$GLOBALS['_BAZAR_']['ligne_resultat']['bf_latitude'].', '.$GLOBALS['_BAZAR_']['ligne_resultat']['bf_longitude'].');
          marker = new GMarker(point, {draggable: true});
          map.addOverlay(marker);
  }
};' ;
        GEN_stockerCodeScript($script);
        GEN_stockerFichierScript('googleMapScript', $this->options['nom_bdd']);
        // On ajoute l attribut load a la balise body
                //GEN_AttributsBody('onload', 'load()');
                $html = '<div id="map" style="width: 400px; height: 300px"></div>';
                return $html;
        }
}

/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>