raw content can be set for files added to archive

Setting the raw content will take the meta data from the document
content but use the file content as passed by the third optional
parameter of addItem()
This commit is contained in:
Uwe Steinmann 2017-04-04 07:09:56 +02:00
parent 3a615b6e06
commit d7af33f579

View File

@ -51,6 +51,7 @@ class SeedDMS_Download_Mgr {
$this->items = array();
$this->header = array('Dokumenten-Nr.', 'Dokumentenname', 'Dateiname', 'Status', 'Int. Version', 'Prüfer', 'Prüfdatum', 'Prüfkommentar', 'Prüfstatus', 'Freigeber', 'Freigabedatum', 'Freigabekommentar', 'Freigabestatus');
$this->extracols = array();
$this->rawcontents = array();
$this->extraheader = array();
}
@ -58,9 +59,10 @@ class SeedDMS_Download_Mgr {
$this->extraheader = $extraheader;
} /* }}} */
public function addItem($item, $extracols) { /* {{{ */
public function addItem($item, $extracols=array(), $rawcontent='') { /* {{{ */
$this->items[$item->getID()] = $item;
$this->extracols[$item->getID()] = $extracols;
$this->rawcontents[$item->getID()] = $rawcontent;
} /* }}} */
public function createToc($file) { /* {{{ */
@ -193,7 +195,10 @@ class SeedDMS_Download_Mgr {
$filename = preg_replace('/[^A-Za-z0-9_-]/', '_', $document->getName()).'.'.$oext;
}
$filename = $prefixdir."/".$document->getID().'-'.$item->getVersion().'-'.$filename; //$lc->getOriginalFileName();
$zip->addFile($dms->contentDir.$item->getPath(), utf8_decode($filename));
if($this->rawcontents[$item->getID()]) {
$zip->addFromString(utf8_decode($filename), $this->rawcontents[$item->getID()]);
} else
$zip->addFile($dms->contentDir.$item->getPath(), utf8_decode($filename));
}
$zip->addFile($file, $prefixdir."/metadata.xls");