Make some variables global
This commit is contained in:
parent
387bc4c161
commit
2ec415907a
|
@ -57,6 +57,7 @@ $oai2 = new OAI2Server(
|
||||||
array(
|
array(
|
||||||
'GetRecord' =>
|
'GetRecord' =>
|
||||||
function($identifier, $metadataPrefix) {
|
function($identifier, $metadataPrefix) {
|
||||||
|
global $records;
|
||||||
if (empty($records[$identifier])) {
|
if (empty($records[$identifier])) {
|
||||||
return array();
|
return array();
|
||||||
} else {
|
} else {
|
||||||
|
@ -69,6 +70,7 @@ $oai2 = new OAI2Server(
|
||||||
},
|
},
|
||||||
'ListRecords' =>
|
'ListRecords' =>
|
||||||
function($metadataPrefix, $from = null, $until = null, $count = false, $deliveredRecords = 0, $maxItems = 100) {
|
function($metadataPrefix, $from = null, $until = null, $count = false, $deliveredRecords = 0, $maxItems = 100) {
|
||||||
|
global $records, $timestamps;
|
||||||
$resultSet = array();
|
$resultSet = array();
|
||||||
foreach($timestamps as $timestamp => $identifiers) {
|
foreach($timestamps as $timestamp => $identifiers) {
|
||||||
if ((is_null($from) || $timestamp >= $from) && (is_null($until) || $timestamp <= $until)) {
|
if ((is_null($from) || $timestamp >= $from) && (is_null($until) || $timestamp <= $until)) {
|
||||||
|
@ -89,14 +91,14 @@ $oai2 = new OAI2Server(
|
||||||
},
|
},
|
||||||
'ListMetadataFormats' =>
|
'ListMetadataFormats' =>
|
||||||
function($identifier = '') {
|
function($identifier = '') {
|
||||||
if (!empty($identifier) && empty($records[$identifier]) {
|
global $config;
|
||||||
|
if (!empty($identifier) && empty($records[$identifier])) {
|
||||||
throw new OAI2Exception('idDoesNotExist');
|
throw new OAI2Exception('idDoesNotExist');
|
||||||
} else {
|
} else {
|
||||||
return array(
|
return array(
|
||||||
$config['metadataFormat'] => array(
|
$config['metadataFormat'] => array(
|
||||||
'metadataPrefix' => $config['metadataFormat'],
|
|
||||||
'schema'=> $config['metadataSchema'],
|
'schema'=> $config['metadataSchema'],
|
||||||
'metadataNamespace' => $config['metadataNamespace']
|
'namespace' => $config['metadataNamespace']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ class OAI2Server {
|
||||||
$cmf = $this->response->addToVerbNode('metadataFormat');
|
$cmf = $this->response->addToVerbNode('metadataFormat');
|
||||||
$this->response->addChild($cmf, 'metadataPrefix', $key);
|
$this->response->addChild($cmf, 'metadataPrefix', $key);
|
||||||
$this->response->addChild($cmf, 'schema', $val['schema']);
|
$this->response->addChild($cmf, 'schema', $val['schema']);
|
||||||
$this->response->addChild($cmf, 'metadataNamespace', $val['metadataNamespace']);
|
$this->response->addChild($cmf, 'metadataNamespace', $val['namespace']);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->errors[] = new OAI2Exception('noMetadataFormats');
|
$this->errors[] = new OAI2Exception('noMetadataFormats');
|
||||||
|
|
Loading…
Reference in New Issue