示例#1
0
 /**
  * Process notifications from the ACS server when an item is checked out
  * or returned.
  **/
 function launch()
 {
     $id = $_REQUEST['id'];
     //Setup JSON response
     header('Content-type: text/plain');
     header('Cache-Control: no-cache, must-revalidate');
     // HTTP/1.1
     header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
     // Date in the past
     require_once ROOT_DIR . '/Drivers/EContentDriver.php';
     $driver = new EContentDriver();
     $result = $driver->cancelHold($id);
     echo json_encode($result);
     exit;
 }
示例#2
0
 /**
  * Cancel a hold on an eContent record.
  *
  * Parameters:
  * <ul>
  * <li>username - The barcode of the user.  Can be truncated to the last 7 or 9 digits.</li>
  * <li>password - The pin number for the user. </li>
  * <li>recordId � The id of the record that should have it's hold cancelled.</li>
  * </ul>
  *
  * Returns:
  * <ul>
  * <li>success � true if the account is valid and the hold could be canceled, false if the username or password were incorrect or the hold could not be canceled.</li>
  * <li>holdMessage � a reason why the method failed if success is false</li>
  * </ul>
  *
  * Sample Call:
  * <code>
  * http://catalog.douglascountylibraries.org/API/UserAPI?method=cancelEContentHold&username=23025003575917&password=1234&recordId=521
  * </code>
  *
  * Sample Response:
  * <code>
  * {"result":{
  *   "success":true,
  *   "holdMessage":"Your hold was cancelled successfully."
  * }}
  * </code>
  *
  * @author Mark Noble <*****@*****.**>
  */
 function cancelEContentHold()
 {
     $username = $_REQUEST['username'];
     $password = $_REQUEST['password'];
     $recordId = $_REQUEST['recordId'];
     global $user;
     $user = UserAccount::validateAccount($username, $password);
     if ($user && !PEAR_Singleton::isError($user)) {
         require_once ROOT_DIR . '/Drivers/EContentDriver.php';
         $driver = new EContentDriver();
         $holdMessage = $driver->cancelHold($recordId);
         return array('success' => $holdMessage['result'], 'holdMessage' => $holdMessage['message']);
     } else {
         return array('success' => false, 'message' => 'Login unsuccessful');
     }
 }