File indexing completed on 2024-12-22 05:36:46

0001 <?php
0002 
0003 /**
0004  * Zend Framework
0005  *
0006  * LICENSE
0007  *
0008  * This source file is subject to the new BSD license that is bundled
0009  * with this package in the file LICENSE.txt.
0010  * It is also available through the world-wide-web at this URL:
0011  * http://framework.zend.com/license/new-bsd
0012  * If you did not receive a copy of the license and are unable to
0013  * obtain it through the world-wide-web, please send an email
0014  * to license@zend.com so we can send you a copy immediately.
0015  *
0016  * @category   Zend
0017  * @package    Zend_Gdata
0018  * @subpackage Spreadsheets
0019  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0020  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0021  * @version    $Id$
0022  */
0023 
0024 /**
0025  * Zend_Gdata_App_util
0026  */
0027 // require_once('Zend/Gdata/App/Util.php');
0028 
0029 /**
0030  * Zend_Gdata_Query
0031  */
0032 // require_once('Zend/Gdata/Query.php');
0033 
0034 /**
0035  * Assists in constructing queries for Google Spreadsheets lists
0036  *
0037  * @link http://code.google.com/apis/gdata/calendar/
0038  *
0039  * @category   Zend
0040  * @package    Zend_Gdata
0041  * @subpackage Spreadsheets
0042  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0043  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0044  */
0045 class Zend_Gdata_Spreadsheets_ListQuery extends Zend_Gdata_Query
0046 {
0047 
0048     const SPREADSHEETS_LIST_FEED_URI = 'https://spreadsheets.google.com/feeds/list';
0049 
0050     protected $_defaultFeedUri = self::SPREADSHEETS_LIST_FEED_URI;
0051     protected $_visibility = 'private';
0052     protected $_projection = 'full';
0053     protected $_spreadsheetKey = null;
0054     protected $_worksheetId = 'default';
0055     protected $_rowId = null;
0056 
0057     /**
0058      * Constructs a new Zend_Gdata_Spreadsheets_ListQuery object.
0059      */
0060     public function __construct()
0061     {
0062         parent::__construct();
0063     }
0064 
0065     /**
0066      * Sets the spreadsheet key for the query.
0067      * @param string $value
0068      * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
0069      */
0070     public function setSpreadsheetKey($value)
0071     {
0072         $this->_spreadsheetKey = $value;
0073         return $this;
0074     }
0075 
0076     /**
0077      * Gets the spreadsheet key for the query.
0078      * @return string spreadsheet key
0079      */
0080     public function getSpreadsheetKey()
0081     {
0082         return $this->_spreadsheetKey;
0083     }
0084 
0085     /**
0086      * Sets the worksheet id for the query.
0087      * @param string $value
0088      * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
0089      */
0090     public function setWorksheetId($value)
0091     {
0092         $this->_worksheetId = $value;
0093         return $this;
0094     }
0095 
0096     /**
0097      * Gets the worksheet id for the query.
0098      * @return string worksheet id
0099      */
0100     public function getWorksheetId()
0101     {
0102         return $this->_worksheetId;
0103     }
0104 
0105     /**
0106      * Sets the row id for the query.
0107      * @param string $value row id
0108      * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
0109      */
0110     public function setRowId($value)
0111     {
0112         $this->_rowId = $value;
0113         return $this;
0114     }
0115 
0116     /**
0117      * Gets the row id for the query.
0118      * @return string row id
0119      */
0120     public function getRowId()
0121     {
0122         return $this->_rowId;
0123     }
0124 
0125     /**
0126      * Sets the projection for the query.
0127      * @param string $value Projection
0128      * @return Zend_Gdata_Spreadsheets_ListQuery Provides a fluent interface
0129      */
0130     public function setProjection($value)
0131     {
0132         $this->_projection = $value;
0133         return $this;
0134     }
0135 
0136     /**
0137      * Sets the visibility for this query.
0138      * @param string $value visibility
0139      * @return Zend_Gdata_Spreadsheets_ListQuery Provides a fluent interface
0140      */
0141     public function setVisibility($value)
0142     {
0143         $this->_visibility = $value;
0144         return $this;
0145     }
0146 
0147     /**
0148      * Gets the projection for this query.
0149      * @return string projection
0150      */
0151     public function getProjection()
0152     {
0153         return $this->_projection;
0154     }
0155 
0156     /**
0157      * Gets the visibility for this query.
0158      * @return string visibility
0159      */
0160     public function getVisibility()
0161     {
0162         return $this->_visibility;
0163     }
0164 
0165     /**
0166      * Sets the spreadsheet key for this query.
0167      * @param string $value
0168      * @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface
0169      */
0170     public function setSpreadsheetQuery($value)
0171     {
0172         if ($value != null) {
0173             $this->_params['sq'] = $value;
0174         } else {
0175             unset($this->_params['sq']);
0176         }
0177         return $this;
0178     }
0179 
0180     /**
0181      * Gets the spreadsheet key for this query.
0182      * @return string spreadsheet query
0183      */
0184     public function getSpreadsheetQuery()
0185     {
0186         if (array_key_exists('sq', $this->_params)) {
0187             return $this->_params['sq'];
0188         } else {
0189             return null;
0190         }
0191     }
0192 
0193     /**
0194      * Sets the orderby attribute for this query.
0195      * @param string $value
0196      * @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface
0197      */
0198     public function setOrderBy($value)
0199     {
0200         if ($value != null) {
0201             $this->_params['orderby'] = $value;
0202         } else {
0203             unset($this->_params['orderby']);
0204         }
0205         return $this;
0206     }
0207 
0208     /**
0209      * Gets the orderby attribute for this query.
0210      * @return string orderby
0211      */
0212     public function getOrderBy()
0213     {
0214         if (array_key_exists('orderby', $this->_params)) {
0215             return $this->_params['orderby'];
0216         } else {
0217             return null;
0218         }
0219     }
0220 
0221     /**
0222      * Sets the reverse attribute for this query.
0223      * @param string $value
0224      * @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface
0225      */
0226     public function setReverse($value)
0227     {
0228         if ($value != null) {
0229             $this->_params['reverse'] = $value;
0230         } else {
0231             unset($this->_params['reverse']);
0232         }
0233         return $this;
0234     }
0235 
0236     /**
0237      * Gets the reverse attribute for this query.
0238      * @return string reverse
0239      */
0240     public function getReverse()
0241     {
0242 
0243 
0244         if (array_key_exists('reverse', $this->_params)) {
0245             return $this->_params['reverse'];
0246         } else {
0247             return null;
0248         }
0249     }
0250 
0251     /**
0252      * Gets the full query URL for this query.
0253      * @return string url
0254      */
0255     public function getQueryUrl()
0256     {
0257 
0258         $uri = $this->_defaultFeedUri;
0259 
0260         if ($this->_spreadsheetKey != null) {
0261             $uri .= '/'.$this->_spreadsheetKey;
0262         } else {
0263             // require_once 'Zend/Gdata/App/Exception.php';
0264             throw new Zend_Gdata_App_Exception('A spreadsheet key must be provided for list queries.');
0265         }
0266 
0267         if ($this->_worksheetId != null) {
0268             $uri .= '/'.$this->_worksheetId;
0269         } else {
0270             // require_once 'Zend/Gdata/App/Exception.php';
0271             throw new Zend_Gdata_App_Exception('A worksheet id must be provided for list queries.');
0272         }
0273 
0274         if ($this->_visibility != null) {
0275             $uri .= '/'.$this->_visibility;
0276         } else {
0277             // require_once 'Zend/Gdata/App/Exception.php';
0278             throw new Zend_Gdata_App_Exception('A visibility must be provided for list queries.');
0279         }
0280 
0281         if ($this->_projection != null) {
0282             $uri .= '/'.$this->_projection;
0283         } else {
0284             // require_once 'Zend/Gdata/App/Exception.php';
0285             throw new Zend_Gdata_App_Exception('A projection must be provided for list queries.');
0286         }
0287 
0288         if ($this->_rowId != null) {
0289             $uri .= '/'.$this->_rowId;
0290         }
0291 
0292         $uri .= $this->getQueryString();
0293         return $uri;
0294     }
0295 
0296     /**
0297      * Gets the attribute query string for this query.
0298      * @return string query string
0299      */
0300     public function getQueryString()
0301     {
0302         return parent::getQueryString();
0303     }
0304 
0305 }