|
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/FeedLink.php'; 00033 00037 require_once 'Zend/Gdata/YouTube/Extension/Description.php'; 00038 00042 require_once 'Zend/Gdata/YouTube/Extension/AboutMe.php'; 00043 00047 require_once 'Zend/Gdata/YouTube/Extension/Age.php'; 00048 00052 require_once 'Zend/Gdata/YouTube/Extension/Username.php'; 00053 00057 require_once 'Zend/Gdata/YouTube/Extension/Books.php'; 00058 00062 require_once 'Zend/Gdata/YouTube/Extension/Company.php'; 00063 00067 require_once 'Zend/Gdata/YouTube/Extension/Hobbies.php'; 00068 00072 require_once 'Zend/Gdata/YouTube/Extension/Hometown.php'; 00073 00077 require_once 'Zend/Gdata/YouTube/Extension/Location.php'; 00078 00082 require_once 'Zend/Gdata/YouTube/Extension/Movies.php'; 00083 00087 require_once 'Zend/Gdata/YouTube/Extension/Music.php'; 00088 00092 require_once 'Zend/Gdata/YouTube/Extension/Occupation.php'; 00093 00097 require_once 'Zend/Gdata/YouTube/Extension/School.php'; 00098 00102 require_once 'Zend/Gdata/YouTube/Extension/Gender.php'; 00103 00107 require_once 'Zend/Gdata/YouTube/Extension/Relationship.php'; 00108 00112 require_once 'Zend/Gdata/YouTube/Extension/FirstName.php'; 00113 00117 require_once 'Zend/Gdata/YouTube/Extension/LastName.php'; 00118 00122 require_once 'Zend/Gdata/YouTube/Extension/Statistics.php'; 00123 00127 require_once 'Zend/Gdata/Media/Extension/MediaThumbnail.php'; 00128 00138 class Zend_Gdata_YouTube_UserProfileEntry extends Zend_Gdata_Entry 00139 { 00140 00141 protected $_entryClassName = 'Zend_Gdata_YouTube_UserProfileEntry'; 00142 00148 protected $_feedLink = array(); 00149 00155 protected $_username = null; 00156 00162 protected $_description = null; 00163 00169 protected $_aboutMe = null; 00170 00176 protected $_age = null; 00177 00183 protected $_books = null; 00184 00190 protected $_company = null; 00191 00197 protected $_hobbies = null; 00198 00204 protected $_hometown = null; 00205 00211 protected $_location = null; 00212 00218 protected $_movies = null; 00219 00225 protected $_music = null; 00226 00232 protected $_occupation = null; 00233 00239 protected $_school = null; 00240 00246 protected $_gender = null; 00247 00253 protected $_relationship = null; 00254 00260 protected $_firstName = null; 00261 00267 protected $_lastName = null; 00268 00274 protected $_statistics = null; 00275 00281 protected $_thumbnail = null; 00282 00290 public function __construct($element = null) 00291 { 00292 $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); 00293 parent::__construct($element); 00294 } 00295 00306 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 00307 { 00308 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 00309 if ($this->_description != null) { 00310 $element->appendChild($this->_description->getDOM($element->ownerDocument)); 00311 } 00312 if ($this->_aboutMe != null) { 00313 $element->appendChild($this->_aboutMe->getDOM($element->ownerDocument)); 00314 } 00315 if ($this->_age != null) { 00316 $element->appendChild($this->_age->getDOM($element->ownerDocument)); 00317 } 00318 if ($this->_username != null) { 00319 $element->appendChild($this->_username->getDOM($element->ownerDocument)); 00320 } 00321 if ($this->_books != null) { 00322 $element->appendChild($this->_books->getDOM($element->ownerDocument)); 00323 } 00324 if ($this->_company != null) { 00325 $element->appendChild($this->_company->getDOM($element->ownerDocument)); 00326 } 00327 if ($this->_hobbies != null) { 00328 $element->appendChild($this->_hobbies->getDOM($element->ownerDocument)); 00329 } 00330 if ($this->_hometown != null) { 00331 $element->appendChild($this->_hometown->getDOM($element->ownerDocument)); 00332 } 00333 if ($this->_location != null) { 00334 $element->appendChild($this->_location->getDOM($element->ownerDocument)); 00335 } 00336 if ($this->_movies != null) { 00337 $element->appendChild($this->_movies->getDOM($element->ownerDocument)); 00338 } 00339 if ($this->_music != null) { 00340 $element->appendChild($this->_music->getDOM($element->ownerDocument)); 00341 } 00342 if ($this->_occupation != null) { 00343 $element->appendChild($this->_occupation->getDOM($element->ownerDocument)); 00344 } 00345 if ($this->_school != null) { 00346 $element->appendChild($this->_school->getDOM($element->ownerDocument)); 00347 } 00348 if ($this->_gender != null) { 00349 $element->appendChild($this->_gender->getDOM($element->ownerDocument)); 00350 } 00351 if ($this->_relationship != null) { 00352 $element->appendChild($this->_relationship->getDOM($element->ownerDocument)); 00353 } 00354 if ($this->_firstName != null) { 00355 $element->appendChild($this->_firstName->getDOM($element->ownerDocument)); 00356 } 00357 if ($this->_lastName != null) { 00358 $element->appendChild($this->_lastName->getDOM($element->ownerDocument)); 00359 } 00360 if ($this->_statistics != null) { 00361 $element->appendChild($this->_statistics->getDOM($element->ownerDocument)); 00362 } 00363 if ($this->_thumbnail != null) { 00364 $element->appendChild($this->_thumbnail->getDOM($element->ownerDocument)); 00365 } 00366 if ($this->_feedLink != null) { 00367 foreach ($this->_feedLink as $feedLink) { 00368 $element->appendChild($feedLink->getDOM($element->ownerDocument)); 00369 } 00370 } 00371 return $element; 00372 } 00373 00380 protected function takeChildFromDOM($child) 00381 { 00382 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; 00383 switch ($absoluteNodeName) { 00384 case $this->lookupNamespace('yt') . ':' . 'description': 00385 $description = new Zend_Gdata_YouTube_Extension_Description(); 00386 $description->transferFromDOM($child); 00387 $this->_description = $description; 00388 break; 00389 case $this->lookupNamespace('yt') . ':' . 'aboutMe': 00390 $aboutMe = new Zend_Gdata_YouTube_Extension_AboutMe(); 00391 $aboutMe->transferFromDOM($child); 00392 $this->_aboutMe = $aboutMe; 00393 break; 00394 case $this->lookupNamespace('yt') . ':' . 'age': 00395 $age = new Zend_Gdata_YouTube_Extension_Age(); 00396 $age->transferFromDOM($child); 00397 $this->_age = $age; 00398 break; 00399 case $this->lookupNamespace('yt') . ':' . 'username': 00400 $username = new Zend_Gdata_YouTube_Extension_Username(); 00401 $username->transferFromDOM($child); 00402 $this->_username = $username; 00403 break; 00404 case $this->lookupNamespace('yt') . ':' . 'books': 00405 $books = new Zend_Gdata_YouTube_Extension_Books(); 00406 $books->transferFromDOM($child); 00407 $this->_books = $books; 00408 break; 00409 case $this->lookupNamespace('yt') . ':' . 'company': 00410 $company = new Zend_Gdata_YouTube_Extension_Company(); 00411 $company->transferFromDOM($child); 00412 $this->_company = $company; 00413 break; 00414 case $this->lookupNamespace('yt') . ':' . 'hobbies': 00415 $hobbies = new Zend_Gdata_YouTube_Extension_Hobbies(); 00416 $hobbies->transferFromDOM($child); 00417 $this->_hobbies = $hobbies; 00418 break; 00419 case $this->lookupNamespace('yt') . ':' . 'hometown': 00420 $hometown = new Zend_Gdata_YouTube_Extension_Hometown(); 00421 $hometown->transferFromDOM($child); 00422 $this->_hometown = $hometown; 00423 break; 00424 case $this->lookupNamespace('yt') . ':' . 'location': 00425 $location = new Zend_Gdata_YouTube_Extension_Location(); 00426 $location->transferFromDOM($child); 00427 $this->_location = $location; 00428 break; 00429 case $this->lookupNamespace('yt') . ':' . 'movies': 00430 $movies = new Zend_Gdata_YouTube_Extension_Movies(); 00431 $movies->transferFromDOM($child); 00432 $this->_movies = $movies; 00433 break; 00434 case $this->lookupNamespace('yt') . ':' . 'music': 00435 $music = new Zend_Gdata_YouTube_Extension_Music(); 00436 $music->transferFromDOM($child); 00437 $this->_music = $music; 00438 break; 00439 case $this->lookupNamespace('yt') . ':' . 'occupation': 00440 $occupation = new Zend_Gdata_YouTube_Extension_Occupation(); 00441 $occupation->transferFromDOM($child); 00442 $this->_occupation = $occupation; 00443 break; 00444 case $this->lookupNamespace('yt') . ':' . 'school': 00445 $school = new Zend_Gdata_YouTube_Extension_School(); 00446 $school->transferFromDOM($child); 00447 $this->_school = $school; 00448 break; 00449 case $this->lookupNamespace('yt') . ':' . 'gender': 00450 $gender = new Zend_Gdata_YouTube_Extension_Gender(); 00451 $gender->transferFromDOM($child); 00452 $this->_gender = $gender; 00453 break; 00454 case $this->lookupNamespace('yt') . ':' . 'relationship': 00455 $relationship = new Zend_Gdata_YouTube_Extension_Relationship(); 00456 $relationship->transferFromDOM($child); 00457 $this->_relationship = $relationship; 00458 break; 00459 case $this->lookupNamespace('yt') . ':' . 'firstName': 00460 $firstName = new Zend_Gdata_YouTube_Extension_FirstName(); 00461 $firstName->transferFromDOM($child); 00462 $this->_firstName = $firstName; 00463 break; 00464 case $this->lookupNamespace('yt') . ':' . 'lastName': 00465 $lastName = new Zend_Gdata_YouTube_Extension_LastName(); 00466 $lastName->transferFromDOM($child); 00467 $this->_lastName = $lastName; 00468 break; 00469 case $this->lookupNamespace('yt') . ':' . 'statistics': 00470 $statistics = new Zend_Gdata_YouTube_Extension_Statistics(); 00471 $statistics->transferFromDOM($child); 00472 $this->_statistics = $statistics; 00473 break; 00474 case $this->lookupNamespace('media') . ':' . 'thumbnail': 00475 $thumbnail = new Zend_Gdata_Media_Extension_MediaThumbnail(); 00476 $thumbnail->transferFromDOM($child); 00477 $this->_thumbnail = $thumbnail; 00478 break; 00479 case $this->lookupNamespace('gd') . ':' . 'feedLink': 00480 $feedLink = new Zend_Gdata_Extension_FeedLink(); 00481 $feedLink->transferFromDOM($child); 00482 $this->_feedLink[] = $feedLink; 00483 break; 00484 default: 00485 parent::takeChildFromDOM($child); 00486 break; 00487 } 00488 } 00489 00498 public function setAboutMe($aboutMe = null) 00499 { 00500 if (($this->getMajorProtocolVersion() == null) || 00501 ($this->getMajorProtocolVersion() == 1)) { 00502 require_once 'Zend/Gdata/App/VersionException.php'; 00503 throw new Zend_Gdata_App_VersionException('The setAboutMe ' . 00504 ' method is only supported as of version 2 of the YouTube ' . 00505 'API.'); 00506 } else { 00507 $this->_aboutMe = $aboutMe; 00508 return $this; 00509 } 00510 } 00511 00518 public function getAboutMe() 00519 { 00520 if (($this->getMajorProtocolVersion() == null) || 00521 ($this->getMajorProtocolVersion() == 1)) { 00522 require_once 'Zend/Gdata/App/VersionException.php'; 00523 throw new Zend_Gdata_App_VersionException('The getAboutMe ' . 00524 ' method is only supported as of version 2 of the YouTube ' . 00525 'API.'); 00526 } else { 00527 return $this->_aboutMe; 00528 } 00529 } 00530 00538 public function setFirstName($firstName = null) 00539 { 00540 if (($this->getMajorProtocolVersion() == null) || 00541 ($this->getMajorProtocolVersion() == 1)) { 00542 require_once 'Zend/Gdata/App/VersionException.php'; 00543 throw new Zend_Gdata_App_VersionException('The setFirstName ' . 00544 ' method is only supported as of version 2 of the YouTube ' . 00545 'API.'); 00546 } else { 00547 $this->_firstName = $firstName; 00548 return $this; 00549 } 00550 } 00551 00558 public function getFirstName() 00559 { 00560 if (($this->getMajorProtocolVersion() == null) || 00561 ($this->getMajorProtocolVersion() == 1)) { 00562 require_once 'Zend/Gdata/App/VersionException.php'; 00563 throw new Zend_Gdata_App_VersionException('The getFirstName ' . 00564 ' method is only supported as of version 2 of the YouTube ' . 00565 'API.'); 00566 } else { 00567 return $this->_firstName; 00568 } 00569 } 00570 00578 public function setLastName($lastName = null) 00579 { 00580 if (($this->getMajorProtocolVersion() == null) || 00581 ($this->getMajorProtocolVersion() == 1)) { 00582 require_once 'Zend/Gdata/App/VersionException.php'; 00583 throw new Zend_Gdata_App_VersionException('The setLastName ' . 00584 ' method is only supported as of version 2 of the YouTube ' . 00585 'API.'); 00586 } else { 00587 $this->_lastName = $lastName; 00588 return $this; 00589 } 00590 } 00591 00598 public function getLastName() 00599 { 00600 if (($this->getMajorProtocolVersion() == null) || 00601 ($this->getMajorProtocolVersion() == 1)) { 00602 require_once 'Zend/Gdata/App/VersionException.php'; 00603 throw new Zend_Gdata_App_VersionException('The getLastName ' . 00604 ' method is only supported as of version 2 of the YouTube ' . 00605 'API.'); 00606 } else { 00607 return $this->_lastName; 00608 } 00609 } 00610 00617 public function getStatistics() 00618 { 00619 if (($this->getMajorProtocolVersion() == null) || 00620 ($this->getMajorProtocolVersion() == 1)) { 00621 require_once 'Zend/Gdata/App/VersionException.php'; 00622 throw new Zend_Gdata_App_VersionException('The getStatistics ' . 00623 ' method is only supported as of version 2 of the YouTube ' . 00624 'API.'); 00625 } else { 00626 return $this->_statistics; 00627 } 00628 } 00629 00636 public function getThumbnail() 00637 { 00638 if (($this->getMajorProtocolVersion() == null) || 00639 ($this->getMajorProtocolVersion() == 1)) { 00640 require_once 'Zend/Gdata/App/VersionException.php'; 00641 throw new Zend_Gdata_App_VersionException('The getThumbnail ' . 00642 ' method is only supported as of version 2 of the YouTube ' . 00643 'API.'); 00644 } else { 00645 return $this->_thumbnail; 00646 } 00647 } 00648 00655 public function setAge($age = null) 00656 { 00657 $this->_age = $age; 00658 return $this; 00659 } 00660 00666 public function getAge() 00667 { 00668 return $this->_age; 00669 } 00670 00677 public function setUsername($username = null) 00678 { 00679 $this->_username = $username; 00680 return $this; 00681 } 00682 00688 public function getUsername() 00689 { 00690 return $this->_username; 00691 } 00692 00699 public function setBooks($books = null) 00700 { 00701 $this->_books = $books; 00702 return $this; 00703 } 00704 00710 public function getBooks() 00711 { 00712 return $this->_books; 00713 } 00714 00721 public function setCompany($company = null) 00722 { 00723 $this->_company = $company; 00724 return $this; 00725 } 00726 00732 public function getCompany() 00733 { 00734 return $this->_company; 00735 } 00736 00743 public function setHobbies($hobbies = null) 00744 { 00745 $this->_hobbies = $hobbies; 00746 return $this; 00747 } 00748 00754 public function getHobbies() 00755 { 00756 return $this->_hobbies; 00757 } 00758 00765 public function setHometown($hometown = null) 00766 { 00767 $this->_hometown = $hometown; 00768 return $this; 00769 } 00770 00776 public function getHometown() 00777 { 00778 return $this->_hometown; 00779 } 00780 00787 public function setLocation($location = null) 00788 { 00789 $this->_location = $location; 00790 return $this; 00791 } 00792 00798 public function getLocation() 00799 { 00800 return $this->_location; 00801 } 00802 00809 public function setMovies($movies = null) 00810 { 00811 $this->_movies = $movies; 00812 return $this; 00813 } 00814 00820 public function getMovies() 00821 { 00822 return $this->_movies; 00823 } 00824 00831 public function setMusic($music = null) 00832 { 00833 $this->_music = $music; 00834 return $this; 00835 } 00836 00842 public function getMusic() 00843 { 00844 return $this->_music; 00845 } 00846 00853 public function setOccupation($occupation = null) 00854 { 00855 $this->_occupation = $occupation; 00856 return $this; 00857 } 00858 00864 public function getOccupation() 00865 { 00866 return $this->_occupation; 00867 } 00868 00875 public function setSchool($school = null) 00876 { 00877 $this->_school = $school; 00878 return $this; 00879 } 00880 00886 public function getSchool() 00887 { 00888 return $this->_school; 00889 } 00890 00897 public function setGender($gender = null) 00898 { 00899 $this->_gender = $gender; 00900 return $this; 00901 } 00902 00908 public function getGender() 00909 { 00910 return $this->_gender; 00911 } 00912 00919 public function setRelationship($relationship = null) 00920 { 00921 $this->_relationship = $relationship; 00922 return $this; 00923 } 00924 00930 public function getRelationship() 00931 { 00932 return $this->_relationship; 00933 } 00934 00941 public function setFeedLink($feedLink = null) 00942 { 00943 $this->_feedLink = $feedLink; 00944 return $this; 00945 } 00946 00960 public function getFeedLink($rel = null) 00961 { 00962 if ($rel == null) { 00963 return $this->_feedLink; 00964 } else { 00965 foreach ($this->_feedLink as $feedLink) { 00966 if ($feedLink->rel == $rel) { 00967 return $feedLink; 00968 } 00969 } 00970 return null; 00971 } 00972 } 00973 00981 public function getFeedLinkHref($rel) 00982 { 00983 $feedLink = $this->getFeedLink($rel); 00984 if ($feedLink !== null) { 00985 return $feedLink->href; 00986 } else { 00987 return null; 00988 } 00989 } 00990 00996 public function getPlaylistListFeedUrl() 00997 { 00998 return $this->getFeedLinkHref(Zend_Gdata_YouTube::USER_PLAYLISTS_REL); 00999 } 01000 01006 public function getUploadsFeedUrl() 01007 { 01008 return $this->getFeedLinkHref(Zend_Gdata_YouTube::USER_UPLOADS_REL); 01009 } 01010 01016 public function getSubscriptionsFeedUrl() 01017 { 01018 return $this->getFeedLinkHref(Zend_Gdata_YouTube::USER_SUBSCRIPTIONS_REL); 01019 } 01020 01026 public function getContactsFeedUrl() 01027 { 01028 return $this->getFeedLinkHref(Zend_Gdata_YouTube::USER_CONTACTS_REL); 01029 } 01030 01036 public function getFavoritesFeedUrl() 01037 { 01038 return $this->getFeedLinkHref(Zend_Gdata_YouTube::USER_FAVORITES_REL); 01039 } 01040 01041 }