19,7 → 19,7 |
// | 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: bazar.carte_google.php,v 1.5.2.4 2008-02-08 08:20:24 alexandre_tb Exp $ |
// CVS : $Id: bazar.carte_google.php,v 1.9 2008-10-29 15:51:36 alexandre_tb Exp $ |
/** |
* |
*@package bazar |
27,7 → 27,7 |
*@author Alexandre GRANIER <alexandre@tela-botanica.org> |
//Autres auteurs : |
*@copyright Tela-Botanica 2000-2007 |
*@version $Revision: 1.5.2.4 $ |
*@version $Revision: 1.9 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
40,8 → 40,18 |
include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazar.fonct.php'; |
// Inclusion d'une classe personnalise si elle existe |
|
// Le fichier de script de google map |
GEN_stockerFichierScript('googleMapScript', 'http://maps.google.com/maps?file=api&v=2&key='.BAZ_GOOGLE_KEY); |
|
// Le fichier jquery pour le date picker |
//GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js'); |
GEN_stockerFichierScript('jquery', 'http://code.jquery.com/jquery-latest.js'); |
GEN_stockerFichierScript('jquery_date_picker', 'api/js/jquery/ui.datepicker.js'); |
GEN_stockerFichierScript('jquery_date_picker_fr', 'api/js/jquery/ui.datepicker-fr.js'); |
|
GEN_stockerStyleExterne( 'jquery_date_picker_style', 'api/js/jquery/ui.datepicker.css'); |
|
|
if (defined('PAP_VERSION')) { //si on est dans Papyrus |
GEN_stockerStyleExterne( 'bazar_interne', 'client/bazar/bazar.interne.css'); |
} |
49,11 → 59,35 |
$GLOBALS['_BAZAR_']['categorie_nature']=$GLOBALS['_GEN_commun']['info_application']->categorie_nature; |
// requete sur le bazar pour recuperer les evenements |
|
$requete = 'select * from bazar_fiche where '; |
if ($GLOBALS['_BAZAR_']['id_typeannonce'] != '') $requete .= 'bf_ce_nature in ('.$GLOBALS['_BAZAR_']['id_typeannonce'].') and ' ; |
$requete .= ' ((bf_date_debut_validite_fiche<=now() and bf_date_fin_validite_fiche>=now()) or (bf_date_fin_validite_fiche="0000-00-00"' . |
' ))'. |
' and bf_statut_fiche=1'; |
$requete_where = ''; |
foreach ($_POST as $cle => $valeur) { |
if (preg_match ('/bazar_filtre_([0-9]+)/', $cle, $sousmotif)) { |
$variable = $sousmotif[0] ; |
if ($_POST[$variable] != '*') { |
$requete_where = ' and bfvl_ce_liste="'.$sousmotif[1].'" and bfvl_valeur="'.$_POST[$variable].'" '; |
} else { |
$requete_where = ' and bfvl_ce_liste="'.$sousmotif[1].'" '; |
} |
} else { |
|
} |
} |
|
if (isset($_POST['date_debut']) && $_POST['date_debut'] != '') { |
|
$requete_date = '((bf_date_debut_evenement <= "'.date('Y-m-d', strtotime($_POST['date_fin'])).'" and bf_date_debut_evenement >="'.date('Y-m-d', strtotime($_POST['date_debut'])).'" )' . |
' or (bf_date_fin_evenement >="'.date('Y-m-d', strtotime($_POST['date_debut'])).'" and bf_date_fin_evenement <="'.date('Y-m-d', strtotime($_POST['date_fin'])).'")' . |
' or bf_date_debut_evenement <= "'.date('Y-m-d', strtotime($_POST['date_debut'])).'" and bf_date_fin_evenement >= "'.date('Y-m-d', strtotime($_POST['date_fin'])).'") '; |
} else { |
$requete_date = '((bf_date_debut_validite_fiche <= now( ) AND bf_date_fin_validite_fiche >= now( )) |
OR (bf_date_fin_validite_fiche = "0000-00-00" AND date_add( bf_date_fin_evenement, INTERVAL 15 DAY ) > now( )) )'; |
} |
|
$requete = 'SELECT blv_label,blv_valeur, bazar_fiche.*'. |
' FROM bazar_fiche, bazar_fiche_valeur_liste , bazar_liste_valeurs'. |
' WHERE bf_statut_fiche =1 and bf_id_fiche=bfvl_ce_fiche'. |
' and bfvl_ce_liste=blv_ce_liste and bfvl_ce_liste=31 and bfvl_valeur=blv_valeur '.$requete_where.' and '. |
$requete_date; |
$resultat = $GLOBALS['_BAZAR_']['db']->query ($requete); |
|
if (DB::isError($resultat)) { |
68,6 → 102,7 |
|
if ($resultat->numRows() != 0) { |
$script_marker = ''; |
$couleur_drapeau = array ( 1 => 'bleu', 2 => 'vert', 3 => 'orange', 4 => 'rose'); |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) { |
if ($ligne['bf_latitude'] == 0 && $ligne['bf_longitude'] == 0) continue; |
$cle = $ligne['bf_latitude'].'-'.$ligne['bf_longitude']; |
77,19 → 112,34 |
// cas un : une seule entree pour le point de coordonnees |
if (count ($valeur) == 1) { |
$chaine = $valeur[0]; |
|
$script_marker .= 'var icon = new GIcon(G_DEFAULT_ICON); |
icon.image = "client/bazar/images/drapeau_'.$couleur_drapeau[$chaine['blv_valeur']].'.png";'."\n".' |
icon.shadow = "http://www.google.com/mapfiles/shadow50.png"; |
icon.iconSize = new GSize(16, 16); |
icon.shadowSize = new GSize(16, 16); |
icon.iconAnchor = new GPoint(6, 16); |
icon.infoWindowAnchor = new GPoint(5, 1);'."\n"; |
$script_marker .= "\t".'point = new GLatLng('.$chaine['bf_latitude'].','.$chaine['bf_longitude'].');'."\n" |
."\t".'map.addOverlay(createMarker(point, \''.'<div class="BAZ_cadre_map">'. |
preg_replace ('/\n/', '', str_replace ("\r\n", '', |
str_replace ("'", "\'", baz_voir_fiche(0, $chaine['bf_id_fiche'])))).'</div>\'));'."\n"; |
str_replace ("'", "\'", baz_voir_fiche(0, $chaine['bf_id_fiche'])))).'</div>\',icon));'."\n"; |
} else { // Cas 2 plusieurs entrees |
$tableau_id = array(); |
foreach ($valeur as $val) { |
array_push ($tableau_id, $val['bf_id_fiche']); |
} |
$script_marker .= 'var icon = new GIcon(); |
icon.image = "http://www.tela-botanica.org/client/bazar/images/drapeau_'.$couleur_drapeau[$chaine['blv_valeur']].'.png"; |
icon.shadow = "http://www.google.com/mapfiles/shadow50.png"; |
icon.iconSize = new GSize(16, 16); |
icon.shadowSize = new GSize(37, 34); |
icon.iconAnchor = new GPoint(6, 34); |
icon.infoWindowAnchor = new GPoint(5, 1);'; |
$script_marker .= "\t".'point = new GLatLng('.$val['bf_latitude'].','.$val['bf_longitude'].');'."\n" |
."\t".'map.addOverlay(createMarker(point, \''.'<div class="BAZ_cadre_map">'. |
preg_replace ('/\n/', '', str_replace ("\r\n", '', |
str_replace ("'", "\'", baz_voir_fiches(0, $tableau_id)))).'</div>\'));'."\n"; |
str_replace ("'", "\'", baz_voir_fiches(0, $tableau_id)))).'</div>\', icon));'."\n"; |
} |
} |
} else { |
97,7 → 147,20 |
} |
|
$script = ' // Variables globales |
var map = null;'; |
var map = null; |
// 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) ; |
} |
} |
} |
addListener(window,\'load\',loadMap) ;'; |
if (BAZ_GOOGLE_MAXIMISE_TAILLE) $script .= ' |
// Pour gerer la taille |
var winW = 630, winH = 560; |
126,14 → 189,8 |
}'; |
$script .= ' |
|
function createMarker(point, chaine) { |
var icon = new GIcon(); |
icon.image = "http://connaisciences.fr/sites/connaisc/fr/images/marker.png"; |
icon.shadow = "http://www.google.com/mapfiles/shadow50.png"; |
icon.iconSize = new GSize(20, 34); |
icon.shadowSize = new GSize(37, 34); |
icon.iconAnchor = new GPoint(6, 34); |
icon.infoWindowAnchor = new GPoint(5, 1); |
function createMarker(point, chaine, icon) { |
|
var marker = new GMarker(point, icon); |
GEvent.addListener(marker, "click", function() { |
marker.openInfoWindowHtml(chaine); |
140,7 → 197,7 |
}); |
return marker; |
} |
function load() {'; |
function loadMap() {'; |
if (BAZ_GOOGLE_MAXIMISE_TAILLE) $script .= ' |
setWinHW();'; |
$script .= ' |
167,10 → 224,13 |
} |
}; |
'; |
|
GEN_stockerCodeScript($script); |
// On ajoute l attribut load a la balise body |
GEN_AttributsBody('onload', 'load()'); |
//GEN_AttributsBody('onload', 'load()'); |
|
|
|
function afficherContenuCorps() { |
|
include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php'; |