Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1629 alexandre_ 1
<?php
2
$requete = 'select * from annuaire where a_est_structure=1';
3
$resultat = $GLOBALS['ins_db']->query ($requete);
4
 
5
if (DB::isError ($resultat)) {
6
	echo $resultat->getMessage().'<br />'.$resultat->getDebugInfo();
7
}
8
 
9
$donnees = array();
10
$script_marker = '';
11
if ($resultat->numRows() != 0) {
12
	$script_marker = '';
13
	while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
14
		if ($ligne['a_latitude'] == 0 && $ligne['a_longitude'] == 0) continue;
15
		$cle = $ligne['a_latitude'].'-'.$ligne['a_longitude'];
16
		$donnees[$cle][] = $ligne;
17
	}
18
	foreach ($donnees as $valeur) {
19
		// cas un : une seule entree pour le point de coordonnees
20
		$script_icon = 'var icon = new GIcon();
21
					icon.image = "'.INS_CHEMIN_APPLI.'presentation/marker.png";
22
					icon.shadow = "http://www.google.com/mapfiles/shadow50.png";
23
					icon.iconSize = new GSize(20, 34);
24
					icon.shadowSize = new GSize(37, 34);
25
					icon.iconAnchor = new GPoint(6, 34);
26
					icon.infoWindowAnchor = new GPoint(5, 1);';
27
		if (count ($valeur) == 1) {
28
			$chaine = $valeur[0];
29
			$script_marker .= $script_icon;
30
			$script_marker .= "\t".'point = new GLatLng('.$chaine['a_latitude'].','.$chaine['a_longitude'].');'."\n"
31
				."\t".'map.addOverlay(createMarker(point, \''.
32
				preg_replace ('/\n/', '', str_replace ("\r\n", '',
33
					str_replace ("'", "\'", info($chaine['a_id'], 'info')))).'\', icon));'."\n";
34
		} else { // Cas 2 plusieurs entrees
35
			$tableau_id = array();
36
			$script_marker .= "\t".'point = new GLatLng('.$val['a_latitude'].','.$val['a_longitude'].');'."\n"
37
				."\t".'map.addOverlay(createMarker(point, \'';
38
			foreach ($valeur as $val) {
39
				$script_marker .= preg_replace ('/\n/', '', str_replace ("\r\n", '',
40
					str_replace ("'", "\'", info($val['a_id'], 'info'))));
41
			}
42
			$script_marker .= '\', icon));'."\n";
43
		}
44
	}
45
} else {
46
	$script_marker = '';
47
}
48
 
49
?>