source: extensions/Google2Piwigo/include/Zend/Gdata/Spreadsheets/ListQuery.php @ 17475

Last change on this file since 17475 was 17475, checked in by mistic100, 12 years ago

new extension: Google2Piwigo

File size: 7.7 KB
Line 
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 Spreadsheets
19 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license    http://framework.zend.com/license/new-bsd     New BSD License
21 * @version    $Id: ListQuery.php 24594 2012-01-05 21:27:01Z matthew $
22 */
23
24/**
25 * Zend_Gdata_App_util
26 */
27require_once('Zend/Gdata/App/Util.php');
28
29/**
30 * Zend_Gdata_Query
31 */
32require_once('Zend/Gdata/Query.php');
33
34/**
35 * Assists in constructing queries for Google Spreadsheets lists
36 *
37 * @link http://code.google.com/apis/gdata/calendar/
38 *
39 * @category   Zend
40 * @package    Zend_Gdata
41 * @subpackage Spreadsheets
42 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
43 * @license    http://framework.zend.com/license/new-bsd     New BSD License
44 */
45class Zend_Gdata_Spreadsheets_ListQuery extends Zend_Gdata_Query
46{
47
48    const SPREADSHEETS_LIST_FEED_URI = 'https://spreadsheets.google.com/feeds/list';
49
50    protected $_defaultFeedUri = self::SPREADSHEETS_LIST_FEED_URI;
51    protected $_visibility = 'private';
52    protected $_projection = 'full';
53    protected $_spreadsheetKey = null;
54    protected $_worksheetId = 'default';
55    protected $_rowId = null;
56
57    /**
58     * Constructs a new Zend_Gdata_Spreadsheets_ListQuery object.
59     */
60    public function __construct()
61    {
62        parent::__construct();
63    }
64
65    /**
66     * Sets the spreadsheet key for the query.
67     * @param string $value
68     * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
69     */
70    public function setSpreadsheetKey($value)
71    {
72        $this->_spreadsheetKey = $value;
73        return $this;
74    }
75
76    /**
77     * Gets the spreadsheet key for the query.
78     * @return string spreadsheet key
79     */
80    public function getSpreadsheetKey()
81    {
82        return $this->_spreadsheetKey;
83    }
84
85    /**
86     * Sets the worksheet id for the query.
87     * @param string $value
88     * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
89     */
90    public function setWorksheetId($value)
91    {
92        $this->_worksheetId = $value;
93        return $this;
94    }
95
96    /**
97     * Gets the worksheet id for the query.
98     * @return string worksheet id
99     */
100    public function getWorksheetId()
101    {
102        return $this->_worksheetId;
103    }
104
105    /**
106     * Sets the row id for the query.
107     * @param string $value row id
108     * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
109     */
110    public function setRowId($value)
111    {
112        $this->_rowId = $value;
113        return $this;
114    }
115
116    /**
117     * Gets the row id for the query.
118     * @return string row id
119     */
120    public function getRowId()
121    {
122        return $this->_rowId;
123    }
124
125    /**
126     * Sets the projection for the query.
127     * @param string $value Projection
128     * @return Zend_Gdata_Spreadsheets_ListQuery Provides a fluent interface
129     */
130    public function setProjection($value)
131    {
132        $this->_projection = $value;
133        return $this;
134    }
135
136    /**
137     * Sets the visibility for this query.
138     * @param string $value visibility
139     * @return Zend_Gdata_Spreadsheets_ListQuery Provides a fluent interface
140     */
141    public function setVisibility($value)
142    {
143        $this->_visibility = $value;
144        return $this;
145    }
146
147    /**
148     * Gets the projection for this query.
149     * @return string projection
150     */
151    public function getProjection()
152    {
153        return $this->_projection;
154    }
155
156    /**
157     * Gets the visibility for this query.
158     * @return string visibility
159     */
160    public function getVisibility()
161    {
162        return $this->_visibility;
163    }
164
165    /**
166     * Sets the spreadsheet key for this query.
167     * @param string $value
168     * @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface
169     */
170    public function setSpreadsheetQuery($value)
171    {
172        if ($value != null) {
173            $this->_params['sq'] = $value;
174        } else {
175            unset($this->_params['sq']);
176        }
177        return $this;
178    }
179
180    /**
181     * Gets the spreadsheet key for this query.
182     * @return string spreadsheet query
183     */
184    public function getSpreadsheetQuery()
185    {
186        if (array_key_exists('sq', $this->_params)) {
187            return $this->_params['sq'];
188        } else {
189            return null;
190        }
191    }
192
193    /**
194     * Sets the orderby attribute for this query.
195     * @param string $value
196     * @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface
197     */
198    public function setOrderBy($value)
199    {
200        if ($value != null) {
201            $this->_params['orderby'] = $value;
202        } else {
203            unset($this->_params['orderby']);
204        }
205        return $this;
206    }
207
208    /**
209     * Gets the orderby attribute for this query.
210     * @return string orderby
211     */
212    public function getOrderBy()
213    {
214        if (array_key_exists('orderby', $this->_params)) {
215            return $this->_params['orderby'];
216        } else {
217            return null;
218        }
219    }
220
221    /**
222     * Sets the reverse attribute for this query.
223     * @param string $value
224     * @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface
225     */
226    public function setReverse($value)
227    {
228        if ($value != null) {
229            $this->_params['reverse'] = $value;
230        } else {
231            unset($this->_params['reverse']);
232        }
233        return $this;
234    }
235
236    /**
237     * Gets the reverse attribute for this query.
238     * @return string reverse
239     */
240    public function getReverse()
241    {
242
243
244        if (array_key_exists('reverse', $this->_params)) {
245            return $this->_params['reverse'];
246        } else {
247            return null;
248        }
249    }
250
251    /**
252     * Gets the full query URL for this query.
253     * @return string url
254     */
255    public function getQueryUrl()
256    {
257
258        $uri = $this->_defaultFeedUri;
259
260        if ($this->_spreadsheetKey != null) {
261            $uri .= '/'.$this->_spreadsheetKey;
262        } else {
263            require_once 'Zend/Gdata/App/Exception.php';
264            throw new Zend_Gdata_App_Exception('A spreadsheet key must be provided for list queries.');
265        }
266
267        if ($this->_worksheetId != null) {
268            $uri .= '/'.$this->_worksheetId;
269        } else {
270            require_once 'Zend/Gdata/App/Exception.php';
271            throw new Zend_Gdata_App_Exception('A worksheet id must be provided for list queries.');
272        }
273
274        if ($this->_visibility != null) {
275            $uri .= '/'.$this->_visibility;
276        } else {
277            require_once 'Zend/Gdata/App/Exception.php';
278            throw new Zend_Gdata_App_Exception('A visibility must be provided for list queries.');
279        }
280
281        if ($this->_projection != null) {
282            $uri .= '/'.$this->_projection;
283        } else {
284            require_once 'Zend/Gdata/App/Exception.php';
285            throw new Zend_Gdata_App_Exception('A projection must be provided for list queries.');
286        }
287
288        if ($this->_rowId != null) {
289            $uri .= '/'.$this->_rowId;
290        }
291
292        $uri .= $this->getQueryString();
293        return $uri;
294    }
295
296    /**
297     * Gets the attribute query string for this query.
298     * @return string query string
299     */
300    public function getQueryString()
301    {
302        return parent::getQueryString();
303    }
304
305}
Note: See TracBrowser for help on using the repository browser.