| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
function display_page($mymarkers) { |
|---|
| 4 |
$output = display_header(); |
|---|
| 5 |
$output .= display_markers($mymarkers); |
|---|
| 6 |
$output .= display_body(); |
|---|
| 7 |
print $output; |
|---|
| 8 |
} |
|---|
| 9 |
|
|---|
| 10 |
function display_header() { |
|---|
| 11 |
global $title; |
|---|
| 12 |
global $gmap_key; |
|---|
| 13 |
$output = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" |
|---|
| 14 |
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"; |
|---|
| 15 |
$output .= "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"; |
|---|
| 16 |
$output .= " <head>\n"; |
|---|
| 17 |
$output .= " <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"/>\n"; |
|---|
| 18 |
$output .= " <title>$title</title>\n"; |
|---|
| 19 |
$output .= " <script type=\"text/javascript\" src=\"carte.js\"></script>\n"; |
|---|
| 20 |
$output .= " <script src=\"http://maps.google.com/maps?file=api&v=2\" |
|---|
| 21 |
type=\"text/javascript\"></script>\n"; |
|---|
| 22 |
return $output; |
|---|
| 23 |
} |
|---|
| 24 |
|
|---|
| 25 |
function display_markers($markers) { |
|---|
| 26 |
global $gmap_center; |
|---|
| 27 |
global $gmap_zoom; |
|---|
| 28 |
$output = " <script type=\"text/javascript\">\n"; |
|---|
| 29 |
$output .= " //<![CDATA[\n"; |
|---|
| 30 |
$output .= " gmap_init();\n"; |
|---|
| 31 |
$output .= " function load() {\n"; |
|---|
| 32 |
$output .= " if (GBrowserIsCompatible()) {\n"; |
|---|
| 33 |
$output .= " var map = new GMap2(document.getElementById(\"map\"));\n"; |
|---|
| 34 |
$output .= " map.setCenter(new GLatLng($gmap_center), $gmap_zoom);\n"; |
|---|
| 35 |
$output .= " map.addControl(new GLargeMapControl());\n"; |
|---|
| 36 |
$output .= " map.addControl(new GScaleControl());\n"; |
|---|
| 37 |
$output .= "\n"; |
|---|
| 38 |
$output .= " // Ajoute les points sur la carte\n"; |
|---|
| 39 |
while($marker = array_shift($markers)) { |
|---|
| 40 |
$status = $marker['status']; |
|---|
| 41 |
$coord = $marker['point']; |
|---|
| 42 |
$label = $marker['label']; |
|---|
| 43 |
$output .= " var point = new GLatLng($coord);\n"; |
|---|
| 44 |
$output .= " map.addOverlay(createMarker(point, '$status', '$label'));\n"; |
|---|
| 45 |
} |
|---|
| 46 |
$output .= " }\n"; |
|---|
| 47 |
$output .= " }\n"; |
|---|
| 48 |
$output .= "\n"; |
|---|
| 49 |
$output .= " //]]>\n"; |
|---|
| 50 |
$output .= " </script>\n"; |
|---|
| 51 |
$output .= " </head>\n"; |
|---|
| 52 |
return $output; |
|---|
| 53 |
} |
|---|
| 54 |
|
|---|
| 55 |
function display_body() { |
|---|
| 56 |
$output = " <body onload=\"load()\" onunload=\"GUnload()\">\n"; |
|---|
| 57 |
$output .= " <div id=\"map\" style=\"width: 600px; height: 500px\"></div>\n"; |
|---|
| 58 |
$output .= " </body>\n"; |
|---|
| 59 |
$output .= "</html>\n"; |
|---|
| 60 |
return $output; |
|---|
| 61 |
} |
|---|
| 62 |
?> |
|---|