2009-03-06 17:12:26 +00:00
|
|
|
<?php
|
2010-04-09 14:40:43 +00:00
|
|
|
// Start...
|
|
|
|
$page = $_GET['page'];
|
|
|
|
$idEntreprise =
|
|
|
|
(isset($_GET['idEntreprise']) == true) ? $_GET['idEntreprise'] : '';
|
|
|
|
$siret = $_GET['siret'];
|
|
|
|
$siren = substr($siret, 0, 9);
|
2009-03-06 17:12:26 +00:00
|
|
|
|
2010-04-09 14:40:43 +00:00
|
|
|
// Construire le titre du fichier PDF en fonction des paramètres fournis
|
2011-02-21 14:01:29 +00:00
|
|
|
$path = realpath(dirname(__FILE__).'/../cache/pages/');
|
2010-04-09 14:40:43 +00:00
|
|
|
if (($siret * 1) == 0 ||
|
|
|
|
($siren * 1) < 100) {
|
2009-03-06 17:12:26 +00:00
|
|
|
$fileName = $path.'/'.$page.'-'.$idEntreprise;
|
2010-04-09 14:40:43 +00:00
|
|
|
} else {
|
2009-03-10 15:07:24 +00:00
|
|
|
$fileName = $path.'/'.$page.'-'.$siret;
|
2009-03-06 17:12:26 +00:00
|
|
|
}
|
|
|
|
|
2010-04-09 14:40:43 +00:00
|
|
|
// Gestion des cas particuliers
|
|
|
|
if ($page == 'dirigeants' && $_GET['vue'] == 'histo') {
|
|
|
|
$fileName .= '-histo';
|
|
|
|
} else if ($page == 'annonces' && isset($_GET['idan']) == true) {
|
|
|
|
$fileName .= '-'.$_GET['idan'];
|
2009-03-06 17:12:26 +00:00
|
|
|
}
|
|
|
|
|
2010-04-09 14:40:43 +00:00
|
|
|
// Ajout de l'extension
|
|
|
|
$fileName .= '.csv';
|
2009-03-06 17:12:26 +00:00
|
|
|
|
2010-04-09 14:40:43 +00:00
|
|
|
// Envoi du fichier au navigateur
|
2009-03-06 17:32:33 +00:00
|
|
|
if (file_exists($fileName)){
|
2010-04-09 14:40:43 +00:00
|
|
|
$csvNameFile = substr($fileName, strrpos($fileName, "/") + 1);
|
|
|
|
// Write the content type to the client...
|
|
|
|
// header("Content-type: application/vnd.ms-excel");
|
|
|
|
header("Content-Type: application/csv-tab-delimited-table");
|
|
|
|
header("Content-disposition: filename=\"$csvNameFile\"");
|
|
|
|
flush();
|
|
|
|
print file_get_contents($fileName);
|
|
|
|
}
|
2009-03-06 17:12:26 +00:00
|
|
|
?>
|