|
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_Calendar_EventQuery extends Zend_Gdata_Query 00046 { 00047 00048 const CALENDAR_FEED_URI = 'http://www.google.com/calendar/feeds'; 00049 00053 protected $_defaultFeedUri = self::CALENDAR_FEED_URI; 00054 00060 protected $_comments = null; 00061 00069 protected $_user = 'default'; 00070 00071 /* 00072 * The visibility to be requested by queries. Defaults to "public". A 00073 * null value should be used when the calendar address has already been 00074 * set as part of the query URI. 00075 */ 00076 protected $_visibility = 'public'; 00077 00083 protected $_projection = 'full'; 00084 00089 protected $_event = null; 00090 00105 public function __construct($url = null) 00106 { 00107 parent::__construct($url); 00108 } 00109 00115 public function setComments($value) 00116 { 00117 $this->_comments = $value; 00118 return $this; 00119 } 00120 00126 public function setEvent($value) 00127 { 00128 $this->_event = $value; 00129 return $this; 00130 } 00131 00137 public function setProjection($value) 00138 { 00139 $this->_projection = $value; 00140 return $this; 00141 } 00142 00148 public function setUser($value) 00149 { 00150 $this->_user = $value; 00151 return $this; 00152 } 00153 00159 public function setVisibility($value) 00160 { 00161 $this->_visibility = $value; 00162 return $this; 00163 } 00164 00169 public function getComments() 00170 { 00171 return $this->_comments; 00172 } 00173 00178 public function getEvent() 00179 { 00180 return $this->_event; 00181 } 00182 00187 public function getProjection() 00188 { 00189 return $this->_projection; 00190 } 00191 00196 public function getUser() 00197 { 00198 return $this->_user; 00199 } 00200 00205 public function getVisibility() 00206 { 00207 return $this->_visibility; 00208 } 00209 00214 public function setStartMax($value) 00215 { 00216 if ($value != null) { 00217 $this->_params['start-max'] = Zend_Gdata_App_Util::formatTimestamp($value); 00218 } else { 00219 unset($this->_params['start-max']); 00220 } 00221 return $this; 00222 } 00223 00228 public function setStartMin($value) 00229 { 00230 if ($value != null) { 00231 $this->_params['start-min'] = Zend_Gdata_App_Util::formatTimestamp($value); 00232 } else { 00233 unset($this->_params['start-min']); 00234 } 00235 return $this; 00236 } 00237 00242 public function setOrderBy($value) 00243 { 00244 if ($value != null) { 00245 $this->_params['orderby'] = $value; 00246 } else { 00247 unset($this->_params['orderby']); 00248 } 00249 return $this; 00250 } 00251 00255 public function getStartMax() 00256 { 00257 if (array_key_exists('start-max', $this->_params)) { 00258 return $this->_params['start-max']; 00259 } else { 00260 return null; 00261 } 00262 } 00263 00267 public function getStartMin() 00268 { 00269 if (array_key_exists('start-min', $this->_params)) { 00270 return $this->_params['start-min']; 00271 } else { 00272 return null; 00273 } 00274 } 00275 00279 public function getOrderBy() 00280 { 00281 if (array_key_exists('orderby', $this->_params)) { 00282 return $this->_params['orderby']; 00283 } else { 00284 return null; 00285 } 00286 } 00287 00291 public function getSortOrder() 00292 { 00293 if (array_key_exists('sortorder', $this->_params)) { 00294 return $this->_params['sortorder']; 00295 } else { 00296 return null; 00297 } 00298 } 00299 00303 public function setSortOrder($value) 00304 { 00305 if ($value != null) { 00306 $this->_params['sortorder'] = $value; 00307 } else { 00308 unset($this->_params['sortorder']); 00309 } 00310 return $this; 00311 } 00312 00316 public function getRecurrenceExpansionStart() 00317 { 00318 if (array_key_exists('recurrence-expansion-start', $this->_params)) { 00319 return $this->_params['recurrence-expansion-start']; 00320 } else { 00321 return null; 00322 } 00323 } 00324 00328 public function setRecurrenceExpansionStart($value) 00329 { 00330 if ($value != null) { 00331 $this->_params['recurrence-expansion-start'] = Zend_Gdata_App_Util::formatTimestamp($value); 00332 } else { 00333 unset($this->_params['recurrence-expansion-start']); 00334 } 00335 return $this; 00336 } 00337 00338 00342 public function getRecurrenceExpansionEnd() 00343 { 00344 if (array_key_exists('recurrence-expansion-end', $this->_params)) { 00345 return $this->_params['recurrence-expansion-end']; 00346 } else { 00347 return null; 00348 } 00349 } 00350 00354 public function setRecurrenceExpansionEnd($value) 00355 { 00356 if ($value != null) { 00357 $this->_params['recurrence-expansion-end'] = Zend_Gdata_App_Util::formatTimestamp($value); 00358 } else { 00359 unset($this->_params['recurrence-expansion-end']); 00360 } 00361 return $this; 00362 } 00363 00368 public function getSingleEvents() 00369 { 00370 if (array_key_exists('singleevents', $this->_params)) { 00371 $value = $this->_params['singleevents']; 00372 switch ($value) { 00373 case 'true': 00374 return true; 00375 break; 00376 case 'false': 00377 return false; 00378 break; 00379 default: 00380 require_once 'Zend/Gdata/App/Exception.php'; 00381 throw new Zend_Gdata_App_Exception( 00382 'Invalid query param value for futureevents: ' . 00383 $value . ' It must be a boolean.'); 00384 } 00385 } else { 00386 return null; 00387 } 00388 } 00389 00394 public function setSingleEvents($value) 00395 { 00396 if ($value !== null) { 00397 if (is_bool($value)) { 00398 $this->_params['singleevents'] = ($value?'true':'false'); 00399 } elseif ($value == 'true' | $value == 'false') { 00400 $this->_params['singleevents'] = $value; 00401 } else { 00402 require_once 'Zend/Gdata/App/Exception.php'; 00403 throw new Zend_Gdata_App_Exception( 00404 'Invalid query param value for futureevents: ' . 00405 $value . ' It must be a boolean.'); 00406 } 00407 } else { 00408 unset($this->_params['singleevents']); 00409 } 00410 return $this; 00411 } 00412 00416 public function getFutureEvents() 00417 { 00418 if (array_key_exists('futureevents', $this->_params)) { 00419 $value = $this->_params['futureevents']; 00420 switch ($value) { 00421 case 'true': 00422 return true; 00423 break; 00424 case 'false': 00425 return false; 00426 break; 00427 default: 00428 require_once 'Zend/Gdata/App/Exception.php'; 00429 throw new Zend_Gdata_App_Exception( 00430 'Invalid query param value for futureevents: ' . 00431 $value . ' It must be a boolean.'); 00432 } 00433 } else { 00434 return null; 00435 } 00436 } 00437 00443 public function setFutureEvents($value) 00444 { 00445 if ($value !== null) { 00446 if (is_bool($value)) { 00447 $this->_params['futureevents'] = ($value?'true':'false'); 00448 } elseif ($value == 'true' | $value == 'false') { 00449 $this->_params['futureevents'] = $value; 00450 } else { 00451 require_once 'Zend/Gdata/App/Exception.php'; 00452 throw new Zend_Gdata_App_Exception( 00453 'Invalid query param value for futureevents: ' . 00454 $value . ' It must be a boolean.'); 00455 } 00456 } else { 00457 unset($this->_params['futureevents']); 00458 } 00459 return $this; 00460 } 00461 00465 public function getQueryUrl() 00466 { 00467 if (isset($this->_url)) { 00468 $uri = $this->_url; 00469 } else { 00470 $uri = $this->_defaultFeedUri; 00471 } 00472 if ($this->getUser() != null) { 00473 $uri .= '/' . $this->getUser(); 00474 } 00475 if ($this->getVisibility() != null) { 00476 $uri .= '/' . $this->getVisibility(); 00477 } 00478 if ($this->getProjection() != null) { 00479 $uri .= '/' . $this->getProjection(); 00480 } 00481 if ($this->getEvent() != null) { 00482 $uri .= '/' . $this->getEvent(); 00483 if ($this->getComments() != null) { 00484 $uri .= '/comments/' . $this->getComments(); 00485 } 00486 } 00487 $uri .= $this->getQueryString(); 00488 return $uri; 00489 } 00490 00491 }