2009-02-17 13:14:53 +00:00
|
|
|
|
<?php
|
2009-02-20 13:04:46 +00:00
|
|
|
|
include_once(FWK_PATH.'/common/curl.php');
|
2009-02-17 13:14:53 +00:00
|
|
|
|
if (!$_SESSION['connected'])
|
|
|
|
|
echo ('Vous devez <20>tre connect<63> afin de pouvoir utiliser cette fonctionnalit<69>');
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
2009-04-01 12:45:45 +00:00
|
|
|
|
$tabInfo = $_SESSION['tabInfo'];
|
|
|
|
|
|
2009-02-17 13:14:53 +00:00
|
|
|
|
if (isset($_REQUEST['nomFic'])) $nomFic = $_REQUEST['nomFic'];
|
|
|
|
|
else $nomFic = '';
|
|
|
|
|
try {
|
|
|
|
|
$O = $client->getListeFichierSurv($_SESSION['tabInfo']['login'], $_SESSION['tabInfo']['prenom'], $nomFic);
|
2009-03-02 11:27:23 +00:00
|
|
|
|
$file = PATH_DATA.'/pdf/'.$nomFic;
|
2009-02-17 13:14:53 +00:00
|
|
|
|
$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) {
|
2009-02-26 17:16:11 +00:00
|
|
|
|
include_once(realpath(dirname(__FILE__).'/../../').'/includes/soaperror.php');
|
|
|
|
|
processSoapFault($client,$fault,$tabInfo);
|
2009-02-17 13:14:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$filename=basename($file);
|
|
|
|
|
$body=file_get_contents($file);
|
|
|
|
|
|
|
|
|
|
header("Pragma: public");
|
|
|
|
|
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
|
|
|
|
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
|
|
|
|
header("Cache-Control: must-revalidate");
|
|
|
|
|
header("Content-type: application/csv");
|
|
|
|
|
header("Content-Length: ".strlen($body));
|
|
|
|
|
header('Content-disposition: inline; filename="'.$filename.'"');// attachement or inline
|
|
|
|
|
header("Accept-Ranges: ".strlen($body));
|
|
|
|
|
|
|
|
|
|
echo $body;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
?>
|