Browse Source

Research Starters, Exact Placard Match, Did you mean, other

- sort the variables on admin interface
- Fixed access to interface when exception existed from wrong API
credentials
- add support for user IP authentication
- add support for GZIP compression in the requests
- clean php code
- prevent site down against network/connection failures
- added more search fields to advanced search
- did you mean / auto suggest terms
- added Research Starters to result list
- Add Exact Placard Match to result list
roblib
Rui Francisco 8 years ago
parent
commit
2c136716a0
  1. 111
      ebsco/css/ebsco.css
  2. 2
      ebsco/ebsco.info
  3. 50
      ebsco/ebsco.module
  4. 3
      ebsco/js/ebsco.js
  5. 54
      ebsco/lib/EBSCOAPI.php
  6. 70
      ebsco/lib/EBSCOConnector.php
  7. 171
      ebsco/lib/EBSCODocument.php
  8. 4
      ebsco/lib/EBSCORecord.php
  9. 122
      ebsco/lib/EBSCOResponse.php
  10. 10
      ebsco/templates/ebsco-advanced-search.tpl.php
  11. 33
      ebsco/templates/ebsco-basic-search.tpl.php
  12. 240
      ebsco/templates/ebsco-result.tpl.php
  13. 369
      ebsco/templates/ebsco-results.tpl.php
  14. 3
      ebsco/templates/ebsco-side-facets.tpl.php

111
ebsco/css/ebsco.css

