Browse Source

Manual cleanup of Drupal coding standards

This commit includes manual fixes to resolve the rest of the coding-standards
errors identified by PHPCS.
roblib
James Wilson 8 years ago
parent
commit
be53d90ee5
  1. 8
      ebsco/css/ebsco.css
  2. 222
      ebsco/ebsco.module
  3. 14
      ebsco/js/ebsco.js
  4. 4
      ebsco/lib/EBSCOAPI.php
  5. 16
      ebsco/lib/EBSCOConnector.php
  6. 3
      ebsco/lib/EBSCODocument.php
  7. 7
      ebsco/lib/EBSCORecord.php
  8. 5
      ebsco/lib/EBSCOResponse.php
  9. 248
      ebsco/templates/ebsco-result.tpl.php

8
ebsco/css/ebsco.css

@ -1,6 +1,6 @@
/* /**
* The styles for EBSCO module * @file
* * The EBSCO module styles.
* *
* Copyright [2017] [EBSCO Information Services] * Copyright [2017] [EBSCO Information Services]
* *
@ -15,7 +15,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
@CHARSET "UTF-8"; @CHARSET "UTF-8";
/** General ***/ /** General ***/

222
ebsco/ebsco.module

@ -1,26 +1,28 @@
<?php <?php
/** /**
* @file * @file
* Copyright [2017] [EBSCO Information Services]. * EBSCO Drupal integration module.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Copyright [2017] [EBSCO Information Services]
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at. * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* http://www.apache.org/licenses/LICENSE-2.0 * You may obtain a copy of the License at
* *
* Unless required by applicable law or agreed to in writing, software * http://www.apache.org/licenses/LICENSE-2.0
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * Unless required by applicable law or agreed to in writing, software
* See the License for the specific language governing permissions and * distributed under the License is distributed on an "AS IS" BASIS,
* limitations under the License. * 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'; require_once 'lib/EBSCODocument.php';
// Global variable. // Global variable.
$Document = NULL; $_ebsco_document = NULL;
/****************************************** /******************************************
@ -28,11 +30,11 @@ $Document = NULL;
******************************************/ ******************************************/
/** /**
* Implements hook_user_login. * Implements hook_user_login().
*
* Redirects after login.
*/ */
function ebsco_user_login(&$edit, $account) { function ebsco_user_login(&$edit, $account) {
// Redirect after login.
if (isset($_SESSION['EBSCO']['redirect'])) { if (isset($_SESSION['EBSCO']['redirect'])) {
$_GET['destination'] = urldecode($_SESSION['EBSCO']['redirect']['destination']); $_GET['destination'] = urldecode($_SESSION['EBSCO']['redirect']['destination']);
unset($_SESSION['EBSCO']['redirect']); unset($_SESSION['EBSCO']['redirect']);
@ -40,29 +42,17 @@ function ebsco_user_login(&$edit, $account) {
} }
/** /**
* Implements hook_help. * Implements hook_help().
*
* Displays help and module information.
*
* @param path
* Which path of the site we're using to display help
* @param arg
* Array that holds the current path as returned from arg() function
*/ */
function ebsco_help($path, $arg) { function ebsco_help($path, $arg) {
$output = ""; $output = "";
switch ($path) { switch ($path) {
case "admin/help#ebsco": case "admin/help#ebsco":
$output .= '<h2>' . t("Full-text articles and eBooks from EBSCOhost Discovery Services") . '</h2>'; $output .= '<h2>' . t("Full-text articles and eBooks from EBSCOhost Discovery Services") . '</h2>';
$output .= '<p>' . t("EBSCO Discovery Service provides users with an easy, yet powerful means of accessing all of $output .= '<p>' . t("EBSCO Discovery Service provides users with an easy, yet powerful means of accessing all of an institution's information resources through a single search.") . '</p>';
an institution's information resources through a single search.") . '</p>'; $output .= '<p>' . t("This is achieved by harvesting metadata from both internal (library) and external (database vendors) sources, and creating a pre-indexed service of unprecedented size and speed.") . '</p>';
$output .= '<p>' . t("This is achieved by harvesting metadata from both internal (library) and external (database vendors) sources, $output .= '<p>' . t("Although the resulting collection can be massive in size and scope, the fact that it is indexed locally (on the EBSCOhost&reg; servers) allows for exceptionally fast search response times.") . '</p>';
and creating a pre-indexed service of unprecedented size and speed.") . '</p>'; $output .= '<p>' . t("As no two institutions are the same, EBSCO Discovery Service offers a vast array of customization options with regard to both the underlying collection of metadata as well as the front-end delivery of search results. All of this functionality is based upon the powerful EBSCOhost search experience familiar to researchers worldwide.") . '</p>';
$output .= '<p>' . t("Although the resulting collection can be massive in size and scope, the fact that it is indexed locally
(on the EBSCOhost&reg; servers) allows for exceptionally fast search response times.") . '</p>';
$output .= '<p>' . t("As no two institutions are the same, EBSCO Discovery Service offers a vast array of customization options with
regard to both the underlying collection of metadata as well as the front-end delivery of search results.
All of this functionality is based upon the powerful EBSCOhost search experience familiar to researchers worldwide.") . '</p>';
break; break;
} }
return $output; return $output;
@ -305,36 +295,32 @@ function ebsco_block_info() {
*/ */
function ebsco_block_view($delta = '') { function ebsco_block_view($delta = '') {
$params = $_GET; $params = $_GET;
$block = array();
switch ($delta) { switch ($delta) {
case 'ebsco_main': case 'ebsco_main':
$reject = isset($params['q']) && strpos('ebsco/advanced', $params['q']) !== FALSE; $reject = isset($params['q']) && strpos('ebsco/advanced', $params['q']) !== FALSE;
return array( $block['content'] = $reject ? '' : ebsco_basic_search_block();
'content' => $reject ? '' : ebsco_basic_search_block(), break;
);
break;
case 'ebsco_facets': case 'ebsco_facets':
$reject = isset($params['q']) && strpos('ebsco/advanced', $params['q']) !== FALSE; $reject = isset($params['q']) && strpos('ebsco/advanced', $params['q']) !== FALSE;
$reject = $reject || (isset($params['edit']) && strpos('ebsco/results', $params['q']) !== FALSE); $reject = $reject || (isset($params['edit']) && strpos('ebsco/results', $params['q']) !== FALSE);
$reject = $reject || (isset($params['q']) && strpos('ebsco/result', $params['q']) !== FALSE); $reject = $reject || (isset($params['q']) && strpos('ebsco/result', $params['q']) !== FALSE);
return array( $block['content'] = $reject ? '' : ebsco_side_facets_block();
'content' => $reject ? '' : ebsco_side_facets_block(), break;
);
break;
} }
return $block;
} }
/** /**
* Page callbacks. * EBSCO search results page callback.
*/ */
function ebsco_results_page() { function ebsco_results_page() {
return theme('ebsco_results'); return theme('ebsco_results');
} }
/** /**
* * EBSCO search result page callback.
*/ */
function ebsco_result_page() { function ebsco_result_page() {
$is_xhr = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'; $is_xhr = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest';
@ -348,7 +334,7 @@ function ebsco_result_page() {
} }
/** /**
* * EBSCO fulltext page callback.
*/ */
function ebsco_fulltext_page() { function ebsco_fulltext_page() {
$is_xhr = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'; $is_xhr = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest';
@ -374,18 +360,18 @@ function ebsco_fulltext_page() {
} }
/** /**
* * EBSCO pdf page callback.
*/ */
function ebsco_pdf_page() { function ebsco_pdf_page() {
global $Document; global $_ebsco_document;
$params = $_REQUEST; $params = $_REQUEST;
if (user_is_logged_in()) { if (user_is_logged_in()) {
if (empty($Document)) { if (empty($_ebsco_document)) {
$Document = new EBSCODocument(); $_ebsco_document = new EBSCODocument();
} }
$Document->retrieve(); $_ebsco_document->retrieve();
$record = $Document->record(); $record = $_ebsco_document->record();
drupal_goto($record->pdf_link); drupal_goto($record->pdf_link);
} }
else { else {
@ -395,21 +381,21 @@ function ebsco_pdf_page() {
} }
/** /**
* * EBSCO advanced search page callback.
*/ */
function ebsco_advanced_search_page() { function ebsco_advanced_search_page() {
return theme('ebsco_advanced_search'); return theme('ebsco_advanced_search');
} }
/** /**
* * EBSCO basic search page callback.
*/ */
function ebsco_basic_search_block() { function ebsco_basic_search_block() {
return theme('ebsco_basic_search'); return theme('ebsco_basic_search');
} }
/** /**
* * EBSCO side facets block callback.
*/ */
function ebsco_side_facets_block() { function ebsco_side_facets_block() {
return theme('ebsco_side_facets'); return theme('ebsco_side_facets');
@ -540,7 +526,7 @@ function ebsco_basic_search_form() {
* @ingroup forms * @ingroup forms
*/ */
function ebsco_advanced_search_form() { function ebsco_advanced_search_form() {
global $Document; global $_ebsco_document;
$params = $_REQUEST; $params = $_REQUEST;
if (isset($params['edit']) && !empty($params['edit'])) { if (isset($params['edit']) && !empty($params['edit'])) {
@ -653,8 +639,8 @@ function ebsco_advanced_search_form() {
'#options' => EBSCODocument::mode_options(), '#options' => EBSCODocument::mode_options(),
); );
$expanders = $Document->expanders(); $expanders = $_ebsco_document->expanders();
$limiters = $Document->limiters(); $limiters = $_ebsco_document->limiters();
$options = array('' => TRUE); $options = array('' => TRUE);
foreach ($expanders as $key => $expander) { foreach ($expanders as $key => $expander) {
$options[$expander['Action']] = TRUE; $options[$expander['Action']] = TRUE;
@ -715,7 +701,9 @@ function ebsco_advanced_search_form() {
'#title' => $limiter['Label'], '#title' => $limiter['Label'],
'#title_display' => 'after', '#title_display' => 'after',
'#name' => 'filter[]', '#name' => 'filter[]',
'#attributes' => array('value' => str_replace('value', 'y', $limiter['Action'])), '#attributes' => array(
'value' => str_replace('value', 'y', $limiter['Action']),
),
'#checked' => $limiter['selected'], '#checked' => $limiter['selected'],
); );
@ -757,7 +745,11 @@ function ebsco_advanced_search_form() {
'#value' => $displayValue, '#value' => $displayValue,
'#name' => $limiter['Id'], '#name' => $limiter['Id'],
'#autocomplete_path' => NULL, '#autocomplete_path' => NULL,
'#attributes' => array('size' => 4, 'maxlength' => 4, 'class' => array('yearbox')), '#attributes' => array(
'size' => 4,
'maxlength' => 4,
'class' => array('yearbox'),
),
); );
$element['#children'] = theme('textfield', array('element' => $element)); $element['#children'] = theme('textfield', array('element' => $element));
$element['#children'] .= '<input id="ebsco-advanced-search-limiter' . $limiter['Id'] . '" type="hidden" name="filter[]" value="' . $value . '"/>'; $element['#children'] .= '<input id="ebsco-advanced-search-limiter' . $limiter['Id'] . '" type="hidden" name="filter[]" value="' . $value . '"/>';
@ -793,8 +785,9 @@ function ebsco_advanced_search_form() {
'#value' => t('Search'), '#value' => t('Search'),
); );
$reset_button_text = t('Clear');
$form['advanced']['clear'] = array( $form['advanced']['clear'] = array(
'#markup' => '<input id="ebsco-advanced-search-clear" class="form-submit" type="reset" value="' . t('Clear') . '" name="reset">', '#markup' => '<input id="ebsco-advanced-search-clear" class="form-submit" type="reset" value="' . $reset_button_text . '" name="reset">',
); );
return $form; return $form;
@ -889,27 +882,27 @@ function ebsco_advanced_search_form_submit($form, &$form_state) {
* @see ebsco-results.tpl.php * @see ebsco-results.tpl.php
*/ */
function template_preprocess_ebsco_results(&$variables) { function template_preprocess_ebsco_results(&$variables) {
global $Document; global $_ebsco_document;
$params = $_REQUEST; $params = $_REQUEST;
$_SESSION['EBSCO']['redirect'] = drupal_get_destination(); $_SESSION['EBSCO']['redirect'] = drupal_get_destination();
if (empty($Document)) { if (empty($_ebsco_document)) {
$Document = new EBSCODocument(); $_ebsco_document = new EBSCODocument();
} }
$title = !empty($params['lookfor']) ? ' - ' . $params['lookfor'] : ''; $title = !empty($params['lookfor']) ? ' - ' . $params['lookfor'] : '';
drupal_set_title('Search results' . $title); drupal_set_title('Search results' . $title);
$Document->search(); $_ebsco_document->search();
$variables['records'] = $Document->records(); $variables['records'] = $_ebsco_document->records();
$variables['record_start'] = $Document->record_start(); $variables['record_start'] = $_ebsco_document->record_start();
$variables['record_end'] = $Document->record_end(); $variables['record_end'] = $_ebsco_document->record_end();
$variables['record_count'] = $Document->record_count(); $variables['record_count'] = $_ebsco_document->record_count();
$variables['search_view'] = $Document->search_view(); $variables['search_view'] = $_ebsco_document->search_view();
$variables['search_time'] = $Document->search_time(); $variables['search_time'] = $_ebsco_document->search_time();
$variables['relatedContent'] = $Document->relatedContent(); $variables['relatedContent'] = $_ebsco_document->relatedContent();
$variables['autoSuggestTerms'] = $Document->autoSuggestTerms(); $variables['autoSuggestTerms'] = $_ebsco_document->autoSuggestTerms();
$variables['lookfor'] = ''; $variables['lookfor'] = '';
if (isset($params['lookfor'])) { if (isset($params['lookfor'])) {
$variables['lookfor'] = $params['lookfor']; $variables['lookfor'] = $params['lookfor'];
@ -923,13 +916,13 @@ function template_preprocess_ebsco_results(&$variables) {
} }
} }
} }
$variables['pager'] = $Document->pager(); $variables['pager'] = $_ebsco_document->pager();
$v1 = drupal_get_form('ebsco_sort_form'); $v1 = drupal_get_form('ebsco_sort_form');
$variables['sort_form'] = drupal_render($v1); $variables['sort_form'] = drupal_render($v1);
// Save data needed by scroller in Detailed view page // Save data needed by scroller in Detailed view page
// $Document->search_write(); // $_ebsco_document->search_write();
} }
/** /**
@ -938,14 +931,14 @@ function template_preprocess_ebsco_results(&$variables) {
* @see ebsco-basic-search.tpl.php * @see ebsco-basic-search.tpl.php
*/ */
function template_preprocess_ebsco_basic_search(&$variables) { function template_preprocess_ebsco_basic_search(&$variables) {
global $Document; global $_ebsco_document;
$params = $_REQUEST; $params = $_REQUEST;
if (empty($Document)) { if (empty($_ebsco_document)) {
$Document = new EBSCODocument(); $_ebsco_document = new EBSCODocument();
} }
$variables['search_view'] = $Document->search_view(); $variables['search_view'] = $_ebsco_document->search_view();
$variables['lookfor'] = ''; $variables['lookfor'] = '';
if (isset($params['lookfor'])) { if (isset($params['lookfor'])) {
$variables['lookfor'] = $params['lookfor']; $variables['lookfor'] = $params['lookfor'];
@ -970,13 +963,13 @@ function template_preprocess_ebsco_basic_search(&$variables) {
*/ */
function template_preprocess_ebsco_advanced_search(&$variables) { function template_preprocess_ebsco_advanced_search(&$variables) {
drupal_add_library('system', 'ui.slider'); drupal_add_library('system', 'ui.slider');
global $Document; global $_ebsco_document;
$params = $_REQUEST; $params = $_REQUEST;
if (empty($Document)) { if (empty($_ebsco_document)) {
$Document = new EBSCODocument(); $_ebsco_document = new EBSCODocument();
} }
$Document->info(); $_ebsco_document->info();
$v1 = drupal_get_form('ebsco_advanced_search_form'); $v1 = drupal_get_form('ebsco_advanced_search_form');
$variables['search_form'] = drupal_render($v1); $variables['search_form'] = drupal_render($v1);
@ -992,14 +985,14 @@ function template_preprocess_ebsco_result(&$variables) {
$params['op'] = isset($params['op']) ? $params['op'] : 'Next'; $params['op'] = isset($params['op']) ? $params['op'] : 'Next';
$_SESSION['EBSCO']['redirect'] = drupal_get_destination(); $_SESSION['EBSCO']['redirect'] = drupal_get_destination();
if (empty($Document)) { if (empty($_ebsco_document)) {
$Document = new EBSCODocument(); $_ebsco_document = new EBSCODocument();
} }
$Document->retrieve(); $_ebsco_document->retrieve();
$record = $Document->record(); $record = $_ebsco_document->record();
$variables['record'] = $record; $variables['record'] = $record;
$lastSearch = isset($params['id']) ? $Document->search_read($params['id'], $params['op']) : ''; $lastSearch = isset($params['id']) ? $_ebsco_document->search_read($params['id'], $params['op']) : '';
$variables['last_search'] = $lastSearch; $variables['last_search'] = $lastSearch;
drupal_set_title($record->title); drupal_set_title($record->title);
@ -1011,23 +1004,23 @@ function template_preprocess_ebsco_result(&$variables) {
* @see ebsco-side-facets.tpl.php * @see ebsco-side-facets.tpl.php
*/ */
function template_preprocess_ebsco_side_facets(&$variables) { function template_preprocess_ebsco_side_facets(&$variables) {
global $Document; global $_ebsco_document;
if (empty($Document)) { if (empty($_ebsco_document)) {
$Document = new EBSCODocument(); $_ebsco_document = new EBSCODocument();
} }
$Document->info(); $_ebsco_document->info();
$variables['record_count'] = $Document->record_count(); $variables['record_count'] = $_ebsco_document->record_count();
$variables['expanders'] = $Document->expanders(); $variables['expanders'] = $_ebsco_document->expanders();
$variables['limiters'] = $Document->limiters(); $variables['limiters'] = $_ebsco_document->limiters();
$variables['facets'] = $Document->facets(); $variables['facets'] = $_ebsco_document->facets();
// Applied facets, limiters or expanders. // Applied facets, limiters or expanders.
$variables['filters'] = $Document->filters(); $variables['filters'] = $_ebsco_document->filters();
// Hidden parameters. // Hidden parameters.
$variables['search_params'] = $Document->search_params(); $variables['search_params'] = $_ebsco_document->search_params();
// Hidden parameters. // Hidden parameters.
$variables['link_search_params'] = $Document->link_search_params(); $variables['link_search_params'] = $_ebsco_document->link_search_params();
} }
/****************************************** /******************************************
@ -1035,9 +1028,10 @@ function template_preprocess_ebsco_side_facets(&$variables) {
******************************************/ ******************************************/
/** /**
* Returns an URL without the given filter parameter. * Returns the current request's URL without the specified filter parameter.
* *
* @return string * @return string
* the filtered request URL
*/ */
function remove_filter_link($filter) { function remove_filter_link($filter) {
$params = $_REQUEST; $params = $_REQUEST;
@ -1052,18 +1046,22 @@ function remove_filter_link($filter) {
} }
/** /**
* Performs a regex and replaces any url's with links containing themselves as the text. * Convert URLs in the given string into HTML link tags.
*
* Performs a regex and replaces any URLs with links containing themselves
* as the text.
* *
* @return string * @return string
* the filtered request URL
*/ */
function auto_link($string) { function auto_link($string) {
$linkedString = preg_replace_callback( $linkedString = preg_replace_callback(
"/\b(https?):\/\/([-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]*)\b/i", "/\b(https?):\/\/([-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]*)\b/i",
create_function( create_function(
'$matches', '$matches',
'return "<a href=\'".($matches[0])."\'>".($matches[0])."</a>";' 'return "<a href=\'".($matches[0])."\'>".($matches[0])."</a>";'
), ),
$string $string
); );
return $linkedString; return $linkedString;
} }

14
ebsco/js/ebsco.js

@ -1,6 +1,6 @@
/* /**
* The EBSCO module javascript * @file
* * The EBSCO module javascript.
* *
* Copyright [2017] [EBSCO Information Services] * Copyright [2017] [EBSCO Information Services]
* *
@ -15,11 +15,10 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
**/ */
(function ($) { (function ($) {
$(document).ready(function () { $(document).ready(function () {
//
var updatePublishDateSlider = function () { var updatePublishDateSlider = function () {
var from = parseInt($('#DT1').val()); var from = parseInt($('#DT1').val());
var min = 1000; var min = 1000;
@ -38,10 +37,9 @@
}); });
}; };
/**
/*
* Self executing function * Self executing function
**/ */
var onLoad = function () { var onLoad = function () {
// EBSCO/Search : Expand limiters // EBSCO/Search : Expand limiters
$('._more_limiters').live('click', function (event) { $('._more_limiters').live('click', function (event) {

4
ebsco/lib/EBSCOAPI.php

@ -1,7 +1,8 @@
<?php <?php
/** /**
* EBSCO EDS API class. * @file
* The EBSCO EDS API class.
* *
* PHP version 5 * PHP version 5
* *
@ -24,7 +25,6 @@
require_once 'EBSCOConnector.php'; require_once 'EBSCOConnector.php';
require_once 'EBSCOResponse.php'; require_once 'EBSCOResponse.php';
/** /**
* EBSCO API class. * EBSCO API class.
*/ */

16
ebsco/lib/EBSCOConnector.php

@ -2,7 +2,8 @@
/** /**
* @file * @file
* EBSCOException class * The EBSCO Connector and Exception classes.
*
* Used when EBSCO API calls return error messages. * Used when EBSCO API calls return error messages.
* *
* Copyright [2017] [EBSCO Information Services] * Copyright [2017] [EBSCO Information Services]
@ -21,7 +22,7 @@
*/ */
/** /**
* * EBSCOException class.
*/ */
class EBSCOException extends Exception { class EBSCOException extends Exception {
const CRITICAL_ERROR = 1; const CRITICAL_ERROR = 1;
@ -35,7 +36,7 @@ class EBSCOException extends Exception {
} }
/** /**
* * EBSCOConnector class.
*/ */
class EBSCOConnector { class EBSCOConnector {
/** /**
@ -465,8 +466,7 @@ BODY;
$return = new EBSCOException($error, $code); $return = new EBSCOException($error, $code);
} }
else { else {
$return = new EBSCOException("HTTP {$code} : The request could not be understood $return = new EBSCOException("HTTP {$code} : The request could not be understood by the server due to malformed syntax. Modify your search before retrying.");
by the server due to malformed syntax. Modify your search before retrying.");
} }
} }
catch (Exception $e) { catch (Exception $e) {
@ -475,13 +475,11 @@ BODY;
break; break;
case self::HTTP_NOT_FOUND: case self::HTTP_NOT_FOUND:
$return = new EBSCOException("HTTP {$code} : The resource you are looking for might $return = new EBSCOException("HTTP {$code} : The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.");
have been removed, had its name changed, or is temporarily unavailable.");
break; break;
case self::HTTP_INTERNAL_SERVER_ERROR: case self::HTTP_INTERNAL_SERVER_ERROR:
$return = new EBSCOException("HTTP {$code} : The server encountered an unexpected condition $return = new EBSCOException("HTTP {$code} : The server encountered an unexpected condition which prevented it from fulfilling the request.");
which prevented it from fulfilling the request.");
break; break;
default: default:

3
ebsco/lib/EBSCODocument.php

@ -1,6 +1,7 @@
<?php <?php
/** /**
* @file
* The EBSCO Document model class. * The EBSCO Document model class.
* *
* It provides all the methods and properties needed for : * It provides all the methods and properties needed for :
@ -10,7 +11,6 @@
* *
* PHP version 5 * PHP version 5
* *
*
* Copyright [2017] [EBSCO Information Services] * Copyright [2017] [EBSCO Information Services]
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -28,6 +28,7 @@
require_once 'EBSCOAPI.php'; require_once 'EBSCOAPI.php';
require_once 'EBSCORecord.php'; require_once 'EBSCORecord.php';
/** /**
* *
*/ */

7
ebsco/lib/EBSCORecord.php

@ -1,12 +1,11 @@
<?php <?php
/** /**
* @file
* The EBSCO record object. * The EBSCO record object.
* *
* PHP version 5 * PHP version 5
* *
*
*
* Copyright [2017] [EBSCO Information Services] * Copyright [2017] [EBSCO Information Services]
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -21,6 +20,10 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/**
* EBSCORecord class.
*/
class EBSCORecord { class EBSCORecord {
/** /**
* The array of data. * The array of data.

5
ebsco/lib/EBSCOResponse.php

@ -1,11 +1,11 @@
<?php <?php
/** /**
* EBSCO Response class. * @file
* The EBSCO Response object.
* *
* PHP version 5 * PHP version 5
* *
*
* Copyright [2017] [EBSCO Information Services] * Copyright [2017] [EBSCO Information Services]
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -23,7 +23,6 @@
require_once 'sanitizer.class.php'; require_once 'sanitizer.class.php';
/** /**
* EBSCOResponse class. * EBSCOResponse class.
*/ */

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

@ -24,137 +24,137 @@
?> ?>
<?php <?php
if ($record) { if ($record) {
$id = check_plain($record->record_id()); $id = check_plain($record->record_id());
$fulltextUrl = url('ebsco/fulltext', array('query' => array('id' => $id))); $fulltextUrl = url('ebsco/fulltext', array('query' => array('id' => $id)));
$pdfUrl = url('ebsco/pdf', array('query' => array('id' => $id))); $pdfUrl = url('ebsco/pdf', array('query' => array('id' => $id)));
?> ?>
<div class="ebsco-record"> <div class="ebsco-record">
<h1><?php print $record->title; ?></h1> <h1><?php print $record->title; ?></h1>
<div class="record-toolbar"> <div class="record-toolbar">
<?php <?php
if ($last_search){ if ($last_search){
?> ?>
<div class="floatright"> <div class="floatright">
<?php <?php
if ($last_search['previous']){ 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 '<a href="' . url('ebsco/result', array('query' => array('id' => $last_search['previous'], 'op' => 'Previous'))) . '" class="_record_link">&laquo; ' . t('Previous') . '</a>';
} }
echo "#"; echo "#";
print $last_search['current_index']; ?> of <?php print $last_search['count']; print $last_search['current_index']; ?> of <?php print $last_search['count'];
if ($last_search['next']){ 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>'; 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>
<div class="floatleft">
<div class="span-5"> <a href="<?php print "?{$last_search['query']}"; ?>">
<ul class="external-links"> &laquo; <?php print t('Back to Results list'); ?>
<?php </a>
if($record->p_link){
echo "<li> <a href='" . $record->p_link . "'>" . t('View in EDS') . "</a></li>";
}
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>
<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){
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>
<div class="clear"></div> <div class="clear"></div>
<?php
</div> }
?>
</div>
<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>";
}
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>
<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){
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>
<?php <?php
} }
?> ?>
<div id="spinner" class="spinner"></div> <div id="spinner" class="spinner"></div>

Loading…
Cancel
Save