1
0
This repository has been archived on 2021-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
gallery3-contrib/modules/exif_gps/views/exif_gps_map.html.php

77 lines
3.6 KiB
PHP
Raw Normal View History

2010-03-11 01:39:22 +00:00
<?php defined("SYSPATH") or die("No direct script access.") ?>
<script type="text/javascript" src="http://www.google.com/jsapi?key=<?= module::get_var("exif_gps", "googlemap_api_key"); ?>"></script>
<script type="text/javascript">
google.load("maps", "3",{"other_params":"sensor=false"});
function initialize() {
var latlng = new google.maps.LatLng(0,0);
var myOptions = {
zoom: 1,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
2010-03-11 04:02:19 +00:00
var glatlngbounds = new google.maps.LatLngBounds( ); // This is so we can auto center the map.
2010-03-11 01:39:22 +00:00
<? $counter = 1; ?>
2010-03-11 03:46:30 +00:00
<? foreach ($items as $item) { ?>
2010-03-11 01:39:22 +00:00
<? $item_coordinates = ORM::factory("exif_coordinate")->where("item_id", "=", $item->id)->find(); ?>
2010-03-11 03:46:30 +00:00
glatlngbounds.extend(new google.maps.LatLng(<?=$item_coordinates->latitude; ?>,<?=$item_coordinates->longitude; ?>));
2010-03-11 01:39:22 +00:00
<? if (!isset($currLat)) { ?>
<? $currLat = $item_coordinates->latitude; ?>
<? $currLong = $item_coordinates->longitude; ?>
var marker<?=$counter; ?> = new google.maps.Marker({
position: new google.maps.LatLng(<?=$item_coordinates->latitude; ?>,<?=$item_coordinates->longitude; ?>),
map: map
});
<? $windowContent = "<div class=\\\"g-exif-gps-thumb\\\"><a href=\\\"" .
$item->url() . "\\\">" .
str_replace("\"", "\\\"", $item->thumb_img(array("class" => "g-exif-gps-thumbnail"))) .
"</a></div>"; ?>
<? } elseif (($currLat != $item_coordinates->latitude) && ($currLong != $item_coordinates->longitude)) { ?>
var infowindow<?=$counter; ?> = new google.maps.InfoWindow({
content: "<?=$windowContent; ?>",
size: new google.maps.Size(50,50)
});
google.maps.event.addListener(marker<?=$counter; ?>, 'click', function() {
infowindow<?=$counter; ?>.open(map,marker<?=$counter; ?>);
});
<? $counter++; ?>
<? $currLat = $item_coordinates->latitude; ?>
<? $currLong = $item_coordinates->longitude; ?>
var marker<?=$counter; ?> = new google.maps.Marker({
position: new google.maps.LatLng(<?=$item_coordinates->latitude; ?>,<?=$item_coordinates->longitude; ?>),
map: map
});
<? $windowContent = "<div class=\\\"g-exif-gps-thumb\\\"><a href=\\\"" .
$item->url() . "\\\">" .
str_replace("\"", "\\\"", $item->thumb_img(array("class" => "g-exif-gps-thumbnail"))) .
"</a></div>"; ?>
<? } else { ?>
<? $windowContent = $windowContent . " <div class=\\\"g-exif-gps-thumb\\\"><a href=\\\"" .
$item->url() . "\\\">" .
str_replace("\"", "\\\"", $item->thumb_img(array("class" => "g-exif-gps-thumbnail"))) .
"</a></div>"; ?>
<? } ?>
<? } ?>
var infowindow<?=$counter; ?> = new google.maps.InfoWindow({
content: "<?=$windowContent; ?>",
size: new google.maps.Size(50,50)
});
google.maps.event.addListener(marker<?=$counter; ?>, 'click', function() {
infowindow<?=$counter; ?>.open(map,marker<?=$counter; ?>);
});
2010-03-11 03:46:30 +00:00
map.fitBounds(glatlngbounds);
2010-03-11 01:39:22 +00:00
}
google.setOnLoadCallback(initialize);
</script>
2010-03-16 20:27:24 +00:00
<div id="g-exif-map-header">
<div id="g-exif-map-header-buttons">
<?= $theme->dynamic_top() ?>
</div>
<h1><?= html::clean($title) ?></h1>
</div>
<br />
<div id="map_canvas" style="width:600px; height:480px;"></div>
<?= $theme->dynamic_bottom() ?>