Skip to content
Snippets Groups Projects
Commit ce399655 authored by Dorian Merz's avatar Dorian Merz
Browse files

Merge branch 'instance/fid' into instance/fid_adlr

parents 92ceed66 628031c4
No related merge requests found
......@@ -135,6 +135,11 @@ return [
Fid::class => FidFactory::class,
],
],
'recordtab' => [
'invokables' => [
'worldcat' => 'fid\RecordTab\Worldcat',
],
],
'resolver_driver' => [
'factories' => [
Ezb::class =>
......
<?php
/**
* Staff view tab for AI records
*
* PHP version 5
*
* Copyright (C) Villanova University 2010.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category VuFind
* @package RecordTabs
* @author Demian Katz <demian.katz@villanova.edu>
* @author André Lahmann <lahmann@ub.uni-leipzig.de>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development:plugins:record_tabs Wiki
*/
namespace fid\RecordTab;
/**
* Staff view tab for AI records
*
* @category VuFind
* @package RecordTabs
* @author Demian Katz <demian.katz@villanova.edu>
* @author Gregor Gawol <gawol@ub.uni-leipzig.de>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development:plugins:record_tabs Wiki
*/
class Worldcat extends \VuFind\RecordTab\AbstractBase
{
/**
* Constructor
*/
public function __construct()
{
$this->accessPermission = 'WorldcatTab';
}
/**
* Get the on-screen description for this tab.
*
* @return string
*/
public function getDescription()
{
return 'view_worldcat';
}
/**
* Is this tab active?
*
* @return bool
*/
public function isActive()
{
$isbns = $this->getRecordDriver()->tryMethod('getISBNs');
$oclc = $this->getRecordDriver()->tryMethod('getOCLC');
$permission = $this->getRecordDriver()->tryMethod('getRecordPermission');
$isFilled = false;
if (!empty($oclc)) {
$isFilled = true;
} elseif (!empty($isbns)) {
$isFilled = true;
}
if (isset($permission)) {
return $permission != null && $isFilled ? true : false;
}
return $isFilled;
}
}
<!-- fid: recordtab - worldcat -->
<? $script = <<<JS
$(document).ready(function() {
var recordId = $('.hiddenId').val();
var recordSource = $('.hiddenSource').val();
// console.log({id: recordId, source: recordSource});
$.ajax({
dataType: 'json',
url: VuFind.path + '/AJAX/JSON?method=getWorldCat',
method: 'GET',
data: {id: recordId, source: recordSource}
}).done(function(response) {
$('.worldcat').html(response.data.html);
});
});
JS;
?>
<?=$this->inlineScript(\Zend\View\Helper\HeadScript::SCRIPT, $script, 'SET');?>
<div class="worldcat"></div>
<!-- fid: recordtab - worldcat - END -->
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