getData('article'); $journal = & $record->getData('journal'); $section = & $record->getData('section'); $issue = & $record->getData('issue'); $galleys = & $record->getData('galleys'); $publication = $article->getCurrentPublication(); // Publisher $publisher = $journal->getLocalizedName(); // Default $publisherInstitution = $journal->getData('publisherInstitution'); if (!empty($publisherInstitution)) { $publisher = $publisherInstitution; } // Sources contains journal title, issue ID, and pages $source = $issue->getIssueIdentification(); $pages = $article->getPages(); if (!empty($pages)) { $source .= '; ' . $pages; } // Format creators $creators = []; foreach ($publication->getAuthors() as $author) { $authorName = $author->getFullName(false, true); $affiliation = $author->getLocalizedAffiliation(); if (!empty($affiliation)) { $authorName .= '; ' . $affiliation; } $creators[] = $authorName; } // Subject $supportedLocales = $journal->getSupportedFormLocales(); $submissionKeywordDao = DAORegistry::getDAO('SubmissionKeywordDAO'); /** @var SubmissionKeywordDAO $submissionKeywordDao */ $submissionSubjectDao = DAORegistry::getDAO('SubmissionSubjectDAO'); /** @var SubmissionSubjectDAO $submissionSubjectDao */ $subjects = array_merge_recursive( (array) $submissionKeywordDao->getKeywords($publication->getId(), $supportedLocales), (array) $submissionSubjectDao->getSubjects($article->getCurrentPublication()->getId(), $supportedLocales) ); $subject = $subjects[$journal->getPrimaryLocale()] ?? ''; // Coverage $coverage = $article->getCoverage($article->getData('locale')); $issueAction = new IssueAction(); $request = Application::get()->getRequest(); $url = $request->url($journal->getPath(), 'article', 'view', [$article->getBestId()]); $includeUrls = $journal->getSetting('publishingMode') != \APP\journal\Journal::PUBLISHING_MODE_NONE || $issueAction->subscribedUser($request->getUser(), $journal, null, $article->getId()); $response = "\n" . "\tv2\n" . $this->formatElement('id', $url) . $this->formatElement('entry', $record->datestamp) . $this->formatElement('organization', $publisher) . $this->formatElement('organization', $source) . $this->formatElement('title', $article->getLocalizedTitle()) . $this->formatElement('type', $section->getLocalizedIdentifyType()) . $this->formatElement('author', $creators) . ($article->getDatePublished() ? $this->formatElement('date', $article->getDatePublished()) : '') . $this->formatElement('copyright', strip_tags($journal->getLocalizedData('licenseTerms'))) . ($includeUrls ? $this->formatElement('other_access', "url:{$url}") : '') . $this->formatElement('keyword', $subject) . $this->formatElement('period', $coverage) . $this->formatElement('monitoring', $article->getLocalizedSponsor()) . $this->formatElement('language', $article->getData('locale')) . $this->formatElement('abstract', strip_tags($article->getLocalizedAbstract())) . "\n"; return $response; } /** * Format XML for single RFC 1807 element. * * @param string $name */ public function formatElement($name, $value) { $response = ''; foreach ((array) $value as $v) { $response .= "\t<{$name}>" . OAIUtils::prepOutput($v) . "\n"; } return $response; } }