Subversion Repositories Applications.papyrus

Rev

Rev 1427 | Blame | 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: carto_google.php,v 1.2 2007-06-25 09:59:03 alexandre_tb Exp $
/**
* Cartographie google du bottin
*
*@package bottin
//Auteur original :
*@author        Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@copyright     Tela-Botanica 2000-2007
*@version       $Revision: 1.2 $ $Date: 2007-06-25 09:59:03 $
// +------------------------------------------------------------------------------------------------------+
*/

// +------------------------------------------------------------------------------------------------------+
// |                                            ENTETE du PROGRAMME                                       |
// +------------------------------------------------------------------------------------------------------+

include_once 'configuration/bottin.config.inc.php';
include_once INS_CHEMIN_APPLI.'bibliotheque/bottin.fonct.php';
// Inclusion d'une classe personnalise si elle existe
if (file_exists (INS_CHEMIN_APPLI.'bibliotheque/inscription.class.local.php')) {
        include_once INS_CHEMIN_APPLI.'bibliotheque/inscription.class.local.php' ;      
} else {
        include_once INS_CHEMIN_APPLI.'bibliotheque/inscription.class.php';
}

$GLOBALS['ins_config']['ic_google_key'] = 'http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAh5MiVKCtb2JEli5I8GRSIhRbQSKaqiLzq_1FqOv3C6TjQ0qw7BS-0YnGUkxsLmj6a2a1z7YsKC-pYg';
GEN_stockerFichierScript('googleMapScript', $GLOBALS['ins_config']['ic_google_key']);



// requete sur l annuaire pour recuperer des coordoonnees

$requete = 'select * from annuaire where a_est_structure=1';
$resultat = $GLOBALS['ins_db']->query ($requete);

if ($resultat->numRows() != 0) {
        $script_marker = '';
        while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
                $id_marker = $ligne['a_id'];
                $script_marker .= "\t".'point = new GLatLng('.$ligne['a_latitude'].','.$ligne['a_longitude'].');'."\n"
                                ."\t".'map.addOverlay(createMarker(point, \''.preg_replace ('/\n/', '', info ($ligne['a_id'], 'info')).'\'));'."\n";
                                
        }
}

$script = '
    // Variables globales
    var map = null;
        var lat = document.getElementById("latitude");
    var lon = document.getElementById("longitude");
    
    function createMarker(point, chaine) {
                var marker = new GMarker(point);
                GEvent.addListener(marker, "click", function() {
                marker.openInfoWindowHtml(chaine);
                });
                return marker;
        }
    function load() {
    if (GBrowserIsCompatible()) {
      map = new GMap2(document.getElementById("map"));
      map.addControl(new GSmallMapControl());
          map.addControl(new GMapTypeControl());
          map.addControl(new GScaleControl());
          map.enableContinuousZoom();
        
          // On centre la carte sur le languedoc roussillon
          center = new GLatLng(43.84245116699036, 3.768310546875);
      map.setCenter(center, 7);
          
      ' .
      $script_marker.'
    }
        };
        // Creates a marker at the given point with the given number label
        
';
GEN_stockerCodeScript($script);

function afficherContenuCorps() {
        
        $res = '<div id="map" style="width: 600px; height: 450px"></div>';
        return $res;
}

/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.1  2007-06-01 13:39:14  alexandre_tb
* version initiale
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/