[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
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 [email protected] so we can send you a copy immediately. 15 * 16 * @category Zend 17 * @package Zend_Gdata 18 * @subpackage Spreadsheets 19 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) 20 * @license http://framework.zend.com/license/new-bsd New BSD License 21 * @version $Id$ 22 */ 23 24 /** 25 * Zend_Gdata_App_util 26 */ 27 require_once('Zend/Gdata/App/Util.php'); 28 29 /** 30 * Zend_Gdata_Query 31 */ 32 require_once('Zend/Gdata/Query.php'); 33 34 /** 35 * Assists in constructing queries for Google Spreadsheets documents 36 * 37 * @link http://code.google.com/apis/gdata/spreadsheets/ 38 * 39 * @category Zend 40 * @package Zend_Gdata 41 * @subpackage Spreadsheets 42 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) 43 * @license http://framework.zend.com/license/new-bsd New BSD License 44 */ 45 class Zend_Gdata_Spreadsheets_DocumentQuery extends Zend_Gdata_Query 46 { 47 48 const SPREADSHEETS_FEED_URI = 'http://spreadsheets.google.com/feeds'; 49 50 protected $_defaultFeedUri = self::SPREADSHEETS_FEED_URI; 51 protected $_documentType; 52 protected $_visibility = 'private'; 53 protected $_projection = 'full'; 54 protected $_spreadsheetKey = null; 55 protected $_worksheetId = null; 56 57 /** 58 * Constructs a new Zend_Gdata_Spreadsheets_DocumentQuery object. 59 */ 60 public function __construct() 61 { 62 parent::__construct(); 63 } 64 65 /** 66 * Sets the spreadsheet key for this 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 this 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 this 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 this query. 98 * @return string worksheet id 99 */ 100 public function getWorksheetId() 101 { 102 return $this->_worksheetId; 103 } 104 105 /** 106 * Sets the document type for this query. 107 * @param string $value spreadsheets or worksheets 108 * @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface 109 */ 110 public function setDocumentType($value) 111 { 112 $this->_documentType = $value; 113 return $this; 114 } 115 116 /** 117 * Gets the document type for this query. 118 * @return string document type 119 */ 120 public function getDocumentType() 121 { 122 return $this->_documentType; 123 } 124 125 /** 126 * Sets the projection for this query. 127 * @param string $value 128 * @return Zend_Gdata_Spreadsheets_DocumentQuery 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 * @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface 139 */ 140 public function setVisibility($value) 141 { 142 $this->_visibility = $value; 143 return $this; 144 } 145 146 /** 147 * Gets the projection for this query. 148 * @return string projection 149 */ 150 public function getProjection() 151 { 152 return $this->_projection; 153 } 154 155 /** 156 * Gets the visibility for this query. 157 * @return string visibility 158 */ 159 public function getVisibility() 160 { 161 return $this->_visibility; 162 } 163 164 /** 165 * Sets the title attribute for this query. 166 * @param string $value 167 * @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface 168 */ 169 public function setTitle($value) 170 { 171 if ($value != null) { 172 $this->_params['title'] = $value; 173 } else { 174 unset($this->_params['title']); 175 } 176 return $this; 177 } 178 179 /** 180 * Sets the title-exact attribute for this query. 181 * @param string $value 182 * @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface 183 */ 184 public function setTitleExact($value) 185 { 186 if ($value != null) { 187 $this->_params['title-exact'] = $value; 188 } else { 189 unset($this->_params['title-exact']); 190 } 191 return $this; 192 } 193 194 /** 195 * Gets the title attribute for this query. 196 * @return string title 197 */ 198 public function getTitle() 199 { 200 if (array_key_exists('title', $this->_params)) { 201 return $this->_params['title']; 202 } else { 203 return null; 204 } 205 } 206 207 /** 208 * Gets the title-exact attribute for this query. 209 * @return string title-exact 210 */ 211 public function getTitleExact() 212 { 213 if (array_key_exists('title-exact', $this->_params)) { 214 return $this->_params['title-exact']; 215 } else { 216 return null; 217 } 218 } 219 220 private function appendVisibilityProjection() 221 { 222 $uri = ''; 223 224 if ($this->_visibility != null) { 225 $uri .= '/'.$this->_visibility; 226 } else { 227 require_once 'Zend/Gdata/App/Exception.php'; 228 throw new Zend_Gdata_App_Exception('A visibility must be provided for document queries.'); 229 } 230 231 if ($this->_projection != null) { 232 $uri .= '/'.$this->_projection; 233 } else { 234 require_once 'Zend/Gdata/App/Exception.php'; 235 throw new Zend_Gdata_App_Exception('A projection must be provided for document queries.'); 236 } 237 238 return $uri; 239 } 240 241 242 /** 243 * Gets the full query URL for this query. 244 * @return string url 245 */ 246 public function getQueryUrl() 247 { 248 $uri = $this->_defaultFeedUri; 249 250 if ($this->_documentType != null) { 251 $uri .= '/'.$this->_documentType; 252 } else { 253 require_once 'Zend/Gdata/App/Exception.php'; 254 throw new Zend_Gdata_App_Exception('A document type must be provided for document queries.'); 255 } 256 257 if ($this->_documentType == 'spreadsheets') { 258 $uri .= $this->appendVisibilityProjection(); 259 if ($this->_spreadsheetKey != null) { 260 $uri .= '/'.$this->_spreadsheetKey; 261 } 262 } else if ($this->_documentType == 'worksheets') { 263 if ($this->_spreadsheetKey != null) { 264 $uri .= '/'.$this->_spreadsheetKey; 265 } else { 266 require_once 'Zend/Gdata/App/Exception.php'; 267 throw new Zend_Gdata_App_Exception('A spreadsheet key must be provided for worksheet document queries.'); 268 } 269 $uri .= $this->appendVisibilityProjection(); 270 if ($this->_worksheetId != null) { 271 $uri .= '/'.$this->_worksheetId; 272 } 273 } 274 275 $uri .= $this->getQueryString(); 276 return $uri; 277 } 278 279 /** 280 * Gets the attribute query string for this query. 281 * @return string query string 282 */ 283 public function getQueryString() 284 { 285 return parent::getQueryString(); 286 } 287 288 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |