2010-03-18 11:15:43 +00:00
< div id = " infogeo " class = " clearfix " >
2010-05-07 16:35:12 +00:00
< div id = " infogeo_txt " >
2010-04-16 07:11:24 +00:00
2010-03-17 16:46:28 +00:00
< ? php
2010-03-18 11:15:43 +00:00
$google_map = './?page=referer&part=gmap&siret=' . $siret .
2010-04-12 12:11:20 +00:00
'&url=http://maps.google.fr/maps?f=q%26hl=fr%26geocode=%26q=' .
2010-03-18 11:15:43 +00:00
$etab [ 'AdresseNum' ] . ',+' .
2010-04-12 12:11:20 +00:00
urlencode ( normaliseVoie ( $etab [ 'AdresseVoie' ])) . '+' .
urlencode ( htmlspecialchars_decode ( $etab [ 'AdresseRue' ], ENT_QUOTES )) .
',+' . $etab [ 'CP' ] . '+' .
2010-03-18 11:15:43 +00:00
urlencode ( $etab [ 'Ville' ]);
2010-04-16 07:11:24 +00:00
if ( $etab [ 'GeoPrecis' ] > 0 ) {
print '<span id="geolocalisation">' ;
print '<b>Information géographique :</b><br/>' .
'Latitude : ' . dec2dms ( $etab [ 'GeoLat' ]) . ' (' . $etab [ 'GeoLat' ] . ')<br/>' .
'Longitude : ' . dec2dms ( $etab [ 'GeoLon' ]) . ' (' . $etab [ 'GeoLon' ] . ')<br/>' ;
print '</span>' ;
2010-03-18 11:15:43 +00:00
}
2010-03-17 16:46:28 +00:00
?>
2010-04-16 07:11:24 +00:00
< a id = " lien-google " href = " <?= $google_map ?> " target = " _blank " >
2010-11-16 16:46:38 +00:00
Afficher l & #039;adresse sur Google Map ©</a><br/>
2010-03-18 11:15:43 +00:00
< br />
< b > Code commune / Rivoli :</ b >< br />
2011-10-14 14:49:09 +00:00
< ? php echo $etab [ 'Dept' ] . ' ' . $etab [ 'codeCommune' ] . ' / ' . $etab [ 'Rivoli' ]; ?>
< ? php
if ( is_array ( $etab [ 'InfosIris' ]) && count ( $etab [ 'InfosIris' ]) > 0 ){
$InfosIris = $etab [ 'InfosIris' ];
$codComIris = str_replace ( $InfosIris [ 'codIris' ], '' , $InfosIris [ 'codComIris' ]);
?>
< br />< br />< b > Iris :</ b >
2011-10-14 15:22:21 +00:00
< ? php
if ( $InfosIris [ 'codIris' ] * 1 == 0 ){
?>
< br /> Commune non découpée en Iris
< ? php } else { ?>
2011-10-14 14:49:09 +00:00
< br /> Code : < ? = $codComIris ?> <?=$InfosIris['codIris']?>
2011-10-14 15:22:21 +00:00
< br /> Libellé : < a title = " Consulter le plan d'assemblage de la commune " href = " ./?page=iris&code=<?= $codComIris ?> " target = " _blank " >< ? = $InfosIris [ 'libIris' ] ?> </a>
< img title = " <?= $InfosIris['typIris'] ?> " style = " vertical-align:middle; " src = " img/info.gif " >
2011-10-14 14:49:09 +00:00
< ? php } ?>
2011-10-14 15:22:21 +00:00
< ? php } ?>
2010-03-18 11:15:43 +00:00
</ div >
2010-04-16 07:11:24 +00:00
< ? php
if ( hasPref ( 'mappy' )) {
require_once 'mappy/mappy.php' ;
$photo = '' ;
$ville = ' ' . trim ( preg_replace ( '/([0-9]|ARRONDISSEMENT|_)/i' , ' ' ,
2010-11-16 16:46:38 +00:00
$etab [ 'Ville' ])) . ' ' ;
2010-04-16 07:11:24 +00:00
$ville = trim ( strtr ( $ville , array ( ' EME ' => '' , ' ER ' => '' )));
if ( in_array ( strtoupper ( $ville ), $tabVilleMappy )) {
$rue = trim ( strtr ( normaliseVoie ( $etab [ 'AdresseVoie' ]) . ' ' .
$etab [ 'AdresseRue' ],
array ( ' ST ' => ' SAINT ' , ' STE ' => ' SAINTE ' )));
$source = 'm' ;
} else {
$photo = 'http://cbk0.google.com/cbk?output=thumbnail&w=150&h=69&ll=' .
$etab [ 'GeoLat' ] . ',' . $etab [ 'GeoLon' ];
if ( @ fopen ( $photo , 'r' ) == false ) {
$photo = '' ;
}
$source = 'g' ;
}
2010-11-16 16:46:38 +00:00
?>
2010-05-07 16:35:12 +00:00
< div id = " infogeo_photo " >
2010-11-16 16:46:38 +00:00
< ? php
if ( $source == 'm' ) {
function getToken ( $login , $pwd ) {
2010-04-16 07:11:24 +00:00
2010-11-16 16:46:38 +00:00
$ACCESSOR_URL = 'http://axe.mappy.com/1v1/' ; // Serveur de Production
$timestamp = time ();
$hash = md5 ( $login . " @ " . $pwd . " @ " . $timestamp );
$preToken = $login . " @ " . $timestamp . " @ " . $hash ;
$urlGetToken = $ACCESSOR_URL . 'token/generate.aspx?auth=' .
urlencode ( $preToken ) . '&ip=' . urlencode ( $_SERVER [ " REMOTE_ADDR " ]);
$fh = @ fopen ( $urlGetToken , 'rb' ) ;
if ( $fh == false ) {
return false ;
}
$token = '' ;
while ( ! feof ( $fh )) {
$token .= fread ( $fh , 8192 );
}
fclose ( $fh );
return $token ;
2010-04-16 07:11:24 +00:00
}
2010-11-16 16:46:38 +00:00
$token = getToken ( 'scoresdecisions' , 'g1nq3iKv' );
if ( $token == false ) {
print " Error while getting the token " ;
}
?>
< div >
< img id = " pp-cb-thumb " width = " 300px " />
</ div >
< script src = " http://axe.mappy.com/1v1/init/get.aspx?auth=<?= $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 = " <?= $etab['AdresseNum'] ?> <?= $rue ?> <?= $ville ?> " ;
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
} else if ( $photo != '' ) {
?>
< div id = " legende-photo " >
Cliché à l & #039;approche de l'adresse postale.
</ div >
< div >
< img id = " pp-cb-thumb " src = " <?= $photo ?> " width = " 300px " height = " 128px " />
</ div >
< ? php
switch ( $_SERVER [ 'SERVER_NAME' ]) {
case 'extranet.devlocal.com' :
$key = 'ABQIAAAAgaXnaVXxxcgebvrN30E-VhT6B-FIN0IQI1kCChCUYV6RpBO17hTl__Sqiv_xQZFCiaRgHAoc_v9HcQ' ;
break ;
case 'extranetrec.scores-decisions.com' :
$key = 'ABQIAAAAuKBtUyFonYJBl1fqfc78tRQQcNgS-tLiAG-ic2CW9PypgC_xRhTjSL9-5iBPvj3GA1_AvZYQU_QR3Q' ;
break ;
case 'extranet.scores-decisions.com' :
$key = 'ABQIAAAAuKBtUyFonYJBl1fqfc78tRSYaqxLwFTMDT_MtTSFor1bsUZ_ChTvuzyTINkPMlW88Ar9fofaphzN3w' ;
break ;
default :
$key = '' ;
break ;
}
?>
2010-04-16 07:11:24 +00:00
2010-03-18 11:15:43 +00:00
< script type = " text/javascript "
2010-04-16 07:11:24 +00:00
src = " http://maps.google.com/maps?file=api&v=2&key=<?= $key ?> " >
2010-03-18 11:15:43 +00:00
</ script >
< script type = " text/javascript " >
2010-04-16 07:11:24 +00:00
function showPanoData ( panoData ) {
2010-03-18 11:15:43 +00:00
if ( panoData . code != 200 ) {
2010-04-16 07:11:24 +00:00
return ;
2010-03-18 11:15:43 +00:00
}
2010-05-19 15:08:00 +00:00
$ ( '#pp-cb-thumb' ) . replaceWith (
'<div id="pp-cb-thumb"><div class="left">' +
'<img src="http://maps.google.fr/cbk?output=tile&panoid=' +
2010-04-16 07:11:24 +00:00
panoData . location . panoId +
2010-05-19 15:08:00 +00:00
'&zoom=1&x=0&y=0&cb_client=maps_sv" />' +
'</div>' +
'<div class="right">' +
'<img src="http://maps.google.fr/cbk?output=tile&panoid=' +
2010-04-16 07:11:24 +00:00
panoData . location . panoId +
2010-05-19 15:08:00 +00:00
'&zoom=1&x=1&y=0&cb_client=maps_sv" />' +
'</div></div>' );
2010-06-08 16:40:22 +00:00
$ ( '#legende-photo' ) . css ( 'display' , 'block' );
$ ( '#pp-cb-thumb' ) . css ( 'display' , 'block' );
2010-04-16 07:11:24 +00:00
}
function doShowPanoData ( ll ) {
2010-03-18 11:15:43 +00:00
var panoClient = new GStreetviewClient ();
panoClient . getNearestPanorama ( ll , showPanoData );
2010-04-16 07:11:24 +00:00
}
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
print '"' . urlencode ( $etab [ 'AdresseNum' ] . ' ' .
$etab [ 'AdresseRue' ] . ' ' .
$etab [ 'CP' ] . ' ' .
$etab [ 'Ville' ]) . '"' ;
?> +
" target=_blank> " +
" Afficher l'adresse sur Google Map ©</a> "
);
doShowPanoData ( ll );
}
}
function affichePhoto () {
< ? php
if ( $etab [ 'GeoPrecis' ] < 7 ) {
print 'var geoCoder = new GClientGeocoder;' ;
print 'geoCoder.getLocations("' .
$etab [ 'AdresseNum' ] . ' ' .
$etab [ 'AdresseRue' ] . ' ' .
$etab [ 'CP' ] . ' ' .
$etab [ 'Ville' ] . '", geoCodeCB);' ;
} else {
print 'var ll = new GLatLng(' . $etab [ 'GeoLat' ] . ', ' . $etab [ 'GeoLon' ] . ');' ;
print 'doShowPanoData(ll);' ;
2010-03-18 11:15:43 +00:00
}
2010-04-16 07:11:24 +00:00
?>
}
$ ( document ) . ready ( function () {
if ( $ ( '#pp-cb-thumb' ) . length ) {
affichePhoto ();
}
}
);
2010-03-18 11:15:43 +00:00
</ script >
< ? php
2010-04-16 07:11:24 +00:00
}
2010-03-18 11:15:43 +00:00
?>
</ div >
< ? php
}
?>
2010-04-16 07:11:24 +00:00
</ div >