16 import(
'lib.pkp.plugins.importexport.native.filter.PKPPublicationNativeXmlFilter');
26 return 'plugins.importexport.native.filter.PublicationNativeXmlFilter';
34 return 'publication-format=>native-xml';
48 $entityNode = parent::createEntityNode($doc, $entity);
50 $context = $deployment->getContext();
52 $deployment->setPublication($entity);
55 if ($seriesId = $entity->getData(
'seriesId')) {
57 $series = $seriesDao->getById($seriesId, $context->getId());
59 $entityNode->setAttribute(
'series', $series->getPath());
60 $entityNode->setAttribute(
'series_position', $entity->getData(
'seriesPosition'));
67 if ($coversNode) $entityNode->appendChild($coversNode);
69 $citationsListNode = $this->createCitationsNode($doc, $deployment, $entity);
70 if ($citationsListNode) {
71 $entityNode->appendChild($citationsListNode);
85 $nativeExportFilters = $filterDao->getObjectsByGroup(
'chapter=>native-xml');
86 assert(count($nativeExportFilters)==1);
87 $exportFilter = array_shift($nativeExportFilters);
90 $chapters = $entity->getData(
'chapters');
91 $chaptersDoc = $exportFilter->execute($chapters);
92 if ($chaptersDoc->documentElement instanceof DOMElement) {
93 $clone = $doc->importNode($chaptersDoc->documentElement,
true);
94 $entityNode->appendChild($clone);
106 $deployment = $filter->getDeployment();
108 $context = $deployment->getContext();
111 $coverImages = $object->getData(
'coverImage');
112 if (!empty($coverImages)) {
113 $coversNode = $doc->createElementNS($deployment->getNamespace(),
'covers');
114 foreach ($coverImages as $locale => $coverImage) {
115 $coverImageName = $coverImage[
'uploadName'];
117 $coverNode = $doc->createElementNS($deployment->getNamespace(),
'cover');
118 $coverNode->setAttribute(
'locale', $locale);
119 $coverNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(),
'cover_image', htmlspecialchars($coverImageName, ENT_COMPAT,
'UTF-8')));
120 $coverNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(),
'cover_image_alt_text', htmlspecialchars($coverImage[
'altText'], ENT_COMPAT,
'UTF-8')));
122 import(
'classes.file.PublicFileManager');
125 $contextId = $context->getId();
127 $filePath = $publicFileManager->getContextFilesPath($contextId) .
'/' . $coverImageName;
128 $embedNode = $doc->createElementNS($deployment->getNamespace(),
'embed', base64_encode(file_get_contents($filePath)));
129 $embedNode->setAttribute(
'encoding',
'base64');
130 $coverNode->appendChild($embedNode);
131 $coversNode->appendChild($coverNode);
145 $deployment = $filter->getDeployment();
146 for ($n = $node->firstChild; $n !==
null; $n=$n->nextSibling) {
147 if (is_a($n,
'DOMElement')) {
148 switch ($n->tagName) {
150 $this->parseCover($filter, $n, $object, $assocType);
153 $deployment->addWarning($assocType, $object->getId(), __(
'plugins.importexport.common.error.unknownElement', array(
'param' => $n->tagName)));
166 private function createCitationsNode($doc, $deployment, $publication) {
169 $nodeCitations = $doc->createElementNS($deployment->getNamespace(),
'citations');
170 $submissionCitations = $citationDao->getByPublicationId($publication->getId());
171 if ($submissionCitations->getCount() != 0) {
172 while ($elementCitation = $submissionCitations->next()) {
173 $rawCitation = $elementCitation->getRawCitation();
174 $nodeCitations->appendChild($node = $doc->createElementNS($deployment->getNamespace(),
'citation', htmlspecialchars($rawCitation, ENT_COMPAT,
'UTF-8')));
177 return $nodeCitations;