scrib_availability

This function connects Scriblio to the ILS or inventory system to show the real-time status of an item. Because of the wide variety of ILSs and local configurations, it is difficult to suggest code that will work on all sites.

Example for III

Lamson Library uses III’s Millenium ILS, and uses the following code to retrieve the current status of items:

function scrib_availability($id){
 
	$id = substr($id, 2);
 
	$WPopac_ilsbase = 'http://lola.plymouth.edu/';
	$WPopac_ilssso = 'http://www.plymouth.edu/library/r/?destination=';
 
	$raw = utf8_encode(file_get_contents($WPopac_ilsbase .'record='. $id));
 
	$temp = explode('</table>', $raw);
 
	$availability = NULL;
	foreach($temp as $tem){
		$te = explode('bibItems">', $tem);
		if($te[1]){
			$availability = strip_tags(('<table>' . $te[1] . '</table>'), '<table><tr><td><th>');
			break;
		}
	}
 
	foreach($temp as $tem){
		$te = explode('bibHoldings">', $tem);
		if($te[1]){
			$holdings = strip_tags(('<table border = 0>' . str_replace("\n", '', $te[1]) . '</table>'), '<table><tr><td><th><hr>');
			break;
		}
	}
 
	if($availability){
		return($availability . '<p><a href="'. $WPopac_ilsbase .'record='. $id .'" rel="nofollow">View record in LOLA catalog</a> ยท <a href="'. $WPopac_ilssso . urlencode($WPopac_ilsbase.'search/.b'.$id .'/.b'.$id .'/1%2C432%2C432%2CB/request') .'" rel="nofollow">Request item</a></p>');
	}else if($holdings){
		return($holdings . '<p><a href="'. $WPopac_ilsbase .'record='. $id .' rel="nofollow"">View record in LOLA catalog</a></p>');
	}else{
		return('<p><a href="'. $WPopac_ilsbase .'record='. $id .'" rel="nofollow">View record in LOLA catalog</a>');
	}
}

Putting the function in a plugin

Writing a plugin for Scriblio is the same as writing a plugin for WordPress. The functions in those plugins are available to both the WordPress and the Scriblio components. Below is an example plugin:

<?php
/*
Plugin Name: My Site Extras
Description: Local customizations for My Site
Author: Me.
Version: 1.0
Author URI: http://My_URL.com/
*/
 
function scrib_availability($id){
// put the appropriate code in here
}
?>

Put that code into a new file in your site’s (pick a name like my_site_extras.php) plugins directory, then activate the plugin, and it should all work. Here some more detail from WordPress about plugin management.


2 Responses to “scrib_availability”

  • 1
    Jonathan Says:

    There’s a gotcha that had me pulling out my hair for a while: display is set to ‘none’ in the scriblio css file. Comment that out to display availability. Hope that saves someone else the frustration.

  • 2
    alejandro garza Says:

    How do you handle LOTS of items hanging from a Bib Record? Like, say, journal issues? Seems this would only gather the first few items…

Leave a Reply

Comments should show a courteous regard for the presence of other voices in the discussion. We reserve the right to edit or delete comments that do not adhere to this standard.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>