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,13 +28,30 @@ class SeedDMS_Controller_TransmittalDownload extends SeedDMS_Controller_Common {
$transmittal = $this->params['transmittal']; $transmittal = $this->params['transmittal'];
$items = $transmittal->getItems(); $items = $transmittal->getItems();
if($items) {
include("../inc/inc.ClassDownloadMgr.php");
$downmgr = new SeedDMS_Download_Mgr();
foreach($items as $item) { foreach($items as $item) {
$content = $item->getContent(); $content = $item->getContent();
$document = $content->getDocument(); $document = $content->getDocument();
if ($document->getAccessMode($user) >= M_READ) { if ($document->getAccessMode($user) >= M_READ) {
echo $document->getName(); $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;
}
} }
} }