extranet/www/pages/bdf.php

145 lines
3.1 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?>"/>
2010-02-12 17:59:00 +00:00
<span>SIREN ou clé BDF</span><br/>
2010-01-28 09:32:35 +00:00
<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">
2010-02-12 17:59:00 +00:00
<?=$module['titre']?>
2010-01-28 09:32:35 +00:00
</a>
</li>
<?php
}
}
?>
<?php
$listModules = bdf_modules_fcc();
foreach($listModules as $id => $module)
{
if($module['liste']!==false){
?>
<li><a class="lienModule" href="./?page=bdf&siret=<?=$siret?>&service=fcc&module=<?=$id?>">
2010-02-12 17:59:00 +00:00
<?=$module['titre']?>
</a></li>
2010-01-28 09:32:35 +00:00
<?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"/>
2010-02-12 17:59:00 +00:00
<label>Clé BDF</label>
2010-01-28 09:32:35 +00:00
<input type="text" name="req"/>
<input type="submit" name="rFicp" value="Ok"/>
</form>
</div>
<?php
}
else
{
$firephp->log($service, 'service');
$firephp->log($module, 'module');
$func_module = 'bdf_modules_'.$service;
$listModules = $func_module();
2010-02-12 17:59:00 +00:00
//Vérifier que le module existe
2010-01-28 09:32:35 +00:00
if(array_key_exists($module, $listModules))
{
$rech = array();
$rech = array(
'denom' => $denom,
'type' => $type,
'code' => $code,
'rechet' => $rechet,
'ape' => $ape,
);
$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');
2010-02-16 17:19:21 +00:00
file_put_contents($filename, $content);
2010-01-28 09:32:35 +00:00
}
}
2010-02-16 17:24:27 +00:00
//$content = utf8_encode($content);
2010-01-28 09:32:35 +00:00
}
$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