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.8 2008-09-17 14:08:45 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.8 $ |
*@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,15 → 59,38 |
$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 date_add(bf_date_fin_evenement,interval 15 day)>now()))'. |
' 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); |
|
//trigger_error($requete); |
if (DB::isError($resultat)) { |
return BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage().'<br />'.$resultat->getDebugInfo(), $requete);echo $requete; |
return BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage().'<br />'.$resultat->getDebugInfo(), $requete); |
} |
|
// Le code complique avec ces 2 tableaux sert |
68,6 → 101,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 → 111,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 { |
129,14 → 178,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); |
180,6 → 223,12 |
$modele = new bazarTemplate($GLOBALS['_BAZAR_']['db']); |
$html = $modele->getTemplate(BAZ_TEMPLATE_ACCUEIL_CARTE_GOOGLE, $GLOBALS['_BAZAR_']['langue'], $GLOBALS['_BAZAR_']['categorie_nature']); |
if (PEAR::isError($html)) return $html->getMessage(); |
|
// Nettoyage url |
$GLOBALS['_BAZAR_'] ['url']->removeQueryString(BAZ_VARIABLE_ID_FICHE); |
$GLOBALS['_BAZAR_'] ['url']->removeQueryString(BAZ_VARIABLE_ACTION); |
$html = bazar::getFormulaireFiltre($html); |
|
$res = str_replace ('{CARTE}', '<div id="map" style="width: '.BAZ_GOOGLE_IMAGE_LARGEUR. |
'px; height: '.BAZ_GOOGLE_IMAGE_HAUTEUR.'px"></div>', $html); |
|
190,6 → 239,9 |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* Revision 1.8 2008-09-17 14:08:45 alexandre_tb |
* merge depuis aha |
* |
* Revision 1.7 2007-12-14 09:59:15 alexandre_tb |
* Fusion avec la livraison AHA : 14 decembre 2007 |
* |