Création d'archive zip avec ZipWriter
FossilOrigin-Name: fdc718ec0f5734bb532742f6da61db7ed55f3373ace6f01aba3629f93c37aa79
This commit is contained in:
parent
36060b71c8
commit
41c93cf556
2 changed files with 40 additions and 14 deletions
|
|
@ -3,6 +3,7 @@
|
|||
namespace Garradin\Plugin\RecusFiscaux;
|
||||
|
||||
use Garradin\DB;
|
||||
use KD2\ZipWriter;
|
||||
|
||||
class Services
|
||||
{
|
||||
|
|
@ -35,7 +36,7 @@ class Services
|
|||
printf(\"%.2f\", services_fees.amount/100) as montantTarif
|
||||
FROM services_fees
|
||||
WHERE services_fees.id_service = ?",
|
||||
$activite
|
||||
$activite
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -177,4 +178,25 @@ class Services
|
|||
WHERE key = 'adresse_asso'"
|
||||
)[0]->value;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// zip archive creation
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
static function makeArchive(
|
||||
$fileList,
|
||||
$year,
|
||||
$archiveDir)
|
||||
{
|
||||
$zipFilename = "recus_dons" . $year . ".zip";
|
||||
header('Content-type: application/zip');
|
||||
header(sprintf('Content-Disposition: attachment; filename="%s"', $zipFilename));
|
||||
$zip = new ZipWriter('php://output');
|
||||
$zip->setCompression(0);
|
||||
foreach ($fileList as $fileName)
|
||||
{
|
||||
$zip->add(basename($fileName), null, $fileName);
|
||||
}
|
||||
$zip->close();
|
||||
} // makeArchive
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue