Décomposition des PDFs survliste

This commit is contained in:
Michael RICOIS 2009-06-23 13:21:46 +00:00
parent abedde5fd8
commit 61d4923ed1
3 changed files with 80 additions and 81 deletions

View File

@ -4,23 +4,16 @@ require_once 'common/dates.php';
require_once 'common/curl.php'; require_once 'common/curl.php';
isset($_REQUEST['q'])? $nomFic = $_REQUEST['q'] : $nomFic = ''; isset($_REQUEST['q'])? $nomFic = $_REQUEST['q'] : $nomFic = '';
isset($_REQUEST['page'])? $page = $_REQUEST['page'] : $page = '';
$nbAnnoncesMin = ($page-1)*100;
$nbAnnoncesMax = $nbAnnoncesMin+100;
if($nomFic == ''){ if($nomFic == ''){
print 'Impossible de générer le document.'; print 'Impossible de générer le document.';
}else{ }else{
require_once 'surveillance/survliste.php'; require_once 'surveillance/survliste.php';
/*
$client = new SoapClient(null, array( 'trace' => 1,
'soap_version' => SOAP_1_1,
'location' => WEBSERVICE_URL,
'uri' => WEBSERVICE_URI,
'login' => $_SESSION['tabInfo']['login'],
'password' => $_SESSION['tabInfo']['password'],
));
*/
//try {
//$O = $client->getListeFichierSurv($_SESSION['tabInfo']['login'], $_SESSION['tabInfo']['prenom'], $nomFic);
$file = PATH_DATA.'/pdf/'.$nomFic; $file = PATH_DATA.'/pdf/'.$nomFic;
$file2 = $file.'.bz2'; $file2 = $file.'.bz2';
if (!file_exists($file)) { if (!file_exists($file)) {
@ -36,11 +29,7 @@ if($nomFic == ''){
} }
bzclose($bz); bzclose($bz);
} }
/*} catch (SoapFault $fault) {
require_once 'soaperror.php';
processSoapFault($client,$fault,$tabInfo);
exit;
}*/
$annonces = readann($file, ''); $annonces = readann($file, '');
$output = ''; $output = '';
@ -66,7 +55,9 @@ if($nomFic == ''){
$count = 0; $count = 0;
if(count($annonces)>0){ if(count($annonces)>0){
foreach($annonces as $annonce){ foreach($annonces as $annonce){
if ($count>0) $output.= '<page pageset="old">'; if ($count>$nbAnnoncesMax) break;
if($count>$nbAnnoncesMin){
$output.= '<page>';
$output.= '<table style="width:100%;">'; $output.= '<table style="width:100%;">';
$output.= '<tr>'; $output.= '<tr>';
$output.= '<td style="width:50%;">Entreprise : '.$annonce['RaisonSociale'].' ('.$annonce['Siren'].')</td>'; $output.= '<td style="width:50%;">Entreprise : '.$annonce['RaisonSociale'].' ('.$annonce['Siren'].')</td>';
@ -88,6 +79,7 @@ if($nomFic == ''){
$output.= '</tr>'; $output.= '</tr>';
$output.= '</table>'; $output.= '</table>';
$output.= '</page>'; $output.= '</page>';
}
$count++; $count++;
} }
} }

View File

@ -66,7 +66,7 @@ else {
Liste des annonces du <?=$dateFic?> Liste des annonces du <?=$dateFic?>
au format <a href="./?page=fichier&nomFic=<?=$nomFic?>" title="<?=$nomFic?>">CSV</a> au format <a href="./?page=fichier&nomFic=<?=$nomFic?>" title="<?=$nomFic?>">CSV</a>
ou au format <a href="./?page=survlisteann&nomFic=<?=$nomFic?>">HTML</a> ou au format <a href="./?page=survlisteann&nomFic=<?=$nomFic?>">HTML</a>
ou au format <a href="./html2pdf.php?q=<?=$nomFic?>" target="_blank">PDF</a> ou au format <a href="./?page=survlisteann&nomFic=<?=$nomFic?>" title="<?=$nomFic?>">PDF</a>
<?=$dejaLu2?> <?=$dejaLu2?>
</td> </td>
</tr> </tr>

View File

@ -24,8 +24,6 @@ else{
} }
} }
try {
$O = $client->getListeFichierSurv($_SESSION['tabInfo']['login'], $_SESSION['tabInfo']['prenom'], $nomFic);
$file = PATH_DATA.'/pdf/'.$nomFic; $file = PATH_DATA.'/pdf/'.$nomFic;
$file2 = $file.'.bz2'; $file2 = $file.'.bz2';
if (!file_exists($file)) { if (!file_exists($file)) {
@ -41,14 +39,10 @@ else{
} }
bzclose($bz); bzclose($bz);
} }
} catch (SoapFault $fault) {
require_once 'soaperror.php';
processSoapFault($client,$fault,$tabInfo);
exit;
}
$annonces = readann($file, $filtre); $annonces = readann($file, $filtre);
$nbAnnonces = count($annonces);
$firephp->log($nbAnnonces, 'count');
?> ?>
<table width="580" border="0" align="left" bgcolor="#FFFFFF"> <table width="580" border="0" align="left" bgcolor="#FFFFFF">
<tr> <tr>
@ -78,6 +72,19 @@ else{
<option value="mmd" <?if ($filtre=='mmd') echo 'selected';?>>Modifications diverses</option> <option value="mmd" <?if ($filtre=='mmd') echo 'selected';?>>Modifications diverses</option>
</select></form></td> </select></form></td>
</tr> </tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Télécharger la liste en pdf</td>
<td width="350" class="StyleInfoData">
<?php
//On souhaite afficher 100 annonces par PDF
$nbPDF = ceil($nbAnnonces/100);
for($i=0;$i<$nbPDF;$i++){ ?>
<a href="./html2pdf.php?q=<?=$nomFic?>&page=<?=$i+1?>"><?=$i+1?></a>
<?php if($i!=$nbPDF-1) print "-"; ?>
<?php } ?>
</td>
</tr>
<tr> <tr>
<td colspan="3">&nbsp;</td> <td colspan="3">&nbsp;</td>
</tr> </tr>