25 $deployment = $filter->getDeployment();
26 $vol = $issue->getVolume();
27 $num = $issue->getNumber();
28 $year = $issue->getYear();
29 $title = $issue->getTitle(
null);
30 assert($issue->getShowVolume() || $issue->getShowNumber() || $issue->getShowYear() || $issue->getShowTitle());
31 $issueIdentificationNode = $doc->createElementNS($deployment->getNamespace(),
'issue_identification');
32 if ($issue->getShowVolume()) {
34 $issueIdentificationNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(),
'volume', htmlspecialchars($vol, ENT_COMPAT,
'UTF-8')));
36 if ($issue->getShowNumber()) {
38 $issueIdentificationNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(),
'number', htmlspecialchars($num, ENT_COMPAT,
'UTF-8')));
40 if ($issue->getShowYear()) {
41 assert(!empty($year));
42 $issueIdentificationNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(),
'year', $year));
44 if ($issue->getShowTitle()) {
45 assert(!empty($title));
46 $filter->createLocalizedNodes($doc, $issueIdentificationNode,
'title', $title);
48 return $issueIdentificationNode;
59 $deployment = $filter->getDeployment();
61 $context = $deployment->getContext();
64 $coverImages = $object->getData(
'coverImage');
65 if (!empty($coverImages)) {
66 $coversNode = $doc->createElementNS($deployment->getNamespace(),
'covers');
67 foreach ($coverImages as $locale => $coverImage) {
68 $coverImageName = $coverImage[
'uploadName'];
70 $coverNode = $doc->createElementNS($deployment->getNamespace(),
'cover');
71 $coverNode->setAttribute(
'locale', $locale);
72 $coverNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(),
'cover_image', htmlspecialchars($coverImageName, ENT_COMPAT,
'UTF-8')));
73 $coverNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(),
'cover_image_alt_text', htmlspecialchars($coverImage[
'altText'], ENT_COMPAT,
'UTF-8')));
75 import(
'classes.file.PublicFileManager');
78 $contextId = $context->getId();
80 $filePath = $publicFileManager->getContextFilesPath($contextId) .
'/' . $coverImageName;
81 $embedNode = $doc->createElementNS($deployment->getNamespace(),
'embed', base64_encode(file_get_contents($filePath)));
82 $embedNode->setAttribute(
'encoding',
'base64');
83 $coverNode->appendChild($embedNode);
84 $coversNode->appendChild($coverNode);
98 $deployment = $filter->getDeployment();
100 $coverImages = $object->getCoverImage(
null);
101 if (!empty($coverImages)) {
102 $coversNode = $doc->createElementNS($deployment->getNamespace(),
'covers');
103 foreach ($coverImages as $locale => $coverImage) {
104 $coverNode = $doc->createElementNS($deployment->getNamespace(),
'cover');
105 $coverNode->setAttribute(
'locale', $locale);
106 $coverNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(),
'cover_image', htmlspecialchars($coverImage, ENT_COMPAT,
'UTF-8')));
107 $coverNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(),
'cover_image_alt_text', htmlspecialchars($object->getCoverImageAltText($locale), ENT_COMPAT,
'UTF-8')));
109 import(
'classes.file.PublicFileManager');
111 $filePath = $publicFileManager->getContextFilesPath($object->getJournalId()) .
'/' . $coverImage;
112 $embedNode = $doc->createElementNS($deployment->getNamespace(),
'embed', base64_encode(file_get_contents($filePath)));
113 $embedNode->setAttribute(
'encoding',
'base64');
114 $coverNode->appendChild($embedNode);
115 $coversNode->appendChild($coverNode);
128 $deployment = $filter->getDeployment();
130 $coverImages = array();
132 for ($n = $node->firstChild; $n !==
null; $n=$n->nextSibling) {
133 if (is_a($n,
'DOMElement')) {
134 switch ($n->tagName) {
137 $coverImages[key($coverImage)] = reset($coverImage);
140 $deployment->addWarning(ASSOC_TYPE_PUBLICATION, $object->getId(), __(
'plugins.importexport.common.error.unknownElement', array(
'param' => $n->tagName)));
145 $object->setData(
'coverImage', $coverImages);
155 $deployment = $filter->getDeployment();
156 for ($n = $node->firstChild; $n !==
null; $n=$n->nextSibling) {
157 if (is_a($n,
'DOMElement')) {
158 switch ($n->tagName) {
163 $deployment->addWarning(ASSOC_TYPE_ISSUE, $object->getId(), __(
'plugins.importexport.common.error.unknownElement', array(
'param' => $n->tagName)));
176 $deployment = $filter->getDeployment();
178 $context = $deployment->getContext();
180 $locale = $node->getAttribute(
'locale');
181 if (empty($locale)) $locale = $context->getPrimaryLocale();
183 $coverImagelocale = array();
184 $coverImage = array();
186 for ($n = $node->firstChild; $n !==
null; $n=$n->nextSibling) {
187 if (is_a($n,
'DOMElement')) {
188 switch ($n->tagName) {
190 $coverImage[
'uploadName'] = $n->textContent;
192 case 'cover_image_alt_text':
193 $coverImage[
'altText'] = $n->textContent;
196 import(
'classes.file.PublicFileManager');
198 $filePath = $publicFileManager->getContextFilesPath($context->getId()) .
'/' . $coverImage[
'uploadName'];
199 file_put_contents($filePath, base64_decode($n->textContent));
202 $deployment->addWarning(ASSOC_TYPE_PUBLICATION, $object->getId(), __(
'plugins.importexport.common.error.unknownElement', array(
'param' => $n->tagName)));
207 $coverImagelocale[$locale] = $coverImage;
209 return $coverImagelocale;
219 $deployment = $filter->getDeployment();
220 $context = $deployment->getContext();
221 $locale = $node->getAttribute(
'locale');
222 if (empty($locale)) $locale = $context->getPrimaryLocale();
223 for ($n = $node->firstChild; $n !==
null; $n=$n->nextSibling) {
224 if (is_a($n,
'DOMElement')) {
225 switch ($n->tagName) {
226 case 'cover_image': $object->setCoverImage($n->textContent, $locale);
break;
227 case 'cover_image_alt_text': $object->setCoverImageAltText($n->textContent, $locale);
break;
229 import(
'classes.file.PublicFileManager');
231 $filePath = $publicFileManager->getContextFilesPath($context->getId()) .
'/' . $object->getCoverImage($locale);
232 file_put_contents($filePath, base64_decode($n->textContent));
235 $deployment->addWarning(ASSOC_TYPE_ISSUE, $object->getId(), __(
'plugins.importexport.common.error.unknownElement', array(
'param' => $n->tagName)));