About Features Downloads Getting Started Documentation Events Support GitHub

Love VuFind®? Consider becoming a financial supporter. Your support helps build a better VuFind®!

Site Tools


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.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
expanded_driver_func [2010/02/11 12:10] l.osullivanexpanded_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://vufind.svn.sourceforge.net/svnroot/vufind/branches/luke%%** **%%https://vufind.svn.sourceforge.net/svnroot/vufind/branches/luke%%**
 +
 +
 +
  
 ===== 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:** +//**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 207: 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 374: Line 378:
 </code> </code>
 === 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 560: Line 563:
 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.
  
 +<code>
 {if $results.sysmessage} {if $results.sysmessage}
 <p class="error">{translate text=$results.sysmessage|escape}</p> <p class="error">{translate text=$results.sysmessage|escape}</p>
 {/if} {/if}
 +</code>
  
 The form action is generated using the variables passed from Holdings.php and view-holdings-holds.tpl.  Each form element is displayed only if its key exists in the $form_fields array. If the array received from the getPickUpLocations  function has only one entry, a hidden input is generated with the library id as the value. If the array has multiple entries, a select box is generated. At present, the entire form is hardcoded but it could be dynamically created using the link and required config  values. The form action is generated using the variables passed from Holdings.php and view-holdings-holds.tpl.  Each form element is displayed only if its key exists in the $form_fields array. If the array received from the getPickUpLocations  function has only one entry, a hidden input is generated with the library id as the value. If the array has multiple entries, a select box is generated. At present, the entire form is hardcoded but it could be dynamically created using the link and required config  values.
  
 +<code>
   <div class="hold-form">   <div class="hold-form">
  
Line 615: Line 621:
      
   </div>   </div>
 +</code>
  
 === New Smarty Variables / Text === === New Smarty Variables / Text ===
Line 628: Line 635:
 Place a Hold Place a Hold
  
-== hold-submit.tpl =+== hold-submit.tpl ==
  
 Comments Comments
Line 648: 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.  The method either takes information supplied via a POST form, passes it to the driver and returns the response or generates a url link to the native OPAC. 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.  The method either takes information supplied via a POST form, passes it to the driver and returns the response or generates a url link to the native OPAC.
 +
  
  
Line 655: Line 663:
  
 [cancelHolds] [cancelHolds]
 +
 enabled = true enabled = true
 +
 link = item_id:recall_id link = item_id:recall_id
 +
 opacurl = %%http://opac.swan.ac.uk/holdingsInfo/cancelHold%% opacurl = %%http://opac.swan.ac.uk/holdingsInfo/cancelHold%%
 +
  
 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 894: Line 906:
           {/if}           {/if}
 </code> </code>
 +
  
 ==== 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 915: 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.  The method either takes information supplied via a POST form, passes it to the driver and returns the response or generates a url link to the native OPAC. 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.  The method either takes information supplied via a POST form, passes it to the driver and returns the response or generates a url link to the native OPAC.
 +
  
 ==== Process ==== ==== Process ====
Line 920: Line 936:
 conf/driver.ini conf/driver.ini
  
-Renewals]+[Renewals] 
 enabled = true enabled = true
 +
 link = item_id link = item_id
-opacurl = http://opac.swan.ac.uk/renewItems+ 
 +opacurl = %%http://opac.swan.ac.uk/renewItems%%
  
 The enabled field determines whether or not Renewals is in use.  The enabled field determines whether or not Renewals is in use. 
Line 937: Line 956:
         // Is Renewing Items allowed?         // Is Renewing Items allowed?
         $this->checkRenew = $this->catalog->checkFunction("Renewals");         $this->checkRenew = $this->catalog->checkFunction("Renewals");
 +
  
 ==== CheckedOut.php ==== ==== CheckedOut.php ====
