|
1 <?php |
|
2 |
|
3 /** |
|
4 * Zend Framework |
|
5 * |
|
6 * LICENSE |
|
7 * |
|
8 * This source file is subject to the new BSD license that is bundled |
|
9 * with this package in the file LICENSE.txt. |
|
10 * It is also available through the world-wide-web at this URL: |
|
11 * http://framework.zend.com/license/new-bsd |
|
12 * If you did not receive a copy of the license and are unable to |
|
13 * obtain it through the world-wide-web, please send an email |
|
14 * to license@zend.com so we can send you a copy immediately. |
|
15 * |
|
16 * @category Zend |
|
17 * @package Zend_Gdata |
|
18 * @subpackage Books |
|
19 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
20 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
21 * @version $Id: VolumeQuery.php 20096 2010-01-06 02:05:09Z bkarwin $ |
|
22 */ |
|
23 |
|
24 /** |
|
25 * Zend_Gdata_Books |
|
26 */ |
|
27 require_once('Zend/Gdata/Books.php'); |
|
28 |
|
29 /** |
|
30 * Zend_Gdata_Query |
|
31 */ |
|
32 require_once('Zend/Gdata/Query.php'); |
|
33 |
|
34 /** |
|
35 * Assists in constructing queries for Books volumes |
|
36 * |
|
37 * @category Zend |
|
38 * @package Zend_Gdata |
|
39 * @subpackage Books |
|
40 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
41 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
42 */ |
|
43 class Zend_Gdata_Books_VolumeQuery extends Zend_Gdata_Query |
|
44 { |
|
45 |
|
46 /** |
|
47 * Create Gdata_Books_VolumeQuery object |
|
48 * |
|
49 * @param string|null $url If non-null, pre-initializes the instance to |
|
50 * use a given URL. |
|
51 */ |
|
52 public function __construct($url = null) |
|
53 { |
|
54 parent::__construct($url); |
|
55 } |
|
56 |
|
57 /** |
|
58 * Sets the minimum level of viewability of volumes to return in the search results |
|
59 * |
|
60 * @param string|null $value The minimum viewability - 'full' or 'partial' |
|
61 * @return Zend_Gdata_Books_VolumeQuery Provides a fluent interface |
|
62 */ |
|
63 public function setMinViewability($value = null) |
|
64 { |
|
65 switch ($value) { |
|
66 case 'full_view': |
|
67 $this->_params['min-viewability'] = 'full'; |
|
68 break; |
|
69 case 'partial_view': |
|
70 $this->_params['min-viewability'] = 'partial'; |
|
71 break; |
|
72 case null: |
|
73 unset($this->_params['min-viewability']); |
|
74 break; |
|
75 } |
|
76 return $this; |
|
77 } |
|
78 |
|
79 /** |
|
80 * Minimum viewability of volumes to include in search results |
|
81 * |
|
82 * @return string|null min-viewability |
|
83 */ |
|
84 public function getMinViewability() |
|
85 { |
|
86 if (array_key_exists('min-viewability', $this->_params)) { |
|
87 return $this->_params['min-viewability']; |
|
88 } else { |
|
89 return null; |
|
90 } |
|
91 } |
|
92 |
|
93 /** |
|
94 * Returns the generated full query URL |
|
95 * |
|
96 * @return string The URL |
|
97 */ |
|
98 public function getQueryUrl() |
|
99 { |
|
100 if (isset($this->_url)) { |
|
101 $url = $this->_url; |
|
102 } else { |
|
103 $url = Zend_Gdata_Books::VOLUME_FEED_URI; |
|
104 } |
|
105 if ($this->getCategory() !== null) { |
|
106 $url .= '/-/' . $this->getCategory(); |
|
107 } |
|
108 $url = $url . $this->getQueryString(); |
|
109 return $url; |
|
110 } |
|
111 |
|
112 } |