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 12:03] – 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 338: | 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. | ||
Line 368: | Line 375: | ||
{/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. | ||
Line 545: | 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 610: | Line 619: | ||
| | ||
</ | </ | ||
+ | </ | ||
=== New Smarty Variables / Text === | === New Smarty Variables / Text === | ||
Line 623: | Line 633: | ||
Place a Hold | Place a Hold | ||
- | == hold-submit.tpl = | + | == hold-submit.tpl |
Comments | Comments | ||
Line 643: | 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 649: | 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 662: | 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 676: | 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 688: | 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 705: | 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 718: | 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 763: | 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 779: | Line 807: | ||
$interface-> | $interface-> | ||
} | } | ||
+ | </ | ||
=== Holds.tpl === | === Holds.tpl === | ||
Line 790: | 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 805: | 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 862: | 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 870: | 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 891: | 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 896: | 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 913: | Line 954: | ||
// Is Renewing Items allowed? | // Is Renewing Items allowed? | ||
$this-> | $this-> | ||
+ | |||
==== CheckedOut.php ==== | ==== CheckedOut.php ==== | ||
Line 918: | 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 924: | 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 941: | Line 986: | ||
| | ||
} | } | ||
+ | </ | ||
Once the transaction list has been established, | Once the transaction list has been established, | ||
+ | < | ||
if($this-> | if($this-> | ||
| | ||
Line 982: | 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 1005: | 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 1028: | 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 1110: | 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 1118: | 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