Line 1... |
Line 1... |
1 |
<?php
|
1 |
<?php
|
2 |
/*vim: set expandtab tabstop=4 shiftwidth=4: */
|
2 |
/*vim: set expandtab tabstop=4 shiftwidth=4: */
|
3 |
// +------------------------------------------------------------------------------------------------------+
|
3 |
// +------------------------------------------------------------------------------------------------------+
|
4 |
// | PHP version 4.1 |
|
4 |
// | PHP version 4.1 |
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
6 |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
|
6 |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
Line 17... |
Line 17... |
17 |
// | |
|
17 |
// | |
|
18 |
// | You should have received a copy of the GNU Lesser General Public |
|
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 |
|
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 |
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
22 |
// CVS : $Id: bazar.carte_google.php,v 1.5.2.4 2008-02-08 08:20:24 alexandre_tb Exp $
|
22 |
// CVS : $Id: bazar.carte_google.php,v 1.9 2008-10-29 15:51:36 alexandre_tb Exp $
|
23 |
/**
|
23 |
/**
|
24 |
*
|
24 |
*
|
25 |
*@package bazar
|
25 |
*@package bazar
|
26 |
//Auteur original :
|
26 |
//Auteur original :
|
27 |
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
|
27 |
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
|
28 |
//Autres auteurs :
|
28 |
//Autres auteurs :
|
29 |
*@copyright Tela-Botanica 2000-2007
|
29 |
*@copyright Tela-Botanica 2000-2007
|
30 |
*@version $Revision: 1.5.2.4 $
|
30 |
*@version $Revision: 1.9 $
|
31 |
// +------------------------------------------------------------------------------------------------------+
|
31 |
// +------------------------------------------------------------------------------------------------------+
|
32 |
*/
|
32 |
*/
|
Line 33... |
Line 33... |
33 |
|
33 |
|
34 |
// +------------------------------------------------------------------------------------------------------+
|
34 |
// +------------------------------------------------------------------------------------------------------+
|
Line 38... |
Line 38... |
38 |
|
38 |
|
39 |
include_once 'configuration/baz_config.inc.php';
|
39 |
include_once 'configuration/baz_config.inc.php';
|
40 |
include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazar.fonct.php';
|
40 |
include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazar.fonct.php';
|
Line -... |
Line 41... |
- |
|
41 |
// Inclusion d'une classe personnalise si elle existe
|
41 |
// Inclusion d'une classe personnalise si elle existe
|
42 |
|
Line -... |
Line 43... |
- |
|
43 |
// Le fichier de script de google map
|
- |
|
44 |
GEN_stockerFichierScript('googleMapScript', 'http://maps.google.com/maps?file=api&v=2&key='.BAZ_GOOGLE_KEY);
|
- |
|
45 |
|
- |
|
46 |
// Le fichier jquery pour le date picker
|
- |
|
47 |
//GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
|
- |
|
48 |
GEN_stockerFichierScript('jquery', 'http://code.jquery.com/jquery-latest.js');
|
- |
|
49 |
GEN_stockerFichierScript('jquery_date_picker', 'api/js/jquery/ui.datepicker.js');
|
- |
|
50 |
GEN_stockerFichierScript('jquery_date_picker_fr', 'api/js/jquery/ui.datepicker-fr.js');
|
- |
|
51 |
|
42 |
|
52 |
GEN_stockerStyleExterne( 'jquery_date_picker_style', 'api/js/jquery/ui.datepicker.css');
|
43 |
GEN_stockerFichierScript('googleMapScript', 'http://maps.google.com/maps?file=api&v=2&key='.BAZ_GOOGLE_KEY);
|
53 |
|
44 |
|
54 |
|
45 |
if (defined('PAP_VERSION')) { //si on est dans Papyrus
|
55 |
if (defined('PAP_VERSION')) { //si on est dans Papyrus
|
46 |
GEN_stockerStyleExterne( 'bazar_interne', 'client/bazar/bazar.interne.css');
|
56 |
GEN_stockerStyleExterne( 'bazar_interne', 'client/bazar/bazar.interne.css');
|
47 |
}
|
57 |
}
|
Line -... |
Line 58... |
- |
|
58 |
$GLOBALS['_BAZAR_']['id_typeannonce']=$GLOBALS['_GEN_commun']['info_application']->id_nature;
|
48 |
$GLOBALS['_BAZAR_']['id_typeannonce']=$GLOBALS['_GEN_commun']['info_application']->id_nature;
|
59 |
$GLOBALS['_BAZAR_']['categorie_nature']=$GLOBALS['_GEN_commun']['info_application']->categorie_nature;
|
- |
|
60 |
// requete sur le bazar pour recuperer les evenements
|
- |
|
61 |
|
- |
|
62 |
$requete_where = '';
|
49 |
$GLOBALS['_BAZAR_']['categorie_nature']=$GLOBALS['_GEN_commun']['info_application']->categorie_nature;
|
63 |
foreach ($_POST as $cle => $valeur) {
|
- |
|
64 |
if (preg_match ('/bazar_filtre_([0-9]+)/', $cle, $sousmotif)) {
|
- |
|
65 |
$variable = $sousmotif[0] ;
|
- |
|
66 |
if ($_POST[$variable] != '*') {
|
- |
|
67 |
$requete_where = ' and bfvl_ce_liste="'.$sousmotif[1].'" and bfvl_valeur="'.$_POST[$variable].'" ';
|
- |
|
68 |
} else {
|
- |
|
69 |
$requete_where = ' and bfvl_ce_liste="'.$sousmotif[1].'" ';
|
- |
|
70 |
}
|
- |
|
71 |
} else {
|
- |
|
72 |
|
- |
|
73 |
}
|
50 |
// requete sur le bazar pour recuperer les evenements
|
74 |
}
|
- |
|
75 |
|
- |
|
76 |
if (isset($_POST['date_debut']) && $_POST['date_debut'] != '') {
|
51 |
|
77 |
|
- |
|
78 |
$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'])).'" )' .
|
- |
|
79 |
' 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'])).'")' .
|
- |
|
80 |
' 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'])).'") ';
|
- |
|
81 |
} else {
|
- |
|
82 |
$requete_date = '((bf_date_debut_validite_fiche <= now( ) AND bf_date_fin_validite_fiche >= now( ))
|
- |
|
83 |
OR (bf_date_fin_validite_fiche = "0000-00-00" AND date_add( bf_date_fin_evenement, INTERVAL 15 DAY ) > now( )) )';
|
52 |
$requete = 'select * from bazar_fiche where ';
|
84 |
}
|
- |
|
85 |
|
- |
|
86 |
$requete = 'SELECT blv_label,blv_valeur, bazar_fiche.*'.
|
53 |
if ($GLOBALS['_BAZAR_']['id_typeannonce'] != '') $requete .= 'bf_ce_nature in ('.$GLOBALS['_BAZAR_']['id_typeannonce'].') and ' ;
|
87 |
' FROM bazar_fiche, bazar_fiche_valeur_liste , bazar_liste_valeurs'.
|
Line 54... |
Line 88... |
54 |
$requete .= ' ((bf_date_debut_validite_fiche<=now() and bf_date_fin_validite_fiche>=now()) or (bf_date_fin_validite_fiche="0000-00-00"' .
|
88 |
' WHERE bf_statut_fiche =1 and bf_id_fiche=bfvl_ce_fiche'.
|
55 |
' ))'.
|
89 |
' and bfvl_ce_liste=blv_ce_liste and bfvl_ce_liste=31 and bfvl_valeur=blv_valeur '.$requete_where.' and '.
|
56 |
' and bf_statut_fiche=1';
|
90 |
$requete_date;
|
Line 65... |
Line 99... |
65 |
// car dans ce cas la seul le second serait visible
|
99 |
// car dans ce cas la seul le second serait visible
|
Line 66... |
Line 100... |
66 |
|
100 |
|
Line 67... |
Line 101... |
67 |
$donnees = array();
|
101 |
$donnees = array();
|
68 |
|
102 |
|
- |
|
103 |
if ($resultat->numRows() != 0) {
|
69 |
if ($resultat->numRows() != 0) {
|
104 |
$script_marker = '';
|
70 |
$script_marker = '';
|
105 |
$couleur_drapeau = array ( 1 => 'bleu', 2 => 'vert', 3 => 'orange', 4 => 'rose');
|
71 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
106 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
72 |
if ($ligne['bf_latitude'] == 0 && $ligne['bf_longitude'] == 0) continue;
|
107 |
if ($ligne['bf_latitude'] == 0 && $ligne['bf_longitude'] == 0) continue;
|
73 |
$cle = $ligne['bf_latitude'].'-'.$ligne['bf_longitude'];
|
108 |
$cle = $ligne['bf_latitude'].'-'.$ligne['bf_longitude'];
|
74 |
$donnees[$cle][] = $ligne;
|
109 |
$donnees[$cle][] = $ligne;
|
75 |
}
|
110 |
}
|
76 |
foreach ($donnees as $valeur) {
|
111 |
foreach ($donnees as $valeur) {
|
77 |
// cas un : une seule entree pour le point de coordonnees
|
112 |
// cas un : une seule entree pour le point de coordonnees
|
- |
|
113 |
if (count ($valeur) == 1) {
|
- |
|
114 |
$chaine = $valeur[0];
|
- |
|
115 |
|
- |
|
116 |
$script_marker .= 'var icon = new GIcon(G_DEFAULT_ICON);
|
- |
|
117 |
icon.image = "client/bazar/images/drapeau_'.$couleur_drapeau[$chaine['blv_valeur']].'.png";'."\n".'
|
- |
|
118 |
icon.shadow = "http://www.google.com/mapfiles/shadow50.png";
|
- |
|
119 |
icon.iconSize = new GSize(16, 16);
|
- |
|
120 |
icon.shadowSize = new GSize(16, 16);
|
78 |
if (count ($valeur) == 1) {
|
121 |
icon.iconAnchor = new GPoint(6, 16);
|
79 |
$chaine = $valeur[0];
|
122 |
icon.infoWindowAnchor = new GPoint(5, 1);'."\n";
|
80 |
$script_marker .= "\t".'point = new GLatLng('.$chaine['bf_latitude'].','.$chaine['bf_longitude'].');'."\n"
|
123 |
$script_marker .= "\t".'point = new GLatLng('.$chaine['bf_latitude'].','.$chaine['bf_longitude'].');'."\n"
|
81 |
."\t".'map.addOverlay(createMarker(point, \''.'<div class="BAZ_cadre_map">'.
|
124 |
."\t".'map.addOverlay(createMarker(point, \''.'<div class="BAZ_cadre_map">'.
|
82 |
preg_replace ('/\n/', '', str_replace ("\r\n", '',
|
125 |
preg_replace ('/\n/', '', str_replace ("\r\n", '',
|
83 |
str_replace ("'", "\'", baz_voir_fiche(0, $chaine['bf_id_fiche'])))).'</div>\'));'."\n";
|
126 |
str_replace ("'", "\'", baz_voir_fiche(0, $chaine['bf_id_fiche'])))).'</div>\',icon));'."\n";
|
84 |
} else { // Cas 2 plusieurs entrees
|
127 |
} else { // Cas 2 plusieurs entrees
|
85 |
$tableau_id = array();
|
128 |
$tableau_id = array();
|
86 |
foreach ($valeur as $val) {
|
129 |
foreach ($valeur as $val) {
|
- |
|
130 |
array_push ($tableau_id, $val['bf_id_fiche']);
|
- |
|
131 |
}
|
- |
|
132 |
$script_marker .= 'var icon = new GIcon();
|
- |
|
133 |
icon.image = "http://www.tela-botanica.org/client/bazar/images/drapeau_'.$couleur_drapeau[$chaine['blv_valeur']].'.png";
|
- |
|
134 |
icon.shadow = "http://www.google.com/mapfiles/shadow50.png";
|
- |
|
135 |
icon.iconSize = new GSize(16, 16);
|
- |
|
136 |
icon.shadowSize = new GSize(37, 34);
|
87 |
array_push ($tableau_id, $val['bf_id_fiche']);
|
137 |
icon.iconAnchor = new GPoint(6, 34);
|
88 |
}
|
138 |
icon.infoWindowAnchor = new GPoint(5, 1);';
|
89 |
$script_marker .= "\t".'point = new GLatLng('.$val['bf_latitude'].','.$val['bf_longitude'].');'."\n"
|
139 |
$script_marker .= "\t".'point = new GLatLng('.$val['bf_latitude'].','.$val['bf_longitude'].');'."\n"
|
90 |
."\t".'map.addOverlay(createMarker(point, \''.'<div class="BAZ_cadre_map">'.
|
140 |
."\t".'map.addOverlay(createMarker(point, \''.'<div class="BAZ_cadre_map">'.
|
91 |
preg_replace ('/\n/', '', str_replace ("\r\n", '',
|
141 |
preg_replace ('/\n/', '', str_replace ("\r\n", '',
|
92 |
str_replace ("'", "\'", baz_voir_fiches(0, $tableau_id)))).'</div>\'));'."\n";
|
142 |
str_replace ("'", "\'", baz_voir_fiches(0, $tableau_id)))).'</div>\', icon));'."\n";
|
93 |
}
|
143 |
}
|
94 |
}
|
144 |
}
|
95 |
} else {
|
145 |
} else {
|
Line 96... |
Line 146... |
96 |
$script_marker = '';
|
146 |
$script_marker = '';
|
97 |
}
|
147 |
}
|
- |
|
148 |
|
- |
|
149 |
$script = ' // Variables globales
|
- |
|
150 |
var map = null;
|
- |
|
151 |
// cette fonction peut déjà être présente
|
- |
|
152 |
if (typeof(addListener) != \'function\') {
|
- |
|
153 |
// fonction portable pour ajout de listeners
|
- |
|
154 |
function addListener(element, baseName, handler)
|
- |
|
155 |
{
|
- |
|
156 |
if (element.addEventListener) {
|
- |
|
157 |
element.addEventListener(baseName, handler, false) ;
|
- |
|
158 |
} else if (element.attachEvent) {
|
- |
|
159 |
element.attachEvent(\'on\'+baseName, handler) ;
|
- |
|
160 |
}
|
98 |
|
161 |
}
|
99 |
$script = ' // Variables globales
|
162 |
}
|
100 |
var map = null;';
|
163 |
addListener(window,\'load\',loadMap) ;';
|
101 |
if (BAZ_GOOGLE_MAXIMISE_TAILLE) $script .= '
|
164 |
if (BAZ_GOOGLE_MAXIMISE_TAILLE) $script .= '
|
102 |
// Pour gerer la taille
|
165 |
// Pour gerer la taille
|
Line 124... |
Line 187... |
124 |
setWinHW();
|
187 |
setWinHW();
|
125 |
if (map) map.checkResize();
|
188 |
if (map) map.checkResize();
|
126 |
}';
|
189 |
}';
|
127 |
$script .= '
|
190 |
$script .= '
|
Line 128... |
Line 191... |
128 |
|
191 |
|
129 |
function createMarker(point, chaine) {
|
- |
|
130 |
var icon = new GIcon();
|
- |
|
131 |
icon.image = "http://connaisciences.fr/sites/connaisc/fr/images/marker.png";
|
- |
|
132 |
icon.shadow = "http://www.google.com/mapfiles/shadow50.png";
|
- |
|
133 |
icon.iconSize = new GSize(20, 34);
|
- |
|
134 |
icon.shadowSize = new GSize(37, 34);
|
- |
|
135 |
icon.iconAnchor = new GPoint(6, 34);
|
- |
|
- |
|
192 |
function createMarker(point, chaine, icon) {
|
136 |
icon.infoWindowAnchor = new GPoint(5, 1);
|
193 |
|
137 |
var marker = new GMarker(point, icon);
|
194 |
var marker = new GMarker(point, icon);
|
138 |
GEvent.addListener(marker, "click", function() {
|
195 |
GEvent.addListener(marker, "click", function() {
|
139 |
marker.openInfoWindowHtml(chaine);
|
196 |
marker.openInfoWindowHtml(chaine);
|
140 |
});
|
197 |
});
|
141 |
return marker;
|
198 |
return marker;
|
142 |
}
|
199 |
}
|
143 |
function load() {';
|
200 |
function loadMap() {';
|
144 |
if (BAZ_GOOGLE_MAXIMISE_TAILLE) $script .= '
|
201 |
if (BAZ_GOOGLE_MAXIMISE_TAILLE) $script .= '
|
145 |
setWinHW();';
|
202 |
setWinHW();';
|
146 |
$script .= '
|
203 |
$script .= '
|
147 |
if (GBrowserIsCompatible()) {
|
204 |
if (GBrowserIsCompatible()) {
|
Line 165... |
Line 222... |
165 |
}
|
222 |
}
|
166 |
$script .= '
|
223 |
$script .= '
|
167 |
}
|
224 |
}
|
168 |
};
|
225 |
};
|
169 |
';
|
226 |
';
|
- |
|
227 |
|
170 |
GEN_stockerCodeScript($script);
|
228 |
GEN_stockerCodeScript($script);
|
171 |
// On ajoute l attribut load a la balise body
|
229 |
// On ajoute l attribut load a la balise body
|
172 |
GEN_AttributsBody('onload', 'load()');
|
230 |
//GEN_AttributsBody('onload', 'load()');
|
- |
|
231 |
|
- |
|
232 |
|
Line 173... |
Line 233... |
173 |
|
233 |
|
Line 174... |
Line 234... |
174 |
function afficherContenuCorps() {
|
234 |
function afficherContenuCorps() {
|
175 |
|
235 |
|