mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-11 20:21:16 +00:00
add download of documents
This commit is contained in:
parent
a178ab9bc0
commit
394a23fa57
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user