/** * Retrieves the URL for the cover of the record by screen scraping OverDrive. * .. * @param EContentRecord $record * @return string */ public function getCoverUrl($record) { $overDriveId = $record->getOverDriveId(); //Get metadata for the record $metadata = $this->getProductMetadata($overDriveId); if (isset($metadata->images) && isset($metadata->images->cover)) { return $metadata->images->cover->href; } else { return ""; } }
/** * Retrieves the URL for the cover of the record by screen scraping OverDrive. * .. * @param EContentRecord $record */ public function getCoverUrl($record) { global $memCache; global $configArray; $overDriveId = $record->getOverDriveId(); echo "OverDrive ID is {$overDriveId}"; //Get metadata for the record $metadata = $this->getProductMetadata($overDriveId); if (isset($metadata->images) && isset($metadata->images->cover)) { return $metadata->images->cover->href; } else { return ""; } }
/** * Checkout an item in OverDrive by first adding to the cart and then processing the cart. * * 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 within the eContent database.</li> * <li>or overdriveId - The id of the record in OverDrive.</li> * <li>format - The format of the item to place a hold on within OverDrive.</li> * <li>lendingPeriod - The number of days to checkout the title. (optional) </li> * </ul> * * Returns JSON encoded data as follows: * <ul> * <li>success � true if the account is valid and the title could be checked out, false if the username or password were incorrect or the hold could not be checked out.</li> * <li>message � information about the process for display to the user.</li> * </ul> * * Sample Call: * <code> * http://catalog.douglascountylibraries.org/API/UserAPI?method=checkoutOverDriveItem&username=23025003575917&password=1234&overDriveId=A3365DAC-EEC3-4261-99D3-E39B7C94A90F&format=420 * </code> * * Sample Response: * <code> * {"result":{ * "success":true, * "message":"Your titles were checked out successfully. You may now download the titles from your Account." * }} * </code> * * @author Mark Noble <*****@*****.**> */ function checkoutOverDriveItem() { $username = $_REQUEST['username']; $password = $_REQUEST['password']; if (isset($_REQUEST['recordId'])) { require_once ROOT_DIR . '/sys/eContent/EContentRecord.php'; $eContentRecord = new EContentRecord(); $eContentRecord->id = $_REQUEST['recordId']; if ($eContentRecord->find(true)) { $overDriveId = $eContentRecord->getOverDriveId(); } } else { $overDriveId = $_REQUEST['overDriveId']; } $format = $_REQUEST['format']; global $user; $user = UserAccount::validateAccount($username, $password); if ($user && !PEAR_Singleton::isError($user)) { require_once ROOT_DIR . '/Drivers/OverDriveDriverFactory.php'; $driver = OverDriveDriverFactory::getDriver(); $lendingPeriod = isset($_REQUEST['lendingPeriod']) ? $_REQUEST['lendingPeriod'] : -1; $holdMessage = $driver->checkoutOverDriveItem($overDriveId, $format, $lendingPeriod, $user); return array('success' => $holdMessage['result'], 'message' => $holdMessage['message']); } else { return array('success' => false, 'message' => 'Login unsuccessful'); } }