|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00027 require_once 'Zend/Gdata/Entry.php'; 00028 00032 require_once 'Zend/Gdata/Extension/Comments.php'; 00033 00037 require_once 'Zend/Gdata/DublinCore/Extension/Creator.php'; 00038 00042 require_once 'Zend/Gdata/DublinCore/Extension/Date.php'; 00043 00047 require_once 'Zend/Gdata/DublinCore/Extension/Description.php'; 00048 00052 require_once 'Zend/Gdata/Books/Extension/Embeddability.php'; 00053 00057 require_once 'Zend/Gdata/DublinCore/Extension/Format.php'; 00058 00062 require_once 'Zend/Gdata/DublinCore/Extension/Identifier.php'; 00063 00067 require_once 'Zend/Gdata/DublinCore/Extension/Language.php'; 00068 00072 require_once 'Zend/Gdata/DublinCore/Extension/Publisher.php'; 00073 00077 require_once 'Zend/Gdata/Extension/Rating.php'; 00078 00082 require_once 'Zend/Gdata/Books/Extension/Review.php'; 00083 00087 require_once 'Zend/Gdata/DublinCore/Extension/Subject.php'; 00088 00092 require_once 'Zend/Gdata/DublinCore/Extension/Title.php'; 00093 00097 require_once 'Zend/Gdata/Books/Extension/Viewability.php'; 00098 00108 class Zend_Gdata_Books_VolumeEntry extends Zend_Gdata_Entry 00109 { 00110 00111 const THUMBNAIL_LINK_REL = 'http://schemas.google.com/books/2008/thumbnail'; 00112 const PREVIEW_LINK_REL = 'http://schemas.google.com/books/2008/preview'; 00113 const INFO_LINK_REL = 'http://schemas.google.com/books/2008/info'; 00114 const ANNOTATION_LINK_REL = 'http://schemas.google.com/books/2008/annotation'; 00115 00116 protected $_comments = null; 00117 protected $_creators = array(); 00118 protected $_dates = array(); 00119 protected $_descriptions = array(); 00120 protected $_embeddability = null; 00121 protected $_formats = array(); 00122 protected $_identifiers = array(); 00123 protected $_languages = array(); 00124 protected $_publishers = array(); 00125 protected $_rating = null; 00126 protected $_review = null; 00127 protected $_subjects = array(); 00128 protected $_titles = array(); 00129 protected $_viewability = null; 00130 00138 public function __construct($element = null) 00139 { 00140 $this->registerAllNamespaces(Zend_Gdata_Books::$namespaces); 00141 parent::__construct($element); 00142 } 00143 00154 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 00155 { 00156 $element = parent::getDOM($doc); 00157 if ($this->_creators !== null) { 00158 foreach ($this->_creators as $creators) { 00159 $element->appendChild($creators->getDOM( 00160 $element->ownerDocument)); 00161 } 00162 } 00163 if ($this->_dates !== null) { 00164 foreach ($this->_dates as $dates) { 00165 $element->appendChild($dates->getDOM($element->ownerDocument)); 00166 } 00167 } 00168 if ($this->_descriptions !== null) { 00169 foreach ($this->_descriptions as $descriptions) { 00170 $element->appendChild($descriptions->getDOM( 00171 $element->ownerDocument)); 00172 } 00173 } 00174 if ($this->_formats !== null) { 00175 foreach ($this->_formats as $formats) { 00176 $element->appendChild($formats->getDOM( 00177 $element->ownerDocument)); 00178 } 00179 } 00180 if ($this->_identifiers !== null) { 00181 foreach ($this->_identifiers as $identifiers) { 00182 $element->appendChild($identifiers->getDOM( 00183 $element->ownerDocument)); 00184 } 00185 } 00186 if ($this->_languages !== null) { 00187 foreach ($this->_languages as $languages) { 00188 $element->appendChild($languages->getDOM( 00189 $element->ownerDocument)); 00190 } 00191 } 00192 if ($this->_publishers !== null) { 00193 foreach ($this->_publishers as $publishers) { 00194 $element->appendChild($publishers->getDOM( 00195 $element->ownerDocument)); 00196 } 00197 } 00198 if ($this->_subjects !== null) { 00199 foreach ($this->_subjects as $subjects) { 00200 $element->appendChild($subjects->getDOM( 00201 $element->ownerDocument)); 00202 } 00203 } 00204 if ($this->_titles !== null) { 00205 foreach ($this->_titles as $titles) { 00206 $element->appendChild($titles->getDOM($element->ownerDocument)); 00207 } 00208 } 00209 if ($this->_comments !== null) { 00210 $element->appendChild($this->_comments->getDOM( 00211 $element->ownerDocument)); 00212 } 00213 if ($this->_embeddability !== null) { 00214 $element->appendChild($this->_embeddability->getDOM( 00215 $element->ownerDocument)); 00216 } 00217 if ($this->_rating !== null) { 00218 $element->appendChild($this->_rating->getDOM( 00219 $element->ownerDocument)); 00220 } 00221 if ($this->_review !== null) { 00222 $element->appendChild($this->_review->getDOM( 00223 $element->ownerDocument)); 00224 } 00225 if ($this->_viewability !== null) { 00226 $element->appendChild($this->_viewability->getDOM( 00227 $element->ownerDocument)); 00228 } 00229 return $element; 00230 } 00231 00238 protected function takeChildFromDOM($child) 00239 { 00240 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; 00241 switch ($absoluteNodeName) { 00242 case $this->lookupNamespace('dc') . ':' . 'creator': 00243 $creators = new Zend_Gdata_DublinCore_Extension_Creator(); 00244 $creators->transferFromDOM($child); 00245 $this->_creators[] = $creators; 00246 break; 00247 case $this->lookupNamespace('dc') . ':' . 'date': 00248 $dates = new Zend_Gdata_DublinCore_Extension_Date(); 00249 $dates->transferFromDOM($child); 00250 $this->_dates[] = $dates; 00251 break; 00252 case $this->lookupNamespace('dc') . ':' . 'description': 00253 $descriptions = new Zend_Gdata_DublinCore_Extension_Description(); 00254 $descriptions->transferFromDOM($child); 00255 $this->_descriptions[] = $descriptions; 00256 break; 00257 case $this->lookupNamespace('dc') . ':' . 'format': 00258 $formats = new Zend_Gdata_DublinCore_Extension_Format(); 00259 $formats->transferFromDOM($child); 00260 $this->_formats[] = $formats; 00261 break; 00262 case $this->lookupNamespace('dc') . ':' . 'identifier': 00263 $identifiers = new Zend_Gdata_DublinCore_Extension_Identifier(); 00264 $identifiers->transferFromDOM($child); 00265 $this->_identifiers[] = $identifiers; 00266 break; 00267 case $this->lookupNamespace('dc') . ':' . 'language': 00268 $languages = new Zend_Gdata_DublinCore_Extension_Language(); 00269 $languages->transferFromDOM($child); 00270 $this->_languages[] = $languages; 00271 break; 00272 case $this->lookupNamespace('dc') . ':' . 'publisher': 00273 $publishers = new Zend_Gdata_DublinCore_Extension_Publisher(); 00274 $publishers->transferFromDOM($child); 00275 $this->_publishers[] = $publishers; 00276 break; 00277 case $this->lookupNamespace('dc') . ':' . 'subject': 00278 $subjects = new Zend_Gdata_DublinCore_Extension_Subject(); 00279 $subjects->transferFromDOM($child); 00280 $this->_subjects[] = $subjects; 00281 break; 00282 case $this->lookupNamespace('dc') . ':' . 'title': 00283 $titles = new Zend_Gdata_DublinCore_Extension_Title(); 00284 $titles->transferFromDOM($child); 00285 $this->_titles[] = $titles; 00286 break; 00287 case $this->lookupNamespace('gd') . ':' . 'comments': 00288 $comments = new Zend_Gdata_Extension_Comments(); 00289 $comments->transferFromDOM($child); 00290 $this->_comments = $comments; 00291 break; 00292 case $this->lookupNamespace('gbs') . ':' . 'embeddability': 00293 $embeddability = new Zend_Gdata_Books_Extension_Embeddability(); 00294 $embeddability->transferFromDOM($child); 00295 $this->_embeddability = $embeddability; 00296 break; 00297 case $this->lookupNamespace('gd') . ':' . 'rating': 00298 $rating = new Zend_Gdata_Extension_Rating(); 00299 $rating->transferFromDOM($child); 00300 $this->_rating = $rating; 00301 break; 00302 case $this->lookupNamespace('gbs') . ':' . 'review': 00303 $review = new Zend_Gdata_Books_Extension_Review(); 00304 $review->transferFromDOM($child); 00305 $this->_review = $review; 00306 break; 00307 case $this->lookupNamespace('gbs') . ':' . 'viewability': 00308 $viewability = new Zend_Gdata_Books_Extension_Viewability(); 00309 $viewability->transferFromDOM($child); 00310 $this->_viewability = $viewability; 00311 break; 00312 default: 00313 parent::takeChildFromDOM($child); 00314 break; 00315 } 00316 } 00317 00323 public function getComments() 00324 { 00325 return $this->_comments; 00326 } 00327 00333 public function getCreators() 00334 { 00335 return $this->_creators; 00336 } 00337 00343 public function getDates() 00344 { 00345 return $this->_dates; 00346 } 00347 00353 public function getDescriptions() 00354 { 00355 return $this->_descriptions; 00356 } 00357 00363 public function getEmbeddability() 00364 { 00365 return $this->_embeddability; 00366 } 00367 00373 public function getFormats() 00374 { 00375 return $this->_formats; 00376 } 00377 00383 public function getIdentifiers() 00384 { 00385 return $this->_identifiers; 00386 } 00387 00393 public function getLanguages() 00394 { 00395 return $this->_languages; 00396 } 00397 00403 public function getPublishers() 00404 { 00405 return $this->_publishers; 00406 } 00407 00413 public function getRating() 00414 { 00415 return $this->_rating; 00416 } 00417 00423 public function getReview() 00424 { 00425 return $this->_review; 00426 } 00427 00433 public function getSubjects() 00434 { 00435 return $this->_subjects; 00436 } 00437 00443 public function getTitles() 00444 { 00445 return $this->_titles; 00446 } 00447 00453 public function getViewability() 00454 { 00455 return $this->_viewability; 00456 } 00457 00464 public function setComments($comments) 00465 { 00466 $this->_comments = $comments; 00467 return $this; 00468 } 00469 00476 public function setCreators($creators) 00477 { 00478 $this->_creators = $creators; 00479 return $this; 00480 } 00481 00488 public function setDates($dates) 00489 { 00490 $this->_dates = $dates; 00491 return $this; 00492 } 00493 00500 public function setDescriptions($descriptions) 00501 { 00502 $this->_descriptions = $descriptions; 00503 return $this; 00504 } 00505 00513 public function setEmbeddability($embeddability) 00514 { 00515 $this->_embeddability = $embeddability; 00516 return $this; 00517 } 00518 00525 public function setFormats($formats) 00526 { 00527 $this->_formats = $formats; 00528 return $this; 00529 } 00530 00537 public function setIdentifiers($identifiers) 00538 { 00539 $this->_identifiers = $identifiers; 00540 return $this; 00541 } 00542 00549 public function setLanguages($languages) 00550 { 00551 $this->_languages = $languages; 00552 return $this; 00553 } 00554 00561 public function setPublishers($publishers) 00562 { 00563 $this->_publishers = $publishers; 00564 return $this; 00565 } 00566 00573 public function setRating($rating) 00574 { 00575 $this->_rating = $rating; 00576 return $this; 00577 } 00578 00585 public function setReview($review) 00586 { 00587 $this->_review = $review; 00588 return $this; 00589 } 00590 00597 public function setSubjects($subjects) 00598 { 00599 $this->_subjects = $subjects; 00600 return $this; 00601 } 00602 00609 public function setTitles($titles) 00610 { 00611 $this->_titles = $titles; 00612 return $this; 00613 } 00614 00622 public function setViewability($viewability) 00623 { 00624 $this->_viewability = $viewability; 00625 return $this; 00626 } 00627 00628 00635 public function getVolumeId() 00636 { 00637 $fullId = $this->getId()->getText(); 00638 $position = strrpos($fullId, '/'); 00639 if ($position === false) { 00640 require_once 'Zend/Gdata/App/Exception.php'; 00641 throw new Zend_Gdata_App_Exception('Slash not found in atom:id'); 00642 } else { 00643 return substr($fullId, strrpos($fullId,'/') + 1); 00644 } 00645 } 00646 00652 public function getThumbnailLink() 00653 { 00654 return $this->getLink(self::THUMBNAIL_LINK_REL); 00655 } 00656 00662 public function getPreviewLink() 00663 { 00664 return $this->getLink(self::PREVIEW_LINK_REL); 00665 } 00666 00672 public function getInfoLink() 00673 { 00674 return $this->getLink(self::INFO_LINK_REL); 00675 } 00676 00682 public function getAnnotationLink() 00683 { 00684 return $this->getLink(self::ANNOTATION_LINK_REL); 00685 } 00686 00687 }