67 lines
2.3 KiB
PHTML
67 lines
2.3 KiB
PHTML
<?php if ($this->source == 'google'):?>
|
|
<div id="infogeo_photo">
|
|
<div id="legende-photo" style="display: block;">
|
|
Cliché à l'approche de l'adresse postale.
|
|
</div>
|
|
<div>
|
|
<img id="pp-cb-thumb" src="http://cbk0.google.com/cbk?output=thumbnail&w=150&h=69&ll=<?=$this->infos->GeoLat.','.$this->infos->GeoLon?>" width="300px" height="128px" />
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key=<?=$this->googleKey?>"></script>
|
|
<script type="text/javascript">
|
|
function affichePhoto() {
|
|
<?php if ($this->infos->GeoPrecis < 7) {?>
|
|
var geoCoder = new GClientGeocoder;
|
|
geoCoder.getLocations("<?=$this->infos->AdresseNum.' '.
|
|
$this->infos->AdresseRue.' '.
|
|
$this->infos->CP.' '.
|
|
$this->infos->Ville?>", geoCodeCB);
|
|
<?php } else { ?>
|
|
var ll = new GLatLng(<?=$this->infos->GeoLat?>, <?=$this->infos->GeoLon?>);
|
|
doShowPanoData(ll);
|
|
<?php } ?>
|
|
}
|
|
|
|
function geoCodeCB(reponse) {
|
|
if (reponse &&
|
|
reponse.Status.code == 200 &&
|
|
reponse.Placemark.length == 1 &&
|
|
reponse.Placemark[0].AddressDetails.Accuracy > 5) {
|
|
var lat = reponse.Placemark[0].Point.coordinates[1];
|
|
var lon = reponse.Placemark[0].Point.coordinates[0];
|
|
var ll = new GLatLng(lat, lon);
|
|
doShowPanoData(ll);
|
|
}
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
if ($('#pp-cb-thumb').length) {
|
|
affichePhoto();
|
|
}
|
|
});
|
|
</script>
|
|
<?php elseif ($this->source == 'mappy'):?>
|
|
<div><img id="pp-cb-thumb" width="300px" /></div>
|
|
<script src="<?=$this->lienJs?>"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
var photoService = new Mappy.api.visiocity.PhotoService();
|
|
var geo = new Mappy.api.geolocation.Geocoder();
|
|
|
|
var address = "<?=$this->infos->AdresseNum?> <?=$this->infos->AdresseRue?> <?=$this->infos->AdresseVille?>";
|
|
geo.geocode(address, function(result) {
|
|
photoService.search(result[0], "f", serviceHandler);
|
|
}, function(error) {});
|
|
|
|
var serviceHandler = function(result) {
|
|
if (result instanceof Mappy.api.visiocity.Frontage) {
|
|
var current = result.getCurrent();
|
|
var img = $('<img src="' + current.getURL(320, null) +
|
|
'" alt="' + current.getDescription() +
|
|
'" width="300px" />');
|
|
$('#pp-cb-thumb').replaceWith(img);
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
<?php endif;?> |