|
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_ListQuery extends Zend_Gdata_Query 00046 { 00047 00048 const SPREADSHEETS_LIST_FEED_URI = 'http://spreadsheets.google.com/feeds/list'; 00049 00050 protected $_defaultFeedUri = self::SPREADSHEETS_LIST_FEED_URI; 00051 protected $_visibility = 'private'; 00052 protected $_projection = 'full'; 00053 protected $_spreadsheetKey = null; 00054 protected $_worksheetId = 'default'; 00055 protected $_rowId = null; 00056 00060 public function __construct() 00061 { 00062 parent::__construct(); 00063 } 00064 00070 public function setSpreadsheetKey($value) 00071 { 00072 $this->_spreadsheetKey = $value; 00073 return $this; 00074 } 00075 00080 public function getSpreadsheetKey() 00081 { 00082 return $this->_spreadsheetKey; 00083 } 00084 00090 public function setWorksheetId($value) 00091 { 00092 $this->_worksheetId = $value; 00093 return $this; 00094 } 00095 00100 public function getWorksheetId() 00101 { 00102 return $this->_worksheetId; 00103 } 00104 00110 public function setRowId($value) 00111 { 00112 $this->_rowId = $value; 00113 return $this; 00114 } 00115 00120 public function getRowId() 00121 { 00122 return $this->_rowId; 00123 } 00124 00130 public function setProjection($value) 00131 { 00132 $this->_projection = $value; 00133 return $this; 00134 } 00135 00141 public function setVisibility($value) 00142 { 00143 $this->_visibility = $value; 00144 return $this; 00145 } 00146 00151 public function getProjection() 00152 { 00153 return $this->_projection; 00154 } 00155 00160 public function getVisibility() 00161 { 00162 return $this->_visibility; 00163 } 00164 00170 public function setSpreadsheetQuery($value) 00171 { 00172 if ($value != null) { 00173 $this->_params['sq'] = $value; 00174 } else { 00175 unset($this->_params['sq']); 00176 } 00177 return $this; 00178 } 00179 00184 public function getSpreadsheetQuery() 00185 { 00186 if (array_key_exists('sq', $this->_params)) { 00187 return $this->_params['sq']; 00188 } else { 00189 return null; 00190 } 00191 } 00192 00198 public function setOrderBy($value) 00199 { 00200 if ($value != null) { 00201 $this->_params['orderby'] = $value; 00202 } else { 00203 unset($this->_params['orderby']); 00204 } 00205 return $this; 00206 } 00207 00212 public function getOrderBy() 00213 { 00214 if (array_key_exists('orderby', $this->_params)) { 00215 return $this->_params['orderby']; 00216 } else { 00217 return null; 00218 } 00219 } 00220 00226 public function setReverse($value) 00227 { 00228 if ($value != null) { 00229 $this->_params['reverse'] = $value; 00230 } else { 00231 unset($this->_params['reverse']); 00232 } 00233 return $this; 00234 } 00235 00240 public function getReverse() 00241 { 00242 00243 00244 if (array_key_exists('reverse', $this->_params)) { 00245 return $this->_params['reverse']; 00246 } else { 00247 return null; 00248 } 00249 } 00250 00255 public function getQueryUrl() 00256 { 00257 00258 $uri = $this->_defaultFeedUri; 00259 00260 if ($this->_spreadsheetKey != null) { 00261 $uri .= '/'.$this->_spreadsheetKey; 00262 } else { 00263 require_once 'Zend/Gdata/App/Exception.php'; 00264 throw new Zend_Gdata_App_Exception('A spreadsheet key must be provided for list queries.'); 00265 } 00266 00267 if ($this->_worksheetId != null) { 00268 $uri .= '/'.$this->_worksheetId; 00269 } else { 00270 require_once 'Zend/Gdata/App/Exception.php'; 00271 throw new Zend_Gdata_App_Exception('A worksheet id must be provided for list queries.'); 00272 } 00273 00274 if ($this->_visibility != null) { 00275 $uri .= '/'.$this->_visibility; 00276 } else { 00277 require_once 'Zend/Gdata/App/Exception.php'; 00278 throw new Zend_Gdata_App_Exception('A visibility must be provided for list queries.'); 00279 } 00280 00281 if ($this->_projection != null) { 00282 $uri .= '/'.$this->_projection; 00283 } else { 00284 require_once 'Zend/Gdata/App/Exception.php'; 00285 throw new Zend_Gdata_App_Exception('A projection must be provided for list queries.'); 00286 } 00287 00288 if ($this->_rowId != null) { 00289 $uri .= '/'.$this->_rowId; 00290 } 00291 00292 $uri .= $this->getQueryString(); 00293 return $uri; 00294 } 00295 00300 public function getQueryString() 00301 { 00302 return parent::getQueryString(); 00303 } 00304 00305 }