Warning: This page has not been updated in over over a year and may be outdated or deprecated.
expanded_driver_func
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
expanded_driver_func [2010/02/11 11:53] – l.osullivan | expanded_driver_func [2010/02/11 12:24] – l.osullivan | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | **Bold Text**====== Expanded Driver Functionality ====== | + | ====== Expanded Driver Functionality ====== |
Line 5: | Line 5: | ||
**%%https:// | **%%https:// | ||
+ | |||
+ | |||
+ | |||
===== Purpose ===== | ===== Purpose ===== | ||
- | To create a flexible and gracefully degrading solution for the Item Loan Renewals, Placing Hold and cancelling Holds. | + | To create a flexible and gracefully degrading solution for Item Loan Renewals, Placing Hold and cancelling Holds. |
- | // | + | //**NB:**// |
- | driver.ini refers to the ILS-specific configuration file found in the config directory. E.g. voyager.ini | + | //driver.ini refers to the ILS-specific configuration file found in the config directory. E.g. voyager.ini// |
- | driver.php refers to the ILS-specific driver e.g. Voyager.php// | + | //driver.php refers to the ILS-specific driver e.g. Voyager.php// |
===== New Functions ===== | ===== New Functions ===== | ||
Line 33: | Line 36: | ||
Accepts a string argument which must correspond with an array key in $this-> | Accepts a string argument which must correspond with an array key in $this-> | ||
+ | |||
Line 43: | Line 47: | ||
Sample: Holds | Sample: Holds | ||
+ | < | ||
function checkFunction($function) | function checkFunction($function) | ||
{ | { | ||
Line 87: | Line 92: | ||
} | } | ||
+ | </ | ||
Accepts a string argument which must correspond with options in its switch statement. When a match is made, it looks to see if the getConfig function is available in the driver. If it is not, it returns false. | Accepts a string argument which must correspond with options in its switch statement. When a match is made, it looks to see if the getConfig function is available in the driver. If it is not, it returns false. | ||
Line 204: | Line 210: | ||
NB: Hypertext link could be converted to form element in order to provide a POST option for continuity between methods. | NB: Hypertext link could be converted to form element in order to provide a POST option for continuity between methods. | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
Line 242: | Line 253: | ||
A call is made to checkFunction and the response is assigned to $checkHolds. | A call is made to checkFunction and the response is assigned to $checkHolds. | ||
+ | < | ||
// Are holds allows? | // Are holds allows? | ||
$checkHolds = $catalog-> | $checkHolds = $catalog-> | ||
Line 251: | Line 263: | ||
$type = $checkHolds[' | $type = $checkHolds[' | ||
+ | </ | ||
Holdings.php then loops through each item to determine if any copies are available and sets the $any_available variable. | Holdings.php then loops through each item to determine if any copies are available and sets the $any_available variable. | ||
+ | < | ||
// Check to see if any copies are available | // Check to see if any copies are available | ||
$any_available = false; | $any_available = false; | ||
Line 264: | Line 278: | ||
} | } | ||
} | } | ||
+ | </ | ||
Holdings.php then performs another loop through each item and creates links for place a hold based on the hold behaviour set in the driver.ini file. This link is attached to the holdings array with the key “link”. | Holdings.php then performs another loop through each item and creates links for place a hold based on the hold behaviour set in the driver.ini file. This link is attached to the holdings array with the key “link”. | ||
+ | < | ||
// Generate Links | // Generate Links | ||
// Loop through each holding | // Loop through each holding | ||
Line 320: | Line 335: | ||
} | } | ||
} | } | ||
+ | </ | ||
Finally, the template is set and the holdings array is assigned to Smarty. | Finally, the template is set and the holdings array is assigned to Smarty. | ||
Line 330: | Line 346: | ||
$interface-> | $interface-> | ||
- | Interface/ | + | |
+ | === Interface/ | ||
View-holdings.tpl is responsible for displaying the holdings for each item. Smarty checks if the item is available and outputs an appropriate link if it has been set in holdings.php. | View-holdings.tpl is responsible for displaying the holdings for each item. Smarty checks if the item is available and outputs an appropriate link if it has been set in holdings.php. | ||
+ | < | ||
{* Begin Available Items (Holds) *} | {* Begin Available Items (Holds) *} | ||
{if $row.availability} | {if $row.availability} | ||
Line 358: | Line 376: | ||
{/if} | {/if} | ||
- | + | </ | |
- | == Hold.php == | + | === Hold.php === |
Hold.php first checks if Holds are enabled. If they are, it registers the function to be used . If they are not, the user is directed back to the holdings page. | Hold.php first checks if Holds are enabled. If they are, it registers the function to be used . If they are not, the user is directed back to the holdings page. | ||
+ | < | ||
// Are Holds Allowed? | // Are Holds Allowed? | ||
Line 379: | Line 397: | ||
exit(); | exit(); | ||
} | } | ||
+ | </ | ||
Next, it checks to see if it has been sent any information from holdings.php or login.php using the link values set in config.ini. If it has, it assigns them to a gatheredDetails array and builds a logon url which will be used to redirected users to a logon screen as required. Hold.php also assigns the required and optional values to PHP variables and also send them to the Smarty template so that the correct form elements can be displayed. | Next, it checks to see if it has been sent any information from holdings.php or login.php using the link values set in config.ini. If it has, it assigns them to a gatheredDetails array and builds a logon url which will be used to redirected users to a logon screen as required. Hold.php also assigns the required and optional values to PHP variables and also send them to the Smarty template so that the correct form elements can be displayed. | ||
+ | < | ||
// Get Values Passed to Page from holdings.php | // Get Values Passed to Page from holdings.php | ||
// Could be removed and rely on response from driver to produce error messages | // Could be removed and rely on response from driver to produce error messages | ||
Line 411: | Line 431: | ||
if ($user && $user-> | if ($user && $user-> | ||
} | } | ||
- | + | </ | |
If the user is logged in and has a catalog username, Holds.php continues by assigning the catalog, registering user details and retrieving a list of pickup libraries based on the patron’s information. This list is assigned to the template. Hold.php also adds a defaultdue date variable using the ISO 8601 format of YYYY-MM-DD. | If the user is logged in and has a catalog username, Holds.php continues by assigning the catalog, registering user details and retrieving a list of pickup libraries based on the patron’s information. This list is assigned to the template. Hold.php also adds a defaultdue date variable using the ISO 8601 format of YYYY-MM-DD. | ||
+ | < | ||
// Connect to Database | // Connect to Database | ||
$this-> | $this-> | ||
Line 432: | Line 453: | ||
$defaultduedate = date(" | $defaultduedate = date(" | ||
$interface-> | $interface-> | ||
+ | </ | ||
If the Hold.tpl form has been submitted, the data is added to the $gatherdDetails array and also re-assigned to the template in case there is insufficient data to place the hold. The patron data is then added to the $gatheredDetails array and assigned to $this-> | If the Hold.tpl form has been submitted, the data is added to the $gatherdDetails array and also re-assigned to the template in case there is insufficient data to place the hold. The patron data is then added to the $gatheredDetails array and assigned to $this-> | ||
+ | < | ||
// Form Has Been Submitted | // Form Has Been Submitted | ||
if(isset($_POST[' | if(isset($_POST[' | ||
Line 478: | Line 501: | ||
} | } | ||
+ | </ | ||
If $proceed is true, then the hold attempt is made using defined function. | If $proceed is true, then the hold attempt is made using defined function. | ||
+ | < | ||
| | ||
Line 499: | Line 523: | ||
} | } | ||
+ | </ | ||
If the user is logged in but does not have a user name, Hold.php displays a form for entering their catalog username and password and assigns the data necessary for a follow up. | If the user is logged in but does not have a user name, Hold.php displays a form for entering their catalog username and password and assigns the data necessary for a follow up. | ||
+ | < | ||
// Require User Log On | // Require User Log On | ||
else if ($user && empty($user-> | else if ($user && empty($user-> | ||
Line 515: | Line 541: | ||
| | ||
} | } | ||
+ | </ | ||
If the user is not logged in, logged Hold.php redirects users to the login page with the details necessary for a follow up. | If the user is not logged in, logged Hold.php redirects users to the login page with the details necessary for a follow up. | ||
+ | < | ||
else{ | else{ | ||
Line 524: | Line 551: | ||
| | ||
} | } | ||
+ | </ | ||
- | == hold.tpl == | + | === hold.tpl |
This has been modified to remove the toolbar and the tabnav bar. Either option could be put back in but either a new Holds Tab would need to be created or Holds would have to become part of the Holdings Tab. | This has been modified to remove the toolbar and the tabnav bar. Either option could be put back in but either a new Holds Tab would need to be created or Holds would have to become part of the Holdings Tab. | ||
- | == hold-submit.tpl == | + | === hold-submit.tpl |
This sub template contains the form required for POSTing data back to Hold.php. It first displays any status messages which can only have been assigned if an error has occurred. | This sub template contains the form required for POSTing data back to Hold.php. It first displays any status messages which can only have been assigned if an error has occurred. | ||
+ | < | ||
{if $results.sysmessage} | {if $results.sysmessage} | ||
<p class=" | <p class=" | ||
{/if} | {/if} | ||
+ | </ | ||
The form action is generated using the variables passed from Holdings.php and view-holdings-holds.tpl. | The form action is generated using the variables passed from Holdings.php and view-holdings-holds.tpl. | ||
+ | < | ||
<div class=" | <div class=" | ||
Line 590: | Line 621: | ||
| | ||
</ | </ | ||
+ | </ | ||
=== New Smarty Variables / Text === | === New Smarty Variables / Text === | ||
Line 603: | Line 635: | ||
Place a Hold | Place a Hold | ||
- | == hold-submit.tpl = | + | == hold-submit.tpl |
Comments | Comments | ||
Line 623: | Line 655: | ||
If enabled, the Cancel Holds method allows vufind users to cancel their holds. If it is not enabled, then none of the functionality is displayed. | If enabled, the Cancel Holds method allows vufind users to cancel their holds. If it is not enabled, then none of the functionality is displayed. | ||
+ | |||
+ | |||
==== Process ==== | ==== Process ==== | ||
Line 629: | Line 663: | ||
[cancelHolds] | [cancelHolds] | ||
+ | |||
enabled = true | enabled = true | ||
+ | |||
link = item_id: | link = item_id: | ||
- | opacurl = http:// | + | |
+ | opacurl = %%http:// | ||
The enabled field determines whether or not Cancel Holds is in use. | The enabled field determines whether or not Cancel Holds is in use. | ||
Line 642: | Line 680: | ||
A call is made to checkFunction and the response is assigned to $cancelHolds. | A call is made to checkFunction and the response is assigned to $cancelHolds. | ||
+ | < | ||
// Is Cancelling Holds allowed? | // Is Cancelling Holds allowed? | ||
$this-> | $this-> | ||
+ | </ | ||
=== Holds.php === | === Holds.php === | ||
Holds.php begins as usual by confirming that the user is signed in: | Holds.php begins as usual by confirming that the user is signed in: | ||
+ | < | ||
// Get My Holds | // Get My Holds | ||
Line 656: | Line 696: | ||
if (PEAR:: | if (PEAR:: | ||
PEAR:: | PEAR:: | ||
+ | </ | ||
It then proceeds to determine if cancelling holds is enabled and retrieves any messages received from services/ | It then proceeds to determine if cancelling holds is enabled and retrieves any messages received from services/ | ||
+ | < | ||
// Is cancelling Holds Available | // Is cancelling Holds Available | ||
if($this-> | if($this-> | ||
Line 668: | Line 710: | ||
$cancelResults[' | $cancelResults[' | ||
} | } | ||
+ | </ | ||
Holds.php then checks if any data has been submitted. If it has, it assigns it to the cancelDetails variable, adds the patron array, calls the required function and assigns the results to the cancelResults array. The cancelResults variable is then assigned to hold.tpl. | Holds.php then checks if any data has been submitted. If it has, it assigns it to the cancelDetails variable, adds the patron array, calls the required function and assigns the results to the cancelResults array. The cancelResults variable is then assigned to hold.tpl. | ||
+ | < | ||
// Process Submitted Form | // Process Submitted Form | ||
Line 685: | Line 729: | ||
$interface-> | $interface-> | ||
} | } | ||
+ | </ | ||
A call is then made to the getMyHolds function: | A call is then made to the getMyHolds function: | ||
+ | < | ||
$result = $this-> | $result = $this-> | ||
Line 698: | Line 744: | ||
$db-> | $db-> | ||
} | } | ||
+ | </ | ||
Holds.php then loops through each result item and assigns the details to the recordList array, If cancel holds is enabled and the function is set as “getcancelHoldLink” , an OPAC url will be added to the cancel_link key in the ils_details array. If no opacurl key is present, the link field in the driver.ini is used to assign an associate array of values to the cancel_details key of the ils_details array. | Holds.php then loops through each result item and assigns the details to the recordList array, If cancel holds is enabled and the function is set as “getcancelHoldLink” , an OPAC url will be added to the cancel_link key in the ils_details array. If no opacurl key is present, the link field in the driver.ini is used to assign an associate array of values to the cancel_details key of the ils_details array. | ||
+ | < | ||
// Get BIB Details and add " | // Get BIB Details and add " | ||
// Addition of values like "date created" | // Addition of values like "date created" | ||
Line 743: | Line 791: | ||
$recordList[] = $record; | $recordList[] = $record; | ||
} | } | ||
+ | </ | ||
Finally, the recordList array is assigned to holds.tpl and the page is displayed. | Finally, the recordList array is assigned to holds.tpl and the page is displayed. | ||
+ | < | ||
$interface-> | $interface-> | ||
| | ||
Line 759: | Line 809: | ||
$interface-> | $interface-> | ||
} | } | ||
+ | </ | ||
=== Holds.tpl === | === Holds.tpl === | ||
Line 770: | Line 821: | ||
Next, if recordList is an array, holds.tpl first determines if vufind is being used to cancel holds. If it is, it will create two forms which POST data back to holds.php. The first cancels all items and uses information in the ils_details array assigned by the driver: | Next, if recordList is an array, holds.tpl first determines if vufind is being used to cancel holds. If it is, it will create two forms which POST data back to holds.php. The first cancels all items and uses information in the ils_details array assigned by the driver: | ||
+ | < | ||
{if is_array($recordList)} | {if is_array($recordList)} | ||
Line 785: | Line 836: | ||
<form name=" | <form name=" | ||
{/if} | {/if} | ||
+ | </ | ||
The second uses checkboxes to give users the option of selecting individual holds to cancel. It is generated as part of the recordList | The second uses checkboxes to give users the option of selecting individual holds to cancel. It is generated as part of the recordList | ||
+ | < | ||
<ul class=" | <ul class=" | ||
{foreach from=$recordList item=resource name=" | {foreach from=$recordList item=resource name=" | ||
Line 842: | Line 895: | ||
{/foreach} | {/foreach} | ||
</ul> | </ul> | ||
+ | </ | ||
holds.tpl finally determines if vufind is being used to cancel holds, supplies a submit button and finishes the form. | holds.tpl finally determines if vufind is being used to cancel holds, supplies a submit button and finishes the form. | ||
+ | < | ||
{if $cancelOption} | {if $cancelOption} | ||
<br /> | <br /> | ||
Line 850: | Line 905: | ||
</ | </ | ||
{/if} | {/if} | ||
+ | </ | ||
+ | |||
==== New Smarty Variables / Text ==== | ==== New Smarty Variables / Text ==== | ||
Cancel All Holds | Cancel All Holds | ||
+ | |||
Cancel Selected Holds | Cancel Selected Holds | ||
+ | |||
Cancel Hold | Cancel Hold | ||
Line 871: | Line 930: | ||
If enabled, the Renew Items method allows vufind users to renew their transactions. If it is not enabled, then none of the functionality is displayed. | If enabled, the Renew Items method allows vufind users to renew their transactions. If it is not enabled, then none of the functionality is displayed. | ||
+ | |||
==== Process ==== | ==== Process ==== | ||
Line 876: | Line 936: | ||
conf/ | conf/ | ||
- | Renewals] | + | [Renewals] |
enabled = true | enabled = true | ||
+ | |||
link = item_id | link = item_id | ||
- | opacurl = http:// | + | |
+ | opacurl = %%http:// | ||
The enabled field determines whether or not Renewals is in use. | The enabled field determines whether or not Renewals is in use. | ||
Line 893: | Line 956: | ||
// Is Renewing Items allowed? | // Is Renewing Items allowed? | ||
$this-> | $this-> | ||
+ | |||
==== CheckedOut.php ==== | ==== CheckedOut.php ==== | ||
Line 898: | Line 962: | ||
CheckedOut.php begins as usual by confirming that the driver is available and that the user is logged | CheckedOut.php begins as usual by confirming that the driver is available and that the user is logged | ||
+ | <code | ||
// Get My Transactions | // Get My Transactions | ||
if ($this-> | if ($this-> | ||
Line 904: | Line 969: | ||
if (PEAR:: | if (PEAR:: | ||
PEAR:: | PEAR:: | ||
+ | </ | ||
It then proceeds to get a list of user transactions. All the data assigned by the driver (duedate and item_id in this instance) is stored in an array with a key of “ils_details” so that system specific values will not have to be added to CheckedOut.php: | It then proceeds to get a list of user transactions. All the data assigned by the driver (duedate and item_id in this instance) is stored in an array with a key of “ils_details” so that system specific values will not have to be added to CheckedOut.php: | ||
- | + | ||
+ | < | ||
$result = $this-> | $result = $this-> | ||
if (!PEAR:: | if (!PEAR:: | ||
Line 921: | Line 988: | ||
| | ||
} | } | ||
+ | </ | ||
Once the transaction list has been established, | Once the transaction list has been established, | ||
+ | < | ||
if($this-> | if($this-> | ||
| | ||
Line 962: | Line 1031: | ||
} | } | ||
} | } | ||
+ | </ | ||
If renewals are enabled, it then checks to see if it has received any POST data. If it has, it adds it to the $gatheredDetails[' | If renewals are enabled, it then checks to see if it has received any POST data. If it has, it adds it to the $gatheredDetails[' | ||
+ | < | ||
// Rewew Items | // Rewew Items | ||
| | ||
Line 985: | Line 1056: | ||
$interface-> | $interface-> | ||
} | } | ||
+ | </ | ||
In this instance, the $_POST data is an array of item ids. The driver returns an array with two main keys. The first, “details” contains an array of details for each renew attempt. In this instance, that includes a Boolean success key (true or false), the item_id and a sysmessage key which holds any message returned by the system (e.g. Items with hold requests may not be renewed.) The second main key is id_array which contains a list of all the item_ids for which a renewal has been attempted. It is included for convenient use in the checkedout template. | In this instance, the $_POST data is an array of item ids. The driver returns an array with two main keys. The first, “details” contains an array of details for each renew attempt. In this instance, that includes a Boolean success key (true or false), the item_id and a sysmessage key which holds any message returned by the system (e.g. Items with hold requests may not be renewed.) The second main key is id_array which contains a list of all the item_ids for which a renewal has been attempted. It is included for convenient use in the checkedout template. | ||
- | checkedout.tpl | + | ==== checkedout.tpl |
checkedout.tpl first determines if vufind is being used to renew items. If it is, it will create two forms which POST data back to checkedout.php. The first renews all items and uses information in the ils_details array assigned by the driver: | checkedout.tpl first determines if vufind is being used to renew items. If it is, it will create two forms which POST data back to checkedout.php. The first renews all items and uses information in the ils_details array assigned by the driver: | ||
+ | < | ||
{if $renewOption == " | {if $renewOption == " | ||
<form name=" | <form name=" | ||
Line 1008: | Line 1081: | ||
<form name=" | <form name=" | ||
{/if} | {/if} | ||
+ | </ | ||
The second uses checkboxes to give users the option of selecting individual items to renew. It is generated as part of the transaction list operation. | The second uses checkboxes to give users the option of selecting individual items to renew. It is generated as part of the transaction list operation. | ||
+ | < | ||
<ul class=" | <ul class=" | ||
{foreach from=$transList item=resource name=" | {foreach from=$transList item=resource name=" | ||
Line 1090: | Line 1165: | ||
{/foreach} | {/foreach} | ||
</ul> | </ul> | ||
+ | </ | ||
checkedout.tpl finally determines if vufind is being to renew items, supplies a submit button and finishes the form. | checkedout.tpl finally determines if vufind is being to renew items, supplies a submit button and finishes the form. | ||
- | | + | |
+ | < | ||
{if $renewOption == " | {if $renewOption == " | ||
<br /> | <br /> | ||
Line 1098: | Line 1175: | ||
</ | </ | ||
{/if} | {/if} | ||
+ | </ | ||
==== New Smarty Variables / Text ==== | ==== New Smarty Variables / Text ==== |
expanded_driver_func.txt · Last modified: 2014/06/13 13:14 by 127.0.0.1