File indexing completed on 2024-06-16 05:30:06

0001 <?php
0002 
0003 /**
0004  * Zend Framework
0005  *
0006  * LICENSE
0007  *
0008  * This source file is subject to the new BSD license that is bundled
0009  * with this package in the file LICENSE.txt.
0010  * It is also available through the world-wide-web at this URL:
0011  * http://framework.zend.com/license/new-bsd
0012  * If you did not receive a copy of the license and are unable to
0013  * obtain it through the world-wide-web, please send an email
0014  * to license@zend.com so we can send you a copy immediately.
0015  *
0016  * @category   Zend
0017  * @package    Zend_Gdata
0018  * @subpackage Books
0019  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0020  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0021  * @version    $Id$
0022  */
0023 
0024 /**
0025  * Zend_Gdata_Books
0026  */
0027 // require_once('Zend/Gdata/Books.php');
0028 
0029 /**
0030  * Zend_Gdata_Query
0031  */
0032 // require_once('Zend/Gdata/Query.php');
0033 
0034 /**
0035  * Assists in constructing queries for Books volumes
0036  *
0037  * @category   Zend
0038  * @package    Zend_Gdata
0039  * @subpackage Books
0040  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0041  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0042  */
0043 class Zend_Gdata_Books_VolumeQuery extends Zend_Gdata_Query
0044 {
0045 
0046     /**
0047      * Create Gdata_Books_VolumeQuery object
0048      *
0049      * @param string|null $url If non-null, pre-initializes the instance to
0050      *        use a given URL.
0051      */
0052     public function __construct($url = null)
0053     {
0054         parent::__construct($url);
0055     }
0056 
0057     /**
0058      * Sets the minimum level of viewability of volumes to return in the search results
0059      *
0060      * @param string|null $value The minimum viewability - 'full' or 'partial'
0061      * @return Zend_Gdata_Books_VolumeQuery Provides a fluent interface
0062      */
0063     public function setMinViewability($value = null)
0064     {
0065         switch ($value) {
0066             case 'full_view':
0067                 $this->_params['min-viewability'] = 'full';
0068                 break;
0069             case 'partial_view':
0070                 $this->_params['min-viewability'] = 'partial';
0071                 break;
0072             case null:
0073                 unset($this->_params['min-viewability']);
0074                 break;
0075         }
0076         return $this;
0077     }
0078 
0079     /**
0080      * Minimum viewability of volumes to include in search results
0081      *
0082      * @return string|null min-viewability
0083      */
0084     public function getMinViewability()
0085     {
0086         if (array_key_exists('min-viewability', $this->_params)) {
0087             return $this->_params['min-viewability'];
0088         } else {
0089             return null;
0090         }
0091     }
0092 
0093     /**
0094      * Returns the generated full query URL
0095      *
0096      * @return string The URL
0097      */
0098     public function getQueryUrl()
0099     {
0100         if (isset($this->_url)) {
0101             $url = $this->_url;
0102         } else {
0103             $url = Zend_Gdata_Books::VOLUME_FEED_URI;
0104         }
0105         if ($this->getCategory() !== null) {
0106             $url .= '/-/' . $this->getCategory();
0107         }
0108         $url = $url . $this->getQueryString();
0109         return $url;
0110     }
0111 
0112 }