|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00027 require_once('Zend/Gdata/App/Util.php'); 00028 00032 require_once('Zend/Gdata/Query.php'); 00033 00045 class Zend_Gdata_Spreadsheets_CellQuery extends Zend_Gdata_Query 00046 { 00047 00048 const SPREADSHEETS_CELL_FEED_URI = 'http://spreadsheets.google.com/feeds/cells'; 00049 00050 protected $_defaultFeedUri = self::SPREADSHEETS_CELL_FEED_URI; 00051 protected $_visibility = 'private'; 00052 protected $_projection = 'full'; 00053 protected $_spreadsheetKey = null; 00054 protected $_worksheetId = 'default'; 00055 protected $_cellId = null; 00056 00062 public function __construct($url = null) 00063 { 00064 parent::__construct($url); 00065 } 00066 00073 public function setSpreadsheetKey($value) 00074 { 00075 $this->_spreadsheetKey = $value; 00076 return $this; 00077 } 00078 00084 public function getSpreadsheetKey() 00085 { 00086 return $this->_spreadsheetKey; 00087 } 00088 00095 public function setWorksheetId($value) 00096 { 00097 $this->_worksheetId = $value; 00098 return $this; 00099 } 00100 00106 public function getWorksheetId() 00107 { 00108 return $this->_worksheetId; 00109 } 00110 00117 public function setCellId($value) 00118 { 00119 $this->_cellId = $value; 00120 return $this; 00121 } 00122 00128 public function getCellId() 00129 { 00130 return $this->_cellId; 00131 } 00132 00139 public function setProjection($value) 00140 { 00141 $this->_projection = $value; 00142 return $this; 00143 } 00144 00150 public function setVisibility($value) 00151 { 00152 $this->_visibility = $value; 00153 return $this; 00154 } 00155 00161 public function getProjection() 00162 { 00163 return $this->_projection; 00164 } 00165 00171 public function getVisibility() 00172 { 00173 return $this->_visibility; 00174 } 00175 00182 public function setMinRow($value) 00183 { 00184 if ($value != null) { 00185 $this->_params['min-row'] = $value; 00186 } else { 00187 unset($this->_params['min-row']); 00188 } 00189 return $this; 00190 } 00191 00197 public function getMinRow() 00198 { 00199 if (array_key_exists('min-row', $this->_params)) { 00200 return $this->_params['min-row']; 00201 } else { 00202 return null; 00203 } 00204 } 00205 00212 public function setMaxRow($value) 00213 { 00214 if ($value != null) { 00215 $this->_params['max-row'] = $value; 00216 } else { 00217 unset($this->_params['max-row']); 00218 } 00219 return $this; 00220 } 00221 00227 public function getMaxRow() 00228 { 00229 if (array_key_exists('max-row', $this->_params)) { 00230 return $this->_params['max-row']; 00231 } else { 00232 return null; 00233 } 00234 } 00235 00242 public function setMinCol($value) 00243 { 00244 if ($value != null) { 00245 $this->_params['min-col'] = $value; 00246 } else { 00247 unset($this->_params['min-col']); 00248 } 00249 return $this; 00250 } 00251 00257 public function getMinCol() 00258 { 00259 if (array_key_exists('min-col', $this->_params)) { 00260 return $this->_params['min-col']; 00261 } else { 00262 return null; 00263 } 00264 } 00265 00272 public function setMaxCol($value) 00273 { 00274 if ($value != null) { 00275 $this->_params['max-col'] = $value; 00276 } else { 00277 unset($this->_params['max-col']); 00278 } 00279 return $this; 00280 } 00281 00287 public function getMaxCol() 00288 { 00289 if (array_key_exists('max-col', $this->_params)) { 00290 return $this->_params['max-col']; 00291 } else { 00292 return null; 00293 } 00294 } 00295 00302 public function setRange($value) 00303 { 00304 if ($value != null) { 00305 $this->_params['range'] = $value; 00306 } else { 00307 unset($this->_params['range']); 00308 } 00309 return $this; 00310 } 00311 00317 public function getRange() 00318 { 00319 if (array_key_exists('range', $this->_params)) { 00320 return $this->_params['range']; 00321 } else { 00322 return null; 00323 } 00324 } 00325 00332 public function setReturnEmpty($value) 00333 { 00334 if (is_bool($value)) { 00335 $this->_params['return-empty'] = ($value?'true':'false'); 00336 } else if ($value != null) { 00337 $this->_params['return-empty'] = $value; 00338 } else { 00339 unset($this->_params['return-empty']); 00340 } 00341 return $this; 00342 } 00343 00349 public function getReturnEmpty() 00350 { 00351 if (array_key_exists('return-empty', $this->_params)) { 00352 return $this->_params['return-empty']; 00353 } else { 00354 return null; 00355 } 00356 } 00357 00363 public function getQueryUrl() 00364 { 00365 if ($this->_url == null) { 00366 $uri = $this->_defaultFeedUri; 00367 00368 if ($this->_spreadsheetKey != null) { 00369 $uri .= '/'.$this->_spreadsheetKey; 00370 } else { 00371 require_once 'Zend/Gdata/App/Exception.php'; 00372 throw new Zend_Gdata_App_Exception('A spreadsheet key must be provided for cell queries.'); 00373 } 00374 00375 if ($this->_worksheetId != null) { 00376 $uri .= '/'.$this->_worksheetId; 00377 } else { 00378 require_once 'Zend/Gdata/App/Exception.php'; 00379 throw new Zend_Gdata_App_Exception('A worksheet id must be provided for cell queries.'); 00380 } 00381 00382 if ($this->_visibility != null) { 00383 $uri .= '/'.$this->_visibility; 00384 } else { 00385 require_once 'Zend/Gdata/App/Exception.php'; 00386 throw new Zend_Gdata_App_Exception('A visibility must be provided for cell queries.'); 00387 } 00388 00389 if ($this->_projection != null) { 00390 $uri .= '/'.$this->_projection; 00391 } else { 00392 require_once 'Zend/Gdata/App/Exception.php'; 00393 throw new Zend_Gdata_App_Exception('A projection must be provided for cell queries.'); 00394 } 00395 00396 if ($this->_cellId != null) { 00397 $uri .= '/'.$this->_cellId; 00398 } 00399 } else { 00400 $uri = $this->_url; 00401 } 00402 00403 $uri .= $this->getQueryString(); 00404 return $uri; 00405 } 00406 00412 public function getQueryString() 00413 { 00414 return parent::getQueryString(); 00415 } 00416 00417 }