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:05] 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 372: Line 377:
               {/if}     {/if}                {/if}     {/if} 
 </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 549: Line 553:
 </code> </code>
  
-== 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.
  
 +<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 614: Line 621:
      
   </div>   </div>
 +</code>
  
 === New Smarty Variables / Text === === New Smarty Variables / Text ===
Line 627: Line 635:
 Place a Hold Place a Hold
  
-== hold-submit.tpl =+== hold-submit.tpl ==
  
 Comments Comments
Line 647: 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.
 +
 +
  
 ==== Process ==== ==== Process ====
Line 653: 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 666: 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. 
 +<code>
         // Is Cancelling Holds allowed?         // Is Cancelling Holds allowed?
         $this->cancelHolds = $this->catalog->checkFunction("CancelHolds");         $this->cancelHolds = $this->catalog->checkFunction("CancelHolds");
 +</code>
  
 === 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:
 +<code>
  
 // Get My Holds // Get My Holds
Line 680: Line 696:
                 if (PEAR::isError($patron))                 if (PEAR::isError($patron))
                     PEAR::raiseError($patron);                     PEAR::raiseError($patron);
 +</code>
  
 It then proceeds to determine if cancelling holds is enabled and retrieves any messages received from services/Record/Hold.php. It then proceeds to determine if cancelling holds is enabled and retrieves any messages received from services/Record/Hold.php.
  
 +<code>
 // Is cancelling Holds Available // Is cancelling Holds Available
          if($this->cancelHolds != false) {          if($this->cancelHolds != false) {
Line 692: Line 710:
                         $cancelResults['success'] = $_GET['success'];                         $cancelResults['success'] = $_GET['success'];
                     }                     }
 +</code>
  
 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. 
  
 +<code>
     // Process Submitted Form     // Process Submitted Form
  
Line 709: Line 729:
                 $interface->assign('cancelResults', $cancelResults);                 $interface->assign('cancelResults', $cancelResults);
                 }                 }
 +</code>
  
 A call is then made to the getMyHolds function: A call is then made to the getMyHolds function:
  
 +<code>
 $result = $this->catalog->getMyHolds($patron); $result = $this->catalog->getMyHolds($patron);
  
Line 722: Line 744:
                             $db->debug = true;                             $db->debug = true;
                         }                         }
 +</code>
  
 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.
  
 +<code>
                         // Get BIB Details and add "ils_details" details to result                         // Get BIB Details and add "ils_details" details to result
                         // Addition of values like "date created" etc moved to "ils_details" array key in Driver to negate need to edit Holds.php                          // Addition of values like "date created" etc moved to "ils_details" array key in Driver to negate need to edit Holds.php 
Line 767: Line 791:
                             $recordList[] = $record;                             $recordList[] = $record;
                         }                         }
 +</code>
  
 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.
  
 +<code>
   $interface->assign('recordList', $recordList);   $interface->assign('recordList', $recordList);
                                          
Line 783: Line 809:
         $interface->display('layout.tpl');         $interface->display('layout.tpl');
     }     }
 +</code>
  
 === Holds.tpl === === Holds.tpl ===
Line 794: 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: 
  
 +<code>
 {if is_array($recordList)} {if is_array($recordList)}
  
Line 809: Line 836:
             <form name="cancelForm" action="{$url|escape}/MyResearch/Holds" method="POST" id="cancelHold">             <form name="cancelForm" action="{$url|escape}/MyResearch/Holds" method="POST" id="cancelHold">
             {/if}             {/if}
 +</code>
  
 The second uses checkboxes to give users the option of selecting individual holds to cancel. It is generated as part of the recordList  list operation. The second uses checkboxes to give users the option of selecting individual holds to cancel. It is generated as part of the recordList  list operation.
  
 +<code>
 <ul class="filters"> <ul class="filters">
         {foreach from=$recordList item=resource name="recordLoop"}         {foreach from=$recordList item=resource name="recordLoop"}
Line 866: Line 895:
         {/foreach}         {/foreach}
         </ul>         </ul>
 +</code>
  
 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.
  
 +<code>
 {if $cancelOption} {if $cancelOption}
    <br />      <br /> 
Line 874: Line 905:
    </form>    </form>
           {/if}           {/if}
 +</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 895: 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 900: 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 917: 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 922: 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 928: 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 945: 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 986: 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 1009: 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 1032: 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 1114: 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 1122: 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