|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00027 require_once 'Zend/Gdata/App/Extension/Element.php'; 00028 00032 require_once 'Zend/Gdata/App/Extension/Author.php'; 00033 00037 require_once 'Zend/Gdata/App/Extension/Category.php'; 00038 00042 require_once 'Zend/Gdata/App/Extension/Contributor.php'; 00043 00047 require_once 'Zend/Gdata/App/Extension/Id.php'; 00048 00052 require_once 'Zend/Gdata/App/Extension/Link.php'; 00053 00057 require_once 'Zend/Gdata/App/Extension/Rights.php'; 00058 00062 require_once 'Zend/Gdata/App/Extension/Title.php'; 00063 00067 require_once 'Zend/Gdata/App/Extension/Updated.php'; 00068 00072 require_once 'Zend/Version.php'; 00073 00083 abstract class Zend_Gdata_App_FeedEntryParent extends Zend_Gdata_App_Base 00084 { 00090 protected $_service = null; 00091 00098 protected $_etag = NULL; 00099 00100 protected $_author = array(); 00101 protected $_category = array(); 00102 protected $_contributor = array(); 00103 protected $_id = null; 00104 protected $_link = array(); 00105 protected $_rights = null; 00106 protected $_title = null; 00107 protected $_updated = null; 00108 00117 protected $_majorProtocolVersion = 1; 00118 00127 protected $_minorProtocolVersion = null; 00128 00132 public function __construct($element = null) 00133 { 00134 if (!($element instanceof DOMElement)) { 00135 if ($element) { 00136 $this->transferFromXML($element); 00137 } 00138 } else { 00139 $this->transferFromDOM($element); 00140 } 00141 } 00142 00153 public function setHttpClient(Zend_Http_Client $httpClient) 00154 { 00155 if (!$this->_service) { 00156 $this->_service = new Zend_Gdata_App(); 00157 } 00158 $this->_service->setHttpClient($httpClient); 00159 return $this; 00160 } 00161 00170 public function getHttpClient() 00171 { 00172 if (!$this->_service) { 00173 $this->_service = new Zend_Gdata_App(); 00174 } 00175 $client = $this->_service->getHttpClient(); 00176 return $client; 00177 } 00178 00186 public function setService($instance) 00187 { 00188 $this->_service = $instance; 00189 return $this; 00190 } 00191 00199 public function getService() 00200 { 00201 return $this->_service; 00202 } 00203 00204 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 00205 { 00206 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 00207 foreach ($this->_author as $author) { 00208 $element->appendChild($author->getDOM($element->ownerDocument)); 00209 } 00210 foreach ($this->_category as $category) { 00211 $element->appendChild($category->getDOM($element->ownerDocument)); 00212 } 00213 foreach ($this->_contributor as $contributor) { 00214 $element->appendChild($contributor->getDOM($element->ownerDocument)); 00215 } 00216 if ($this->_id != null) { 00217 $element->appendChild($this->_id->getDOM($element->ownerDocument)); 00218 } 00219 foreach ($this->_link as $link) { 00220 $element->appendChild($link->getDOM($element->ownerDocument)); 00221 } 00222 if ($this->_rights != null) { 00223 $element->appendChild($this->_rights->getDOM($element->ownerDocument)); 00224 } 00225 if ($this->_title != null) { 00226 $element->appendChild($this->_title->getDOM($element->ownerDocument)); 00227 } 00228 if ($this->_updated != null) { 00229 $element->appendChild($this->_updated->getDOM($element->ownerDocument)); 00230 } 00231 return $element; 00232 } 00233 00234 protected function takeChildFromDOM($child) 00235 { 00236 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; 00237 switch ($absoluteNodeName) { 00238 case $this->lookupNamespace('atom') . ':' . 'author': 00239 $author = new Zend_Gdata_App_Extension_Author(); 00240 $author->transferFromDOM($child); 00241 $this->_author[] = $author; 00242 break; 00243 case $this->lookupNamespace('atom') . ':' . 'category': 00244 $category = new Zend_Gdata_App_Extension_Category(); 00245 $category->transferFromDOM($child); 00246 $this->_category[] = $category; 00247 break; 00248 case $this->lookupNamespace('atom') . ':' . 'contributor': 00249 $contributor = new Zend_Gdata_App_Extension_Contributor(); 00250 $contributor->transferFromDOM($child); 00251 $this->_contributor[] = $contributor; 00252 break; 00253 case $this->lookupNamespace('atom') . ':' . 'id': 00254 $id = new Zend_Gdata_App_Extension_Id(); 00255 $id->transferFromDOM($child); 00256 $this->_id = $id; 00257 break; 00258 case $this->lookupNamespace('atom') . ':' . 'link': 00259 $link = new Zend_Gdata_App_Extension_Link(); 00260 $link->transferFromDOM($child); 00261 $this->_link[] = $link; 00262 break; 00263 case $this->lookupNamespace('atom') . ':' . 'rights': 00264 $rights = new Zend_Gdata_App_Extension_Rights(); 00265 $rights->transferFromDOM($child); 00266 $this->_rights = $rights; 00267 break; 00268 case $this->lookupNamespace('atom') . ':' . 'title': 00269 $title = new Zend_Gdata_App_Extension_Title(); 00270 $title->transferFromDOM($child); 00271 $this->_title = $title; 00272 break; 00273 case $this->lookupNamespace('atom') . ':' . 'updated': 00274 $updated = new Zend_Gdata_App_Extension_Updated(); 00275 $updated->transferFromDOM($child); 00276 $this->_updated = $updated; 00277 break; 00278 default: 00279 parent::takeChildFromDOM($child); 00280 break; 00281 } 00282 } 00283 00287 public function getAuthor() 00288 { 00289 return $this->_author; 00290 } 00291 00299 public function setAuthor($value) 00300 { 00301 $this->_author = $value; 00302 return $this; 00303 } 00304 00311 public function getCategory() 00312 { 00313 return $this->_category; 00314 } 00315 00323 public function setCategory($value) 00324 { 00325 $this->_category = $value; 00326 return $this; 00327 } 00328 00335 public function getContributor() 00336 { 00337 return $this->_contributor; 00338 } 00339 00347 public function setContributor($value) 00348 { 00349 $this->_contributor = $value; 00350 return $this; 00351 } 00352 00356 public function getId() 00357 { 00358 return $this->_id; 00359 } 00360 00365 public function setId($value) 00366 { 00367 $this->_id = $value; 00368 return $this; 00369 } 00370 00386 public function getLink($rel = null) 00387 { 00388 if ($rel == null) { 00389 return $this->_link; 00390 } else { 00391 foreach ($this->_link as $link) { 00392 if ($link->rel == $rel) { 00393 return $link; 00394 } 00395 } 00396 return null; 00397 } 00398 } 00399 00407 public function getEditLink() 00408 { 00409 return $this->getLink('edit'); 00410 } 00411 00420 public function getNextLink() 00421 { 00422 return $this->getLink('next'); 00423 } 00424 00433 public function getPreviousLink() 00434 { 00435 return $this->getLink('previous'); 00436 } 00437 00441 public function getLicenseLink() 00442 { 00443 return $this->getLink('license'); 00444 } 00445 00454 public function getSelfLink() 00455 { 00456 return $this->getLink('self'); 00457 } 00458 00470 public function getAlternateLink() 00471 { 00472 return $this->getLink('alternate'); 00473 } 00474 00479 public function setLink($value) 00480 { 00481 $this->_link = $value; 00482 return $this; 00483 } 00484 00488 public function getRights() 00489 { 00490 return $this->_rights; 00491 } 00492 00497 public function setRights($value) 00498 { 00499 $this->_rights = $value; 00500 return $this; 00501 } 00502 00510 public function getTitle() 00511 { 00512 return $this->_title; 00513 } 00514 00522 public function getTitleValue() 00523 { 00524 if (($titleObj = $this->getTitle()) != null) { 00525 return $titleObj->getText(); 00526 } else { 00527 return null; 00528 } 00529 } 00530 00539 public function setTitle($value) 00540 { 00541 $this->_title = $value; 00542 return $this; 00543 } 00544 00548 public function getUpdated() 00549 { 00550 return $this->_updated; 00551 } 00552 00557 public function setUpdated($value) 00558 { 00559 $this->_updated = $value; 00560 return $this; 00561 } 00562 00570 public function setEtag($value) { 00571 $this->_etag = $value; 00572 return $this; 00573 } 00574 00580 public function getEtag() { 00581 return $this->_etag; 00582 } 00583 00593 public function setMajorProtocolVersion($value) 00594 { 00595 if (!($value >= 1) && ($value !== null)) { 00596 require_once('Zend/Gdata/App/InvalidArgumentException.php'); 00597 throw new Zend_Gdata_App_InvalidArgumentException( 00598 'Major protocol version must be >= 1'); 00599 } 00600 $this->_majorProtocolVersion = $value; 00601 } 00602 00609 public function getMajorProtocolVersion() 00610 { 00611 return $this->_majorProtocolVersion; 00612 } 00613 00623 public function setMinorProtocolVersion($value) 00624 { 00625 if (!($value >= 0)) { 00626 require_once('Zend/Gdata/App/InvalidArgumentException.php'); 00627 throw new Zend_Gdata_App_InvalidArgumentException( 00628 'Minor protocol version must be >= 0 or null'); 00629 } 00630 $this->_minorProtocolVersion = $value; 00631 } 00632 00640 public function getMinorProtocolVersion() 00641 { 00642 return $this->_minorProtocolVersion; 00643 } 00644 00665 public function lookupNamespace($prefix, 00666 $majorVersion = null, 00667 $minorVersion = null) 00668 { 00669 // Auto-select current version 00670 if ($majorVersion === null) { 00671 $majorVersion = $this->getMajorProtocolVersion(); 00672 } 00673 if ($minorVersion === null) { 00674 $minorVersion = $this->getMinorProtocolVersion(); 00675 } 00676 00677 // Perform lookup 00678 return parent::lookupNamespace($prefix, $majorVersion, $minorVersion); 00679 } 00680 00681 }