00001 <?php
00002
00016
00017
00018
00019 class OAIMetadataFormat_RFC1807 extends OAIMetadataFormat {
00020
00024 function toXml(&$record, $format = null) {
00025 $conference =& $record->getData('conference');
00026 $schedConf =& $record->getData('schedConf');
00027 $paper =& $record->getData('paper');
00028 $track =& $record->getData('track');
00029 $galleys =& $record->getData('galleys');
00030
00031
00032 $source = $conference->getConferenceTitle() . '; ' . $schedConf->getSchedConfTitle();
00033 if ($paper->getPages() != '') {
00034 $source .= '; ' . $paper->getPages();
00035 }
00036
00037
00038 $creators = array();
00039 foreach ($paper->getAuthors() as $author) {
00040 $authorName = $author->getFullName();
00041 $affiliation = $author->getAffiliation();
00042 if (!empty($affiliation)) {
00043 $authorName .= '; ' . $affiliation;
00044 }
00045 $creators[] = $authorName;
00046 }
00047
00048
00049 $subject = array(
00050 $paper->getLocalizedDiscipline(null),
00051 $paper->getLocalizedSubject(null),
00052 $paper->getLocalizedSubjectClass(null)
00053 );
00054
00055
00056 $publisher = $conference->getConferenceTitle();
00057 $publisherInstitution = $conference->getSetting('publisherInstitution');
00058 if (!empty($publisherInstitution)) {
00059 $publisher = $publisherInstitution;
00060 }
00061
00062
00063 AppLocale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON));
00064 $type = __('rt.metadata.pkp.peerReviewed');
00065
00066
00067 $format = array();
00068 foreach ($galleys as $galley) {
00069 $format[] = $galley->getFileType();
00070 }
00071
00072
00073 $subject = array(
00074 $paper->getLocalizedDiscipline(null),
00075 $paper->getLocalizedSubject(null),
00076 $paper->getLocalizedSubjectClass(null)
00077 );
00078
00079
00080 $relation = array();
00081 foreach ($paper->getSuppFiles() as $suppFile) {
00082
00083 $relation[] = Request::url($conference->getPath(), $schedConf->getPath(), 'paper', 'download', array($paper->getId(), $suppFile->getFileId()));
00084 }
00085
00086 $url = Request::url($conference->getPath(), $schedConf->getPath(), 'paper', 'view', array($paper->getBestPaperId()));
00087
00088 $response = "<rfc1807\n" .
00089 "\txmlns=\"http://info.internet.isi.edu:80/in-notes/rfc/files/rfc1807.txt\"\n" .
00090 "\txmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" .
00091 "\txsi:schemaLocation=\"http://info.internet.isi.edu:80/in-notes/rfc/files/rfc1807.txt\n" .
00092 "\thttp://www.openarchives.org/OAI/1.1/rfc1807.xsd\">\n" .
00093 "\t<bib-version>v2</bib-version>\n" .
00094 $this->formatElement('id', $url) .
00095 $this->formatElement('entry', $record->datestamp) .
00096 $this->formatElement('organization', $publisher) .
00097 $this->formatElement('organization', $source) .
00098 $this->formatElement('title', $paper->getLocalizedTitle()) .
00099 $this->formatElement('type', $type) .
00100 $this->formatElement('type', $relation) .
00101 $this->formatElement('author', $creators) .
00102 $this->formatElement('date', $paper->getDatePublished()) .
00103 $this->formatElement('copyright', $conference->getLocalizedSetting('copyrightNotice')) .
00104 $this->formatElement('other_access', "url:$url") .
00105 $this->formatElement('keyword', $subject) .
00106 $this->formatElement('period', array(
00107 $paper->getLocalizedCoverageGeo(null),
00108 $paper->getLocalizedCoverageChron(null),
00109 $paper->getLocalizedCoverageSample(null)
00110 )) .
00111 $this->formatElement('monitoring', $paper->getLocalizedSponsor()) .
00112 $this->formatElement('language', $paper->getLanguage()) .
00113 $this->formatElement('abstract', strip_tags($paper->getLocalizedAbstract())) .
00114 "</rfc1807>\n";
00115
00116 return $response;
00117 }
00118
00124 function formatElement($name, $value) {
00125 if (!is_array($value)) {
00126 $value = array($value);
00127 }
00128
00129 $response = '';
00130 foreach ($value as $v) {
00131 $response .= "\t<$name>" . OAIUtils::prepOutput($v) . "</$name>\n";
00132 }
00133 return $response;
00134 }
00135 }
00136
00137 ?>