Line 942: Line 962:
 CheckedOut.php begins as usual by confirming that the driver is available and that the user is logged  in: CheckedOut.php begins as usual by confirming that the driver is available and that the user is logged  in:
  
 +<code
        // Get My Transactions        // Get My Transactions
         if ($this->catalog->status) {         if ($this->catalog->status) {
Line 948: Line 969:
                 if (PEAR::isError($patron))                 if (PEAR::isError($patron))
                     PEAR::raiseError($patron);                     PEAR::raiseError($patron);
 +</code>
  
 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:
- + 
 +<code>
  $result = $this->catalog->getMyTransactions($patron);  $result = $this->catalog->getMyTransactions($patron);
                 if (!PEAR::isError($result)) {                 if (!PEAR::isError($result)) {
Line 965: Line 988:
                                                  
                     }                     }
 +</code>
  
 Once the transaction list has been established, CheckedOut.php checks to see if the renewal function is enabled. If it is, it sets the name of the function and assigns the information required to renew each item to the ils_details array. If function is set to “renewMyItemsLink”, it passes the array key values set in the “link field” of driver.ini to renewMyItemsLink and receives a ur which is assigned to the “ils_details” array with the “renew_link” key. If the function is not “renewMyItemsLink”, it assigns the array keys set in the “link” field of  driver.ini file to the “ils_details” array with the “renew_details” key. A renewOption variable of OPAC or vufind is assigned to CheckedOut.tpl for form display options. Once the transaction list has been established, CheckedOut.php checks to see if the renewal function is enabled. If it is, it sets the name of the function and assigns the information required to renew each item to the ils_details array. If function is set to “renewMyItemsLink”, it passes the array key values set in the “link field” of driver.ini to renewMyItemsLink and receives a ur which is assigned to the “ils_details” array with the “renew_link” key. If the function is not “renewMyItemsLink”, it assigns the array keys set in the “link” field of  driver.ini file to the “ils_details” array with the “renew_details” key. A renewOption variable of OPAC or vufind is assigned to CheckedOut.tpl for form display options.
  
 +<code>
 if($this->checkRenew) { if($this->checkRenew) {
                                          
Line 1006: Line 1031:
                         }                         }
                     }                     }
 +</code>
  
 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['details'] array together with the patron information. CheckedOut.php then calls the driver renewal function and assigns the results to the template. It also extracts the array keys and assigns them to the renewArray variable so that smarty can determine which items have returned a renew response. 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['details'] array together with the patron information. CheckedOut.php then calls the driver renewal function and assigns the results to the template. It also extracts the array keys and assigns them to the renewArray variable so that smarty can determine which items have returned a renew response.
  
 +<code>
                              // Rewew Items                              // Rewew Items
                                  
Line 1029: Line 1056:
                             $interface->assign('renewArray', $ids);                             $interface->assign('renewArray', $ids);
                                     }                                     }
 +</code>
  
 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: 
  
 +<code>
 {if $renewOption == "vufind"} {if $renewOption == "vufind"}
                 <form name="renewall" action="{$url|escape}/MyResearch/CheckedOut" method="POST" id="renewall">                  <form name="renewall" action="{$url|escape}/MyResearch/CheckedOut" method="POST" id="renewall"> 
Line 1052: Line 1081:
                 <form name="renewals" action="{$url}/MyResearch/CheckedOut" method="POST" id="renewals">                 <form name="renewals" action="{$url}/MyResearch/CheckedOut" method="POST" id="renewals">
               {/if}               {/if}
 +</code>
  
 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.
  
 +<code>
 <ul class="filters"> <ul class="filters">
           {foreach from=$transList item=resource name="recordLoop"}           {foreach from=$transList item=resource name="recordLoop"}
Line 1134: Line 1165:
           {/foreach}           {/foreach}
           </ul>           </ul>
 +</code>
  
 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.
-   + 
 +<code>   
 {if $renewOption == "vufind"} {if $renewOption == "vufind"}
    <br />      <br /> 
Line 1142: Line 1175:
  </form>  </form>
    {/if}    {/if}
 +</code>
  
 ==== New Smarty Variables / Text ==== ==== New Smarty Variables / Text ====
expanded_driver_func.txt · Last modified: 2014/06/13 13:14 by 127.0.0.1