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.8 2008-09-17 14:08:45 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.8 $
|
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 48... |
Line 58... |
48 |
$GLOBALS['_BAZAR_']['id_typeannonce']=$GLOBALS['_GEN_commun']['info_application']->id_nature;
|
58 |
$GLOBALS['_BAZAR_']['id_typeannonce']=$GLOBALS['_GEN_commun']['info_application']->id_nature;
|
49 |
$GLOBALS['_BAZAR_']['categorie_nature']=$GLOBALS['_GEN_commun']['info_application']->categorie_nature;
|
59 |
$GLOBALS['_BAZAR_']['categorie_nature']=$GLOBALS['_GEN_commun']['info_application']->categorie_nature;
|
50 |
// requete sur le bazar pour recuperer les evenements
|
60 |
// requete sur le bazar pour recuperer les evenements
|
51 |
|
61 |
|
52 |
$requete = 'select * from bazar_fiche where ';
|
62 |
$requete_where = '';
|
- |
|
63 |
foreach ($_POST as $cle => $valeur) {
|
- |
|
64 |
if (preg_match ('/bazar_filtre_([0-9]+)/', $cle, $sousmotif)) {
|
53 |
if ($GLOBALS['_BAZAR_']['id_typeannonce'] != '') $requete .= 'bf_ce_nature in ('.$GLOBALS['_BAZAR_']['id_typeannonce'].') and ' ;
|
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 |
}
|
Line -... |
Line 71... |
- |
|
71 |
} else {
|
- |
|
72 |
|
- |
|
73 |
}
|
- |
|
74 |
}
|
- |
|
75 |
|
- |
|
76 |
if (isset($_POST['date_debut']) && $_POST['date_debut'] != '') {
|
- |
|
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( )) )';
|
- |
|
84 |
}
|
- |
|
85 |
$requete = 'SELECT blv_label,blv_valeur, bazar_fiche.*'.
|
- |
|
86 |
' FROM bazar_fiche, bazar_fiche_valeur_liste , bazar_liste_valeurs'.
|
54 |
$requete .= ' ((bf_date_debut_validite_fiche<=now() and bf_date_fin_validite_fiche>=now()) or (bf_date_fin_validite_fiche="0000-00-00"' .
|
87 |
' WHERE bf_statut_fiche =1 and bf_id_fiche=bfvl_ce_fiche'.
|
55 |
' and date_add(bf_date_fin_evenement,interval 15 day)>now()))'.
|
88 |
' 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';
|
89 |
$requete_date;
|
Line 57... |
Line 90... |
57 |
$resultat = $GLOBALS['_BAZAR_']['db']->query ($requete);
|
90 |
$resultat = $GLOBALS['_BAZAR_']['db']->query ($requete);
|
58 |
|
91 |
//trigger_error($requete);
|
59 |
if (DB::isError($resultat)) {
|
92 |
if (DB::isError($resultat)) {
|
Line 60... |
Line 93... |
60 |
return BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage().'<br />'.$resultat->getDebugInfo(), $requete);echo $requete;
|
93 |
return BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage().'<br />'.$resultat->getDebugInfo(), $requete);
|
Line 61... |
Line 94... |
61 |
}
|
94 |
}
|
62 |
|
95 |
|
- |
|
96 |
// Le code complique avec ces 2 tableaux sert
|
63 |
// Le code complique avec ces 2 tableaux sert
|
97 |
// a ne pas mettre 2 points aux memes coordonnees
|
64 |
// a ne pas mettre 2 points aux memes coordonnees
|
98 |
// car dans ce cas la seul le second serait visible
|
65 |
// car dans ce cas la seul le second serait visible
|
99 |
|
66 |
|
100 |
$donnees = array();
|
67 |
$donnees = array();
|
101 |
|
68 |
|
102 |
if ($resultat->numRows() != 0) {
|
69 |
if ($resultat->numRows() != 0) {
|
103 |
$script_marker = '';
|
70 |
$script_marker = '';
|
104 |
$couleur_drapeau = array ( 1 => 'bleu', 2 => 'vert', 3 => 'orange', 4 => 'rose');
|
71 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
105 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
- |
|
106 |
if ($ligne['bf_latitude'] == 0 && $ligne['bf_longitude'] == 0) continue;
|
- |
|
107 |
$cle = $ligne['bf_latitude'].'-'.$ligne['bf_longitude'];
|
- |
|
108 |
$donnees[$cle][] = $ligne;
|
- |
|
109 |
}
|
- |
|
110 |
foreach ($donnees as $valeur) {
|
- |
|
111 |
// cas un : une seule entree pour le point de coordonnees
|
- |
|
112 |
if (count ($valeur) == 1) {
|
- |
|
113 |
$chaine = $valeur[0];
|
72 |
if ($ligne['bf_latitude'] == 0 && $ligne['bf_longitude'] == 0) continue;
|
114 |
|
73 |
$cle = $ligne['bf_latitude'].'-'.$ligne['bf_longitude'];
|
115 |
$script_marker .= 'var icon = new GIcon(G_DEFAULT_ICON);
|
74 |
$donnees[$cle][] = $ligne;
|
116 |
icon.image = "client/bazar/images/drapeau_'.$couleur_drapeau[$chaine['blv_valeur']].'.png";'."\n".'
|
75 |
}
|
117 |
icon.shadow = "http://www.google.com/mapfiles/shadow50.png";
|
76 |
foreach ($donnees as $valeur) {
|
118 |
icon.iconSize = new GSize(16, 16);
|
77 |
// cas un : une seule entree pour le point de coordonnees
|
119 |
icon.shadowSize = new GSize(16, 16);
|
78 |
if (count ($valeur) == 1) {
|
120 |
icon.iconAnchor = new GPoint(6, 16);
|
79 |
$chaine = $valeur[0];
|
121 |
icon.infoWindowAnchor = new GPoint(5, 1);'."\n";
|
80 |
$script_marker .= "\t".'point = new GLatLng('.$chaine['bf_latitude'].','.$chaine['bf_longitude'].');'."\n"
|
122 |
$script_marker .= "\t".'point = new GLatLng('.$chaine['bf_latitude'].','.$chaine['bf_longitude'].');'."\n"
|
- |
|
123 |
."\t".'map.addOverlay(createMarker(point, \''.'<div class="BAZ_cadre_map">'.
|
- |
|
124 |
preg_replace ('/\n/', '', str_replace ("\r\n", '',
|
- |
|
125 |
str_replace ("'", "\'", baz_voir_fiche(0, $chaine['bf_id_fiche'])))).'</div>\',icon));'."\n";
|
- |
|
126 |
} else { // Cas 2 plusieurs entrees
|
- |
|
127 |
$tableau_id = array();
|
- |
|
128 |
foreach ($valeur as $val) {
|
- |
|
129 |
array_push ($tableau_id, $val['bf_id_fiche']);
|
81 |
."\t".'map.addOverlay(createMarker(point, \''.'<div class="BAZ_cadre_map">'.
|
130 |
}
|
82 |
preg_replace ('/\n/', '', str_replace ("\r\n", '',
|
131 |
$script_marker .= 'var icon = new GIcon();
|
83 |
str_replace ("'", "\'", baz_voir_fiche(0, $chaine['bf_id_fiche'])))).'</div>\'));'."\n";
|
132 |
icon.image = "http://www.tela-botanica.org/client/bazar/images/drapeau_'.$couleur_drapeau[$chaine['blv_valeur']].'.png";
|
84 |
} else { // Cas 2 plusieurs entrees
|
133 |
icon.shadow = "http://www.google.com/mapfiles/shadow50.png";
|
85 |
$tableau_id = array();
|
134 |
icon.iconSize = new GSize(16, 16);
|
86 |
foreach ($valeur as $val) {
|
135 |
icon.shadowSize = new GSize(37, 34);
|
87 |
array_push ($tableau_id, $val['bf_id_fiche']);
|
136 |
icon.iconAnchor = new GPoint(6, 34);
|
88 |
}
|
137 |
icon.infoWindowAnchor = new GPoint(5, 1);';
|
89 |
$script_marker .= "\t".'point = new GLatLng('.$val['bf_latitude'].','.$val['bf_longitude'].');'."\n"
|
138 |
$script_marker .= "\t".'point = new GLatLng('.$val['bf_latitude'].','.$val['bf_longitude'].');'."\n"
|
Line 127... |
Line 176... |
127 |
setWinHW();
|
176 |
setWinHW();
|
128 |
if (map) map.checkResize();
|
177 |
if (map) map.checkResize();
|
129 |
}';
|
178 |
}';
|
130 |
$script .= '
|
179 |
$script .= '
|
Line 131... |
Line 180... |
131 |
|
180 |
|
132 |
function createMarker(point, chaine) {
|
- |
|
133 |
var icon = new GIcon();
|
- |
|
134 |
icon.image = "http://connaisciences.fr/sites/connaisc/fr/images/marker.png";
|
- |
|
135 |
icon.shadow = "http://www.google.com/mapfiles/shadow50.png";
|
- |
|
136 |
icon.iconSize = new GSize(20, 34);
|
- |
|
137 |
icon.shadowSize = new GSize(37, 34);
|
- |
|
138 |
icon.iconAnchor = new GPoint(6, 34);
|
- |
|
- |
|
181 |
function createMarker(point, chaine,icon) {
|
139 |
icon.infoWindowAnchor = new GPoint(5, 1);
|
182 |
|
140 |
var marker = new GMarker(point, icon);
|
183 |
var marker = new GMarker(point, icon);
|
141 |
GEvent.addListener(marker, "click", function() {
|
184 |
GEvent.addListener(marker, "click", function() {
|
142 |
marker.openInfoWindowHtml(chaine);
|
185 |
marker.openInfoWindowHtml(chaine);
|
143 |
});
|
186 |
});
|
Line 176... |
Line 219... |
176 |
|
219 |
|
Line 177... |
Line 220... |
177 |
function afficherContenuCorps() {
|
220 |
function afficherContenuCorps() {
|
178 |
|
221 |
|
179 |
include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php';
|
222 |
include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php';
|
180 |
$modele = new bazarTemplate($GLOBALS['_BAZAR_']['db']);
|
223 |
$modele = new bazarTemplate($GLOBALS['_BAZAR_']['db']);
|
- |
|
224 |
$html = $modele->getTemplate(BAZ_TEMPLATE_ACCUEIL_CARTE_GOOGLE, $GLOBALS['_BAZAR_']['langue'], $GLOBALS['_BAZAR_']['categorie_nature']);
|
- |
|
225 |
if (PEAR::isError($html)) return $html->getMessage();
|
- |
|
226 |
|
- |
|
227 |
// Nettoyage url
|
- |
|
228 |
$GLOBALS['_BAZAR_'] ['url']->removeQueryString(BAZ_VARIABLE_ID_FICHE);
|
- |
|
229 |
$GLOBALS['_BAZAR_'] ['url']->removeQueryString(BAZ_VARIABLE_ACTION);
|
181 |
$html = $modele->getTemplate(BAZ_TEMPLATE_ACCUEIL_CARTE_GOOGLE, $GLOBALS['_BAZAR_']['langue'], $GLOBALS['_BAZAR_']['categorie_nature']);
|
230 |
$html = bazar::getFormulaireFiltre($html);
|
182 |
if (PEAR::isError($html)) return $html->getMessage();
|
231 |
|
Line 183... |
Line 232... |
183 |
$res = str_replace ('{CARTE}', '<div id="map" style="width: '.BAZ_GOOGLE_IMAGE_LARGEUR.
|
232 |
$res = str_replace ('{CARTE}', '<div id="map" style="width: '.BAZ_GOOGLE_IMAGE_LARGEUR.
|
184 |
'px; height: '.BAZ_GOOGLE_IMAGE_HAUTEUR.'px"></div>', $html);
|
233 |
'px; height: '.BAZ_GOOGLE_IMAGE_HAUTEUR.'px"></div>', $html);
|
Line 185... |
Line 234... |
185 |
|
234 |
|
186 |
return $res;
|
235 |
return $res;
|
187 |
}
|
236 |
}
|
- |
|
237 |
|
- |
|
238 |
|
- |
|
239 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
188 |
|
240 |
*
|
189 |
|
241 |
* $Log: not supported by cvs2svn $
|
190 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
242 |
* Revision 1.8 2008-09-17 14:08:45 alexandre_tb
|
191 |
*
|
243 |
* merge depuis aha
|
192 |
* $Log: not supported by cvs2svn $
|
244 |
*
|