*prechod na novsiu verziu ZF
[sport-group.git] / library / Zend / Gdata / Spreadsheets / CellQuery.php
blob18b1eb42a75b5521be8902d8a4c4ba300ce57bbf
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 Spreadsheets
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: CellQuery.php 16971 2009-07-22 18:05:45Z mikaelkael $
24 /**
25 * Zend_Gdata_App_util
27 require_once('Zend/Gdata/App/Util.php');
29 /**
30 * Zend_Gdata_Query
32 require_once('Zend/Gdata/Query.php');
34 /**
35 * Assists in constructing queries for Google Spreadsheets cells
37 * @link http://code.google.com/apis/gdata/spreadsheets/
39 * @category Zend
40 * @package Zend_Gdata
41 * @subpackage Spreadsheets
42 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
43 * @license http://framework.zend.com/license/new-bsd New BSD License
45 class Zend_Gdata_Spreadsheets_CellQuery extends Zend_Gdata_Query
48 const SPREADSHEETS_CELL_FEED_URI = 'http://spreadsheets.google.com/feeds/cells';
50 protected $_defaultFeedUri = self::SPREADSHEETS_CELL_FEED_URI;
51 protected $_visibility = 'private';
52 protected $_projection = 'full';
53 protected $_spreadsheetKey = null;
54 protected $_worksheetId = 'default';
55 protected $_cellId = null;
57 /**
58 * Constructs a new Zend_Gdata_Spreadsheets_CellQuery object.
60 * @param string $url Base URL to use for queries
62 public function __construct($url = null)
64 parent::__construct($url);
67 /**
68 * Sets the spreadsheet key for this query.
70 * @param string $value
71 * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
73 public function setSpreadsheetKey($value)
75 $this->_spreadsheetKey = $value;
76 return $this;
79 /**
80 * Gets the spreadsheet key for this query.
82 * @return string spreadsheet key
84 public function getSpreadsheetKey()
86 return $this->_spreadsheetKey;
89 /**
90 * Sets the worksheet id for this query.
92 * @param string $value
93 * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
95 public function setWorksheetId($value)
97 $this->_worksheetId = $value;
98 return $this;
102 * Gets the worksheet id for this query.
104 * @return string worksheet id
106 public function getWorksheetId()
108 return $this->_worksheetId;
112 * Sets the cell id for this query.
114 * @param string $value
115 * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
117 public function setCellId($value)
119 $this->_cellId = $value;
120 return $this;
124 * Gets the cell id for this query.
126 * @return string cell id
128 public function getCellId()
130 return $this->_cellId;
134 * Sets the projection for this query.
136 * @param string $value
137 * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
139 public function setProjection($value)
141 $this->_projection = $value;
142 return $this;
146 * Sets the visibility for this query.
148 * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
150 public function setVisibility($value)
152 $this->_visibility = $value;
153 return $this;
157 * Gets the projection for this query.
159 * @return string projection
161 public function getProjection()
163 return $this->_projection;
167 * Gets the visibility for this query.
169 * @return string visibility
171 public function getVisibility()
173 return $this->_visibility;
177 * Sets the min-row attribute for this query.
179 * @param string $value
180 * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
182 public function setMinRow($value)
184 if ($value != null) {
185 $this->_params['min-row'] = $value;
186 } else {
187 unset($this->_params['min-row']);
189 return $this;
193 * Gets the min-row attribute for this query.
195 * @return string min-row
197 public function getMinRow()
199 if (array_key_exists('min-row', $this->_params)) {
200 return $this->_params['min-row'];
201 } else {
202 return null;
207 * Sets the max-row attribute for this query.
209 * @param string $value
210 * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
212 public function setMaxRow($value)
214 if ($value != null) {
215 $this->_params['max-row'] = $value;
216 } else {
217 unset($this->_params['max-row']);
219 return $this;
223 * Gets the max-row attribute for this query.
225 * @return string max-row
227 public function getMaxRow()
229 if (array_key_exists('max-row', $this->_params)) {
230 return $this->_params['max-row'];
231 } else {
232 return null;
237 * Sets the min-col attribute for this query.
239 * @param string $value
240 * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
242 public function setMinCol($value)
244 if ($value != null) {
245 $this->_params['min-col'] = $value;
246 } else {
247 unset($this->_params['min-col']);
249 return $this;
253 * Gets the min-col attribute for this query.
255 * @return string min-col
257 public function getMinCol()
259 if (array_key_exists('min-col', $this->_params)) {
260 return $this->_params['min-col'];
261 } else {
262 return null;
267 * Sets the max-col attribute for this query.
269 * @param string $value
270 * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
272 public function setMaxCol($value)
274 if ($value != null) {
275 $this->_params['max-col'] = $value;
276 } else {
277 unset($this->_params['max-col']);
279 return $this;
283 * Gets the max-col attribute for this query.
285 * @return string max-col
287 public function getMaxCol()
289 if (array_key_exists('max-col', $this->_params)) {
290 return $this->_params['max-col'];
291 } else {
292 return null;
297 * Sets the range attribute for this query.
299 * @param string $value
300 * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
302 public function setRange($value)
304 if ($value != null) {
305 $this->_params['range'] = $value;
306 } else {
307 unset($this->_params['range']);
309 return $this;
313 * Gets the range attribute for this query.
315 * @return string range
317 public function getRange()
319 if (array_key_exists('range', $this->_params)) {
320 return $this->_params['range'];
321 } else {
322 return null;
327 * Sets the return-empty attribute for this query.
329 * @param mixed $value String or bool value for whether to return empty cells
330 * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
332 public function setReturnEmpty($value)
334 if (is_bool($value)) {
335 $this->_params['return-empty'] = ($value?'true':'false');
336 } else if ($value != null) {
337 $this->_params['return-empty'] = $value;
338 } else {
339 unset($this->_params['return-empty']);
341 return $this;
345 * Gets the return-empty attribute for this query.
347 * @return string return-empty
349 public function getReturnEmpty()
351 if (array_key_exists('return-empty', $this->_params)) {
352 return $this->_params['return-empty'];
353 } else {
354 return null;
359 * Gets the full query URL for this query.
361 * @return string url
363 public function getQueryUrl()
365 if ($this->_url == null) {
366 $uri = $this->_defaultFeedUri;
368 if ($this->_spreadsheetKey != null) {
369 $uri .= '/'.$this->_spreadsheetKey;
370 } else {
371 require_once 'Zend/Gdata/App/Exception.php';
372 throw new Zend_Gdata_App_Exception('A spreadsheet key must be provided for cell queries.');
375 if ($this->_worksheetId != null) {
376 $uri .= '/'.$this->_worksheetId;
377 } else {
378 require_once 'Zend/Gdata/App/Exception.php';
379 throw new Zend_Gdata_App_Exception('A worksheet id must be provided for cell queries.');
382 if ($this->_visibility != null) {
383 $uri .= '/'.$this->_visibility;
384 } else {
385 require_once 'Zend/Gdata/App/Exception.php';
386 throw new Zend_Gdata_App_Exception('A visibility must be provided for cell queries.');
389 if ($this->_projection != null) {
390 $uri .= '/'.$this->_projection;
391 } else {
392 require_once 'Zend/Gdata/App/Exception.php';
393 throw new Zend_Gdata_App_Exception('A projection must be provided for cell queries.');
396 if ($this->_cellId != null) {
397 $uri .= '/'.$this->_cellId;
399 } else {
400 $uri = $this->_url;
403 $uri .= $this->getQueryString();
404 return $uri;
408 * Gets the attribute query string for this query.
410 * @return string query string
412 public function getQueryString()
414 return parent::getQueryString();