extranet/www/pages/bdf.php

191 lines
4.4 KiB
PHP
Raw Normal View History

2010-01-28 09:32:35 +00:00
<?php
?>
<style>
#center{width:760px; padding-right:10px; padding-left:10px;}
.blockh2{margin:5px; }
</style>
<script>
$(document).ready(function(){
$('#listeModulesD').click(function(){
var display = $('#listeModules').css('display');
if(display=='none') $('#listeModules').css('display', 'block');
else $('#listeModules').css('display', 'none');
});
$('.lienModule').click(function(){
var value = $('input[name=req]').val();
var href = $(this).attr('href');
if(value!='') { $(this).attr('href', href+'&req='+value ); return true; }
else{ alert('Aucun identifiant saisi!'); return false; }
});
});
</script>
<div id="center">
<?php
if( $module=='autres' || $module=='' )
{
?>
<h1>Modules</h1>
<h2>Liste des modules FIBEN / FCC</h2>
<div class="blockh2">
<form name="rFibenM" method="post" action="#">
<label>Identifiant</label> <input type="text" name="req" value="<?=$req?>"/>
<span>SIREN ou cl<EFBFBD> BDF</span><br/>
<a href='#' id="listeModulesD">Afficher/masquer la liste des modules</a>
<ul id="listeModules">
<?php
$listModules = bdf_modules_fiben();
foreach($listModules as $id => $module)
{
if($module['liste']!==false){
?>
<li>
<a href="./?page=bdf&siret=<?=$siret?>&module=<?=$id?>" class="lienModule">
<?=$id?>. <?=$module['titre']?>
</a>
</li>
<?php
}
}
?>
<?php
$listModules = bdf_modules_fcc();
foreach($listModules as $id => $module)
{
if($module['liste']!==false){
?>
<li><a href="./?page=bdf&siret=<?=$siret?>&module=<?=$id?>"><?=$id?>. <?=$module['titre']?></a></li>
<?php
}
}
?>
</ul>
</form>
</div>
<br/>
<h2>Recherche FICP</h2>
<div class="blockh2">
<form name="rFicp" method="post" action="./?page=bdf">
<input type="hidden" name="module" value="G"/>
<input type="hidden" name="service" value="ficp"/>
<label>Cl<EFBFBD> BDF</label>
<input type="text" name="req"/>
<input type="submit" name="rFicp" value="Ok"/>
</form>
</div>
<h2>Recherche FCC</h2>
<div class="blockh2">
<form name="rFcc" method="post" action="./?page=bdf">
<input type="hidden" name="service" value="fcc"/>
<label>Mode</label>
<select name="module">
<option value="G">Simplifi<EFBFBD></option>
<option value="D">D<EFBFBD>taill<EFBFBD></option>
</select>
<label>Cl<EFBFBD> BDF</label>
<input type="text" name="req"/>
<input type="submit" name="rFcc" value="Ok"/>
</form>
</div>
<?php
/*
<h2>Recherche FIBEN</h2>
<div class="blockh2">
<form name="rFiben" method="post" action="./?page=bdf">
<input type="hidden" name="module" value="07"/>
<input type="hidden" name="service" value="fiben"/>
<label>Nom recherch<EFBFBD></label>
<input type="text" name="denom"/>
<br/>
<label>Type</label>
<select name="type">
<option value="">Choix</option>
<option value="J">Personne morale</option>
<option value="X">Personne physique</option>
<option value="S">Personne morale sur le sigle</option>
</select>
<br/>
<label>Code d<EFBFBD>partement</label>
<input type="text" size="3" name="code"/>
<br/>
<label>Recherche Etendue</label>
<input type="checkbox" value="O" name="rechet"/>
<br/>
<label>Code Activit<EFBFBD> APE</label>
<input type="text" name="ape"/>
<input type="submit" name="rFiben" value="Ok"/>
</form>
</div>
*/
?>
<?php
}
else
{
$firephp->log($service, 'service');
$firephp->log($module, 'module');
$func_module = 'bdf_modules_'.$service;
$listModules = $func_module();
//V<>rifier que le module existe
if(array_key_exists($module, $listModules))
{
$rech = array();
$rech = array(
'denom' => $denom,
'type' => $type,
'code' => $code,
'rechet' => $rechet,
'ape' => $ape,
);
//http://protectel.scrypto.fr/iBDF/RequeteLanceur.php?Etablissement=12345&Guichet=00001&Utilisateur=Dupont&MDP=&Profil=Agence&Service=FIBEN&Denom=peugeot&Req=&TypeOp=07
$url = bdf_lien_module($module, $service, $req, $rech);
if($module=='07'){
$filename = false;
}
else
{
$filename = PATH_DATA.'/bdf/bdf_'.$service.'_'.$req.'_'.$module.'.html';
}
if($filename!==false && file_exists($filename))
{
$content = file_get_contents($filename);
}
else
{
$content = trim(bdf_loadpage($url));
if( !empty($content) && $filename!==false )
{
if(!file_exists(PATH_DATA.'/bdf')) mkdir(PATH_DATA.'/bdf');
file_put_contents($filename, $content);
}
}
}
$titreModule = $module.'. '.$listModules[$module]['titre'];
?>
<h1>Module <?=$titreModule?></h1>
<div class="blockh2">
<?php
if(!empty($content))
{
echo $content;
}else{
echo 'ERREUR';
}
?>
</div>
<?php
}
?>
</div>
<?php