function exportIssues(&$journal, &$issues, $outputFile = null) { $this->import('PubMedExportDom'); $doc =& PubMedExportDom::generatePubMedDom(); $articleSetNode =& PubMedExportDom::generateArticleSetDom($doc); $sectionDao = DAORegistry::getDAO('SectionDAO'); $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO'); foreach ($issues as $issue) { foreach ($sectionDao->getByIssueId($issue->getId()) as $section) { foreach ($publishedArticleDao->getPublishedArticlesBySectionId($section->getId(), $issue->getId()) as $article) { $articleNode = PubMedExportDom::generateArticleDom($doc, $journal, $issue, $section, $article); XMLCustomWriter::appendChild($articleSetNode, $articleNode); } } } if (!empty($outputFile)) { if (($h = fopen($outputFile, 'w')) === false) { return false; } fwrite($h, XMLCustomWriter::getXML($doc)); fclose($h); } else { header("Content-Type: application/xml"); header("Cache-Control: private"); header("Content-Disposition: attachment; filename=\"pubmed.xml\""); XMLCustomWriter::printXML($doc); } return true; }