|
|
@ -45,10 +45,17 @@ function roblib_search_evergreen_menu() { |
|
|
|
'type' => MENU_NORMAL_ITEM, |
|
|
|
'type' => MENU_NORMAL_ITEM, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$items['roblib_search/evergreen/ajax/%'] = array( |
|
|
|
|
|
|
|
'title' => 'evergreen ajax', |
|
|
|
|
|
|
|
'page callback' => 'roblib_search_evergreen_ajax', |
|
|
|
|
|
|
|
'page arguments' => array(3), |
|
|
|
|
|
|
|
'type' => MENU_CALLBACK, |
|
|
|
|
|
|
|
'access arguments' => array('search roblib evergreen'), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
return $items; |
|
|
|
return $items; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function roblib_search_evergreen_config_form($form, &$form_state) { |
|
|
|
function roblib_search_evergreen_config_form($form, &$form_state) { |
|
|
|
/* |
|
|
|
/* |
|
|
|
* $url = variable_get('roblib_search_evergreen_url', 'http://137.149.200.52'); |
|
|
|
* $url = variable_get('roblib_search_evergreen_url', 'http://137.149.200.52'); |
|
|
@ -123,7 +130,6 @@ function roblib_search_evergreen_theme() { |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function roblib_search_evergreen_block_info() { |
|
|
|
function roblib_search_evergreen_block_info() { |
|
|
|
|
|
|
|
|
|
|
|
$blocks['roblib_search_evergreen_results'] = array( |
|
|
|
$blocks['roblib_search_evergreen_results'] = array( |
|
|
@ -146,22 +152,26 @@ function roblib_search_evergreen_block_view($delta = '') { |
|
|
|
$block['subject'] = t('Evergreen Results'); |
|
|
|
$block['subject'] = t('Evergreen Results'); |
|
|
|
// The content of the block is typically generated by calling a custom |
|
|
|
// The content of the block is typically generated by calling a custom |
|
|
|
// function. |
|
|
|
// function. |
|
|
|
$block['content'] = roblib_search_evergreen_get_results(); |
|
|
|
$block['content'] = theme('roblib_search_evergreen', array('results' => NULL)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
return $block; |
|
|
|
return $block; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function roblib_search_evergreen_get_results() { |
|
|
|
function roblib_search_evergreen_ajax($query) { |
|
|
|
drupal_add_css(drupal_get_path('module', 'roblib_search_evergreen') . '/css/roblib_search_evergreen.theme.css'); |
|
|
|
$output = roblib_search_evergreen_get_results($query); |
|
|
|
|
|
|
|
print $output; |
|
|
|
|
|
|
|
exit(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Url parameters. |
|
|
|
/** |
|
|
|
if (isset($_GET['roblib_query'])) { |
|
|
|
* |
|
|
|
$query = $_GET['roblib_query']; |
|
|
|
* @param string $query |
|
|
|
} |
|
|
|
* @return string |
|
|
|
else { |
|
|
|
* json |
|
|
|
return ''; |
|
|
|
*/ |
|
|
|
} |
|
|
|
function roblib_search_evergreen_get_results($query) { |
|
|
|
|
|
|
|
drupal_add_css(drupal_get_path('module', 'roblib_search_evergreen') . '/css/roblib_search_evergreen.theme.css'); |
|
|
|
|
|
|
|
|
|
|
|
$url = variable_get('roblib_search_evergreen_url', 'http://137.149.200.52'); |
|
|
|
$url = variable_get('roblib_search_evergreen_url', 'http://137.149.200.52'); |
|
|
|
$url_suffix = variable_get('roblib_search_evergreen_search_suffix', '/opac/extras/sru?version=1.1&operation=searchRetrieve&query='); |
|
|
|
$url_suffix = variable_get('roblib_search_evergreen_search_suffix', '/opac/extras/sru?version=1.1&operation=searchRetrieve&query='); |
|
|
@ -175,9 +185,16 @@ function roblib_search_evergreen_get_results() { |
|
|
|
$output = 'Error retrieving Evergreen results ' . $results->status_message; |
|
|
|
$output = 'Error retrieving Evergreen results ' . $results->status_message; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return theme('roblib_search_evergreen', array('results' => $output)); |
|
|
|
return json_encode($output); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param string $results |
|
|
|
|
|
|
|
* results in marcxml |
|
|
|
|
|
|
|
* @return array $output |
|
|
|
|
|
|
|
* information we want from the xml stored in an array |
|
|
|
|
|
|
|
*/ |
|
|
|
function roblib_search_evergreen_parse_results($results) { |
|
|
|
function roblib_search_evergreen_parse_results($results) { |
|
|
|
$xml = $results->data; |
|
|
|
$xml = $results->data; |
|
|
|
if (!isset($xml)) { |
|
|
|
if (!isset($xml)) { |
|
|
@ -196,10 +213,10 @@ function roblib_search_evergreen_parse_results($results) { |
|
|
|
$title = (string) $title[0]; |
|
|
|
$title = (string) $title[0]; |
|
|
|
$id = $record->xpath('marcxml:datafield[@tag="901"]/marcxml:subfield[@code="c"]'); |
|
|
|
$id = $record->xpath('marcxml:datafield[@tag="901"]/marcxml:subfield[@code="c"]'); |
|
|
|
$id = (string) $id[0]; |
|
|
|
$id = (string) $id[0]; |
|
|
|
$output[$index]['title'] = $title ; |
|
|
|
$output[$index]['title'] = $title; |
|
|
|
$output[$index++]['url'] = variable_get('roblib_search_evergreen_url', 'http://137.149.200.52') |
|
|
|
$output[$index++]['url'] = variable_get('roblib_search_evergreen_url', 'http://137.149.200.52') |
|
|
|
. variable_get('roblib_search_evergreen_detail_suffix','/opac/en-CA/skin/default/xml/rdetail.xml?r=') |
|
|
|
. variable_get('roblib_search_evergreen_detail_suffix', '/opac/en-CA/skin/default/xml/rdetail.xml?r=') |
|
|
|
. (string) $id ; |
|
|
|
. (string) $id; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return $output; |
|
|
|
return $output; |
|
|
|