fixed issue #0000128 : modification des méthodes mappy

This commit is contained in:
Michael RICOIS 2010-01-20 09:21:47 +00:00
parent 0dc905bfcc
commit 11b9b8a195
3 changed files with 69 additions and 14 deletions

View File

@ -3,9 +3,56 @@
define('MAPPY_URL', 'http://pro.mappy.com/BtoB/scoresdecisions/'); define('MAPPY_URL', 'http://pro.mappy.com/BtoB/scoresdecisions/');
function contentSrc($town, $way, $num, $postal_code){ function contentSrc($town, $way, $num, $postal_code){
$return = MAPPY_URL.'photo?photo.town='.$town.';photo.way='.$way.';photo.num='.$num.';photo.postal_code='.$postal_code; return MAPPY_URL.
'photo?photo.town='.urlencode($town).
';photo.way='.urlencode($way).
';photo.num='.$num.
';photo.postal_code='.$postal_code;
} }
function formatVille($nomVille)
{
//Suppression des accents, ponctuation
$nomVille = str_replace(
array('é', 'è', '-'),
array('e', 'e', ' '),
$nomVille
);
return strtoupper($nomVille);
}
$tabVilleMappy = array(
'Bordeaux',
'Caen' ,
'Cannes',
'Grenoble',
'La Baule',
'Lille',
'Lyon',
'Marseille',
'Montpellier',
'Nancy',
'Nantes',
'Nice',
'Rennes',
'Strasbourg',
'Toulouse',
'Asnières-sur-Seine',
'Boulogne-Billancourt',
'Courbevoie',
'Issy-les-Moulineaux',
'Levallois-Perret',
'Montrouge',
'Nanterre',
'Neuilly-sur-Seine',
'Rueil-Malmaison',
'Sèvres',
'Versailles',
'Paris',
);
$tabVilleMappy = array_map('formatVille', $tabVilleMappy);

View File

