예제 #1
0
 /**
  * Loads the reading history for the user.  Includes print, eContent, and OverDrive titles.
  * Note: The return of this method can be quite lengthy if the patron has a large number of items in their reading history.
  *
  * 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>
  * </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=getPatronReadingHistory&username=23025003575917&password=1234
  * </code>
  *
  * Sample Response:
  * <code>
  * {"result":{
  *   "success":true,
  *   "readingHistory":[
  *     {"recordId":"597608",
  *      "checkout":"2011-03-18",
  *      "checkoutTime":1300428000,
  *      "lastCheckout":"2011-03-22",
  *      "lastCheckoutTime":1300773600,
  *      "title":"The wanderer",
  *      "title_sort":"wanderer",
  *      "author":"O.A.R. (Musical group)",
  *      "format":"Music CD",
  *      "format_category":"Music",
  *      "isbn":"",
  *      "upc":"803494030726"
  *     },
  *     {"recordId":"808990",
  *      "checkout":"2011-03-18",
  *      "checkoutTime":1300428000,
  *      "lastCheckout":"2011-03-22",
  *      "lastCheckoutTime":1300773600,
  *      "title":"Seals \/",
  *      "title_sort":"seals \/",
  *      "author":"Sexton, Colleen A.,",
  *      "format":"Book",
  *      "format_category":"Books",
  *      "isbn":"9781600140563",
  *      "upc":""
  *     }
  *   ]
  * }}
  * </code>
  *
  * @author Mark Noble <*****@*****.**>
  */
 function getPatronReadingHistory()
 {
     $username = $_REQUEST['username'];
     $password = $_REQUEST['password'];
     global $user;
     $user = UserAccount::validateAccount($username, $password);
     if ($user && !PEAR_Singleton::isError($user)) {
         $readingHistory = $this->catalog->getReadingHistory($user);
         return array('success' => true, 'readingHistory' => $readingHistory['titles']);
     } else {
         return array('success' => false, 'message' => 'Login unsuccessful');
     }
 }