getData('article'); $journal =& $record->getData('journal'); $section =& $record->getData('section'); $issue =& $record->getData('issue'); $galleys =& $record->getData('galleys'); // Publisher $publisher = $journal->getLocalizedTitle(); // Default $publisherInstitution = $journal->getLocalizedSetting('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; // Relation $relation = array(); foreach ($article->getSuppFiles() as $suppFile) { $relation[] = Request::url($journal->getPath(), 'article', 'download', array($article->getId(), $suppFile->getFileId())); } // Format creators $creators = array(); $authors = $article->getAuthors(); for ($i = 0, $num = count($authors); $i < $num; $i++) { $authorName = $authors[$i]->getFullName(true); $affiliation = $authors[$i]->getLocalizedAffiliation(); if (!empty($affiliation)) { $authorName .= '; ' . $affiliation; } $creators[] = $authorName; } // Subject $subjects = array_merge_recursive( $this->stripAssocArray((array) $article->getDiscipline(null)), $this->stripAssocArray((array) $article->getSubject(null)), $this->stripAssocArray((array) $article->getSubjectClass(null)) ); $subject = isset($subjects[$journal->getPrimaryLocale()])?$subjects[$journal->getPrimaryLocale()]:''; // Coverage $coverage = array( $article->getLocalizedCoverageGeo(), $article->getLocalizedCoverageChron(), $article->getLocalizedCoverageSample() ); $url = Request::url($journal->getPath(), 'article', 'view', array($article->getBestArticleId())); $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('type', $relation) . $this->formatElement('author', $creators) . ($article->getDatePublished()?$this->formatElement('date', $article->getDatePublished()):'') . $this->formatElement('copyright', strip_tags($journal->getLocalizedSetting('copyrightNotice'))) . $this->formatElement('other_access', "url:$url") . $this->formatElement('keyword', $subject) . $this->formatElement('period', $coverage) . $this->formatElement('monitoring', $article->getLocalizedSponsor()) . $this->formatElement('language', $article->getLanguage()) . $this->formatElement('abstract', strip_tags($article->getLocalizedAbstract())) . "\n"; return $response; } /** * Format XML for single RFC 1807 element. * @param $name string * @param $value mixed */ function formatElement($name, $value) { if (!is_array($value)) { $value = array($value); } $response = ''; foreach ($value as $v) { $response .= "\t<$name>" . OAIUtils::prepOutput($v) . "\n"; } return $response; } } ?>