*prechod na novsiu verziu ZF
[sport-group.git] / library / Zend / Gdata / Docs / Query.php
blobcfcfe90f6a39f701d92dfaceefde7f90b8de7f2b
1 <?php
3 /**
4 * Zend Framework
6 * LICENSE
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.
16 * @category Zend
17 * @package Zend_Gdata
18 * @subpackage Docs
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 $
24 /**
25 * Zend_Gdata_Query
27 require_once('Zend/Gdata/Query.php');
29 /**
30 * Assists in constructing queries for Google Document List documents
32 * @link http://code.google.com/apis/gdata/spreadsheets/
34 * @category Zend
35 * @package Zend_Gdata
36 * @subpackage Docs
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
43 /**
44 * The base URL for retrieving a document list
46 * @var string
48 const DOCUMENTS_LIST_FEED_URI = 'http://docs.google.com/feeds/documents';
50 /**
51 * The generic base URL used by some inherited methods
53 * @var string
55 protected $_defaultFeedUri = self::DOCUMENTS_LIST_FEED_URI;
57 /**
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.
62 * @var string
64 protected $_visibility = 'private';
66 /**
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
69 * documents list.
71 * @var string
73 protected $_projection = 'full';
75 /**
76 * Constructs a new instance of a Zend_Gdata_Docs_Query object.
78 public function __construct()
80 parent::__construct();
83 /**
84 * Sets the projection for this query. Common values for projection
85 * include 'full'.
87 * @param string $value
88 * @return Zend_Gdata_Docs_Query Provides a fluent interface
90 public function setProjection($value)
92 $this->_projection = $value;
93 return $this;
96 /**
97 * Sets the visibility for this query. Common values for visibility
98 * include 'private'.
100 * @return Zend_Gdata_Docs_Query Provides a fluent interface
102 public function setVisibility($value)
104 $this->_visibility = $value;
105 return $this;
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;
140 } else {
141 unset($this->_params['title']);
143 return $this;
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'];
155 } else {
156 return null;
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)
171 if ($value) {
172 $this->_params['title-exact'] = $value;
173 } else {
174 unset($this->_params['title-exact']);
176 return $this;
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'];
188 } else {
189 return false;
194 * Gets the full query URL for this query.
196 * @return string url
198 public function getQueryUrl()
200 $uri = $this->_defaultFeedUri;
202 if ($this->_visibility !== null) {
203 $uri .= '/' . $this->_visibility;
204 } else {
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;
212 } else {
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();
219 return $uri;