public function writeEmlFile() { global $clientRoot, $defaultTitle, $adminEmail; $this->logOrEcho("Creating eml.xml (" . date('h:i:s A') . ")... "); $urlPathPrefix = 'http://' . $_SERVER["SERVER_NAME"] . $clientRoot . (substr($clientRoot, -1) == '/' ? '' : '/'); $emlArr = array(); $emlArr['alternateIdentifier'][] = UuidFactory::getUuidV4(); $emlArr['title'] = $this->title; $emlArr['creator'][0]['organizationName'] = $defaultTitle; $emlArr['creator'][0]['electronicMailAddress'] = $adminEmail; $emlArr['creator'][0]['onlineUrl'] = $urlPathPrefix . 'index.php'; $emlArr['metadataProvider'][0]['organizationName'] = $defaultTitle; $emlArr['metadataProvider'][0]['electronicMailAddress'] = $adminEmail; $emlArr['metadataProvider'][0]['onlineUrl'] = $urlPathPrefix . 'index.php'; $emlArr['pubDate'] = date("Y-m-d"); $emlArr['language'] = 'eng'; $emlArr['description'] = $this->description; //Get EML string $dwcaHandler = new DwcArchiverOccurrence(); $emlDoc = $dwcaHandler->getEmlDom($emlArr); $tempFileName = $this->targetPath . $this->ts . '-eml.xml'; $emlDoc->save($tempFileName); $this->zipArchive->addFile($tempFileName); $this->zipArchive->renameName($tempFileName, 'eml.xml'); $this->logOrEcho("Done!! (" . date('h:i:s A') . ")\n"); }
<?php include_once '../../config/symbini.php'; include_once $serverRoot . '/classes/DwcArchiverOccurrence.php'; $collId = $_REQUEST["collid"]; if ($collId && is_numeric($collId)) { $dwcaManager = new DwcArchiverOccurrence(); $dwcaManager->setCollArr($collId); $collArr = $dwcaManager->getCollArr(); header('Content-Description: ' . $collArr[$collId]['collname'] . ' EML'); header('Content-Type: text/xml'); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: no-cache"); header("Pragma: no-cache"); $xmlDom = $dwcaManager->getEmlDom(); echo $xmlDom->saveXML(); }