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:59] – l.osullivan | expanded_driver_func [2010/02/11 12:21] – l.osullivan | ||
---|---|---|---|
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. |
// | // | ||
Line 33: | Line 34: | ||
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 45: | ||
Sample: Holds | Sample: Holds | ||
+ | < | ||
function checkFunction($function) | function checkFunction($function) | ||
{ | { | ||
Line 87: | Line 90: | ||
} | } | ||
+ | </ | ||
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 208: | ||
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 337: | Line 344: | ||
$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 365: | Line 374: | ||
{/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 386: | Line 395: | ||
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 418: | Line 429: | ||
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 439: | Line 451: | ||
$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 485: | Line 499: | ||
} | } | ||
+ | </ | ||
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 506: | Line 521: | ||
} | } | ||
+ | </ | ||
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 522: | Line 539: | ||
| | ||
} | } | ||
+ | </ | ||
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 531: | Line 549: | ||
| | ||
} | } | ||
+ | </ | ||
- | == 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 597: | Line 619: | ||
| | ||
</ | </ | ||
+ | </ | ||
=== New Smarty Variables / Text === | === New Smarty Variables / Text === | ||
Line 610: | Line 633: | ||
Place a Hold | Place a Hold | ||
- | == hold-submit.tpl = | + | == hold-submit.tpl |
Comments | Comments | ||
Line 630: | Line 653: | ||
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 636: | Line 661: | ||
[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 649: | Line 678: | ||
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 663: | Line 694: | ||
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 675: | Line 708: | ||
$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 692: | Line 727: | ||
$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 705: | Line 742: | ||
$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 750: | Line 789: | ||
$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 766: | Line 807: | ||
$interface-> | $interface-> | ||
} | } | ||
+ | </ | ||
=== Holds.tpl === | === Holds.tpl === | ||
Line 777: | Line 819: | ||
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 792: | Line 834: | ||
<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 849: | Line 893: | ||
{/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 857: | Line 903: | ||
</ | </ | ||
{/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 878: | Line 928: | ||
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 883: | Line 934: | ||
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 900: | Line 954: | ||
// Is Renewing Items allowed? | // Is Renewing Items allowed? | ||
$this-> | $this-> | ||
+ | |||
==== CheckedOut.php ==== | ==== CheckedOut.php ==== | ||
Line 905: | Line 960: | ||
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 911: | Line 967: | ||
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 928: | Line 986: | ||
| | ||
} | } | ||
+ | </ | ||
Once the transaction list has been established, | Once the transaction list has been established, | ||
+ | < | ||
if($this-> | if($this-> | ||
| | ||
Line 969: | Line 1029: | ||
} | } | ||
} | } | ||
+ | </ | ||
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 992: | Line 1054: | ||
$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 1015: | Line 1079: | ||
<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 1097: | Line 1163: | ||
{/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 1105: | Line 1173: | ||
</ | </ | ||
{/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