From 7a05b3e8a5c813b5ee71ac4a0adc9ec41603c00b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Lahmann?= <lahmann@ub.uni-leipzig.de> Date: Wed, 18 Jan 2017 16:38:04 +0100 Subject: [PATCH] refs #9556: * initial commit for RecordDriver SolrIS --- module/finc/config/module.config.php | 3 +- module/finc/src/finc/RecordDriver/Factory.php | 18 +++++++ module/finc/src/finc/RecordDriver/SolrIS.php | 54 +++++++++++++++++++ .../templates/RecordDriver/SolrAI/core.phtml | 2 +- 4 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 module/finc/src/finc/RecordDriver/SolrIS.php diff --git a/module/finc/config/module.config.php b/module/finc/config/module.config.php index 2214c7fe670..0c664342790 100644 --- a/module/finc/config/module.config.php +++ b/module/finc/config/module.config.php @@ -51,7 +51,8 @@ $config = [ 'solrmarcfincpda' => 'finc\RecordDriver\Factory::getSolrMarcFincPDA', 'solrmarcremote' => 'finc\RecordDriver\Factory::getSolrMarcRemote', 'solrmarcremotefinc' => 'finc\RecordDriver\Factory::getSolrMarcRemoteFinc', - 'solrai' => 'finc\RecordDriver\Factory::getSolrAI' + 'solrai' => 'finc\RecordDriver\Factory::getSolrAI', + 'solris' => 'finc\RecordDriver\Factory::getSolrIS' ], ], 'recordtab' => [ diff --git a/module/finc/src/finc/RecordDriver/Factory.php b/module/finc/src/finc/RecordDriver/Factory.php index 8281c7f0be3..96f1b7404e8 100644 --- a/module/finc/src/finc/RecordDriver/Factory.php +++ b/module/finc/src/finc/RecordDriver/Factory.php @@ -144,6 +144,24 @@ class Factory ); } + /** + * Factory for SolrIS record driver. + * + * @param ServiceManager $sm Service manager. + * + * @return SolrIS + */ + public static function getSolrIS(ServiceManager $sm) + { + // Despite providing recordConfig to AI RecordDriver RecordDriver IS does not + // need a recordConfig, thus null is provided + return new SolrIS( + $sm->getServiceLocator()->get('VuFind\Config')->get('config'), + null, + null + ); + } + /** * Factory for SolrMarcRemoteFinc record driver. * diff --git a/module/finc/src/finc/RecordDriver/SolrIS.php b/module/finc/src/finc/RecordDriver/SolrIS.php new file mode 100644 index 00000000000..acd89ad39c4 --- /dev/null +++ b/module/finc/src/finc/RecordDriver/SolrIS.php @@ -0,0 +1,54 @@ +<?php +/** + * Recorddriver for Solr records with intermediate schema in field fullrecord in + * index of Leipzig University Library + * + * PHP version 5 + * + * Copyright (C) Leipzig University Library 2017. + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * @category VuFind2 + * @package RecordDrivers + * @author André Lahmann <lahmann@ub.uni-leipzig.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org/wiki/vufind2:record_drivers Wiki + */ +namespace finc\RecordDriver; + +/** + * Recorddriver for Solr records with intermediate schema in field fullrecord in + * index of Leipzig University Library + * + * @category VuFind2 + * @package RecordDrivers + * @author André Lahmann <lahmann@ub.uni-leipzig.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org/wiki/vufind2:record_drivers Wiki + */ +class SolrIS extends SolrAI +{ + /** + * Returns the IS fullrecord as decoded json. + * + * @param string $id Record id to be retrieved. + * + * @return array + */ + protected function getAIJSONFullrecord($id) + { + return json_decode($this->fields['fullrecord'], true); + } +} diff --git a/themes/finc/templates/RecordDriver/SolrAI/core.phtml b/themes/finc/templates/RecordDriver/SolrAI/core.phtml index baeef4cbd15..95605d92e0f 100644 --- a/themes/finc/templates/RecordDriver/SolrAI/core.phtml +++ b/themes/finc/templates/RecordDriver/SolrAI/core.phtml @@ -206,7 +206,7 @@ if($loggedin = $this->auth()->isLoggedIn()) { <? endif; ?> <?/* Display series section if at least one series exists. */?> - <? $series = $this->driver->getSeries(); if (!empty($series)): ?> + <? $series = $this->driver->getSeries(); if (!empty($series) && is_array($series)): ?> <tr> <th><?=$this->transEsc('Series')?>: </th> <td> -- GitLab