@ -1,7 +1,8 @@
/*
* The styles for EBSCO module
* The styles for EBSCO module
*
* Copyright [2014] [EBSCO Information Services]
*
* Copyright [2017] [EBSCO Information Services]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -397,7 +398,7 @@
/** Icons ***/
.ebsco .icon {
.icon {
background: url("../images/sprites_32.png") no-repeat top left;
height: 32px;
line-height: 32px;
@ -405,15 +406,15 @@
padding: 0 0 0 36px !important;
}
.ebsco .icon.ebook {
.icon.ebook {
background-position: 0 0;
}
.ebsco .icon.html {
.icon.html {
background-position: 0 -42px;
}
.ebsco .icon.pdf {
.icon.pdf {
background-position: 0 -84px;
}
@ -443,3 +444,101 @@
.icon16.tick {
background-position: 0 -171px;
}
/* RS, EMP carousel */
#quote-carousel
{
padding: 0 10px 30px 10px;
margin-top: 30px;
}
/* Control buttons */
#quote-carousel .carousel-control
{
background: none;
color: #222;
font-size: 2.3em;
text-shadow: none;
margin-top: 30px;
}
/* Previous button */
#quote-carousel .carousel-control.left
{
left: -12px;
}
/* Next button */
#quote-carousel .carousel-control.right
{
right: -12px !important;
}
/* Changes the position of the indicators */
#quote-carousel .carousel-indicators
{
right: 50%;
top: auto;
bottom: 0px;
margin-right: -19px;
}
/* Changes the color of the indicators */
#quote-carousel .carousel-indicators li
{
background: #c0c0c0;
}
#quote-carousel .carousel-indicators .active
{
background: #333333;
}
#quote-carousel img
{
width: 250px;
height: 100px
}
/* End carousel */
.item blockquote {
border-left: none;
margin: 0;
}
.item blockquote img {
margin-bottom: 10px;
}
.item blockquote p:before {
content: "\f10d";
font-family: 'Fontawesome';
float: left;
margin-right: 10px;
}
#relatedInformation img { padding-right :10px;}
.glyphicon {
position: relative;
top: 1px;
display: inline-block;
font-family: 'Glyphicons Halflings';
font-style: normal;
font-weight: 400;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.carousel-control .glyphicon-chevron-right {
position: absolute;
top: 50%;
z-index: 5;
display: inline-block;
}
.carousel-control.left span, .carousel-control.right span {
background-color: #000;
}
h3.relatedTitle a{
font-size:24px;
}
/* */

2
ebsco/ebsco.info

@ -1,5 +1,5 @@
name = EBSCO Discovery Service
description = Full-text articles and eBooks from EBSCOhost Discovery Service
description = Full-text articles and eBooks from EBSCO Discovery Service
core = 7.x
configure = admin/config/search/ebsco

50
ebsco/ebsco.module

@ -1,8 +1,8 @@
<?php
/*
* EBSCO Drupal module
/*
*
* Copyright [2014] [EBSCO Information Services]
*
* Copyright [2017] [EBSCO Information Services]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
require_once 'lib/EBSCODocument.php';
# global variable
@ -108,6 +108,9 @@ function ebsco_permission() {
'administer ebsco' => array(
'title' => t('Administer EBSCO')
),
'use ebsco' => array(
'title' => t('Use EBSCO')
)
);
}
@ -121,15 +124,15 @@ function ebsco_admin() {
$form['ebsco_credentials'] = array(
'#type' => 'fieldset',
'#title' => t('API credentials')
'#title' => t('EDS API credentials')
);
$form['ebsco_credentials']['ebsco_password'] = array(
$form['ebsco_credentials']['ebsco_profile'] = array(
'#type' => 'textfield',
'#title' => t('Password'),
'#default_value' => variable_get('ebsco_password'),
'#title' => t('Profile Id'),
'#default_value' => variable_get('ebsco_profile'),
'#size' => 50,
'#description' => t("The API password."),
'#description' => t("The API Profile Id."),
'#required' => TRUE
);
@ -142,18 +145,19 @@ function ebsco_admin() {
'#required' => TRUE
);
$form['ebsco_credentials']['ebsco_profile'] = array(
$form['ebsco_credentials']['ebsco_password'] = array(
'#type' => 'textfield',
'#title' => t('Profile Id'),
'#default_value' => variable_get('ebsco_profile'),
'#title' => t('Password'),
'#default_value' => variable_get('ebsco_password'),
'#size' => 50,
'#description' => t("The API Profile Id."),
'#description' => t("The API password."),
'#required' => TRUE
);
$form['ebsco_credentials']['ebsco_interface'] = array(
'#type' => 'textfield',
'#title' => t('Interface Id'),
'#default_value' => variable_get('ebsco_interface'),
'#size' => 50,
'#description' => t("The API Interface Id."),
'#required' => FALSE
@ -162,11 +166,21 @@ function ebsco_admin() {
$form['ebsco_credentials']['ebsco_organization'] = array(
'#type' => 'textfield',
'#title' => t('Organization Id'),
'#default_value' => variable_get('ebsco_organization'),
'#size' => 50,
'#description' => t("The API Organization Id."),
'#required' => FALSE
);
$form['ebsco_credentials']['ebsco_local_ips'] = array(
'#type' => 'textfield',
'#title' => t('Local IP addresses'),
'#default_value' => variable_get('ebsco_local_ips'),
'#size' => 100,
'#description' => t("Local IP address list for guest detection (ex: 127.0.0.1, 192.168.10.1, 172.18.12)"),
'#required' => FALSE
);
$form['ebsco_credentials']['ebsco_guest'] = array(
'#type' => 'radios',
'#title' => t('Guest ?'),
@ -202,7 +216,7 @@ function ebsco_admin() {
$form['ebsco_general']['ebsco_default_amount'] = array(
'#type' => 'select',
'#title' => t('Default detail level'),
'#default_value' => variable_get('ebsco_default_amount', 'detailed'),
'#default_value' => variable_get('ebsco_default_amount', 'brief'),
'#description' => t("Default level of data detail."),
'#options' => EBSCODocument::amount_options(),
'#required' => TRUE
@ -415,7 +429,7 @@ function ebsco_sort_form() {
$options = EBSCODocument::amount_options();
$values = array_values($options);
$default_value = isset($params['amount']) ? $params['amount'] : $values[0];
$default_value = isset($params['amount']) ? $params['amount'] : variable_get('ebsco_default_amount', 'brief');
$form['mode'] = array(
'#id' => 'ebsco-amount',
'#type' => 'select',
@ -886,6 +900,8 @@ function template_preprocess_ebsco_results(&$variables) {
$variables['record_count'] = $Document->record_count();
$variables['search_view'] = $Document->search_view();
$variables['search_time'] = $Document->search_time();
$variables['relatedContent'] = $Document->relatedContent();
$variables['autoSuggestTerms'] = $Document->autoSuggestTerms();
$variables['lookfor'] = '';
if (isset($params['lookfor'])) {
$variables['lookfor'] = $params['lookfor'];
@ -904,7 +920,7 @@ function template_preprocess_ebsco_results(&$variables) {
$variables['sort_form'] = drupal_render($v1);
// Save data needed by scroller in Detailed view page
$Document->search_write();
//$Document->search_write();
}
@ -1046,4 +1062,4 @@ function auto_link($string)
$string
);
return $linkedString;
}
}

3
ebsco/js/ebsco.js

@ -1,7 +1,8 @@
/*
* The EBSCO module javascript
*
*
* Copyright [2014] [EBSCO Information Services]
* Copyright [2017] [EBSCO Information Services]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

54
ebsco/lib/EBSCOAPI.php

@ -4,9 +4,9 @@
* EBSCO EDS API class
*
* PHP version 5
*
*
*
* Copyright [2014] [EBSCO Information Services]
* Copyright [2017] [EBSCO Information Services]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -18,7 +18,8 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*
*/
require_once 'EBSCOConnector.php';
@ -56,7 +57,6 @@ class EBSCOAPI
*/
private $config;
/**
* VuFind search types mapped to EBSCO search types
* used for urls in search results / detailed result
@ -69,7 +69,9 @@ class EBSCOAPI
'Author' => 'AU',
'Source' => 'SO',
'Subject' => 'SU',
'Title' => 'TI'
'Title' => 'TI',
'ISBN' => 'IB',
'ISSN' => 'IS'
);
@ -326,7 +328,6 @@ class EBSCOAPI
);
$response = $this->connector()->requestSessionToken($headers);
// Raise the exception so that any code running this method should exit immediately
if ($this->isError($response)) {
return $response;
@ -384,8 +385,7 @@ class EBSCOAPI
* @access public
*/
public function apiSearch($search, $filters,
$start = 1, $limit = 10, $sortBy = 'relevance', $amount = 'detailed', $mode = 'all'
) {
$start = 1, $limit = 10, $sortBy = 'relevance', $amount = 'detailed', $mode = 'all', $rs=false, $emp=false,$autosuggest=false) {
$query = array();
// Basic search
@ -411,7 +411,8 @@ class EBSCOAPI
}
// Advanced search
} else if(!empty($search['group'])) {
}
else if(!empty($search['group'])) {
$counter = 1;
foreach ($search['group'] as $group) {
@ -480,7 +481,13 @@ class EBSCOAPI
$groupId += 1;
}
}
//2014-03-26 - new action to jump to page
if ($start>1) {
$query['action']="GoToPage(".$start.")";
}
// Add the sort option
$sortBy = in_array($sortBy, self::$sort_options) ? $sortBy : self::$mapped_sort_options[$sortBy];
@ -503,11 +510,33 @@ class EBSCOAPI
/// Specifies whether or not to include facets
'includefacets' => 'y',
'resultsperpage' => $limit,
'pagenumber' => $start,
//2014-03-26 RF
'pagenumber' => $start,
//'pagenumber' => 1,
// Specifies whether or not to include highlighting in the search results
'highlight' => 'y'
);
if($autosuggest==true) {
$params["autosuggest"]="y";
}
if ($rs==true){
$params["relatedcontent"]="rs";
}
if ($emp==true){
if (isset($params["relatedcontent"])) {
$params["relatedcontent"].=",emp";
}
else
{
$params["relatedcontent"]="emp";
}
}
$params = array_merge($params, $query);
$result = $this->request('Search', $params);
@ -551,11 +580,12 @@ class EBSCOAPI
if ($result = $this->readSession('info')) {
return $result;
}
$result = $this->request('Info');
if(!$this->isError($result)) {
$this->writeSession('info', $result);
}
return $result;
}

70
ebsco/lib/EBSCOConnector.php

@ -3,8 +3,9 @@
/**
* EBSCOException class
* Used when EBSCO API calls return error messages
*
*
* Copyright [2014] [EBSCO Information Services]
* Copyright [2017] [EBSCO Information Services]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,7 +17,7 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
class EBSCOException extends Exception
{
@ -151,6 +152,12 @@ class EBSCOConnector
*/
private $isGuest;
/**
* Contains the list of ip addresses
* @global string
*/
private $local_ip_address;
/*
* You can log HTTP_Request requests using this option
@ -175,6 +182,7 @@ class EBSCOConnector
*
* @access public
*/
public function __construct($config)
{
$this->password = $config['password'];
@ -182,7 +190,8 @@ class EBSCOConnector
$this->interfaceId = $config['interface'];
$this->profileId = $config['profile'];
$this->orgId = $config['organization'];
$this->isGuest = user_is_logged_in() ? 'n' : 'y';
$this->local_ip_address = $config['local_ip_address'];
$this->isGuest = (user_is_logged_in() || $this->isGuestIPAddress($_SERVER["REMOTE_ADDR"]))? 'n' : 'y';
$this->logAPIRequests = ($config['log'] == 1);
if ($this->logAPIRequests) {
$writer = new Zend_Log_Writer_Stream('php://output');
@ -191,6 +200,30 @@ class EBSCOConnector
}
/**
* Detects if the user is authorized based on the IP address
*
* @return string
*/
public function isGuestIPAddress($ipUser)
{
$s= $this->local_ip_address;
if (trim($s)=="") {
return false;
}
//break records
$m=explode(",",$s);
foreach($m as $ip) {
if ( strcmp(substr($ipUser,0,strlen(trim($ip))),trim($ip))==0) {
// inside of ip address range of customer
return true;
}
}
return false;
}
/**
* Public getter for private isGuest
*
@ -305,10 +338,12 @@ BODY;
$url = self::$end_point . '/Info';
$response = $this->request($url, $params, $headers);
return $response;
}
/**
* Send an HTTP request and inspect the response
*
@ -343,6 +378,13 @@ BODY;
}
}
//add compression in case its not there
$headers = array_merge(
array('Accept-Encoding' => 'gzip,deflate'),
$headers
);
$options = array(
'headers' => $headers,
'method' => $method,
@ -352,12 +394,26 @@ BODY;
// Send the request
try {
$response = drupal_http_request($url, $options);
//print_r($url);
//print_r($response);
$code = $response->code;
switch ($code) {
if (isset($response->headers['content-encoding'])) {
if ($response->headers['content-encoding'] == 'gzip') {
$response->data = gzinflate(substr($response->data, 10));
}
elseif ($response->headers['content-encoding'] == 'deflate') {
$response->data = gzinflate($response->data);
}
}
switch ($code) {
case self::HTTP_OK:
$xml_str = $response->data;
try {
$xml_str = $response->data;
try {
// clean EMP namespace
$xml_str=str_replace(array("<a:","</a:"),array("<","</"),$xml_str);
$xml = simplexml_load_string($xml_str);
$return = $xml;
} catch(Exception $e) {
@ -411,6 +467,8 @@ BODY;
break;
}
} catch (Exception $e) {
$message = $this->toString($client); // or $this->toString($response)
$this->logger->log($message, Zend_Log::ERR);
$return = new EBSCOException($response);
}

171
ebsco/lib/EBSCODocument.php

@ -9,9 +9,9 @@
* - displaying statistics about the search, etc
*
* PHP version 5
*
*
*
* Copyright [2014] [EBSCO Information Services]
* Copyright [2017] [EBSCO Information Services]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -23,7 +23,7 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.*
*/
require_once 'EBSCOAPI.php';
@ -73,6 +73,14 @@ class EBSCODocument
* #global array of EBSCORecord objects
*/
private $records = array();
/**
* The array of EBSCORecord models returned by a Search API call
* #global array of RelatedRecords
*/
private $relatedContent = array();
private $autoSuggestTerms = array();
/**
* The array of filters currently applied
@ -85,6 +93,12 @@ class EBSCODocument
* @global integer
*/
private $limit = 10;
/**
* Default level of data detail
* @global string
*/
private $amount = 'brief';
/**
* Maximum number of links displayed by the pagination
@ -166,9 +180,14 @@ class EBSCODocument
'AllFields' => 'All Text',
'Title' => 'Title',
'Author' => 'Author',
'Subject' => 'Subject terms'
'Subject' => 'Subject terms',
'Source' => 'Journal Title/Source',
'Abstract' => 'Abstract',
'ISBN' => 'ISBN',
'ISSN' => 'ISSN'
);
private $local_ips = "";
/**
* Constructor.
@ -183,12 +202,14 @@ class EBSCODocument
'profile' => variable_get('ebsco_profile'),
'interface' => variable_get('ebsco_interface'),
'organization' => variable_get('ebsco_organization'),
'local_ip_address' => variable_get('ebsco_local_ips'),
'guest' => variable_get('ebsco_guest'),
'log' => variable_get('ebsco_log')
));
$this->params = $params ? $params : $_REQUEST;
$this->limit = variable_get('ebsco_default_limit') ? variable_get('ebsco_default_limit') : $this->limit;
$this->amount = variable_get('ebsco_default_amount') ? variable_get('ebsco_default_amount') : $this->amount;
}
@ -226,7 +247,7 @@ class EBSCODocument
public function search()
{
$search = array();
if (isset($this->params['lookfor']) && isset($this->params['type'])) {
$search = array(
'lookfor' => $this->params['lookfor'],
@ -242,15 +263,34 @@ class EBSCODocument
$page = isset($this->params['page']) ? $this->params['page'] + 1 : 1;
$limit = $this->limit;
$sort = isset($this->params['sort']) ? $this->params['sort'] : 'relevance';
$amount = isset($this->params['amount']) ? $this->params['amount'] : 'detailed';
$amount = isset($this->params['amount']) ? $this->params['amount'] : 'brief'; //
$mode = isset($this->params['mode']) ? $this->params['mode'] : 'all';
$this->results = $this->eds->apiSearch($search, $filter, $page, $limit, $sort, $amount, $mode);
if (isset($this->results['start'])) {
$this->results['start'] = $limit * ($page - 1);
}
//check if research starters , EMP are active
$info = $this->info();
$rs=false;
$emp=false;
if ($info["relatedContent"]){
foreach ($info["relatedContent"] as $related) {
if ( ($related["Type"] == "rs") and ($related["DefaultOn"] == "y")) {
$rs=true;
}
if ( ($related["Type"] == "emp") and ($related["DefaultOn"] == "y")) {
$emp=true;
}
}
}
$autosug=false;
if ($info["didYouMean"]){
if ( $info["didYouMean"][0]["DefaultOn"] == "y") {
$autosug=true;
}
}
$this->results = $this->eds->apiSearch($search, $filter, $page, $limit, $sort, $amount, $mode,$rs,$emp,$autosug);
return $this->results;
}
@ -277,6 +317,12 @@ class EBSCODocument
*/
public function records()
{
if ($this->record instanceof EBSCOException ) {
return null;
}
if ($this->results instanceof EBSCOException ) {
return null;
}
if (empty($this->records) && !(empty($this->results))) {
foreach($this->results['documents'] as $result) {
$this->records[] = new EBSCORecord($result);
@ -285,6 +331,26 @@ class EBSCODocument
return $this->records;
}
public function relatedContent()
{
if ($this->results instanceof EBSCOException ) {
return null;
}
$this->relatedContent = isset($this->results['relatedContent']) ? $this->results['relatedContent'] : array();
return $this->relatedContent;
}
public function autoSuggestTerms()
{
$this->autoSuggestTerms = isset($this->results['autoSuggestTerms']) ? $this->results['autoSuggestTerms'] : null;
return $this->autoSuggestTerms;
}
/**
@ -295,11 +361,19 @@ class EBSCODocument
public function pager()
{
$pager = null;
if ($this->has_records()) {
pager_default_initialize($this->record_count() / $this->limit, 1);
$pager = theme('pager', array('tags' => null, 'quantity' => self::$page_links));
$pager = preg_replace('/<li class="pager-last last">(.*)<\/li>/', '', $pager);
}
try
{
if ($this->has_records()) {
pager_default_initialize($this->record_count() / $this->limit, 1);
$pager = theme('pager', array('tags' => null, 'quantity' => self::$page_links));
$pager = preg_replace('/<li class="pager-last last">(.*)<\/li>/', '', $pager);
}
}
catch(Exception $e)
{
}
return $pager;
}
@ -395,18 +469,31 @@ class EBSCODocument
*/
public function expanders()
{
$actions = array();
$filters = $this->filters();
foreach($filters as $filter) {
$actions[] = $filter['action'];
}
$expanders = isset($this->info['expanders']) ? $this->info['expanders'] : array();
foreach($expanders as $key => $expander) {
if (in_array($expander['Action'], $actions)) {
$expanders[$key]['selected'] = true;
}
}
$expanders=array();
try
{
if ($this->info instanceof EBSCOException)
{
return $expanders;
}
$actions = array();
$filters = $this->filters();
foreach($filters as $filter) {
$actions[] = $filter['action'];
}
$expanders = isset($this->info['expanders']) ? $this->info['expanders'] : array();
foreach($expanders as $key => $expander) {
if (in_array($expander['Action'], $actions)) {
$expanders[$key]['selected'] = true;
}
}
}
catch(Exception $e)
{
}
return $expanders;
}
@ -419,6 +506,10 @@ class EBSCODocument
*/
public function facets()
{
if ($this->results instanceof EBSCOException ) {
return array();
}
$actions = array();
foreach($this->filters as $filter) {
$actions[] = $filter['action'];
@ -494,6 +585,10 @@ class EBSCODocument
public function limiters()
{
$actions = array(); $ids = array();
if ($this->info instanceof EBSCOException)
{
return array();
}
$filters = $this->filters();
foreach($filters as $filter) {
$actions[] = $filter['action'];
@ -536,6 +631,9 @@ class EBSCODocument
*/
public function record_count()
{
if ($this->results instanceof EBSCOException ) {
return 0;
}
return !empty($this->results) ? $this->results['recordCount'] : 0;
}
@ -547,6 +645,9 @@ class EBSCODocument
*/
public function record_end()
{
if ($this->results instanceof EBSCOException ) {
return -1;
}
$count = !empty($this->results) ? count($this->results['documents']) : 0;
$start = !empty($this->results) ? $this->results['start'] : 0;
return $start + $count;
@ -560,6 +661,9 @@ class EBSCODocument
*/
public function record_start()
{
if ($this->results instanceof EBSCOException ) {
return null;
}
return !empty($this->results) ? $this->results['start'] + 1 : 0;
}
@ -571,6 +675,9 @@ class EBSCODocument
*/
public function search_time()
{
if ($this->results instanceof EBSCOException ) {
return 0;
}
return !empty($this->results) &&
isset($this->results['searchTime']) ? $this->results['searchTime'] : 0;
}
@ -644,6 +751,9 @@ class EBSCODocument
*/
public function has_records()
{
if ($this->results instanceof EBSCOException ) {
return false;
}
return !empty($this->results) && !empty($this->results['documents']);
}
@ -655,6 +765,9 @@ class EBSCODocument
*/
public function search_create($query = null)
{
if ($this->results instanceof EBSCOException ) {
return array();
}
$last_search = array();
if (!empty($this->results)) {
$results_identifiers = array();

4
ebsco/lib/EBSCORecord.php

@ -4,7 +4,9 @@
*
* PHP version 5
*
* Copyright [2014] [EBSCO Information Services]
*
*
* Copyright [2017] [EBSCO Information Services]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

122
ebsco/lib/EBSCOResponse.php

@ -7,7 +7,7 @@
* PHP version 5
*
*
* Copyright [2014] [EBSCO Information Services]
* Copyright [2017] [EBSCO Information Services]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -65,15 +65,20 @@ class EBSCOResponse
{
if (!empty($this->response->AuthToken)) {
return $this->buildAuthenticationToken();
} else if (!empty($this->response->SessionToken)) {
}
else if (!empty($this->response->SessionToken)) {
return (string) $this->response->SessionToken;
} else if (!empty($this->response->SearchResult)) {
}
else if (!empty($this->response->SearchResult)) {
return $this->buildSearch();
} else if(!empty($this->response->Record)) {
}
else if(!empty($this->response->Record)) {
return $this->buildRetrieve();
} else if(!empty($this->response->AvailableSearchCriteria)) {
}
else if(!empty($this->response->AvailableSearchCriteria)) {
return $this->buildInfo();
} else { // Should not happen, it may be an exception
}
else { // Should not happen, it may be an exception
return $this->response;
}
}
@ -119,13 +124,29 @@ class EBSCOResponse
$records = $this->buildRecords();
$facets = $this->buildFacets();
}
// research Starters & emp
$relatedC=null;
if ($this->response->SearchResult->RelatedContent) {
$result =json_decode(json_encode($this->response->SearchResult->RelatedContent), TRUE);;
$relatedC = $result;
}
//did you mean / auto suggest
$autoSuggestTerms=null;
if ($this->response->SearchResult->AutoSuggestedTerms) {
$result =json_decode(json_encode($this->response->SearchResult->AutoSuggestedTerms), TRUE);;
$autoSuggestTerms = $result;
}
$results = array(
'recordCount' => $hits,
'searchTime' => $searchTime,
'numFound' => $hits,
'start' => 0,
'documents' => $records,
'relatedContent' => $relatedC,
'autoSuggestTerms' => $autoSuggestTerms,
'facets' => $facets
);
@ -149,7 +170,8 @@ class EBSCOResponse
$records = $this->response->SearchResult->Data->Records->Record;
foreach ($records as $record) {
$result = array();
//var_dump($record);
$result['ResultId'] = $record->ResultId ? (integer) $record->ResultId : '';
$result['DbId'] = $record->Header->DbId ? (string) $record->Header->DbId : '';
$result['DbLabel'] = $record->Header->DbLabel ? (string) $record->Header->DbLabel : '';
@ -225,9 +247,11 @@ class EBSCOResponse
}
}
$results[] = $result;
}
return $results;
}
@ -246,30 +270,32 @@ class EBSCOResponse
$results = array();
$facets = $this->response->SearchResult->AvailableFacets->AvailableFacet;
foreach ($facets as $facet) {
$values = array();
foreach ($facet->AvailableFacetValues->AvailableFacetValue as $value) {
$this_value = (string) $value->Value;
$this_value = str_replace(array('\(','\)'), array('(', ')'), $this_value);
$this_action = (string) $value->AddAction;
$this_action = str_replace(array('\(','\)'), array('(', ')'), $this_action);
$values[] = array(
'Value' => $this_value,
'Action' => $this_action,
'Count' => (string) $value->Count
);
}
$id = (string) $facet->Id;
$label = (string) $facet->Label;
if (!empty($label)) {
$results[] = array(
'Id' => $id,
'Label' => $label,
'Values' => $values,
'isApplied' => false
);
}
}
if ($facets) {
foreach ($facets as $facet) {
$values = array();
foreach ($facet->AvailableFacetValues->AvailableFacetValue as $value) {
$this_value = (string) $value->Value;
$this_value = str_replace(array('\(','\)'), array('(', ')'), $this_value);
$this_action = (string) $value->AddAction;
$this_action = str_replace(array('\(','\)'), array('(', ')'), $this_action);
$values[] = array(
'Value' => $this_value,
'Action' => $this_action,
'Count' => (string) $value->Count
);
}
$id = (string) $facet->Id;
$label = (string) $facet->Label;
if (!empty($label)) {
$results[] = array(
'Id' => $id,
'Label' => $label,
'Values' => $values,
'isApplied' => false
);
}
}
}
return $results;
}
@ -319,6 +345,29 @@ class EBSCOResponse
);
}
// RelatedContent
$elements = $this->response->AvailableSearchCriteria->AvailableRelatedContent->AvailableRelatedContent;
$relatedContent = array();
foreach ($elements as $element) {
$relatedContent[] = array(
'Type' => (string) $element->Type,
'Label' => (string) $element->Label,
'Action' => (string) $element->AddAction,
'DefaultOn' => (string) $element->DefaultOn
);
}
// Did you mean
$elements = $this->response->AvailableSearchCriteria->AvailableDidYouMeanOptions->AvailableDidYouMeanOption;
$didYouMean = array();
foreach ($elements as $element) {
$didYouMean[] = array(
'Id' => (string) $element->Id,
'Label' => (string) $element->Label,
'DefaultOn' => (string) $element->DefaultOn
);
}
// Limiters
$elements = $this->response->AvailableSearchCriteria->AvailableLimiters->AvailableLimiter;
$limiters = array();
@ -348,7 +397,9 @@ class EBSCOResponse
'sort' => $sort,
'tags' => $tags,
'expanders' => $expanders,
'limiters' => $limiters
'limiters' => $limiters,
'relatedContent' => $relatedContent,
'didYouMean' => $didYouMean
);
return $result;
@ -385,9 +436,12 @@ class EBSCOResponse
$target = (string) $image->Target;
$result['ImageInfo'][$size] = $target;
}
} else {
}
else
{
$result['ImageInfo'] = '';
}
if ($record->FullText) {
$availability = (integer) ($record->FullText->Text->Availability) == 1;
$links = array();

10
ebsco/templates/ebsco-advanced-search.tpl.php

@ -5,8 +5,9 @@
* Displays the advanced search form.
*
* @see template_preprocess_ebsco_advanced_search()
*
*
* Copyright [2014] [EBSCO Information Services]
* Copyright [2017] [EBSCO Information Services]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -18,7 +19,7 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
?>
@ -46,6 +47,11 @@
<option value="Title">Title</option>
<option value="Author">Author</option>
<option value="Subject">Subject terms</option>
<option value="Source">Journal Title/Source</option>
<option value="Abstract">Abstract</option>
<option value="ISBN">ISBN</option>
<option value="ISSN">ISSN</option>
</select>
</div>
<div class="delete-search">

33
ebsco/templates/ebsco-basic-search.tpl.php

@ -5,8 +5,9 @@
* Displays the basic search form block.
*
* @see template_preprocess_ebsco_basic_search()
*
*
* Copyright [2014] [EBSCO Information Services]
* Copyright [2017] [EBSCO Information Services]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -18,24 +19,22 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
?>
<div class="container-inline">
<?php if ($search_view == 'basic'): ?>
<?php print $search_form; ?>
<?php elseif ($search_view == 'advanced'): ?>
<a href="<?php print url('ebsco/advanced', array('query' => array('edit' => 1))); ?>" class="small">
<?php print t('Edit this Advanced Search'); ?>
</a> |
<a href="<?php print url('ebsco/advanced'); ?>" class="small">
<?php print t('Start a new Advanced Search'); ?>
</a> |
<a href="<?php print url('ebsco/results'); ?>" class="small">
<?php print t('Start a new Basic Search'); ?>
</a>
<br/>
<?php print t('Your search terms'); ?> : <strong><?php print check_plain($lookfor); ?></strong>
<?php endif; ?>
<?php
if ($search_view == 'basic'){
echo $search_form;
}
elseif ($search_view == 'advanced'){
echo '<a href="'.url('ebsco/advanced', array('query' => array('edit' => 1))).'" class="small">'.t('Edit this Advanced Search')."</a> |";
echo '<a href="'.url('ebsco/advanced').'" class="small">'.t('Start a new Advanced Search').'</a> |';
echo '<a href="'.url('ebsco/results').'" class="small">'.t('Start a new Basic Search').'</a>';
echo "<br/>";
echo t('Your search terms').": <strong>".check_plain($lookfor); "</strong>";
}
?>
</div>

240
ebsco/templates/ebsco-result.tpl.php

@ -5,8 +5,9 @@
* Default theme implementation for displaying an EBSCO result.
*
* @see template_preprocess_ebsco_result()
*
*
* Copyright [2014] [EBSCO Information Services]
* Copyright [2017] [EBSCO Information Services]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -18,131 +19,142 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
?>
<?php if ($record): ?>
<?php
if ($record) {
<?php
$id = check_plain($record->record_id());
$fulltextUrl = url('ebsco/fulltext', array('query' => array('id' => $id)));
$pdfUrl = url('ebsco/pdf', array('query' => array('id' => $id)));
$id = check_plain($record->record_id());
$fulltextUrl = url('ebsco/fulltext', array('query' => array('id' => $id)));
$pdfUrl = url('ebsco/pdf', array('query' => array('id' => $id)));
?>
<div class="ebsco-record">
<h1><?php print $record->title; ?></h1>
<div class="record-toolbar">
<?php if ($last_search): ?>
<div class="floatright">
<?php if ($last_search['previous']): ?>
<a href="<?php print url('ebsco/result', array('query' => array('id' => $last_search['previous'], 'op' => 'Previous'))); ?>" class="_record_link">
&laquo; <?php print t('Previous'); ?>
</a>
<?php endif; ?>
#<?php print $last_search['current_index']; ?> of <?php print $last_search['count']; ?>
<?php if ($last_search['next']): ?>
<a href="<?php print url('ebsco/result', array('query' => array('id' => $last_search['next'], 'op' => 'Next'))); ?>" class="_record_link">
<?php print t('Next'); ?> &raquo;
</a>
<?php endif; ?>
</div>
<div class="floatleft">
<a href="<?php print "?{$last_search['query']}"; ?>">
&laquo; <?php print t('Back to Results list'); ?>
</a>
</div>
<div class="clear"></div>
<?php endif; ?>
</div>
<div class="ebsco-record">
<h1><?php print $record->title; ?></h1>
<div class="span-5">
<ul class="external-links">
<?php if($record->p_link): ?>
<li>
<a href="<?php print $record->p_link; ?>">
<?php print t('View in EDS'); ?>
</a>
</li>
<?php endif; ?>
<?php if ($record->pdf_link): ?>
<li>
<a href="<?php print $pdfUrl; ?>" class="icon pdf fulltext">
<?php print t('PDF full text'); ?>
</a>
</li>
<?php endif; ?>
<?php if ($record->full_text_availability): ?>
<li>
<a href="<?php if (!user_is_logged_in()) { print $fulltextUrl; } ?>#html" class="icon html fulltext">
<?php print t('HTML full text'); ?>
</a>
</li>
<?php endif; ?>
<?php if (!empty($record->custom_links)): ?>
<?php foreach ($record->custom_links as $link): ?>
<li>
<a href="<?php print $link['Url']; ?>" target="_blank" title="<?php print $link['MouseOverText']; ?>" class="external-link">
<?php if ($link['Icon']): ?><img src="<?php print $link['Icon']?>" /><?php endif; ?><?php print $link['Name']; ?>
</a>
</li>
<?php endforeach; ?>
<?php endif; ?>
</ul>
</div>
<div class="record-toolbar">
<?php
if ($last_search){
?>
<div class="floatright">
<?php
if ($last_search['previous']){
echo '<a href="'.url('ebsco/result', array('query' => array('id' => $last_search['previous'], 'op' => 'Previous'))).'" class="_record_link">&laquo; '.t('Previous').'</a>';
}
echo "#";
print $last_search['current_index']; ?> of <?php print $last_search['count'];
if ($last_search['next']){
echo '<a href="'.url('ebsco/result', array('query' => array('id' => $last_search['next'], 'op' => 'Next'))).'" class="_record_link">'.t('Next').' &raquo;</a>';
}
?>
</div>
<div class="floatleft">
<a href="<?php print "?{$last_search['query']}"; ?>">
&laquo; <?php print t('Back to Results list'); ?>
</a>
</div>
<div class="clear"></div>
<?php
}
?>
</div>
<div class="span-13">
<table cellpadding="2" cellspacing="0" border="0" class="citation" summary="<?php print t('Bibliographic Details'); ?>">
<?php foreach ($record->items as $item): ?>
<?php if (!empty($item['Data'])): ?>
<tr valign="top">
<th width="150"><?php print t($item['Label']); ?>:</th>
<td><?php print auto_link($item['Data']); ?></td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
<div class="span-5">
<ul class="external-links">
<?php
if($record->p_link){
echo "<li> <a href='".$record->p_link."'>".t('View in EDS')."</a></li>";
}
<?php if ($record->db_label): ?>
<tr valign="top">
<th width="150"><?php print t('Database'); ?>:</th>
<td><?php print check_plain($record->db_label); ?></td>
</tr>
<?php endif; ?>
if ($record->pdf_link){
echo '
<li>
<a href="'.$pdfUrl.'" class="icon pdf fulltext">'.t('PDF full text').'</a>
</li>';
}
if ($record->full_text_availability){
echo '
<li>
<a href="'.( (!user_is_logged_in())?$fulltextUrl:"").'#html" class="icon html fulltext">'.t('HTML full text').'</a>
</li>';
}
if (!empty($record->custom_links)){
foreach ($record->custom_links as $link){
echo '
<li>
<a href="'.$link['Url'].'" target="_blank" title="'.$link['MouseOverText'].'" class="external-link">'. ($link['Icon'])? '<img src="'.$link['Icon'].'" />':''.$link['Name'].'</a>
</li>';
}
}
?>
</ul>
</div>
<?php if ($record->full_text): ?>
<tr id="html" valign="top">
<td colspan="2" class="html">
<?php print $record->full_text; ?>
</td>
</tr>
<?php elseif ($record->access_level && !user_is_logged_in()): ?>
<tr id="html" valign="top">
<td colspan="2" class="html">
<p>
<?php print t('The full text cannot be displayed to guests.'); ?>
<br />
<?php $link = '<a href="' . url('user') . '">' . t('Login') . '</a>'; ?>
<strong><?php print sprintf(t('%s for full access.'), $link); ?></strong>
</p>
</td>
</tr>
<?php endif; ?>
</table>
</div>
<div class="span-13">
<table cellpadding="2" cellspacing="0" border="0" class="citation" summary="<?php print t('Bibliographic Details'); ?>">
<?php
foreach ($record->items as $item){
if (!empty($item['Data'])){
echo '
<tr valign="top">
<th width="150">'.t($item['Label']).':</th>
<td>'.auto_link($item['Data']).'</td>
</tr>';
}
}
if ($record->db_label){
echo '
<tr valign="top">
<th width="150">'.t('Database').':</th><td>'.check_plain($record->db_label).'</td>
</tr>';
}
if ($record->full_text){
echo '
<tr id="html" valign="top">
<td colspan="2" class="html">'.$record->full_text.'</td>
</tr>';
}
elseif ($record->access_level && !user_is_logged_in()){
echo '
<tr id="html" valign="top">
<td colspan="2" class="html">
<p>'.t('The full text cannot be displayed to guests.').'<br />.';
$link = '<a href="' . url('user') . '">' . t('Login') . '</a>';
echo '<strong>'.sprintf(t('%s for full access.'), $link).'</strong>
</p>
</td>
</tr>
';
}
?>
</table>
</div>
<div class="span-4">
<?php if ($record->medium_thumb_link): ?>
<img src="<?php print check_url($record->medium_thumb_link); ?>" class="book-jacket" alt="<?php print t('Book jacket')?>"/>
<?php endif; ?>
<?php if ($record->publication_type): ?>
<p><?php print check_plain($record->publication_type); ?></p>
<?php endif; ?>
</div>
<div class="span-4">
<?php
if ($record->medium_thumb_link){
echo '<img src="'.check_url($record->medium_thumb_link).'" class="book-jacket" alt="'.t('Book jacket').'"/>';
}
if ($record->publication_type){
echo '<p>'. check_plain($record->publication_type).'</p>';
}
?>
</div>
<div class="clear"></div>
<div class="clear"></div>
</div>
<?php endif; ?>
</div>
<?php
}
?>
<div id="spinner" class="spinner"></div>

369
ebsco/templates/ebsco-results.tpl.php

@ -5,8 +5,9 @@
* Default theme implementation for displaying EBSCO results.
*
* @see template_preprocess_ebsco_results()
*
*
* Copyright [2014] [EBSCO Information Services]
* Copyright [2017] [EBSCO Information Services]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -20,37 +21,219 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
?>
<?php if ($records): ?>
if (isset ($autoSuggestTerms) ) {
if (count($autoSuggestTerms)>0) {
$suggestString="";
foreach ($autoSuggestTerms as $term ) {
$path = url('ebsco/results', array('query' => array('type' => "")));
$suggestString.="<a href=\"{$path}&lookfor=$term\">".$term."</a> ";
}
echo "<p><strong>Did you mean ".$suggestString."?</strong></p>";
}
}
<?php print t('Showing'); ?>
<strong><?php print $record_start; ?></strong> - <strong><?php print $record_end; ?></strong>
<?php print t('of'); ?> <strong><?php print $record_count; ?></strong>
<?php if ($search_view == 'basic'): ?>
<?php print t('for search')?>: <strong>'<?php print check_plain($lookfor); ?>'</strong>
<?php endif; ?>
<?php if ($search_time): ?>
, <?php print t('query time'); ?>: <?php print check_plain(round($search_time, 2)); ?>s
<?php endif; ?>
if ($records){
echo t('Showing')." <strong>".$record_start."</strong> - <strong> ".$record_end."</strong> ".t('of')." <strong>".$record_count."</strong> ";
if ($search_view == 'basic') {
echo t('for search')." <strong>'".check_plain($lookfor)."'</strong> ";
}
if ($search_time){
echo "," .t('query time').":".check_plain(round($search_time, 2))." s";
}
<?php print $sort_form; ?>
<?php print $pager; ?>
print $sort_form;
print $pager;
if (!user_is_logged_in()) {
$link = '<a href="' . url('user') . '">' . t('Login') . '</a>';
echo '<p class="top-login-message">';
echo sprintf(t('Hello, Guest. %s for full access.'), $link);
echo '</p>';
}
$tabs="";
$tabsContent="";
$counter=0;
$rsItem=null;
if (isset ($relatedContent) ) {
foreach ($relatedContent as $item ) {
if (isset($item["RelatedRecord"])) {
$tabs.='<li data-target="#researchstarters" data-slide-to="'.$counter.'" '.($counter==0?' class="active" ':' ').'></li>';
$counter++;
if (isset($item["RelatedRecord"]["Records"]["Record"][0])) {
$rsItem=$item["RelatedRecord"]["Records"]["Record"][0];
}
else
{
if (isset($item["Records"]["Record"])) {
$rsItem=$item["Records"]["Record"];
}
}
if ($rsItem==null) {
continue ;
}
//var_dump($rsItem);
$rsTitle="";
$rsSubjects="";
$rsAbstract="";
$rsSource="";
$rsImage="";
$rsAN=$rsItem["Header"]["An"];
$rsDB=$rsItem["Header"]["DbId"];
$rsUrl = url('ebsco/result', array('query' => array('id' => $rsAN."|".$rsDB)));
if (isset($rsItem["ImageInfo"]["CoverArt"])) {
$rsImage=$rsItem["ImageInfo"]["CoverArt"]["Target"];
}
foreach($rsItem["Items"]["Item"] as $it) {
switch ($it["Group"]) {
case "Ti":
$rsTitle=$it["Data"];
break;
case "Src":
$rsSource=$it["Data"];
break;
case "Su":
$rsSubjects=$it["Data"];
break;
case "Ab":
$rsAbstract=$it["Data"];
break;
}
}
$tabsContent.='<div class="item" ><div class="carousel-caption">';
if ($rsImage<>"") {
$tabsContent.='<img src="'.$rsImage.'" alt="'.$rsTitle.'" style="float:left">';
}
if ($rsTitle<>""){
$tabsContent.='<h3 class="relatedTitle"><a href="'.$rsUrl.'" class="title _record_link">'.$rsTitle.'</a></h3>';
}
if ($rsSubjects<>""){
$path = url('ebsco/results', array('query' => array('type' => "Subject")));
$link_xml = '/<searchLink fieldCode="([^\"]*)" term="%22([^\"]*)%22">/';
$link_html = "<a href=\"{$path}&lookfor=$2\">";
$rsSubjects = preg_replace($link_xml, $link_html, $rsSubjects);
$rsSubjects = str_replace('</searchLink>', '</a>', $rsSubjects);
$tabsContent.='<p><strong>'.t('Subjects').'</strong>:<span class="quotestart">'.str_replace(array("<br>","<br />"), ', ', $rsSubjects).'</span></p>';
}
if ($rsSource<>""){
$tabsContent.='<p>'.$rsSource.'</p>';
}
if ($rsAbstract<>""){
$tabsContent.='<p><cite>'.$rsAbstract.'</cite></p>';
}
$tabsContent.='</div></div>';
}
// replated publications
if (isset($item["RelatedPublication"])) {
//var_dump($item);
$tabs.='<li data-target="#ematchplacard" data-slide-to="'.$counter.'" '.($counter==0?' class="active" ':' ').'></li>';
$counter++;
$tabsContent.='<div class="item" ><div class="carousel-caption">';
$tabsContent.='
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/themes/default/style.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/jstree.min.js"></script>
';
foreach ($item["RelatedPublication"]["PublicationRecords"] as $pub){
$plink = $pub["PLink"];
foreach($pub["Items"]["Item"] as $item) {
if ($item["Group"]=="Ti")
{
$tabsContent.='<h3 class="relatedTitle"><a href="'.$plink.' target="_blank" >'.$item["Data"].'</a></h3>';
}
else
{
$tabsContent.="<strong>".$item["Label"]."</strong> : ".$item["Data"]."<br/>";
}
}
$tabsContent.='<div id="publicationList"><ul>';
foreach($pub["FullTextHoldings"]["FullTextHolding"] as $itemHoldings) {
$hURL=isset($itemHoldings["URL"])?$itemHoldings["URL"] :"";
$hName=isset($itemHoldings["Name"])?$itemHoldings["Name"] :"";
$hCoverage=isset($itemHoldings["CoverageStatement"])?$itemHoldings["CoverageStatement"] :"";
$hEmbargo="";
if (isset($itemHoldings["EmbargoDescription"])) {
// if no embargo, zero size array
if (!is_array($itemHoldings["EmbargoDescription"] )) {
$hEmbargo=$itemHoldings["EmbargoDescription"];
}
}
$tabsContent.='<li>
<a href="'.$hURL.'" target="_blank">'.$hName.'</a>;
<ul><li>Coverage:'.$hCoverage.'; ';
if ($hEmbargo<>'') {
$tabsContent.='</li><li>Embargo:'.$hEmbargo;
}
$tabsContent.='</li></ul></li>';
// Notes
}
$tabsContent.='</ul></div>';
}
$tabsContent.='
<script>
jQuery("#publicationList").jstree().on("changed.jstree", function (e, data) {
var pubURL = data.instance.get_node(data.node, true).children("a").attr("href");
if (pubURL!="#") {
window.open(pubURL);
}
});
</script>';
$tabsContent.='</div></div>';
break;
}
}
}
if ($tabsContent<>"") {
echo '<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<?php if (!user_is_logged_in()): ?>
<?php $link = '<a href="' . url('user') . '">' . t('Login') . '</a>'; ?>
<p class="top-login-message">
<?php print sprintf(t('Hello, Guest. %s for full access.'), $link); ?>
</p>
<?php endif; ?>
<div id="relatedInformation" class="carousel slide" data-ride="carousel" style="display:block;">
<!-- Indicators -->
<ol class="carousel-indicators">'.$tabs.'</ol>';
echo '<div class="carousel-inner" role="listbox" >'.$tabsContent.'</div>';
echo '<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" ></span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" ></span>
</a>
</div>
<script>
jQuery("#relatedInformation").carousel({
pause: true,
interval:4000
})
</script>';
}
?>
<ol class="search-results ebsco">
<?php foreach ($records as $record): ?>
<?php
<?php foreach ($records as $record):
$id = check_plain($record->record_id());
$recordUrl = url('ebsco/result', array('query' => array('id' => $id)));
$fulltextUrl = url('ebsco/fulltext', array('query' => array('id' => $id)));
$pdfUrl = url('ebsco/pdf', array('query' => array('id' => $id)));
?>
<li>
<div class="record-number floatleft">
@ -59,87 +242,92 @@
<div class="result floatleft">
<div class="span-2">
<?php if ($record->small_thumb_link): ?>
<a href="<?php print $recordUrl; ?>" class="_record_link">
<img src="<?php print $record->small_thumb_link; ?>" class="book-jacket" alt="<?php print t('Book jacket'); ?>"/>
</a>
<?php endif; ?>
<?php
if ($record->small_thumb_link){
echo'
<a href="'.$recordUrl.'" class="_record_link">
<img src="'.$record->small_thumb_link.'" class="book-jacket" alt="'.t('Book jacket').'"/>
</a>';
}
?>
</div>
<div class="span-9">
<div class="result-line1">
<?php if ($record->access_level == '1'): ?>
<p>
<?php
$label = '<strong>' . check_plain($record->db_label) . '</strong>';
$link = '<a href="' . url('user') . '">' . t('Login') . '</a>';
?>
<?php print sprintf(t('This result from %s cannot be displayed to guests.'), $label); ?>
<br />
<strong><?php print sprintf(t('%s for full access.'), $link); ?></strong>
</p>
<?php elseif ($record->title): ?>
<a href="<?php print $recordUrl; ?>" class="title _record_link">
<?php print $record->title; ?>
</a>
<?php endif; ?>
<?php
if ($record->access_level == '1'){
echo '<p>';
$label = '<strong>' . check_plain($record->db_label) . '</strong>';
$link = '<a href="' . url('user') . '">' . t('Login') . '</a>';
echo sprintf(t('This result from %s cannot be displayed to guests.'), $label)."<br /><strong>".sprintf(t('%s for full access.'), $link)."</strong>";
echo "</p>";
}
elseif ($record->title){
echo '<a href="'.$recordUrl.'" class="title _record_link">'.$record->title.'</a>';
}
?>
</div>
<div class="result-line2">
<?php if (!empty($record->authors)): ?>
<p>
<?php print t('by'); ?>
<?php print $record->authors; ?>
</p>
<?php endif; ?>
<?php if (!empty($record->source)): ?>
<p>
<?php print t('Published in'); ?>
<?php print $record->source; ?>
</p>
<?php endif; ?>
<?php
if (!empty($record->authors)){
echo "<span>".t('by'). " ".str_replace(array("<br>","<br />"), ', ', $record->authors)." </span>";
}
if (!empty($record->source)){
echo '<p>'.t('Published in')." ".$record->source.'</p>';
}
?>
</div>
<div class="result-line3">
<?php if (!empty($record->summary)): ?>
<cite><?php print $record->summary; ?></cite>
<br />
<?php endif; ?>
<?php if (!empty($record->subjects)): ?>
<strong><?php print t('Subjects'); ?></strong>:
<span class="quotestart"><?php print str_replace('<br />', ', ', $record->subjects); ?></span>
<?php endif; ?>
<?php
if (!empty($record->summary)){
echo '<cite>'.$record->summary.'</cite><br />';
}
if (!empty($record->subjects)){
echo '<strong>'.t('Subjects').'</strong>:<span class="quotestart">'.str_replace('<br />', ', ', $record->subjects).'</span>';
}
?>
</div>
<?php if (!empty($record->custom_links)): ?>
<?php
if (!empty($record->custom_links)){
?>
<div class="result-line4">
<ul class="custom-links">
<?php foreach ($record->custom_links as $link): ?>
<?php
foreach ($record->custom_links as $link){ ?>
<li>
<a href="<?php print $link['Url']; ?>" target="_blank" title="<?php print $link['MouseOverText']; ?>" class="external-link">
<?php if ($link['Icon']): ?><img src="<?php print $link['Icon']?>" /><?php endif; ?><?php print $link['Name']; ?>
</a>
</li>
<?php endforeach; ?>
<?php } ?>
</ul>
</div>
<?php endif; ?>
<?php } ?>
<div class="result-line5">
<?php if ($record->full_text_availability): ?>
<a href="<?php print $fulltextUrl; ?>#html" class="icon html fulltext _record_link">
<?php print t('HTML full text'); ?>
</a>
&nbsp; &nbsp;
<?php endif; ?>
<?php if ($record->pdf_availability): ?>
<a href="<?php print $pdfUrl; ?>" class="icon pdf fulltext">
<?php print t('PDF full text'); ?>
</a>
<?php endif; ?>
<?php
if ($record->full_text_availability){
echo '<a href="'.$fulltextUrl.'#html" class="icon html fulltext _record_link">';
echo t('HTML full text');
echo "</a>&nbsp; &nbsp;";
}
if ($record->pdf_availability){
echo ' <a href="'.$pdfUrl.'" class="icon pdf fulltext">';
echo t('PDF full text');
echo "</a>";
}
?>
</div>
</div>
</div>
@ -149,9 +337,22 @@
</ol>
<?php print $pager; ?>
<?php elseif (!empty($lookfor)) : ?>
<h2><?php print t('Your search did not match any resources.');?></h2>
<?php print search_help('search#noresults', drupal_help_arg()); ?>
<?php endif; ?>
<?php
}
elseif (!empty($lookfor)) {
echo "<h2>".t('Your search did not match any resources.')."</h2>";
// check for autocomplete
/*
if (isset ($autoSuggestTerms) ) {
if (count($autoSuggestTerms)>0) {
echo "Did you mean "."?<br/>";
var_dump($autoSuggestTerms);
}
}
*/
echo search_help('search#noresults', drupal_help_arg());
}
?>
<div id="spinner" class="spinner"></div>

3
ebsco/templates/ebsco-side-facets.tpl.php

@ -6,7 +6,8 @@
*
* @see template_preprocess_ebsco_side_facets()
*
* Copyright [2014] [EBSCO Information Services]
*
* Copyright [2017] [EBSCO Information Services]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

Loading…
Cancel
Save