@ -196,18 +196,22 @@ if($element!==false){ echo dRow($element['lib'], $element['data'], $element['tit
<table> <table>
<?php <?php
//Information géographique //Information géographique
$ville=' '.trim(preg_replace('/([0-9]|BILLANCOURT|SUR.SEINE| PERRET|ARRONDISSEMENT|_)/i',' ',$etab['Ville'])).' '; require_once 'mappy/mappy.php';
$ville = ' '.trim(preg_replace('/([0-9]|ARRONDISSEMENT|_)/i',' ',$etab['Ville'])).' ';
$ville = trim(strtr($ville, array(' EME '=>'', ' ER '=>''))); $ville = trim(strtr($ville, array(' EME '=>'', ' ER '=>'')));
$firephp->log($ville, 'ville');
if (preg_match('/\bMAPPY\b/i', $_SESSION['tabInfo']['pref']) && if ( hasPref('mappy') && in_array(strtoupper($ville), $tabVilleMappy) )
preg_match('/(LILLE|CAEN|RENNES|BAULE|NANTES|NANCY|STRASBOURG|LYON|BORDEAUX|GRENOBLE|MONTPELLIER|TOULOUSE|MARSEILLE|CANNES|NICE|PARIS|NEUILLY|LEVALLOIS|ASNIERES|COURBEVOIE|NANTERRE|REUIL|BOULOGNE|SEVRES|VERSAILLES|MONTROUGE|MOULINEAUX)/', $ville))
{ {
$rue = trim( strtr(
normaliseVoie($etab['AdresseVoie']).' '.$etab['AdresseRue'],
array(' ST '=>' SAINT ',' STE '=>' SAINTE ', )
));
?> ?>
<tr> <tr>
<td width="580" colspan="3"class="StyleInfoData"> <td width="580" colspan="3"class="StyleInfoData">
<table><tr> <table><tr>
<td width="340" height="320"> <td width="340" height="320">
<IFRAME src="http://pro.mappy.com/BtoB/scoresdecisions/photo?photo.town=<?=urlencode($ville)?>;photo.way=<?=urlencode(trim(strtr(normaliseVoie($etab['AdresseVoie']).' '.$etab['AdresseRue'], array( ' ST '=>' SAINT ',' STE '=>' SAINTE ', ))))?>;photo.num=<?=$etab['AdresseNum']*1?>;photo.postal_code=<?=$etab['CP']?>" width="340" height="320" scrolling="no" frameborder="0"></IFRAME> <IFRAME src="<?=contentSrc($ville, $rue, $etab['AdresseNum'], $etab['CP'])?>" width="340" height="320" scrolling="no" frameborder="0"></IFRAME>
</td> </td>
<td width="240"><b>Information g&eacute;ographique :</b><br/> <td width="240"><b>Information g&eacute;ographique :</b><br/>
<? if ($etab['GeoPrecis']>0) { ?> <? if ($etab['GeoPrecis']>0) { ?>

View File

@ -212,18 +212,22 @@ if($element!==false){ echo dRow($element['lib'], $element['data'], $element['tit
<table> <table>
<?php <?php
//Information géographique //Information géographique
$ville=' '.trim(preg_replace('/([0-9]|BILLANCOURT|SUR.SEINE| PERRET|ARRONDISSEMENT|_)/i',' ',$etab['Ville'])).' '; require_once 'mappy/mappy.php';
$ville = ' '.trim(preg_replace('/([0-9]|ARRONDISSEMENT|_)/i',' ',$etab['Ville'])).' ';
$ville = trim(strtr($ville, array(' EME '=>'', ' ER '=>''))); $ville = trim(strtr($ville, array(' EME '=>'', ' ER '=>'')));
$firephp->log($ville, 'ville');
if (preg_match('/\bMAPPY\b/i', $_SESSION['tabInfo']['pref']) && if ( hasPref('mappy') && in_array(strtoupper($ville), $tabVilleMappy) )
preg_match('/(LILLE|CAEN|RENNES|BAULE|NANTES|NANCY|STRASBOURG|LYON|BORDEAUX|GRENOBLE|MONTPELLIER|TOULOUSE|MARSEILLE|CANNES|NICE|PARIS|NEUILLY|LEVALLOIS|ASNIERES|COURBEVOIE|NANTERRE|REUIL|BOULOGNE|SEVRES|VERSAILLES|MONTROUGE|MOULINEAUX)/', $ville))
{ {
$rue = trim( strtr(
normaliseVoie($etab['AdresseVoie']).' '.$etab['AdresseRue'],
array(' ST '=>' SAINT ',' STE '=>' SAINTE ', )
));
?> ?>
<tr> <tr>
<td width="580" colspan="3"class="StyleInfoData"> <td width="580" colspan="3"class="StyleInfoData">
<table><tr> <table><tr>
<td width="340" height="420"> <td width="340" height="320">
<IFRAME src="http://pro.mappy.com/BtoB/scoresdecisions/photo?photo.town=<?=$ville?>;photo.way=<?=trim(strtr(normaliseVoie($etab['AdresseVoie']).' '.$etab['AdresseRue'], array( ' ST '=>' SAINT ',' STE '=>' SAINTE ', )))?>;photo.num=<?=$etab['AdresseNum']*1?>;photo.postal_code=<?=$etab['CP']?>" width="340" height="420" scrolling="no" frameborder="0"></IFRAME> <IFRAME src="<?=contentSrc($ville, $rue, $etab['AdresseNum'], $etab['CP'])?>" width="340" height="320" scrolling="no" frameborder="0"></IFRAME>
</td> </td>
<td width="240"><b>Information g&eacute;ographique :</b><br/> <td width="240"><b>Information g&eacute;ographique :</b><br/>
<? if ($etab['GeoPrecis']>0) { ?> <? if ($etab['GeoPrecis']>0) { ?>