scrib_availability

4 Comments

[innerindex]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('', $raw);

	$availability = NULL;
	foreach($temp as $tem){
		$te = explode('bibItems">', $tem);
		if($te[1]){
			$availability = strip_tags(('' . $te[1] . '
'), '
'); break; } } foreach($temp as $tem){ $te = explode('bibHoldings">', $tem); if($te[1]){ $holdings = strip_tags(('' . str_replace("\n", '', $te[1]) . '
'), '

'); break; } } if($availability){ return($availability . '

View record in LOLA catalog · Request item

'); }else if($holdings){ return($holdings . '

View record in LOLA catalog

'); }else{ return('

View record in LOLA catalog'); } }

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.


4 Responses to “scrib_availability”

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>