Décomposition des PDFs survliste
This commit is contained in:
parent
abedde5fd8
commit
61d4923ed1
@ -4,43 +4,32 @@ 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';
|
||||||
/*
|
$file = PATH_DATA.'/pdf/'.$nomFic;
|
||||||
$client = new SoapClient(null, array( 'trace' => 1,
|
$file2 = $file.'.bz2';
|
||||||
'soap_version' => SOAP_1_1,
|
if (!file_exists($file)) {
|
||||||
'location' => WEBSERVICE_URL,
|
$page = getUrl(WEBSERVICE_URI.'csv/'.$nomFic.'.bz2', '', '', '', false);
|
||||||
'uri' => WEBSERVICE_URI,
|
$body = $page['body'];
|
||||||
'login' => $_SESSION['tabInfo']['login'],
|
$fp=@fopen($file2, 'w');
|
||||||
'password' => $_SESSION['tabInfo']['password'],
|
@fwrite($fp, $body);
|
||||||
));
|
@fclose($fp);
|
||||||
*/
|
$bz = bzopen($file2, "r") or die("Impossible d'ouvrir le fichier $file");
|
||||||
//try {
|
$fp=@fopen($file, 'w');
|
||||||
//$O = $client->getListeFichierSurv($_SESSION['tabInfo']['login'], $_SESSION['tabInfo']['prenom'], $nomFic);
|
while (!feof($bz)) {
|
||||||
$file = PATH_DATA.'/pdf/'.$nomFic;
|
@fwrite($fp, bzread($bz, 4096));
|
||||||
$file2 = $file.'.bz2';
|
|
||||||
if (!file_exists($file)) {
|
|
||||||
$page = getUrl(WEBSERVICE_URI.'csv/'.$nomFic.'.bz2', '', '', '', false);
|
|
||||||
$body = $page['body'];
|
|
||||||
$fp=@fopen($file2, 'w');
|
|
||||||
@fwrite($fp, $body);
|
|
||||||
@fclose($fp);
|
|
||||||
$bz = bzopen($file2, "r") or die("Impossible d'ouvrir le fichier $file");
|
|
||||||
$fp=@fopen($file, 'w');
|
|
||||||
while (!feof($bz)) {
|
|
||||||
@fwrite($fp, bzread($bz, 4096));
|
|
||||||
}
|
|
||||||
bzclose($bz);
|
|
||||||
}
|
}
|
||||||
/*} catch (SoapFault $fault) {
|
bzclose($bz);
|
||||||
require_once 'soaperror.php';
|
}
|
||||||
processSoapFault($client,$fault,$tabInfo);
|
|
||||||
exit;
|
|
||||||
}*/
|
|
||||||
$annonces = readann($file, '');
|
$annonces = readann($file, '');
|
||||||
|
|
||||||
$output = '';
|
$output = '';
|
||||||
@ -66,28 +55,31 @@ 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;
|
||||||
$output.= '<table style="width:100%;">';
|
if($count>$nbAnnoncesMin){
|
||||||
$output.= '<tr>';
|
$output.= '<page>';
|
||||||
$output.= '<td style="width:50%;">Entreprise : '.$annonce['RaisonSociale'].' ('.$annonce['Siren'].')</td>';
|
$output.= '<table style="width:100%;">';
|
||||||
$output.= '<td style="width:50%;"> </td>';
|
$output.= '<tr>';
|
||||||
$output.= '</tr>';
|
$output.= '<td style="width:50%;">Entreprise : '.$annonce['RaisonSociale'].' ('.$annonce['Siren'].')</td>';
|
||||||
$output.= '<tr>';
|
$output.= '<td style="width:50%;"> </td>';
|
||||||
$output.= '<td style="width:50%;">Site : '.$annonce['SiteCnasea'].'</td>';
|
$output.= '</tr>';
|
||||||
$output.= '<td style="width:50%;">Référence : '.$annonce['Ref'].'</td>';
|
$output.= '<tr>';
|
||||||
$output.= '</tr>';
|
$output.= '<td style="width:50%;">Site : '.$annonce['SiteCnasea'].'</td>';
|
||||||
$output.= '<tr>';
|
$output.= '<td style="width:50%;">Référence : '.$annonce['Ref'].'</td>';
|
||||||
$output.= '<td style="width:100%;" colspan="2">BODACC n°'.$annonce['Parution'].' '.$annonce['Bodacc'].' du '.$annonce['DatePar'].' '.$annonce['Tribunal'].'.</td>';
|
$output.= '</tr>';
|
||||||
$output.= '</tr>';
|
$output.= '<tr>';
|
||||||
$output.= '<tr><td style="width:100%;" colspan="2"> </td></tr>';
|
$output.= '<td style="width:100%;" colspan="2">BODACC n°'.$annonce['Parution'].' '.$annonce['Bodacc'].' du '.$annonce['DatePar'].' '.$annonce['Tribunal'].'.</td>';
|
||||||
$output.= '<tr>';
|
$output.= '</tr>';
|
||||||
$output.= '<td style="width:100%;" colspan="2"><b>'.$annonce['Even'].'</b></td>';
|
$output.= '<tr><td style="width:100%;" colspan="2"> </td></tr>';
|
||||||
$output.= '</tr>';
|
$output.= '<tr>';
|
||||||
$output.= '<tr>';
|
$output.= '<td style="width:100%;" colspan="2"><b>'.$annonce['Even'].'</b></td>';
|
||||||
$output.= '<td style="width:100%;" colspan="2">'.$annonce['TexteAnn'].'</td>';
|
$output.= '</tr>';
|
||||||
$output.= '</tr>';
|
$output.= '<tr>';
|
||||||
$output.= '</table>';
|
$output.= '<td style="width:100%;" colspan="2">'.$annonce['TexteAnn'].'</td>';
|
||||||
$output.= '</page>';
|
$output.= '</tr>';
|
||||||
|
$output.= '</table>';
|
||||||
|
$output.= '</page>';
|
||||||
|
}
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,14 +10,14 @@ if (!$_SESSION['connected'])
|
|||||||
else {
|
else {
|
||||||
|
|
||||||
isset($_REQUEST['nomFic'])? $nomFic = $_REQUEST['nomFic'] : $nomFic='' ;
|
isset($_REQUEST['nomFic'])? $nomFic = $_REQUEST['nomFic'] : $nomFic='' ;
|
||||||
|
|
||||||
//Génération liste surveillance
|
//Génération liste surveillance
|
||||||
$ref = $_SESSION['tabInfo']['prenom'];
|
$ref = $_SESSION['tabInfo']['prenom'];
|
||||||
if ( strtolower($_SESSION['tabInfo']['login'])=='cnasea95' ||
|
if ( strtolower($_SESSION['tabInfo']['login'])=='cnasea95' ||
|
||||||
strtolower($_SESSION['tabInfo']['login'])=='cnasea96' ||
|
strtolower($_SESSION['tabInfo']['login'])=='cnasea96' ||
|
||||||
$_SESSION['tabInfo']['idClient']==32
|
$_SESSION['tabInfo']['idClient']==32
|
||||||
) $ref='*';
|
) $ref='*';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$O = $client->getListeFichierSurv($_SESSION['tabInfo']['login'], $ref, $nomFic);
|
$O = $client->getListeFichierSurv($_SESSION['tabInfo']['login'], $ref, $nomFic);
|
||||||
$tabFichier=$O['results'];
|
$tabFichier=$O['results'];
|
||||||
@ -51,7 +51,7 @@ else {
|
|||||||
<?php
|
<?php
|
||||||
$tabTmp=explode('_', $nomFic);// surveillanceBodacc_SURBODTSTFTSCNASEA_20081223.csv html
|
$tabTmp=explode('_', $nomFic);// surveillanceBodacc_SURBODTSTFTSCNASEA_20081223.csv html
|
||||||
$dateFic=Wdate::dateT('Ymd','d/m/Y', substr($tabTmp[2],0,8));
|
$dateFic=Wdate::dateT('Ymd','d/m/Y', substr($tabTmp[2],0,8));
|
||||||
|
|
||||||
$localfile = PATH_DATA.'/pdf/'.$nomFic;
|
$localfile = PATH_DATA.'/pdf/'.$nomFic;
|
||||||
if (!file_exists($localfile)) {
|
if (!file_exists($localfile)) {
|
||||||
$dejaLu1='<b>';
|
$dejaLu1='<b>';
|
||||||
@ -63,10 +63,10 @@ else {
|
|||||||
?>
|
?>
|
||||||
<td width="200" colspan="2" class="lienNormal">
|
<td width="200" colspan="2" class="lienNormal">
|
||||||
<?=$dejaLu1?>
|
<?=$dejaLu1?>
|
||||||
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>
|
||||||
|
@ -24,31 +24,25 @@ else{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
$file = PATH_DATA.'/pdf/'.$nomFic;
|
||||||
$O = $client->getListeFichierSurv($_SESSION['tabInfo']['login'], $_SESSION['tabInfo']['prenom'], $nomFic);
|
$file2 = $file.'.bz2';
|
||||||
$file = PATH_DATA.'/pdf/'.$nomFic;
|
if (!file_exists($file)) {
|
||||||
$file2 = $file.'.bz2';
|
$page = getUrl(WEBSERVICE_URI.'csv/'.$nomFic.'.bz2', '', '', '', false);
|
||||||
if (!file_exists($file)) {
|
$body = $page['body'];
|
||||||
$page = getUrl(WEBSERVICE_URI.'csv/'.$nomFic.'.bz2', '', '', '', false);
|
$fp=@fopen($file2, 'w');
|
||||||
$body = $page['body'];
|
@fwrite($fp, $body);
|
||||||
$fp=@fopen($file2, 'w');
|
@fclose($fp);
|
||||||
@fwrite($fp, $body);
|
$bz = bzopen($file2, "r") or die("Impossible d'ouvrir le fichier $file");
|
||||||
@fclose($fp);
|
$fp=@fopen($file, 'w');
|
||||||
$bz = bzopen($file2, "r") or die("Impossible d'ouvrir le fichier $file");
|
while (!feof($bz)) {
|
||||||
$fp=@fopen($file, 'w');
|
@fwrite($fp, bzread($bz, 4096));
|
||||||
while (!feof($bz)) {
|
|
||||||
@fwrite($fp, bzread($bz, 4096));
|
|
||||||
}
|
|
||||||
bzclose($bz);
|
|
||||||
}
|
}
|
||||||
} catch (SoapFault $fault) {
|
bzclose($bz);
|
||||||
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"> </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"> </td>
|
<td colspan="3"> </td>
|
||||||
</tr>
|
</tr>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user