add download of documents

This commit is contained in:
Uwe Steinmann 2015-06-09 21:31:13 +02:00
parent a178ab9bc0
commit 394a23fa57

View File

@ -28,12 +28,29 @@ class SeedDMS_Controller_TransmittalDownload extends SeedDMS_Controller_Common {
$transmittal = $this->params['transmittal'];
$items = $transmittal->getItems();
foreach($items as $item) {
$content = $item->getContent();
$document = $content->getDocument();
if ($document->getAccessMode($user) >= M_READ) {
echo $document->getName();
if($items) {
include("../inc/inc.ClassDownloadMgr.php");
$downmgr = new SeedDMS_Download_Mgr();
foreach($items as $item) {
$content = $item->getContent();
$document = $content->getDocument();
if ($document->getAccessMode($user) >= M_READ) {
$downmgr->addItem($content);
}
}
$filename = tempnam('/tmp', '');
$downmgr->createArchive($filename);
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($filename));
header("Content-Disposition: attachment; filename=\"export-" .date('Y-m-d') . ".zip\"");
header("Content-Type: application/zip");
header("Cache-Control: must-revalidate");
readfile($filename);
unlink($filename);
exit;
}
}
}