/** * Generate the journal_article node (the heart of the file). * @param $doc XMLNode * @param $journal Journal * @param $issue Issue * @param $section Section * @param $article Article * @return XMLNode */ function &generateJournalArticleDom(&$doc, &$journal, &$issue, &$section, &$article) { // Create the base node $journalArticleNode =& XMLCustomWriter::createElement($doc, 'journal_article'); XMLCustomWriter::setAttribute($journalArticleNode, 'publication_type', 'full_text'); /* Titles */ $titlesNode =& XMLCustomWriter::createElement($doc, 'titles'); XMLCustomWriter::createChildWithText($doc, $titlesNode, 'title', $article->getLocalizedTitle()); XMLCustomWriter::appendChild($journalArticleNode, $titlesNode); /* AuthorList */ $contributorsNode =& XMLCustomWriter::createElement($doc, 'contributors'); $isFirst = true; foreach ($article->getAuthors() as $author) { $authorNode =& CrossRefExportDom::generateAuthorDom($doc, $author, $isFirst); $isFirst = false; XMLCustomWriter::appendChild($contributorsNode, $authorNode); } XMLCustomWriter::appendChild($journalArticleNode, $contributorsNode); /* publication date of article */ if ($article->getDatePublished()) { $publicationDateNode =& CrossRefExportDom::generatePublisherDateDom($doc, $article->getDatePublished()); XMLCustomWriter::appendChild($journalArticleNode, $publicationDateNode); } elseif ($issue->getDatePublished()) { $publicationDateNode =& CrossRefExportDom::generatePublisherDateDom($doc, $issue->getDatePublished()); XMLCustomWriter::appendChild($journalArticleNode, $publicationDateNode); } else { echo __('plugins.importexport.crossref.articleDatePublishedError', array('articleId' => $article->getId())) . "\n\n"; } /* publisher_item is the article pages */ if ($article->getPages() != '') { $pageNode =& XMLCustomWriter::createElement($doc, 'pages'); // extract the first page for the first_page element, store the remaining bits in otherPages, // after removing any preceding non-numerical characters. if (preg_match('/^[^\\d]*(\\d+)\\D*(.*)$/', $article->getPages(), $matches)) { $firstPage = $matches[1]; $otherPages = $matches[2]; XMLCustomWriter::createChildWithText($doc, $pageNode, 'first_page', $firstPage); if ($otherPages != '') { XMLCustomWriter::createChildWithText($doc, $pageNode, 'other_pages', $otherPages); } } XMLCustomWriter::appendChild($journalArticleNode, $pageNode); } // DOI data node $articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO'); $DOIdataNode =& CrossRefExportDom::generateDOIdataDom($doc, $article->getPubId('doi'), Request::url(null, 'article', 'view', $article->getBestArticleId()), $articleGalleyDao->getGalleysByArticle($article->getId())); XMLCustomWriter::appendChild($journalArticleNode, $DOIdataNode); /* Component list (supplementary files) */ $componentListNode =& CrossRefExportDom::generateComponentListDom($doc, $journal, $article); if ($componentListNode) { XMLCustomWriter::appendChild($journalArticleNode, $componentListNode); } return $journalArticleNode; }
/** * Generate the journal_article node (the heart of the file). * @param $doc XMLNode * @param $journal Journal * @param $issue Issue * @param $section Section * @param $article Article * @return XMLNode */ function &generateJournalArticleDom(&$doc, &$journal, &$issue, &$section, &$article) { // Create the base node $journalArticleNode =& XMLCustomWriter::createElement($doc, 'journal_article'); XMLCustomWriter::setAttribute($journalArticleNode, 'publication_type', 'full_text'); /* Titles */ $titlesNode =& XMLCustomWriter::createElement($doc, 'titles'); XMLCustomWriter::createChildWithText($doc, $titlesNode, 'title', $article->getLocalizedTitle()); XMLCustomWriter::appendChild($journalArticleNode, $titlesNode); /* AuthorList */ $contributorsNode =& XMLCustomWriter::createElement($doc, 'contributors'); $isFirst = true; foreach ($article->getAuthors() as $author) { $authorNode =& CrossRefExportDom::generateAuthorDom($doc, $author, $isFirst); $isFirst = false; XMLCustomWriter::appendChild($contributorsNode, $authorNode); } XMLCustomWriter::appendChild($journalArticleNode, $contributorsNode); /* publication date of article */ if ($article->getDatePublished()) { $publicationDateNode =& CrossRefExportDom::generatePublisherDateDom($doc, $article->getDatePublished()); XMLCustomWriter::appendChild($journalArticleNode, $publicationDateNode); } /* publisher_item is the article pages */ if ($article->getPages() != '') { $publisherItemNode =& XMLCustomWriter::createElement($doc, 'publisher_item'); XMLCustomWriter::createChildWithText($doc, $publisherItemNode, 'item_number', $article->getPages()); XMLCustomWriter::appendChild($journalArticleNode, $publisherItemNode); } // DOI data node $DOIdataNode =& CrossRefExportDom::generateDOIdataDom($doc, $article->getPubId('doi'), Request::url(null, 'article', 'view', $article->getBestArticleId())); XMLCustomWriter::appendChild($journalArticleNode, $DOIdataNode); /* Component list (supplementary files) */ $componentListNode =& CrossRefExportDom::generateComponentListDom($doc, $journal, $article); XMLCustomWriter::appendChild($journalArticleNode, $componentListNode); return $journalArticleNode; }