124 lines
5.0 KiB
PHTML
124 lines
5.0 KiB
PHTML
<h2>Localisation géographique</h2>
|
|
<div class="paragraph">
|
|
<div id="infogeo" class="clearfix">
|
|
<div id="infogeo_txt">
|
|
<span id=geolocalisation>
|
|
<b>Information géographique :</b><br/>
|
|
Latitude : <?php echo geoLocalisationLib::dec2dms($this->infos->GeoLat)?> (<?php echo $this->infos->GeoLat;?>)<br />
|
|
Longitude : <?php echo geoLocalisationLib::dec2dms($this->infos->GeoLon)?> (<?php echo $this->infos->GeoLon;?>)<br />
|
|
</span>
|
|
<a id="lien-google" href="<?php echo $this->google_map_link;?>" target="_blank">
|
|
Afficher l'adresse sur Google Map ©</a><br/>
|
|
<br/>
|
|
<b>Code commune / Rivoli :</b><br/>
|
|
<?php print $this->infos->Dept.' '.$this->infos->codeCommune.' / '.$this->infos->Rivoli; ?>
|
|
<?php
|
|
if (count($this->infos->InfosIris)>0){
|
|
$InfosIris = $this->infos->InfosIris;
|
|
$codComIris = str_replace($InfosIris->codIris, '', $InfosIris->codComIris);
|
|
?>
|
|
<br/><br/><b>Iris :</b>
|
|
<?php
|
|
if ($InfosIris->codIris*1 == 0){
|
|
?>
|
|
<br/>Commune non découpée en Iris
|
|
<?php } else {?>
|
|
<br/>Code : <?=$codComIris?> <?=$InfosIris->codIris?>
|
|
<br/>Libellé : <a title="Consulter le plan d'assemblage de la commune" href="<?=$this->url(array('controller'=>'identite', 'action'=>'iris', 'code'=>$codComIris), null, true)?>" target="_blank"><?=$InfosIris->libIris?></a>
|
|
<img title="<?=$InfosIris->typIris?>" style="vertical-align:middle;" src="/themes/default/images/info.gif">
|
|
<?php }?>
|
|
<?php }?>
|
|
</div>
|
|
<?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=<?php echo $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=<?php echo $this->googleKey;?>">
|
|
</script>
|
|
<script type="text/javascript">
|
|
function affichePhoto() {
|
|
<?php
|
|
if ($this->infos->GeoPrecis < 7) {
|
|
print 'var geoCoder = new GClientGeocoder;';
|
|
print 'geoCoder.getLocations("'.
|
|
$this->infos->AdresseNum.' '.
|
|
$this->infos->AdresseRue.' '.
|
|
$this->infos->CP.' '.
|
|
$this->infos->Ville.'", geoCodeCB);';
|
|
} else {
|
|
print 'var ll = new GLatLng('.$this->infos->GeoLat.', '.$this->infos->GeoLon.');';
|
|
print 'doShowPanoData(ll);';
|
|
}
|
|
?>
|
|
}
|
|
|
|
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);
|
|
$("#geolocalisation").
|
|
replaceWith("<b>Information géographique :</b><br/>" +
|
|
"Latitude : " + lat + "<br/>" +
|
|
"Longitude : " + lon + "<br/>"
|
|
);
|
|
$("#lien-google").
|
|
replaceWith(
|
|
"<a href=http://maps.google.fr/maps?q=" +
|
|
"<?php echo $this->info->AdresseNum.'+'.$this->infos->AdresseRue.'+'.
|
|
$this->infos->CP.'+'.$this->infos->Ville;?>" +
|
|
" target=_blank>" +
|
|
"Afficher l'adresse sur Google Map ©</a>"
|
|
);
|
|
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="http://axe.mappy.com/1v1/init/get.aspx?auth=<?php echo $this->token;?>&version=2.01&solution=ajax"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
var photoService = new Mappy.api.visiocity.PhotoService();
|
|
var geo = new Mappy.api.geolocation.Geocoder();
|
|
|
|
var address = "<?php echo $this->AdresseNum;?> <?php echo $this->AdresseRue;?> <?php echo $this->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;?>
|
|
</div>
|
|
</div>
|