Skip to content
Snippets Groups Projects
Commit 98b73d26 authored by Gregor Gawol's avatar Gregor Gawol
Browse files

modified ui

parent 31380ee3
Branches
Tags
No related merge requests found
Pipeline #1781 passed with stage
in 13 seconds
<!-- dbis-module: ajax - dbis --> <!-- dbis-module: ajax - dbis -->
<div> <div>
<? if (!empty($this->results)): ?> <? if (!empty($this->isISIL)): ?>
<?=print_r($this->results);?> <?=$this->transEsc('Exemplar in Ihrer Heimatbibliothek vorhanden.');?>
<div class="openurls"> <? else: ?>
<ul> <?=$this->transEsc('Nicht in Ihrer Heimatbibliothek vorhanden.');?>
<? /*foreach ($this->results as $result): ?>
<li>
<h3><?=$result['name']?></h3>
</li>
<? unset($result['name']); ?>
<? foreach ($result as $db): ?>
<li>
<a href="<?=$db[0]->getUrl()?>" target="_blank"><?=$db[0]->getHeadline()?></a>
</li>
<? endforeach; ?>
<? endforeach;*/ ?>
</ul>
</div>
<? endif; ?> <? endif; ?>
<a href="<?=$this->url?>" target="_blank"><?=$this->transEsc('Mehr Informationen');?></a>
</div> </div>
<!-- dbis-module: ajax - dbis - END --> <!-- dbis-module: ajax - dbis - END -->
\ No newline at end of file
...@@ -119,6 +119,12 @@ class GetBoss extends \VuFind\AjaxHandler\AbstractBase ...@@ -119,6 +119,12 @@ class GetBoss extends \VuFind\AjaxHandler\AbstractBase
*/ */
public function handleRequest(Params $params) public function handleRequest(Params $params)
{ {
if (!isset($this->config->Search)) {
return $this->formatResponse(
'Configuration file boss.ini not found',
self::STATUS_HTTP_BAD_REQUEST
);
}
// if ($patron = $this->ils->patronLogin()) { // if ($patron = $this->ils->patronLogin()) {
// //
// // Stop now if the user does not have valid catalog credentials available: // // Stop now if the user does not have valid catalog credentials available:
...@@ -129,10 +135,15 @@ class GetBoss extends \VuFind\AjaxHandler\AbstractBase ...@@ -129,10 +135,15 @@ class GetBoss extends \VuFind\AjaxHandler\AbstractBase
// $profile['homeLibrary'] : 'AAAAA'; // $profile['homeLibrary'] : 'AAAAA';
// $this->rlm->checkLibConfig($bibId); // $this->rlm->checkLibConfig($bibId);
// } // }
// } else {
// $this->rlm->checkLibConfig('AAAAA');
// } // }
// Sample BibId // Sample BibId
$this->rlm->checkLibConfig('UBL'); $this->rlm->checkLibConfig('UBL');
$networks = isset($this->config->Network->networks) ?
$this->config->Network->networks->toArray() : [];
$network = $this->rlm->getLibValue('network');
$driver = $this->recordLoader->load( $driver = $this->recordLoader->load(
$params->fromQuery('id'), $params->fromQuery('id'),
...@@ -149,7 +160,7 @@ class GetBoss extends \VuFind\AjaxHandler\AbstractBase ...@@ -149,7 +160,7 @@ class GetBoss extends \VuFind\AjaxHandler\AbstractBase
$methodName = "getRequest" . strtoupper($data); $methodName = "getRequest" . strtoupper($data);
// TODO library network value of configuration // TODO library network value of configuration
$results = $this->bossClient->$methodName( $results = $this->bossClient->$methodName(
$value, $this->rlm->getNetworkValueUpper() $value, strtoupper($this->rlm->getLibValue('network'))
); );
if (!empty($results['data'])) { if (!empty($results['data'])) {
break; break;
...@@ -158,29 +169,35 @@ class GetBoss extends \VuFind\AjaxHandler\AbstractBase ...@@ -158,29 +169,35 @@ class GetBoss extends \VuFind\AjaxHandler\AbstractBase
} }
// default search of boss // default search of boss
if (empty($results)) { if (empty($results)) {
$author = $driver->tryMethod('getAuthor'); $author = $driver->tryMethod('getCombinedAuthors');
$author = count($author) > 0 ? $author[0] : '';
$title = $driver->tryMethod('getTitle'); $title = $driver->tryMethod('getTitle');
$year = $driver->tryMethod('getYear'); $year = $driver->tryMethod('getPublishDateSort');
$this->bossClient->getRequestQuery( $results = $this->bossClient->getRequestQuery(
$author, $title, $year, $author, $title, $year,
$this->rlm->getNetworkValueUpper() strtoupper($this->rlm->getLibValue('network'))
); );
} }
$isilCallNumber = $this->getISILCallNumber($results);
$network = $this->rlm->getNetworkValueLower(); $isilCallNumber = $this->getISILCallNumber($results['data']);
$inArray = in_array($network, $networks);
$isbns = $driver->tryMethod('getISBNs');
$isbns = count($isbns) > 0 ? $isbns[0] : '';
$view = [ $view = [
'isISIL' => $this->isISIL($isilCallNumber['isils'], $this->rlm->getBossValue()), 'isISIL' => ($inArray ?
'url' => sprintf($this->config->Search->$network, $results['param']) $this->isISIL($isilCallNumber['isils'], $this->rlm->getLibValue('boss')) : false),
'url' => sprintf($this->config->SearchUrls->$network, ($inArray ?
$results['param'] : $isbns))
]; ];
$html = $this->renderer->render('ajax/boss.phtml', $view); $html = $this->renderer->render('ajax/boss.phtml', $view);
return $this->formatResponse(compact('html')); return $this->formatResponse(compact('html'));
} }
private function getISILCallNumber($results) private function getISILCallNumber($results)
{ {
$tmp = [];
$retval = []; $retval = [];
$results = is_null($results) ? [] : $results;
foreach ($results as $result) { foreach ($results as $result) {
foreach ($result as $holding) { foreach ($result as $holding) {
$tmp[] = $holding['isil']; $tmp[] = $holding['isil'];
...@@ -191,6 +208,10 @@ class GetBoss extends \VuFind\AjaxHandler\AbstractBase ...@@ -191,6 +208,10 @@ class GetBoss extends \VuFind\AjaxHandler\AbstractBase
$retval['isils'] = !empty($tmp) ? $tmp : []; $retval['isils'] = !empty($tmp) ? $tmp : [];
if (empty($results)) {
$retval['isils'] = [];
}
return $retval; return $retval;
} }
......
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