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.
19 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
21 * @version $Id: Query.php 16971 2009-07-22 18:05:45Z mikaelkael $
27 require_once('Zend/Gdata/Query.php');
30 * Assists in constructing queries for Google Document List documents
32 * @link http://code.google.com/apis/gdata/spreadsheets/
37 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
38 * @license http://framework.zend.com/license/new-bsd New BSD License
40 class Zend_Gdata_Docs_Query
extends Zend_Gdata_Query
44 * The base URL for retrieving a document list
48 const DOCUMENTS_LIST_FEED_URI
= 'http://docs.google.com/feeds/documents';
51 * The generic base URL used by some inherited methods
55 protected $_defaultFeedUri = self
::DOCUMENTS_LIST_FEED_URI
;
58 * The visibility to be used when querying for the feed. A request for a
59 * feed with private visbility requires the user to be authenricated.
60 * Private is the only avilable visibility for the documents list.
64 protected $_visibility = 'private';
67 * The projection determines how much detail should be given in the
68 * result of the query. Full is the only valid projection for the
73 protected $_projection = 'full';
76 * Constructs a new instance of a Zend_Gdata_Docs_Query object.
78 public function __construct()
80 parent
::__construct();
84 * Sets the projection for this query. Common values for projection
87 * @param string $value
88 * @return Zend_Gdata_Docs_Query Provides a fluent interface
90 public function setProjection($value)
92 $this->_projection
= $value;
97 * Sets the visibility for this query. Common values for visibility
100 * @return Zend_Gdata_Docs_Query Provides a fluent interface
102 public function setVisibility($value)
104 $this->_visibility
= $value;
109 * Gets the projection for this query.
111 * @return string projection
113 public function getProjection()
115 return $this->_projection
;
119 * Gets the visibility for this query.
121 * @return string visibility
123 public function getVisibility()
125 return $this->_visibility
;
129 * Sets the title attribute for this query. The title parameter is used
130 * to restrict the results to documents whose titles either contain or
131 * completely match the title.
133 * @param string $value
134 * @return Zend_Gdata_Docs_Query Provides a fluent interface
136 public function setTitle($value)
138 if ($value !== null) {
139 $this->_params
['title'] = $value;
141 unset($this->_params
['title']);
147 * Gets the title attribute for this query.
149 * @return string title
151 public function getTitle()
153 if (array_key_exists('title', $this->_params
)) {
154 return $this->_params
['title'];
161 * Sets the title-exact attribute for this query.
162 * If title-exact is set to true, the title query parameter will be used
163 * in an exact match. Only documents with a title identical to the
164 * title parameter will be returned.
166 * @param boolean $value Use either true or false
167 * @return Zend_Gdata_Docs_Query Provides a fluent interface
169 public function setTitleExact($value)
172 $this->_params
['title-exact'] = $value;
174 unset($this->_params
['title-exact']);
180 * Gets the title-exact attribute for this query.
182 * @return string title-exact
184 public function getTitleExact()
186 if (array_key_exists('title-exact', $this->_params
)) {
187 return $this->_params
['title-exact'];
194 * Gets the full query URL for this query.
198 public function getQueryUrl()
200 $uri = $this->_defaultFeedUri
;
202 if ($this->_visibility
!== null) {
203 $uri .= '/' . $this->_visibility
;
205 require_once 'Zend/Gdata/App/Exception.php';
206 throw new Zend_Gdata_App_Exception(
207 'A visibility must be provided for cell queries.');
210 if ($this->_projection
!== null) {
211 $uri .= '/' . $this->_projection
;
213 require_once 'Zend/Gdata/App/Exception.php';
214 throw new Zend_Gdata_App_Exception(
215 'A projection must be provided for cell queries.');
218 $uri .= $this->getQueryString();