19 import(
'lib.pkp.classes.oai.OAI');
20 import(
'classes.oai.ojs.OAIDAO');
43 $this->site = $request->getSite();
44 $this->journal = $request->getJournal();
45 $this->journalId = isset($this->journal) ? $this->journal->getId() :
null;
47 $this->dao->setOAI($this);
55 return array(
'journal',
'page');
64 return 'oai:' . $this->config->repositoryId .
':' .
'article/' . $articleId;
73 $prefix =
'oai:' . $this->config->repositoryId .
':' .
'article/';
74 if (strstr($identifier, $prefix)) {
75 return (
int) str_replace($prefix,
'', $identifier);
86 $tmpArray = preg_split(
'/:/', $setSpec);
87 if (
count($tmpArray) == 1) {
88 list($journalSpec) = $tmpArray;
89 $journalSpec = urldecode($journalSpec);
91 }
else if (
count($tmpArray) == 2) {
92 list($journalSpec, $sectionSpec) = $tmpArray;
93 $journalSpec = urldecode($journalSpec);
94 $sectionSpec = urldecode($sectionSpec);
98 return $this->dao->getSetJournalSectionId($journalSpec, $sectionSpec, $this->journalId);
112 if (isset($this->journal)) {
113 $info->repositoryName = $this->journal->getLocalizedName();
114 $info->adminEmail = $this->journal->getData(
'contactEmail');
117 $info->repositoryName = $this->site->getLocalizedTitle();
118 $info->adminEmail = $this->site->getLocalizedContactEmail();
122 $info->earliestDatestamp = $this->dao->getEarliestDatestamp(array($this->journalId));
124 $info->toolkitTitle =
'Open Journal Systems';
126 $currentVersion = $versionDao->getCurrentVersion();
127 $info->toolkitVersion = $currentVersion->getVersionString();
128 $info->toolkitURL =
'http://pkp.sfu.ca/ojs/';
144 $recordExists =
false;
147 $recordExists = $this->dao->recordExists($articleId, array($this->journalId));
149 return $recordExists;
158 $record = $this->dao->getRecord($articleId, array($this->journalId));
160 if (!isset($record)) {
169 function records($metadataPrefix, $from, $until, $set, $offset, $limit, &$total) {
171 if (!
HookRegistry::call(
'JournalOAI::records', array($this, $from, $until, $set, $offset, $limit, &$total, &$records))) {
178 $records = $this->dao->getRecords(array(
$journalId, $sectionId), $from, $until, $set, $offset, $limit, $total);
186 function identifiers($metadataPrefix, $from, $until, $set, $offset, $limit, &$total) {
188 if (!
HookRegistry::call(
'JournalOAI::identifiers', array($this, $from, $until, $set, $offset, $limit, &$total, &$records))) {
195 $records = $this->dao->getIdentifiers(array(
$journalId, $sectionId), $from, $until, $set, $offset, $limit, $total);
203 function sets($offset, $limit, &$total) {
205 if (!
HookRegistry::call(
'JournalOAI::sets', array($this, $offset, $limit, &$total, &$sets))) {
206 $sets = $this->dao->getJournalSets($this->journalId, $offset, $limit, $total);
215 $this->dao->clearTokens();
216 $token = $this->dao->getToken($tokenId);
217 if (!isset($token)) {
228 $this->dao->insertToken($token);