diff --git a/targets/cufts/theme/roblib-search-cufts.tpl.php b/targets/cufts/theme/roblib-search-cufts.tpl.php
index a604166..2aa7539 100644
--- a/targets/cufts/theme/roblib-search-cufts.tpl.php
+++ b/targets/cufts/theme/roblib-search-cufts.tpl.php
@@ -18,7 +18,7 @@
?>
-
+
Search all Journals
\ No newline at end of file
diff --git a/targets/eds/includes/rest/EBSCOAPI.php b/targets/eds/includes/rest/EBSCOAPI.php
index 2d19fe1..cdc5a6a 100755
--- a/targets/eds/includes/rest/EBSCOAPI.php
+++ b/targets/eds/includes/rest/EBSCOAPI.php
@@ -1,6 +1,5 @@
config = $config;
+class EBSCOAPI {
+
+ /**
+ * The authentication token used for API transactions
+ * @global string
+ */
+ private $authenticationToken;
+
+ /**
+ * The session token for API transactions
+ * @global string
+ */
+ private $sessionToken;
+
+ /**
+ * The EBSCOConnector object used for API transactions
+ * @global object EBSCOConnector
+ */
+ private $connector;
+ private $config;
+
+ public function __construct($config) {
+ $this->config = $config;
+ $this->connector = new EBSCOConnector($config);
+ }
+
+ /**
+ * Create a new EBSCOConnector object or reuse an existing one
+ *
+ * @param none
+ *
+ * @return EBSCOConnector object
+ * @access public
+ */
+ public function connector($config) {
+ if (empty($this->connector)) {
$this->connector = new EBSCOConnector($config);
}
- /**
- * Create a new EBSCOConnector object or reuse an existing one
- *
- * @param none
- *
- * @return EBSCOConnector object
- * @access public
- */
- public function connector($config)
- {
- if (empty($this->connector)) {
- $this->connector = new EBSCOConnector($config);
- }
+ return $this->connector;
+ }
- return $this->connector;
- }
+ /**
+ * Create a new EBSCOResponse object
+ *
+ * @param object $response
+ *
+ * @return EBSCOResponse object
+ * @access public
+ */
+ public function response($response) {
+ $responseObj = new EBSCOResponse($response);
+ return $responseObj;
+ }
+ /**
+ * Request authentication and session tokens, then send the API request.
+ * Retry the request if authentication errors occur
+ *
+ * @param string $action The EBSCOConnector method name
+ * @param array $params The parameters for the HTTP request
+ * @param integer $attempts The number of retries. The default number is 3 but can be increased.
+ * 3 retries can handle a situation when both autentication and session tokens need to be refreshed + the current API call
+ *
+ * @return array An associative array with results.
+ * @access protected
+ */
+ protected function request($action, $params = null, $attempts = 3) {
+ try {
- /**
- * Create a new EBSCOResponse object
- *
- * @param object $response
- *
- * @return EBSCOResponse object
- * @access public
- */
- public function response($response)
- {
- $responseObj = new EBSCOResponse($response);
- return $responseObj;
- }
+ $authenticationToken = $this->getAuthToken();
+ $sessionToken = $this->getSessionToken($authenticationToken);
+ if (empty($authenticationToken)) {
+ $authenticationToken = $this->getAuthToken();
+ }
- /**
- * Request authentication and session tokens, then send the API request.
- * Retry the request if authentication errors occur
- *
- * @param string $action The EBSCOConnector method name
- * @param array $params The parameters for the HTTP request
- * @param integer $attempts The number of retries. The default number is 3 but can be increased.
- * 3 retries can handle a situation when both autentication and session tokens need to be refreshed + the current API call
- *
- * @return array An associative array with results.
- * @access protected
- */
- protected function request($action, $params = null, $attempts = 3)
- {
- try {
-
+ if (empty($sessionToken)) {
+ $sessionToken = $this->getSessionToken($authenticationToken, 'y');
+ }
+
+ $headers = array(
+ 'x-authenticationToken: ' . $authenticationToken,
+ 'x-sessionToken: ' . $sessionToken
+ );
+
+ $response = call_user_func_array(array($this->connector($this->config), "request{$action}"), array($params, $headers));
+ $result = $this->response($response)->result();
+ $results = $result;
+ return $results;
+ } catch (EBSCOException $e) {
+ try {
+ // Retry the request if there were authentication errors
+ $code = $e->getCode();
+ switch ($code) {
+ case EBSCOConnector::EDS_AUTH_TOKEN_INVALID:
$authenticationToken = $this->getAuthToken();
$sessionToken = $this->getSessionToken($authenticationToken);
-
- if(empty($authenticationToken)){
- $authenticationToken = $this -> getAuthToken();
- }
-
- if(empty($sessionToken)){
- $sessionToken = $this -> getSessionToken($authenticationToken,'y');
- }
-
$headers = array(
- 'x-authenticationToken: ' . $authenticationToken,
- 'x-sessionToken: ' . $sessionToken
- );
-
- $response = call_user_func_array(array($this->connector($this->config), "request{$action}"), array($params, $headers));
- $result = $this->response($response)->result();
- $results = $result;
- return $results;
- } catch(EBSCOException $e) {
- try {
- // Retry the request if there were authentication errors
- $code = $e->getCode();
- switch ($code) {
- case EBSCOConnector::EDS_AUTH_TOKEN_INVALID:
- $authenticationToken = $this->getAuthToken();
- $sessionToken = $this ->getSessionToken($authenticationToken);
- $headers = array(
- 'x-authenticationToken: ' . $authenticationToken,
- 'x-sessionToken: ' . $sessionToken
+ 'x-authenticationToken: ' . $authenticationToken,
+ 'x-sessionToken: ' . $sessionToken
);
- if ($attempts > 0) {
- return $this->request($action, $params, $headers, --$attempts);
- }
- break;
- case EBSCOConnector::EDS_SESSION_TOKEN_INVALID:
- $sessionToken = $this ->getSessionToken($authenticationToken,'y');
- $headers = array(
- 'x-authenticationToken: ' . $authenticationToken,
- 'x-sessionToken: ' . $sessionToken
+ if ($attempts > 0) {
+ return $this->request($action, $params, $headers, --$attempts);
+ }
+ break;
+ case EBSCOConnector::EDS_SESSION_TOKEN_INVALID:
+ $sessionToken = $this->getSessionToken($authenticationToken, 'y');
+ $headers = array(
+ 'x-authenticationToken: ' . $authenticationToken,
+ 'x-sessionToken: ' . $sessionToken
);
- if ($attempts > 0) {
- return $this->request($action, $params, $headers, --$attempts);
- }
- break;
- default:
- $result = array(
- 'error' => $e->getMessage()
- );
- return $result;
- break;
- }
- } catch(Exception $e) {
- $result = array(
- 'error' => $e->getMessage()
- );
- return $result;
+ if ($attempts > 0) {
+ return $this->request($action, $params, $headers, --$attempts);
}
- } catch(Exception $e) {
+ break;
+ default:
$result = array(
- 'error' => $e->getMessage()
+ 'error' => $e->getMessage()
);
return $result;
+ break;
+ }
+ } catch (Exception $e) {
+ $result = array(
+ 'error' => $e->getMessage()
+ );
+ return $result;
+ }
+ } catch (Exception $e) {
+ $result = array(
+ 'error' => $e->getMessage()
+ );
+ return $result;
}
+ }
+
+ private function writeTokenFile() {
+ $tokenFile = fopen("edstoken.txt", "w+");
+ $result = $this->apiAuthenticationToken();
+ fwrite($tokenFile, $result['authenticationToken'] . "\n");
+ fwrite($tokenFile, $result['authenticationTimeout'] . "\n");
+ fwrite($tokenFile, $result['authenticationTimeStamp']);
+ fclose($tokenFile);
+ return $result['authenticationToken'];
+ }
+
+ private function writeLockFile() {
+ $lockFile = fopen("edslock.txt", "w+");
+ fwrite($lockFile, 'lock');
+ fclose($lockFile);
+ }
+
+ /*
+ * Get authentication token from appication scop
+ * Check authToen's expiration
+ * if expired get a new authToken and re-new the time stamp
+ *
+ * @param none
+ *
+ * @access public
+ */
+
+ public function getAuthToken() {
+ $lockFile = fopen("edslock.txt", "r");
+ if (empty($lockFile)) {
+ $this->writeLockFile();
+ $lockFile = fopen("edslock.txt", "r");
+ }
+ $tokenFile = fopen("edstoken.txt", "r");
+ if (empty($tokenFile)) {
+ $this->writetokenFile();
+ $tokenFile = fopen("edstoken.txt", "r");
}
-
- private function writeLockFile(){
- $tokenFile = fopen("edstoken.txt","w+");
- $result = $this->apiAuthenticationToken();
- fwrite($tokenFile, $result['authenticationToken']."\n");
- fwrite($tokenFile, $result['authenticationTimeout']."\n");
- fwrite($tokenFile, $result['authenticationTimeStamp']);
- fclose($tokenFile);
- return $result['authenticationToken'];
+ while (!feof($tokenFile)) {
+ $authToken = rtrim(fgets($tokenFile), "\n");
+ $timeout = fgets($tokenFile) - 600;
+ $timestamp = fgets($tokenFile);
}
-
- /*
- * Get authentication token from appication scop
- * Check authToen's expiration
- * if expired get a new authToken and re-new the time stamp
- *
- * @param none
- *
- * @access public
- */
- public function getAuthToken(){
- $lockFile = fopen("edslock.txt","r");
- $tokenFile =fopen("edstoken.txt","r");
- if(empty($lockFile) || empty($tokenFile)){
- return $this->writeLockFile();
- }
- while(!feof($tokenFile)){
- $authToken = rtrim(fgets($tokenFile),"\n");
- $timeout = fgets($tokenFile)-600;
- $timestamp = fgets($tokenFile);
- }
+ fclose($tokenFile);
+ if (time() - $timestamp >= $timeout) {
+ // Lock check.
+ if (flock($lockFile, LOCK_EX)) {
+ $tokenFile = fopen("edstoken.txt", "w+");
+ $result = $this->apiAuthenticationToken();
+ fwrite($tokenFile, $result['authenticationToken'] . "\n");
+ fwrite($tokenFile, $result['authenticationTimeout'] . "\n");
+ fwrite($tokenFile, $result['authenticationTimeStamp']);
fclose($tokenFile);
- if(time()-$timestamp>=$timeout){
- // Lock check.
- if(flock($lockFile, LOCK_EX)){
- $tokenFile = fopen("edstoken.txt","w+");
- $result = $this->apiAuthenticationToken();
- fwrite($tokenFile, $result['authenticationToken']."\n");
- fwrite($tokenFile, $result['authenticationTimeout']."\n");
- fwrite($tokenFile, $result['authenticationTimeStamp']);
- fclose($tokenFile);
- return $result['authenticationToken'];
- }else{
- return $authToken;
- }
- }else{
- return $authToken;
- }
- fclose($lockFile);
+ return $result['authenticationToken'];
+ }
+ else {
+ return $authToken;
+ }
}
-
- /**
- * Wrapper for authentication API call
- *
- * @param none
- *
- * @access public
- */
- public function apiAuthenticationToken()
- {
- $response = $this->connector->requestAuthenticationToken();
- $result = $this->response($response)->result();
- return $result;
+ else {
+ return $authToken;
}
+ fclose($lockFile);
+ }
+
+ /**
+ * Wrapper for authentication API call
+ *
+ * @param none
+ *
+ * @access public
+ */
+ public function apiAuthenticationToken() {
+ $response = $this->connector->requestAuthenticationToken();
+ $result = $this->response($response)->result();
+ return $result;
+ }
- /**
- * Get session token for a profile
- * If session token is not available
- * a new session token will be generated
- *
- * @param Authentication token, Profile
- * @access public
- */
- public function getSessionToken($authenToken, $invalid='n'){
- $token = '';
-
- // Check user's login status
- if(isset($_COOKIE['login'])){
- if($invalid=='y'){
- $profile = $_SESSION['sessionToken']['profile'];
- $sessionToken = $this->apiSessionToken($authenToken, $profile,'n');
- $_SESSION['sessionToken']=$sessionToken;
- }
- $token = $_SESSION['sessionToken']['sessionToken'];
+ /**
+ * Get session token for a profile
+ * If session token is not available
+ * a new session token will be generated
+ *
+ * @param Authentication token, Profile
+ * @access public
+ */
+ public function getSessionToken($authenToken, $invalid = 'n') {
+ $token = '';
+
+ // Check user's login status
+ /* if(isset($_COOKIE['login'])){
+ if($invalid=='y'){
+ $profile = $_SESSION['sessionToken']['profile'];
+ $sessionToken = $this->apiSessionToken($authenToken, $profile,'n');
+ $_SESSION['sessionToken']=$sessionToken;
+ }
+ $token = $_SESSION['sessionToken']['sessionToken'];
+ } */
+ //else
+ if (isset($_COOKIE['Guest'])) {
+ if ($invalid == 'y') {
+ $profile = $_SESSION['sessionToken']['profile'];
+ if (empty($profile)) {
+ $profile = $_COOKIE['Guest'];
}
- else if(isset($_COOKIE['Guest'])){
- if($invalid=='y'){
- $profile = $_SESSION['sessionToken']['profile'];
- $sessionToken = $this->apiSessionToken($authenToken, $profile,'y');
- $_SESSION['sessionToken']=$sessionToken;
- }
- $token = $_SESSION['sessionToken']['sessionToken'];
- }else{
- //$xml ="Config.xml";
- //$dom = new DOMDocument();
- //$dom->load($xml);
- //$EDSCredentials = $dom ->getElementsByTagName('EDSCredentials')->item(0);
- //$users = $EDSCredentials -> getElementsByTagName('User');
- $profileId = $this->config['profile'];
- //foreach($users as $user){
- // $userType = $user->getElementsByTagName('ClientUser')->item(0)->nodeValue;
- // if($userType == 'guest'){
- // $profileId = $user -> getElementsByTagName('EDSProfile')->item(0)->nodeValue;
- // break;
- // }
- //}
- $sessionToken = $this->apiSessionToken($authenToken, $profileId,'y');
- $_SESSION['profile'] = $profileId;
- $_SESSION['sessionToken']=$sessionToken;
- setcookie("Guest", $profileId, 0);
- $token = $sessionToken['sessionToken'];
- }
- return $token;
+ $sessionToken = $this->apiSessionToken($authenToken, $profile, 'y');
+ $_SESSION['sessionToken'] = $sessionToken;
+ }
+ $token = $_SESSION['sessionToken']['sessionToken'];
}
+ else {
- /**
- * Wrapper for session API call
- *
- * @param Authentication token
- *
- * @access public
- */
- public function apiSessionToken($authenToken, $profile, $guest)
- {
- // Add authentication tokens to headers
- $headers = array(
- 'x-authenticationToken: ' . $authenToken
- );
+ $profileId = $this->config['profile'];
- $response = $this->connector($this->config)->requestSessionToken($headers, $profile,$guest);
- $result = $this->response($response)->result();
- $token = array(
- 'sessionToken'=>$result,
- 'profile' => $profile
- );
- return $token;
- }
-
- /**
- * Wrapper for end session API call
- *
- * @param Authentication token
- *
- * @access public
- */
- public function apiEndSessionToken($authenToken, $sessionToken){
-
- // Add authentication tokens to headers
- $headers = array(
- 'x-authenticationToken: '.$authenToken
- );
-
- $this -> connector($this->config)->requestEndSessionToken($headers, $sessionToken);
+ $sessionToken = $this->apiSessionToken($authenToken, $profileId, 'y');
+ $_SESSION['profile'] = $profileId;
+ $_SESSION['sessionToken'] = $sessionToken;
+ setcookie("Guest", $profileId, 0);
+ $token = $sessionToken['sessionToken'];
}
+ return $token;
+ }
- /**
- * Wrapper for search API call
- *
- * @param
- *
- * @throws object PEAR Error
- * @return array An array of query results
- * @access public
- */
- public function apiSearch($params) {
-
- $results = $this->request('Search', $params);
- return $results;
- }
+ /**
+ * Wrapper for session API call
+ *
+ * @param Authentication token
+ *
+ * @access public
+ */
+ public function apiSessionToken($authenToken, $profile, $guest) {
+ // Add authentication tokens to headers
+ $headers = array(
+ 'x-authenticationToken: ' . $authenToken
+ );
+ $response = $this->connector($this->config)->requestSessionToken($headers, $profile, $guest);
+ $result = $this->response($response)->result();
+ $token = array(
+ 'sessionToken' => $result,
+ 'profile' => $profile
+ );
+ return $token;
+ }
- /**
- * Wrapper for retrieve API call
- *
- * @param array $an The accession number
- * @param string $start The short database name
- *
- * @throws object PEAR Error
- * @return array An associative array of data
- * @access public
- */
- public function apiRetrieve($an, $db, $term)
- {
- // Add the HTTP query params
- $params = array(
- 'an' => $an,
- 'dbid' => $db,
- 'highlightterms' => $term // Get currect param name
- );
- $params = http_build_query($params);
- $result = $this->request('Retrieve', $params);
- return $result;
- }
+ /**
+ * Wrapper for end session API call
+ *
+ * @param Authentication token
+ *
+ * @access public
+ */
+ public function apiEndSessionToken($authenToken, $sessionToken) {
+ // Add authentication tokens to headers
+ $headers = array(
+ 'x-authenticationToken: ' . $authenToken
+ );
- /**
- * Wrapper for info API call
- *
- * @return array An associative array of data
- * @access public
- */
- public function getInfo()
- {
- if(isset($_SESSION['info'])){
- $InfoArray = $_SESSION['info'];
- $timestamp = $InfoArray['timestamp'];
- if(time()-$timestamp>=3600){
- // Get new Info for the profile
- $InfoArray = $this->apiInfo();
- $_SESSION['info'] = $InfoArray;
- $info = $InfoArray['Info'];
- }else{
- $info = $InfoArray['Info'];
- }
- }else{
- // Get new Info for the profile
- $InfoArray = $this->apiInfo();
- $_SESSION['info'] = $InfoArray;
- $info = $InfoArray['Info'];
- }
- return $info;
+ $this->connector($this->config)->requestEndSessionToken($headers, $sessionToken);
+ }
+
+ /**
+ * Wrapper for search API call
+ *
+ * @param
+ *
+ * @throws object PEAR Error
+ * @return array An array of query results
+ * @access public
+ */
+ public function apiSearch($params) {
+
+ $results = $this->request('Search', $params);
+ return $results;
+ }
+
+ /**
+ * Wrapper for retrieve API call
+ *
+ * @param array $an The accession number
+ * @param string $start The short database name
+ *
+ * @throws object PEAR Error
+ * @return array An associative array of data
+ * @access public
+ */
+ public function apiRetrieve($an, $db, $term) {
+ // Add the HTTP query params
+ $params = array(
+ 'an' => $an,
+ 'dbid' => $db,
+ 'highlightterms' => $term // Get currect param name
+ );
+ $params = http_build_query($params);
+ $result = $this->request('Retrieve', $params);
+ return $result;
+ }
+
+ /**
+ * Wrapper for info API call
+ *
+ * @return array An associative array of data
+ * @access public
+ */
+ public function getInfo() {
+ if (isset($_SESSION['info'])) {
+ $InfoArray = $_SESSION['info'];
+ $timestamp = $InfoArray['timestamp'];
+ if (time() - $timestamp >= 3600) {
+ // Get new Info for the profile
+ $InfoArray = $this->apiInfo();
+ $_SESSION['info'] = $InfoArray;
+ $info = $InfoArray['Info'];
+ }
+ else {
+ $info = $InfoArray['Info'];
+ }
}
-
- public function apiInfo(){
-
- $response = $this->request('Info','');
- $Info = array(
- 'Info' => $response,
- 'timestamp'=>time()
- );
- return $Info;
+ else {
+ // Get new Info for the profile
+ $InfoArray = $this->apiInfo();
+ $_SESSION['info'] = $InfoArray;
+ $info = $InfoArray['Info'];
}
+ return $info;
+ }
+
+ public function apiInfo() {
+
+ $response = $this->request('Info', '');
+ $Info = array(
+ 'Info' => $response,
+ 'timestamp' => time()
+ );
+ return $Info;
+ }
+
}
+
?>
\ No newline at end of file
diff --git a/targets/eds/roblib_search_eds.module b/targets/eds/roblib_search_eds.module
index c5ec170..b8298b0 100644
--- a/targets/eds/roblib_search_eds.module
+++ b/targets/eds/roblib_search_eds.module
@@ -41,7 +41,7 @@ function roblib_search_eds_menu() {
$items['admin/roblib_search/eds_search'] = array(
'title' => 'EDS search Target configuration',
- 'description' => 'Configuration for the Roblib evergreen search target',
+ 'description' => 'Configuration for the Roblib eds search target',
'page callback' => 'drupal_get_form',
'page arguments' => array('roblib_search_eds_config_form'),
'access arguments' => array('access administration pages'),
@@ -216,11 +216,6 @@ function roblib_search_eds_get_results($query = NULL) {
}
$config = roblib_search_eds_build_config_arr();
- /*$config['user'] = variable_get('roblib_search_eds_user', 'edsusername');
- $config['pass'] = variable_get('roblib_search_eds_pass', 'edspassword');
- $config['profile'] = variable_get('roblib_search_eds_profile', 'edsapi');
- $config['auth_url'] = variable_get('roblib_search_eds_auth_url', 'https://eds-api.ebscohost.com/Authservice/rest');
- $config['rest_url'] = variable_get('roblib_search_eds_rest_url', 'http://eds-api.ebscohost.com/edsapi/rest');*/
$eds_api = new EBSCOAPI($config);
$number_per_page = variable_get('roblib_search_eds_num_results', '5');
$query = urlencode($query);
diff --git a/targets/eds/theme/roblib-search-eds.tpl.php b/targets/eds/theme/roblib-search-eds.tpl.php
index 2e244d8..0b240e9 100644
--- a/targets/eds/theme/roblib-search-eds.tpl.php
+++ b/targets/eds/theme/roblib-search-eds.tpl.php
@@ -18,7 +18,7 @@
?>
-
+
\ No newline at end of file
diff --git a/targets/evergreen/js/evergreen_results.js b/targets/evergreen/js/evergreen_results.js
index d71a153..5dcf95c 100644
--- a/targets/evergreen/js/evergreen_results.js
+++ b/targets/evergreen/js/evergreen_results.js
@@ -30,6 +30,13 @@ Drupal.behaviors.roblib_search_evergreen = {
})
items.push('')
}
+ if(typeof val.electronic_holdings !== 'undefined'){
+ items.push('');
+ jQuery.each(val.electronic_holdings, function(key2, val2){
+ roblibEvergreenAddElectronicHoldings(val2, items);
+ })
+ items.push('
')
+ }
items.push('');
});
}
@@ -41,9 +48,10 @@ Drupal.behaviors.roblib_search_evergreen = {
}
function roblibEvergreenAddHoldings(holdings, items){
- items.push('' + holdings.call_number + ' ' + holdings.availability + '
');
-
+ items.push('' + holdings.call_number + ' - ' + holdings.location +' (' + holdings.availability + ')
');
+}
+function roblibEvergreenAddElectronicHoldings(holdings, items){
+ items.push('');
}
-
diff --git a/targets/evergreen/roblib_search_evergreen.module b/targets/evergreen/roblib_search_evergreen.module
index 4913248..5ba0982 100644
--- a/targets/evergreen/roblib_search_evergreen.module
+++ b/targets/evergreen/roblib_search_evergreen.module
@@ -233,6 +233,7 @@ function roblib_search_evergreen_parse_results($results, $query) {
roblib_search_evergreen_update_array($output, $index, 'date', $record->xpath('marcxml:datafield[@tag="260"]/marcxml:subfield[@code="c"]'));
roblib_search_evergreen_update_array($output, $index, 'id', $record->xpath('marcxml:datafield[@tag="901"]/marcxml:subfield[@code="c"]'));
roblib_search_evergreen_holdings($output, $index, $record->xpath('marcxml:datafield[@tag="852"]'));
+ roblib_search_evergreen_electronic_holdings($output, $index, $record->xpath('marcxml:datafield[@tag="856"]'));
$id = $output[$index]['id'];
$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=')
@@ -249,10 +250,26 @@ function roblib_search_evergreen_holdings(&$arr, $index, $xpath_result){
$call_number = $xml->xpath('marcxml:subfield[@code="c"]');
$arr[$index]['holdings'][$holding_index]['call_number'] = (string)$call_number[0];
$availability = $xml->xpath('marcxml:subfield[@code="n"]');
- $arr[$index]['holdings'][$holding_index++]['availability'] = (string)$availability[0];
+ $arr[$index]['holdings'][$holding_index]['availability'] = (string)$availability[0];
+ $location = $xml->xpath('marcxml:subfield[@code="a"]');
+ $arr[$index]['holdings'][$holding_index++]['location'] = (string)$location[0];
}
}
+function roblib_search_evergreen_electronic_holdings(&$arr, $index, $xpath_result){
+ $holding_index = 0;
+ foreach($xpath_result as $xml){
+ $xml->registerXPathNamespace('marcxml', 'http://www.loc.gov/MARC21/slim');
+ $label = $xml->xpath('marcxml:subfield[@code="y"]');
+ $label = (string)$label[0];
+ $url = $xml->xpath('marcxml:subfield[@code="u"]');
+ $url = (string)$url[0];
+ $arr[$index]['electronic_holdings'][$holding_index]['url'] = $url;
+ $arr[$index]['electronic_holdings'][$holding_index++]['label'] = $label;
+
+ }
+}
+
function roblib_search_evergreen_update_array(&$arr, $index, $key, $xpath_result){
if(!empty($xpath_result)){
$val = (string)$xpath_result[0];
diff --git a/targets/evergreen/theme/roblib-search-evergreen.tpl.php b/targets/evergreen/theme/roblib-search-evergreen.tpl.php
index ee8256a..b3a47d9 100644
--- a/targets/evergreen/theme/roblib-search-evergreen.tpl.php
+++ b/targets/evergreen/theme/roblib-search-evergreen.tpl.php
@@ -18,7 +18,7 @@
?>
-
+
Search all Results
\ No newline at end of file