Skip to content
Snippets Groups Projects
Commit b59465ed authored by Robert Lange's avatar Robert Lange
Browse files

Merge branch 'instance/fid' into instance/fid_adlr

parents 5a94eb9a 8150244f
Branches
Tags
No related merge requests found
......@@ -147,12 +147,13 @@ class Ezb extends BaseEzb
$this->getElectronicResults('2', 'Licensed', $records, $xpath);
$this->getElectronicResults('3', 'Partially licensed', $records, $xpath);
$this->getElectronicResults('4', 'Not free', $records, $xpath);
$this->getElectronicResults('10', 'Not free', $records, $xpath);
$this->getElectronicResults('10', 'Unknown Electronic', $records, $xpath);
$this->getElectronicResults('-1', 'Not free', $records, $xpath);
// get results for print, only if available
$this->getPrintResults('2', 'Print available', $records, $xpath);
$this->getPrintResults('3', 'Print partially available', $records, $xpath);
$this->getPrintResults('10', 'Unknown Print', $records, $xpath);
$records['messages'] = $this->messages ?? [];
$records['stateOfResults'] = $this->stateOfResults ?? [];
......@@ -208,10 +209,12 @@ class Ezb extends BaseEzb
$bibId = 'AAAAA';
$isil = '';
}
$openURL .= '&pid=' .
'bibid%3D' . $bibId .
(!empty($isil) ? '%26isil%3D' . $isil : '');
} elseif (isset($this->config->bibid)) {
if (!empty($isil)) {
$openURL .= '&pid=' . 'isil%3D' . $isil;
} else {
$openURL .= '&pid=' . 'bibid%3D' . $bibId;
}
} elseif (isset($this->config->bibid)) { // if library info fails use normal config?
$openURL .= '&pid=' .
'bibid%3D' . $this->config->bibid;
} elseif (isset($this->config->useClientIp)
......@@ -249,7 +252,7 @@ class Ezb extends BaseEzb
"/OpenURLResponseXML/Full/ElectronicData/ResultList/Result[@state=" .
$state . "]"
);
$accessLevel_mapping = [
'article' => 'article',
'issue' => 'issue',
......@@ -258,10 +261,11 @@ class Ezb extends BaseEzb
'homepage' => 'default',
'abstract' => 'abstract'
];
$i = 0;
foreach ($results as $result) {
$record = [];
// get title from XPath Element defined in $xpathTitleSelector
$accessLevelXP = "/OpenURLResponseXML/Full/ElectronicData/ResultList/" .
"Result[@state={$state}][".($i+1)."]/AccessLevel";
$accessLevel = $xpath->query($accessLevelXP, $result)->item(0);
......@@ -269,28 +273,58 @@ class Ezb extends BaseEzb
$record['title']
= $accessLevel_mapping[strip_tags($accessLevel->nodeValue)];
}
// get additional coverage information
$additionalXP = "/OpenURLResponseXML/Full/ElectronicData/ResultList/" .
"Result[@state={$state}][" . ($i + 1) . "]/Additionals/Additional";
$additionalType = ['nali', 'intervall', 'moving_wall'];
$additionals = [];
foreach ($additionalType as $type) {
$additional = $xpath
->query($additionalXP . "[@type='" . $type . "']", $result)->item(0);
if (isset($additional->nodeValue)) {
$additionals[$type] = strip_tags($additional->nodeValue);
}
}
$record['coverage']
= !empty($additionals) ? implode(";", $additionals) : $coverage;
// try to find direct access URL
$accessUrlXP = "/OpenURLResponseXML/Full/ElectronicData/ResultList/" .
"Result[@state={$state}][".($i+1)."]/AccessURL";
$accessUrl = $xpath->query($accessUrlXP, $result)->item(0);
// try to find journal URL as fallback for direct access URL
$journalUrlXP = "/OpenURLResponseXML/Full/ElectronicData/ResultList/" .
"Result[@state={$state}][".($i+1)."]/JournalURL";
$journalUrl = $xpath->query($journalUrlXP, $result)->item(0);
// return direct access URL if available
// otherwise journal URL as fallback
if (isset($accessUrl->nodeValue)) {
$record['href'] = $accessUrl->nodeValue;
} elseif (isset($journalUrl)) {
$record['href'] = $journalUrl->nodeValue;
}
$stateOfResultXP = "/OpenURLResponseXML/Full/ElectronicData/ResultList/"
. "Result/@state";
$stateOfResult = $xpath->query($stateOfResultXP, $result)->item(0);
if (isset($stateOfResult->nodeValue)) {
$this->stateOfResults[] = $stateOfResult->nodeValue;
}
$readmeXP = "/OpenURLResponseXML/Full/ElectronicData/ResultList/" .
"Result[@state={$state}][" . ($i + 1) . "]/ReadmeURL[@lang='" .
$this->getTranslatorLocale() . "']";
$readme = $xpath->query($readmeXP, $result)->item(0);
if (isset($readme->nodeValue)) {
$record['coverageHref'] = $readme->nodeValue;
}
$record['access'] = $this->electronic_state_access_mapping[$state];
// Service type needs to be hard-coded for calling code to properly
// categorize links. The commented code below picks a more appropriate
// value but won't work for now -- retained for future reference.
......@@ -344,6 +378,12 @@ class Ezb extends BaseEzb
/* messages depends on access state and will be build within templates */
$record['access'] = $this->print_state_access_mapping[$state];
$urlXP = "/OpenURLResponseXML/Full/PrintData/References/Reference/URL";
$url = $xpath->query($urlXP, $result)->item($i);
if (isset($url->nodeValue)) {
$record['href'] = $url->nodeValue;
}
// Service type needs to be hard-coded for calling code to properly
// categorize links. The commented code below picks a more appropriate
// value but won't work for now -- retained for future reference.
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment