|
|
|
@ -1,12 +1,12 @@
|
|
|
|
|
<?php |
|
|
|
|
/* |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* Copyright [2017] [EBSCO Information Services] |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @file |
|
|
|
|
* 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. |
|
|
|
|
* You may obtain a copy of the License at |
|
|
|
|
* You may obtain a copy of the License at. |
|
|
|
|
* |
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
|
|
|
|
* |
|
|
|
@ -16,22 +16,21 @@
|
|
|
|
|
* See the License for the specific language governing permissions and |
|
|
|
|
* limitations under the License. |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
require_once 'lib/EBSCODocument.php'; |
|
|
|
|
|
|
|
|
|
# global variable |
|
|
|
|
$Document = null; |
|
|
|
|
// Global variable. |
|
|
|
|
$Document = NULL; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************** |
|
|
|
|
* Hooks |
|
|
|
|
******************************************/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Implements hook_user_login. |
|
|
|
|
* |
|
|
|
|
* Redirects after login |
|
|
|
|
* |
|
|
|
|
* Redirects after login. |
|
|
|
|
*/ |
|
|
|
|
function ebsco_user_login(&$edit, $account) { |
|
|
|
|
if (isset($_SESSION['EBSCO']['redirect'])) { |
|
|
|
@ -69,32 +68,30 @@ function ebsco_help($path, $arg) {
|
|
|
|
|
return $output; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Implements hook_theme(). |
|
|
|
|
*/ |
|
|
|
|
function ebsco_theme() { |
|
|
|
|
$themes = array( |
|
|
|
|
'ebsco_result' => array( |
|
|
|
|
'template' => 'templates/ebsco-result' |
|
|
|
|
'template' => 'templates/ebsco-result', |
|
|
|
|
), |
|
|
|
|
'ebsco_results' => array( |
|
|
|
|
'template' => 'templates/ebsco-results' |
|
|
|
|
'template' => 'templates/ebsco-results', |
|
|
|
|
), |
|
|
|
|
'ebsco_side_facets' => array( |
|
|
|
|
'template' => 'templates/ebsco-side-facets' |
|
|
|
|
'template' => 'templates/ebsco-side-facets', |
|
|
|
|
), |
|
|
|
|
'ebsco_basic_search' => array( |
|
|
|
|
'template' => 'templates/ebsco-basic-search' |
|
|
|
|
'template' => 'templates/ebsco-basic-search', |
|
|
|
|
), |
|
|
|
|
'ebsco_advanced_search' => array( |
|
|
|
|
'template' => 'templates/ebsco-advanced-search' |
|
|
|
|
) |
|
|
|
|
'template' => 'templates/ebsco-advanced-search', |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
return $themes; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Implements hook_permission(). |
|
|
|
|
* |
|
|
|
@ -106,25 +103,23 @@ function ebsco_theme() {
|
|
|
|
|
function ebsco_permission() { |
|
|
|
|
return array( |
|
|
|
|
'administer ebsco' => array( |
|
|
|
|
'title' => t('Administer EBSCO') |
|
|
|
|
'title' => t('Administer EBSCO'), |
|
|
|
|
), |
|
|
|
|
'use ebsco' => array( |
|
|
|
|
'title' => t('Use EBSCO') |
|
|
|
|
) |
|
|
|
|
'title' => t('Use EBSCO'), |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Implements hook_admin(). |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
function ebsco_admin() { |
|
|
|
|
$form = array(); |
|
|
|
|
|
|
|
|
|
$form['ebsco_credentials'] = array( |
|
|
|
|
'#type' => 'fieldset', |
|
|
|
|
'#title' => t('EDS API credentials') |
|
|
|
|
'#title' => t('EDS API credentials'), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$form['ebsco_credentials']['ebsco_profile'] = array( |
|
|
|
@ -133,7 +128,7 @@ function ebsco_admin() {
|
|
|
|
|
'#default_value' => variable_get('ebsco_profile'), |
|
|
|
|
'#size' => 50, |
|
|
|
|
'#description' => t("The API Profile Id."), |
|
|
|
|
'#required' => TRUE |
|
|
|
|
'#required' => TRUE, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$form['ebsco_credentials']['ebsco_user'] = array( |
|
|
|
@ -142,7 +137,7 @@ function ebsco_admin() {
|
|
|
|
|
'#default_value' => variable_get('ebsco_user'), |
|
|
|
|
'#size' => 50, |
|
|
|
|
'#description' => t("The API User Id."), |
|
|
|
|
'#required' => TRUE |
|
|
|
|
'#required' => TRUE, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$form['ebsco_credentials']['ebsco_password'] = array( |
|
|
|
@ -151,7 +146,7 @@ function ebsco_admin() {
|
|
|
|
|
'#default_value' => variable_get('ebsco_password'), |
|
|
|
|
'#size' => 50, |
|
|
|
|
'#description' => t("The API password."), |
|
|
|
|
'#required' => TRUE |
|
|
|
|
'#required' => TRUE, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$form['ebsco_credentials']['ebsco_interface'] = array( |
|
|
|
@ -160,7 +155,7 @@ function ebsco_admin() {
|
|
|
|
|
'#default_value' => variable_get('ebsco_interface'), |
|
|
|
|
'#size' => 50, |
|
|
|
|
'#description' => t("The API Interface Id."), |
|
|
|
|
'#required' => FALSE |
|
|
|
|
'#required' => FALSE, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$form['ebsco_credentials']['ebsco_organization'] = array( |
|
|
|
@ -169,7 +164,7 @@ function ebsco_admin() {
|
|
|
|
|
'#default_value' => variable_get('ebsco_organization'), |
|
|
|
|
'#size' => 50, |
|
|
|
|
'#description' => t("The API Organization Id."), |
|
|
|
|
'#required' => FALSE |
|
|
|
|
'#required' => FALSE, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$form['ebsco_credentials']['ebsco_local_ips'] = array( |
|
|
|
@ -178,7 +173,7 @@ function ebsco_admin() {
|
|
|
|
|
'#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 |
|
|
|
|
'#required' => FALSE, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$form['ebsco_credentials']['ebsco_guest'] = array( |
|
|
|
@ -187,12 +182,12 @@ function ebsco_admin() {
|
|
|
|
|
'#default_value' => variable_get('ebsco_guest', 0), |
|
|
|
|
'#description' => t("The Guest session."), |
|
|
|
|
'#options' => array(t('No'), t('Yes')), |
|
|
|
|
'#required' => TRUE |
|
|
|
|
'#required' => TRUE, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$form['ebsco_general'] = array( |
|
|
|
|
'#type' => 'fieldset', |
|
|
|
|
'#title' => t('General Settings') |
|
|
|
|
'#title' => t('General Settings'), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$form['ebsco_general']['ebsco_default_limit'] = array( |
|
|
|
@ -201,7 +196,7 @@ function ebsco_admin() {
|
|
|
|
|
'#default_value' => variable_get('ebsco_default_limit', 10), |
|
|
|
|
'#description' => t("Default number of results per page."), |
|
|
|
|
'#options' => EBSCODocument::limit_options(), |
|
|
|
|
'#required' => TRUE |
|
|
|
|
'#required' => TRUE, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$form['ebsco_general']['ebsco_default_sort'] = array( |
|
|
|
@ -210,7 +205,7 @@ function ebsco_admin() {
|
|
|
|
|
'#default_value' => variable_get('ebsco_default_sort', 'relevance'), |
|
|
|
|
'#description' => t("Default sorting option."), |
|
|
|
|
'#options' => EBSCODocument::sort_options(), |
|
|
|
|
'#required' => TRUE |
|
|
|
|
'#required' => TRUE, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$form['ebsco_general']['ebsco_default_amount'] = array( |
|
|
|
@ -219,7 +214,7 @@ function ebsco_admin() {
|
|
|
|
|
'#default_value' => variable_get('ebsco_default_amount', 'brief'), |
|
|
|
|
'#description' => t("Default level of data detail."), |
|
|
|
|
'#options' => EBSCODocument::amount_options(), |
|
|
|
|
'#required' => TRUE |
|
|
|
|
'#required' => TRUE, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$form['ebsco_general']['ebsco_default_mode'] = array( |
|
|
|
@ -228,51 +223,50 @@ function ebsco_admin() {
|
|
|
|
|
'#default_value' => variable_get('ebsco_default_mode', 'all'), |
|
|
|
|
'#description' => t("Default search mode."), |
|
|
|
|
'#options' => EBSCODocument::mode_options(), |
|
|
|
|
'#required' => TRUE |
|
|
|
|
'#required' => TRUE, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
return system_settings_form($form); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Implements hook_menu(). |
|
|
|
|
*/ |
|
|
|
|
function ebsco_menu() { |
|
|
|
|
// Ths is a route |
|
|
|
|
// Ths is a route. |
|
|
|
|
$items['ebsco/results'] = array( |
|
|
|
|
'title' => 'EBSCO Results', |
|
|
|
|
'page callback' => 'ebsco_results_page', |
|
|
|
|
'access callback' => true, |
|
|
|
|
'type' => MENU_CALLBACK |
|
|
|
|
'access callback' => TRUE, |
|
|
|
|
'type' => MENU_CALLBACK, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$items['ebsco/result'] = array( |
|
|
|
|
'title' => 'EBSCO Record', |
|
|
|
|
'page callback' => 'ebsco_result_page', |
|
|
|
|
'access callback' => true, |
|
|
|
|
'type' => MENU_CALLBACK |
|
|
|
|
'access callback' => TRUE, |
|
|
|
|
'type' => MENU_CALLBACK, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$items['ebsco/pdf'] = array( |
|
|
|
|
'title' => 'EBSCO Record', |
|
|
|
|
'page callback' => 'ebsco_pdf_page', |
|
|
|
|
'access callback' => true, |
|
|
|
|
'type' => MENU_CALLBACK |
|
|
|
|
'access callback' => TRUE, |
|
|
|
|
'type' => MENU_CALLBACK, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$items['ebsco/fulltext'] = array( |
|
|
|
|
'title' => 'EBSCO Record', |
|
|
|
|
'page callback' => 'ebsco_fulltext_page', |
|
|
|
|
'access callback' => true, |
|
|
|
|
'type' => MENU_CALLBACK |
|
|
|
|
'access callback' => TRUE, |
|
|
|
|
'type' => MENU_CALLBACK, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$items['ebsco/advanced'] = array( |
|
|
|
|
'title' => 'EBSCO advanced search', |
|
|
|
|
'page callback' => 'ebsco_advanced_search_page', |
|
|
|
|
'access callback' => true, |
|
|
|
|
'type' => MENU_CALLBACK |
|
|
|
|
'access callback' => TRUE, |
|
|
|
|
'type' => MENU_CALLBACK, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$items['admin/config/search/ebsco'] = array( |
|
|
|
@ -281,31 +275,29 @@ function ebsco_menu() {
|
|
|
|
|
'page callback' => 'drupal_get_form', |
|
|
|
|
'page arguments' => array('ebsco_admin'), |
|
|
|
|
'access arguments' => array('administer ebsco'), |
|
|
|
|
'type' => MENU_NORMAL_ITEM |
|
|
|
|
'type' => MENU_NORMAL_ITEM, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
return $items; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Implements hook_block_info(). |
|
|
|
|
*/ |
|
|
|
|
function ebsco_block_info() { |
|
|
|
|
$blocks['ebsco_main'] = array( |
|
|
|
|
'info' => t('EBSCO Search Form'), |
|
|
|
|
'cache' => DRUPAL_CACHE_PER_PAGE |
|
|
|
|
'cache' => DRUPAL_CACHE_PER_PAGE, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$blocks['ebsco_facets'] = array( |
|
|
|
|
'info' => t('EBSCO Narrow Search'), |
|
|
|
|
'cache' => DRUPAL_CACHE_PER_PAGE |
|
|
|
|
'cache' => DRUPAL_CACHE_PER_PAGE, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
return $blocks; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Implements hook_block_view(). |
|
|
|
|
* |
|
|
|
@ -315,66 +307,75 @@ function ebsco_block_view($delta = '') {
|
|
|
|
|
$params = $_GET; |
|
|
|
|
switch ($delta) { |
|
|
|
|
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( |
|
|
|
|
'content' => $reject ? '' : ebsco_basic_search_block() |
|
|
|
|
'content' => $reject ? '' : ebsco_basic_search_block(), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case 'ebsco_facets': |
|
|
|
|
$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['q']) && strpos('ebsco/result', $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['q']) && strpos('ebsco/result', $params['q']) !== FALSE); |
|
|
|
|
return array( |
|
|
|
|
'content' => $reject ? '' : ebsco_side_facets_block() |
|
|
|
|
'content' => $reject ? '' : ebsco_side_facets_block(), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************** |
|
|
|
|
* Page callbacks |
|
|
|
|
******************************************************/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Page callbacks. |
|
|
|
|
*/ |
|
|
|
|
function ebsco_results_page() { |
|
|
|
|
return theme('ebsco_results'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
function ebsco_result_page() { |
|
|
|
|
$is_xhr = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'; |
|
|
|
|
if ($is_xhr) { |
|
|
|
|
print theme('ebsco_result'); |
|
|
|
|
return true; |
|
|
|
|
} else { |
|
|
|
|
return TRUE; |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
return theme('ebsco_result'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
function ebsco_fulltext_page() { |
|
|
|
|
$is_xhr = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'; |
|
|
|
|
if (user_is_logged_in()) { |
|
|
|
|
if ($is_xhr) { |
|
|
|
|
print theme('ebsco_result'); |
|
|
|
|
return true; |
|
|
|
|
} else { |
|
|
|
|
return TRUE; |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
return theme('ebsco_result'); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
$_SESSION['EBSCO']['redirect'] = drupal_get_destination(); |
|
|
|
|
if ($is_xhr) { |
|
|
|
|
echo "<script type=\"text/javascript\">window.location.href = '" . url('user') . "';</script>"; |
|
|
|
|
return; |
|
|
|
|
} else { |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
drupal_goto('user'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
function ebsco_pdf_page() { |
|
|
|
|
global $Document; |
|
|
|
|
$params = $_REQUEST; |
|
|
|
@ -386,34 +387,38 @@ function ebsco_pdf_page() {
|
|
|
|
|
$Document->retrieve(); |
|
|
|
|
$record = $Document->record(); |
|
|
|
|
drupal_goto($record->pdf_link); |
|
|
|
|
} else { |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
$_SESSION['EBSCO']['redirect'] = drupal_get_destination(); |
|
|
|
|
drupal_goto('user'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
function ebsco_advanced_search_page() { |
|
|
|
|
return theme('ebsco_advanced_search'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
function ebsco_basic_search_block() { |
|
|
|
|
return theme('ebsco_basic_search'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
function ebsco_side_facets_block() { |
|
|
|
|
return theme('ebsco_side_facets'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************** |
|
|
|
|
* Form builders, form handlers and templates handlers |
|
|
|
|
******************************************************/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Form builder; Output a sort form for the search results. |
|
|
|
|
* |
|
|
|
@ -424,7 +429,7 @@ function ebsco_sort_form() {
|
|
|
|
|
|
|
|
|
|
$form = array( |
|
|
|
|
'#attributes' => array('class' => 'sort-form'), |
|
|
|
|
'#method' => 'get' |
|
|
|
|
'#method' => 'get', |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$options = EBSCODocument::amount_options(); |
|
|
|
@ -436,7 +441,7 @@ function ebsco_sort_form() {
|
|
|
|
|
'#title' => t('Page options'), |
|
|
|
|
'#default_value' => $default_value, |
|
|
|
|
'#options' => $options, |
|
|
|
|
'#attributes' => array('class' => array('form-select', '_jump_menu')) |
|
|
|
|
'#attributes' => array('class' => array('form-select', '_jump_menu')), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$options = EBSCODocument::sort_options(); |
|
|
|
@ -448,13 +453,12 @@ function ebsco_sort_form() {
|
|
|
|
|
'#title' => t('Sort'), |
|
|
|
|
'#default_value' => $default_value, |
|
|
|
|
'#options' => $options, |
|
|
|
|
'#attributes' => array('class' => array('form-select', '_jump_menu')) |
|
|
|
|
'#attributes' => array('class' => array('form-select', '_jump_menu')), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
return $form; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Form builder; Output a search form for the search block's search box. |
|
|
|
|
* |
|
|
|
@ -466,12 +470,12 @@ function ebsco_basic_search_form() {
|
|
|
|
|
$form = array( |
|
|
|
|
'#attributes' => array('class' => 'search-form'), |
|
|
|
|
'#action' => url('ebsco/results'), |
|
|
|
|
'#method' => 'get' |
|
|
|
|
'#method' => 'get', |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$form['basic']['q'] = array( |
|
|
|
|
'#type' => 'hidden', |
|
|
|
|
'#default_value' => 'ebsco/results' |
|
|
|
|
'#default_value' => 'ebsco/results', |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$default_value = isset($params['lookfor']) ? $params['lookfor'] : ''; |
|
|
|
@ -488,23 +492,23 @@ function ebsco_basic_search_form() {
|
|
|
|
|
'#id' => 'ebsco-basic-search-type', |
|
|
|
|
'#type' => 'select', |
|
|
|
|
'#options' => EBSCODocument::basic_search_type_options(), |
|
|
|
|
'#default_value' => $default_value |
|
|
|
|
'#default_value' => $default_value, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$form['basic']['submit'] = array( |
|
|
|
|
'#id' => 'ebsco-basic-search-submit', |
|
|
|
|
'#type' => 'submit', |
|
|
|
|
'#value' => t('Search') |
|
|
|
|
'#value' => t('Search'), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$link = url('ebsco/advanced'); |
|
|
|
|
$form['basic']['links'] = array( |
|
|
|
|
'#type' => 'fieldset', |
|
|
|
|
'#value' => "<a href=\"$link\">" . t('Advanced search') . "</a>" |
|
|
|
|
'#value' => "<a href=\"$link\">" . t('Advanced search') . "</a>", |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$form['basic']['offscreen'] = array( |
|
|
|
|
'#type' => 'container' |
|
|
|
|
'#type' => 'container', |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if (isset($params['filter'])) { |
|
|
|
@ -512,8 +516,9 @@ function ebsco_basic_search_form() {
|
|
|
|
|
$form['basic']['offscreen']['group' . $key]['filter[]'] = array( |
|
|
|
|
'#id' => 'ebsco-basic-search-filter' . $key, |
|
|
|
|
'#type' => 'checkbox', |
|
|
|
|
'#default_value' => $value, // doesn't work |
|
|
|
|
'#attributes' => array('checked' => 'checked', 'value' => $value) |
|
|
|
|
// doesn't work. |
|
|
|
|
'#default_value' => $value, |
|
|
|
|
'#attributes' => array('checked' => 'checked', 'value' => $value), |
|
|
|
|
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
@ -522,7 +527,7 @@ function ebsco_basic_search_form() {
|
|
|
|
|
'#type' => 'checkbox', |
|
|
|
|
'#title' => t('Retain my current filters'), |
|
|
|
|
'#prefix' => '<br />', |
|
|
|
|
'#default_value' => true |
|
|
|
|
'#default_value' => TRUE, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -547,26 +552,26 @@ function ebsco_advanced_search_form() {
|
|
|
|
|
|
|
|
|
|
$form = array( |
|
|
|
|
'#attributes' => array('class' => 'search-form'), |
|
|
|
|
'#action' => url('ebsco/advanced') |
|
|
|
|
'#action' => url('ebsco/advanced'), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$form['advanced'] = array( |
|
|
|
|
'#type' => 'fieldset', |
|
|
|
|
'#title' => t('Advanced Search'), |
|
|
|
|
'#collapsible' => false, |
|
|
|
|
'#collapsed' => false |
|
|
|
|
'#collapsible' => FALSE, |
|
|
|
|
'#collapsed' => FALSE, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$form['advanced']['rows'] = array( |
|
|
|
|
'#type' => 'fieldset', |
|
|
|
|
'#title' => '' |
|
|
|
|
'#title' => '', |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
for ($i = 0; $i < $counter; $i++) { |
|
|
|
|
$form['advanced']['rows']['group' . $i] = array( |
|
|
|
|
'#type' => 'fieldset', |
|
|
|
|
'#tree' => true, |
|
|
|
|
'#attributes' => array('class' => array('_advanced-row')) |
|
|
|
|
'#tree' => TRUE, |
|
|
|
|
'#attributes' => array('class' => array('_advanced-row')), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$default_value = isset($params['group'][$i]['bool']) ? $params['group'][$i]['bool'] : ''; |
|
|
|
@ -575,13 +580,14 @@ function ebsco_advanced_search_form() {
|
|
|
|
|
'#id' => 'ebsco-advanced-search-bool' . $i, |
|
|
|
|
'#type' => 'select', |
|
|
|
|
'#default_value' => $default_value, |
|
|
|
|
'#options' => EBSCODocument::bool_options() |
|
|
|
|
'#options' => EBSCODocument::bool_options(), |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
$form['advanced']['rows']['group' . $i]['bool'] = array( |
|
|
|
|
'#id' => 'ebsco-advanced-search-bool' . $i, |
|
|
|
|
'#type' => 'hidden', |
|
|
|
|
'#default_value' => 'AND' |
|
|
|
|
'#default_value' => 'AND', |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -593,7 +599,7 @@ function ebsco_advanced_search_form() {
|
|
|
|
|
'#size' => 30, |
|
|
|
|
'#default_value' => $default_value, |
|
|
|
|
'#title' => $title, |
|
|
|
|
'#attributes' => array('title' => t('Enter the terms you wish to search for.')) |
|
|
|
|
'#attributes' => array('title' => t('Enter the terms you wish to search for.')), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$default_value = isset($params['group'][$i]['type']) ? $params['group'][$i]['type'] : ''; |
|
|
|
@ -602,30 +608,30 @@ function ebsco_advanced_search_form() {
|
|
|
|
|
'#type' => 'select', |
|
|
|
|
'#default_value' => $default_value, |
|
|
|
|
'#title' => t('in'), |
|
|
|
|
'#options' => EBSCODocument::advanced_search_type_options() |
|
|
|
|
'#options' => EBSCODocument::advanced_search_type_options(), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if ($i > 2) { |
|
|
|
|
$form['advanced']['rows']['group' . $i]['remove'] = array( |
|
|
|
|
'#markup' => '<div class="delete-search"><a href="#" class="delete _delete_row" id="delete_search_link_' . $i . '">' . t('Remove Search Field') . '</a></div>' |
|
|
|
|
'#markup' => '<div class="delete-search"><a href="#" class="delete _delete_row" id="delete_search_link_' . $i . '">' . t('Remove Search Field') . '</a></div>', |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$form['advanced']['rows']['add_row'] = array( |
|
|
|
|
'#type' => 'fieldset', |
|
|
|
|
'#value' => "<a class=\"add _add_row\" href=\"#\">". t('Add Search Field') . "</a>" |
|
|
|
|
'#value' => "<a class=\"add _add_row\" href=\"#\">" . t('Add Search Field') . "</a>", |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$items = array( |
|
|
|
|
array( |
|
|
|
|
'url' => url('ebsco/results'), |
|
|
|
|
'title' => t('Basic search') |
|
|
|
|
'title' => t('Basic search'), |
|
|
|
|
), |
|
|
|
|
array( |
|
|
|
|
'url' => url('ebsco/advanced'), |
|
|
|
|
'title' => t('Advanced search') |
|
|
|
|
) |
|
|
|
|
'title' => t('Advanced search'), |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
$links = array(); |
|
|
|
|
foreach ($items as $item) { |
|
|
|
@ -633,45 +639,46 @@ function ebsco_advanced_search_form() {
|
|
|
|
|
} |
|
|
|
|
$form['advanced']['links'] = array( |
|
|
|
|
'#type' => 'fieldset', |
|
|
|
|
'#value' => implode(' | ', $links) |
|
|
|
|
'#value' => implode(' | ', $links), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$form['advanced']['modes'] = array( |
|
|
|
|
'#type' => 'fieldset', |
|
|
|
|
'#title' => t('Search modes') |
|
|
|
|
'#title' => t('Search modes'), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$form['advanced']['modes']['mode'] = array( |
|
|
|
|
'#type' => 'radios', |
|
|
|
|
'#default_value' => 'all', |
|
|
|
|
'#options' => EBSCODocument::mode_options() |
|
|
|
|
'#options' => EBSCODocument::mode_options(), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$expanders = $Document->expanders(); |
|
|
|
|
$limiters = $Document->limiters(); |
|
|
|
|
$options = array('' => true); |
|
|
|
|
$options = array('' => TRUE); |
|
|
|
|
foreach ($expanders as $key => $expander) { |
|
|
|
|
$options[$expander['Action']] = true; |
|
|
|
|
$options[$expander['Action']] = TRUE; |
|
|
|
|
} |
|
|
|
|
foreach ($limiters as $key => $limiter) { |
|
|
|
|
if (!empty($limiter['Values'])) { |
|
|
|
|
$options[$limiter['Id']] = true; |
|
|
|
|
$options[$limiter['Id']] = TRUE; |
|
|
|
|
foreach ($limiter['Values'] as $value) { |
|
|
|
|
$options[str_replace('value', $value['Value'], $value['Action'])] = true; |
|
|
|
|
$options[str_replace('value', $value['Value'], $value['Action'])] = TRUE; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
$options[str_replace('value', 'y', $limiter['Action'])] = true; |
|
|
|
|
else { |
|
|
|
|
$options[str_replace('value', 'y', $limiter['Action'])] = TRUE; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$form['advanced']['expanders'] = array( |
|
|
|
|
'#type' => 'fieldset', |
|
|
|
|
'#title' => t('Expand results') |
|
|
|
|
'#title' => t('Expand results'), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$form['advanced']['limiters'] = array( |
|
|
|
|
'#type' => 'fieldset', |
|
|
|
|
'#title' => t('Limit results') |
|
|
|
|
'#title' => t('Limit results'), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$children = array(); |
|
|
|
@ -683,7 +690,7 @@ function ebsco_advanced_search_form() {
|
|
|
|
|
'#title_display' => 'after', |
|
|
|
|
'#name' => 'filter[]', |
|
|
|
|
'#attributes' => array('value' => $expander['Action']), |
|
|
|
|
'#checked' => $expander['selected'] |
|
|
|
|
'#checked' => $expander['selected'], |
|
|
|
|
); |
|
|
|
|
$element['#children'] = ($key != 0) ? '<br />' : ''; |
|
|
|
|
$element['#children'] .= theme('checkbox', array('element' => $element)); |
|
|
|
@ -694,9 +701,9 @@ function ebsco_advanced_search_form() {
|
|
|
|
|
|
|
|
|
|
$form['advanced']['expanders']['filter'] = array( |
|
|
|
|
'#type' => 'checkboxes', |
|
|
|
|
'#validated' => true, |
|
|
|
|
'#validated' => TRUE, |
|
|
|
|
'#options' => $options, |
|
|
|
|
'#children' => implode('', $children) |
|
|
|
|
'#children' => implode('', $children), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$checkboxes = $selects = $dates = array(); |
|
|
|
@ -709,34 +716,38 @@ function ebsco_advanced_search_form() {
|
|
|
|
|
'#title_display' => 'after', |
|
|
|
|
'#name' => 'filter[]', |
|
|
|
|
'#attributes' => array('value' => str_replace('value', 'y', $limiter['Action'])), |
|
|
|
|
'#checked' => $limiter['selected'] |
|
|
|
|
'#checked' => $limiter['selected'], |
|
|
|
|
|
|
|
|
|
); |
|
|
|
|
$element['#children'] = ($key != 0) ? '<br />' : ''; |
|
|
|
|
if (!isset($element['#children'])) |
|
|
|
|
{$element['#children']="";} |
|
|
|
|
if (!isset($element['#children'])) { |
|
|
|
|
$element['#children'] = ""; |
|
|
|
|
} |
|
|
|
|
$element['#children'] .= theme('checkbox', array('element' => $element)); |
|
|
|
|
$checkboxes[] = theme('form_element', array('element' => $element)); |
|
|
|
|
} else if ($limiter['Type'] == 'multiselectvalue') { |
|
|
|
|
} |
|
|
|
|
elseif ($limiter['Type'] == 'multiselectvalue') { |
|
|
|
|
$opts = array('' => t('All')); |
|
|
|
|
foreach ($limiter['Values'] as $value) { |
|
|
|
|
$opts[$value['Action']] = $value['Value']; |
|
|
|
|
} |
|
|
|
|
$element = array( |
|
|
|
|
'#type' => 'select', |
|
|
|
|
'#multiple' => true, |
|
|
|
|
'#multiple' => TRUE, |
|
|
|
|
'#size' => 4, |
|
|
|
|
'#id' => 'ebsco-advanced-search-limiter' . $limiter['Id'], |
|
|
|
|
'#title' => $limiter['Label'], |
|
|
|
|
'#name' => 'filter[]', |
|
|
|
|
'#options' => $opts, |
|
|
|
|
'#default_value' => $limiter['selected'], // empty value means "All" |
|
|
|
|
// Empty value means "All". |
|
|
|
|
'#default_value' => $limiter['selected'], |
|
|
|
|
'#value' => $limiter['selected'], |
|
|
|
|
'#attributes' => array('class' => array('multiselectvalue'), 'multiple' => 'multiple') |
|
|
|
|
'#attributes' => array('class' => array('multiselectvalue'), 'multiple' => 'multiple'), |
|
|
|
|
); |
|
|
|
|
$element['#children'] = theme('select', array('element' => $element)); |
|
|
|
|
$selects[] = theme('form_element', array('element' => $element)); |
|
|
|
|
} else if ($limiter['Type'] == 'ymrange') { |
|
|
|
|
} |
|
|
|
|
elseif ($limiter['Type'] == 'ymrange') { |
|
|
|
|
$value = $limiter['selected'] ? $limiter['selected'] : ''; |
|
|
|
|
$displayValue = str_replace(array('addlimiter(DT1:', '-1/2013-1)'), array('', ''), $value); |
|
|
|
|
$element = array( |
|
|
|
@ -745,8 +756,8 @@ function ebsco_advanced_search_form() {
|
|
|
|
|
'#title' => $limiter['Label'], |
|
|
|
|
'#value' => $displayValue, |
|
|
|
|
'#name' => $limiter['Id'], |
|
|
|
|
'#autocomplete_path' => null, |
|
|
|
|
'#attributes' => array('size' => 4, 'maxlength' => 4, 'class' => array('yearbox')) |
|
|
|
|
'#autocomplete_path' => NULL, |
|
|
|
|
'#attributes' => array('size' => 4, 'maxlength' => 4, 'class' => array('yearbox')), |
|
|
|
|
); |
|
|
|
|
$element['#children'] = theme('textfield', array('element' => $element)); |
|
|
|
|
$element['#children'] .= '<input id="ebsco-advanced-search-limiter' . $limiter['Id'] . '" type="hidden" name="filter[]" value="' . $value . '"/>'; |
|
|
|
@ -757,39 +768,38 @@ function ebsco_advanced_search_form() {
|
|
|
|
|
|
|
|
|
|
$form['advanced']['limiters']['checkboxes'] = array( |
|
|
|
|
'#type' => 'checkboxes', |
|
|
|
|
'#validated' => true, |
|
|
|
|
'#validated' => TRUE, |
|
|
|
|
'#options' => $options, |
|
|
|
|
'#children' => implode('', $checkboxes), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$form['advanced']['limiters']['dates'] = array( |
|
|
|
|
'#type' => 'container', |
|
|
|
|
'#validated' => true, |
|
|
|
|
'#validated' => TRUE, |
|
|
|
|
'#prefix' => '<hr />', |
|
|
|
|
'#children' => implode('', $dates) |
|
|
|
|
'#children' => implode('', $dates), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$form['advanced']['limiters']['selects'] = array( |
|
|
|
|
'#type' => 'container', |
|
|
|
|
'#prefix' => '<hr />', |
|
|
|
|
'#validated' => true, |
|
|
|
|
'#children' => implode('', $selects) |
|
|
|
|
'#validated' => TRUE, |
|
|
|
|
'#children' => implode('', $selects), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$form['advanced']['submit'] = array( |
|
|
|
|
'#id' => 'ebsco-advanced-search-submit', |
|
|
|
|
'#type' => 'submit', |
|
|
|
|
'#value' => t('Search') |
|
|
|
|
'#value' => t('Search'), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$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="' . t('Clear') . '" name="reset">', |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
return $form; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Form validation handler for ebsco_basic_search_form(). |
|
|
|
|
* |
|
|
|
@ -802,7 +812,6 @@ function ebsco_basic_search_form_validate($form, &$form_state) {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Form validation handler for ebsco_advanced_search_form(). |
|
|
|
|
* |
|
|
|
@ -817,7 +826,6 @@ function ebsco_advanced_search_form_validate($form, &$form_state) {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Form submission handler for ebsco_basic_search_form(). |
|
|
|
|
* |
|
|
|
@ -831,11 +839,10 @@ function ebsco_basic_search_form_submit($form, &$form_state) {
|
|
|
|
|
unset($params[$key]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$form_state['rebuild'] = false; |
|
|
|
|
$form_state['rebuild'] = FALSE; |
|
|
|
|
$form_state['redirect'] = array('ebsco/results', array('query' => $params)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Form submission handler for ebsco_advanced_search_form(). |
|
|
|
|
* |
|
|
|
@ -847,34 +854,35 @@ function ebsco_advanced_search_form_submit($form, &$form_state) {
|
|
|
|
|
$allowed_keys = array('filter', 'mode'); |
|
|
|
|
|
|
|
|
|
foreach ($params as $key => $value) { |
|
|
|
|
if (!(in_array($key, $allowed_keys) || strpos($key, 'group') !== false)) { |
|
|
|
|
if (!(in_array($key, $allowed_keys) || strpos($key, 'group') !== FALSE)) { |
|
|
|
|
unset($params[$key]); |
|
|
|
|
} else { |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
if ($key == 'filter') { |
|
|
|
|
foreach ($value as $k => $v) { |
|
|
|
|
if (empty($v)) { |
|
|
|
|
unset($params[$key][$k]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else if (empty($value)) { |
|
|
|
|
} |
|
|
|
|
elseif (empty($value)) { |
|
|
|
|
unset($params[$key]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
foreach ($params as $key => $value) { |
|
|
|
|
if (strpos($key, 'group') !== false) { |
|
|
|
|
if (strpos($key, 'group') !== FALSE) { |
|
|
|
|
$new_params['group'][] = $value; |
|
|
|
|
unset($params[$key]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$params = array_merge($params, $new_params); |
|
|
|
|
|
|
|
|
|
$form_state['rebuild'] = false; |
|
|
|
|
$form_state['rebuild'] = FALSE; |
|
|
|
|
$form_state['redirect'] = array('ebsco/results', array('query' => $params)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Process variables for ebsco-results.tpl.php. |
|
|
|
|
* |
|
|
|
@ -905,7 +913,8 @@ function template_preprocess_ebsco_results(&$variables) {
|
|
|
|
|
$variables['lookfor'] = ''; |
|
|
|
|
if (isset($params['lookfor'])) { |
|
|
|
|
$variables['lookfor'] = $params['lookfor']; |
|
|
|
|
} else if (isset($params['group'])) { |
|
|
|
|
} |
|
|
|
|
elseif (isset($params['group'])) { |
|
|
|
|
$types = EBSCODocument::basic_search_type_options(); |
|
|
|
|
foreach ($params['group'] as $key => $group) { |
|
|
|
|
if (!empty($group['lookfor'])) { |
|
|
|
@ -923,7 +932,6 @@ function template_preprocess_ebsco_results(&$variables) {
|
|
|
|
|
// $Document->search_write(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Process variables for ebsco-basic-search.tpl.php. |
|
|
|
|
* |
|
|
|
@ -941,7 +949,8 @@ function template_preprocess_ebsco_basic_search(&$variables) {
|
|
|
|
|
$variables['lookfor'] = ''; |
|
|
|
|
if (isset($params['lookfor'])) { |
|
|
|
|
$variables['lookfor'] = $params['lookfor']; |
|
|
|
|
} else if (isset($params['group'])) { |
|
|
|
|
} |
|
|
|
|
elseif (isset($params['group'])) { |
|
|
|
|
$types = EBSCODocument::basic_search_type_options(); |
|
|
|
|
foreach ($params['group'] as $key => $group) { |
|
|
|
|
if (!empty($group['lookfor'])) { |
|
|
|
@ -954,7 +963,6 @@ function template_preprocess_ebsco_basic_search(&$variables) {
|
|
|
|
|
$variables['search_form'] = drupal_render($v1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Process variables for ebsco-advanced-search.tpl.php. |
|
|
|
|
* |
|
|
|
@ -974,7 +982,6 @@ function template_preprocess_ebsco_advanced_search(&$variables) {
|
|
|
|
|
$variables['search_form'] = drupal_render($v1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Process variables for ebsco-result.tpl.php. |
|
|
|
|
* |
|
|
|
@ -998,7 +1005,6 @@ function template_preprocess_ebsco_result(&$variables) {
|
|
|
|
|
drupal_set_title($record->title); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Process variables for ebsco-side-facets.tpl.php. |
|
|
|
|
* |
|
|
|
@ -1016,24 +1022,24 @@ function template_preprocess_ebsco_side_facets(&$variables) {
|
|
|
|
|
$variables['expanders'] = $Document->expanders(); |
|
|
|
|
$variables['limiters'] = $Document->limiters(); |
|
|
|
|
$variables['facets'] = $Document->facets(); |
|
|
|
|
$variables['filters'] = $Document->filters(); // applied facets, limiters or expanders |
|
|
|
|
$variables['search_params'] = $Document->search_params(); // hidden parameters |
|
|
|
|
$variables['link_search_params'] = $Document->link_search_params(); // hidden parameters |
|
|
|
|
// Applied facets, limiters or expanders. |
|
|
|
|
$variables['filters'] = $Document->filters(); |
|
|
|
|
// Hidden parameters. |
|
|
|
|
$variables['search_params'] = $Document->search_params(); |
|
|
|
|
// Hidden parameters. |
|
|
|
|
$variables['link_search_params'] = $Document->link_search_params(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************** |
|
|
|
|
* View Helpers |
|
|
|
|
******************************************/ |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns an URL without the given filter parameter |
|
|
|
|
* Returns an URL without the given filter parameter. |
|
|
|
|
* |
|
|
|
|
* @return string |
|
|
|
|
*/ |
|
|
|
|
function remove_filter_link($filter) |
|
|
|
|
{ |
|
|
|
|
function remove_filter_link($filter) { |
|
|
|
|
$params = $_REQUEST; |
|
|
|
|
if (isset($params['filter'])) { |
|
|
|
|
foreach ($params['filter'] as $key => $value) { |
|
|
|
@ -1045,14 +1051,12 @@ function remove_filter_link($filter)
|
|
|
|
|
return url('ebsco/results', array('query' => $params)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Performs a regex and replaces any url's with links containing themselves as the text |
|
|
|
|
* Performs a regex and replaces any url's with links containing themselves as the text. |
|
|
|
|
* |
|
|
|
|
* @return string |
|
|
|
|
*/ |
|
|
|
|
function auto_link($string) |
|
|
|
|
{ |
|
|
|
|
function auto_link($string) { |
|
|
|
|
$linkedString = preg_replace_callback( |
|
|
|
|
"/\b(https?):\/\/([-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]*)\b/i", |
|
|
|
|
create_function( |
|
|
|
|