16 import(
'lib.pkp.plugins.importexport.native.filter.NativeExportFilter');
25 parent::__construct($filterGroup);
36 return 'plugins.importexport.native.filter.IssueNativeXmlFilter';
50 $doc =
new DOMDocument(
'1.0');
51 $doc->preserveWhiteSpace =
false;
52 $doc->formatOutput =
true;
55 if (count($issues)==1) {
60 $rootNode = $doc->createElementNS($deployment->getNamespace(),
'issues');
61 foreach ($issues as $issue) {
65 $doc->appendChild($rootNode);
66 $rootNode->setAttributeNS(
'http://www.w3.org/2000/xmlns/',
'xmlns:xsi',
'http://www.w3.org/2001/XMLSchema-instance');
67 $rootNode->setAttribute(
'xsi:schemaLocation', $deployment->getNamespace() .
' ' . $deployment->getSchemaFilename());
84 $deployment->setIssue($issue);
86 $issueNode = $doc->createElementNS($deployment->getNamespace(),
'issue');
89 $issueNode->setAttribute(
'published', $issue->getPublished());
90 $issueNode->setAttribute(
'current', $issue->getCurrent());
91 $issueNode->setAttribute(
'access_status', $issue->getAccessStatus());
92 $issueNode->setAttribute(
'url_path', $issue->getData(
'urlPath'));
95 import(
'plugins.importexport.native.filter.NativeFilterHelper');
97 $issueNode->appendChild($nativeFilterHelper->createIssueIdentificationNode($this, $doc, $issue));
99 $this->
addDates($doc, $issueNode, $issue);
102 import(
'plugins.importexport.native.filter.NativeFilterHelper');
104 $coversNode = $nativeFilterHelper->createIssueCoversNode($this, $doc, $issue);
105 if ($coversNode) $issueNode->appendChild($coversNode);
123 $issueNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(),
'id', $issue->getId()));
124 $node->setAttribute(
'type',
'internal');
125 $node->setAttribute(
'advice',
'ignore');
128 if ($pubId = $issue->getStoredPubId(
'publisher-id')) {
129 $issueNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(),
'id', htmlspecialchars($pubId, ENT_COMPAT,
'UTF-8')));
130 $node->setAttribute(
'type',
'public');
131 $node->setAttribute(
'advice',
'update');
136 foreach ($pubIdPlugins as $pubIdPlugin) {
150 $pubId = $issue->getStoredPubId($pubIdPlugin->getPubIdType());
153 $issueNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(),
'id', htmlspecialchars($pubId, ENT_COMPAT,
'UTF-8')));
154 $node->setAttribute(
'type', $pubIdPlugin->getPubIdType());
155 $node->setAttribute(
'advice',
'update');
170 if ($issue->getDatePublished())
171 $issueNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(),
'date_published', strftime(
'%Y-%m-%d', strtotime($issue->getDatePublished()))));
173 if ($issue->getDateNotified())
174 $issueNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(),
'date_notified', strftime(
'%Y-%m-%d', strtotime($issue->getDateNotified()))));
176 if ($issue->getLastModified())
177 $issueNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(),
'last_modified', strftime(
'%Y-%m-%d', strtotime($issue->getLastModified()))));
179 if ($issue->getOpenAccessDate())
180 $issueNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(),
'open_access_date', strftime(
'%Y-%m-%d', strtotime($issue->getOpenAccessDate()))));
191 $nativeExportFilters = $filterDao->getObjectsByGroup(
'article=>native-xml');
192 assert(count($nativeExportFilters)==1);
193 $exportFilter = array_shift($nativeExportFilters);
194 $exportFilter->setOpts($this->opts);
196 $exportFilter->setIncludeSubmissionsNode(
true);
198 $submissionsIterator =
Services::get(
'submission')->getMany([
199 'contextId' => $issue->getJournalId(),
200 'issueIds' => $issue->getId(),
202 $submissionsArray = iterator_to_array($submissionsIterator);
203 $articlesDoc = $exportFilter->execute($submissionsArray);
204 if ($articlesDoc->documentElement instanceof DOMElement) {
205 $clone = $doc->importNode($articlesDoc->documentElement,
true);
206 $issueNode->appendChild($clone);
218 $nativeExportFilters = $filterDao->getObjectsByGroup(
'issuegalley=>native-xml');
219 assert(count($nativeExportFilters)==1);
220 $exportFilter = array_shift($nativeExportFilters);
224 $issue = $issueGalleyDao->getByIssueId($issue->getId());
225 $issueGalleysDoc = $exportFilter->execute($issue);
226 if ($issueGalleysDoc->documentElement instanceof DOMElement) {
227 $clone = $doc->importNode($issueGalleysDoc->documentElement,
true);
228 $issueNode->appendChild($clone);
240 $sections = $sectionDao->getByIssueId($issue->getId());
242 $journal = $deployment->getContext();
245 if (!count($sections))
return;
247 $sectionsNode = $doc->createElementNS($deployment->getNamespace(),
'sections');
248 foreach ($sections as $section) {
249 $sectionNode = $doc->createElementNS($deployment->getNamespace(),
'section');
251 $sectionNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(),
'id', $section->getId()));
252 $node->setAttribute(
'type',
'internal');
253 $node->setAttribute(
'advice',
'ignore');
255 if ($section->getReviewFormId()) $sectionNode->setAttribute(
'review_form_id', $section->getReviewFormId());
256 $sectionNode->setAttribute(
'ref', $section->getAbbrev($journal->getPrimaryLocale()));
257 $sectionNode->setAttribute(
'seq', (
int) $section->getSequence());
258 $sectionNode->setAttribute(
'editor_restricted', $section->getEditorRestricted());
259 $sectionNode->setAttribute(
'meta_indexed', $section->getMetaIndexed());
260 $sectionNode->setAttribute(
'meta_reviewed', $section->getMetaReviewed());
261 $sectionNode->setAttribute(
'abstracts_not_required', $section->getAbstractsNotRequired());
262 $sectionNode->setAttribute(
'hide_title', $section->getHideTitle());
263 $sectionNode->setAttribute(
'hide_author', $section->getHideAuthor());
264 $sectionNode->setAttribute(
'abstract_word_count', (
int) $section->getAbstractWordCount());
270 $sectionsNode->appendChild($sectionNode);
273 $issueNode->appendChild($sectionsNode);