diff -r 000000000000 -r 4eba9c11703f web/Zend/Gdata/Photos/UserFeed.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/Zend/Gdata/Photos/UserFeed.php Mon Dec 13 18:29:26 2010 +0100 @@ -0,0 +1,247 @@ + 'Zend_Gdata_Photos_AlbumEntry', + 'http://schemas.google.com/photos/2007#photo' => 'Zend_Gdata_Photos_PhotoEntry', + 'http://schemas.google.com/photos/2007#comment' => 'Zend_Gdata_Photos_CommentEntry', + 'http://schemas.google.com/photos/2007#tag' => 'Zend_Gdata_Photos_TagEntry' + ); + + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct($element); + } + + /** + * Creates individual Entry objects of the appropriate type and + * stores them in the $_entry array based upon DOM data. + * + * @param DOMNode $child The DOMNode to process + */ + protected function takeChildFromDOM($child) + { + $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; + switch ($absoluteNodeName) { + case $this->lookupNamespace('gphoto') . ':' . 'user'; + $user = new Zend_Gdata_Photos_Extension_User(); + $user->transferFromDOM($child); + $this->_gphotoUser = $user; + break; + case $this->lookupNamespace('gphoto') . ':' . 'nickname'; + $nickname = new Zend_Gdata_Photos_Extension_Nickname(); + $nickname->transferFromDOM($child); + $this->_gphotoNickname = $nickname; + break; + case $this->lookupNamespace('gphoto') . ':' . 'thumbnail'; + $thumbnail = new Zend_Gdata_Photos_Extension_Thumbnail(); + $thumbnail->transferFromDOM($child); + $this->_gphotoThumbnail = $thumbnail; + break; + case $this->lookupNamespace('atom') . ':' . 'entry': + $entryClassName = $this->_entryClassName; + $tmpEntry = new Zend_Gdata_App_Entry($child); + $categories = $tmpEntry->getCategory(); + foreach ($categories as $category) { + if ($category->scheme == Zend_Gdata_Photos::KIND_PATH && + $this->_entryKindClassMapping[$category->term] != "") { + $entryClassName = $this->_entryKindClassMapping[$category->term]; + break; + } else { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception('Entry is missing kind declaration.'); + } + } + + $newEntry = new $entryClassName($child); + $newEntry->setHttpClient($this->getHttpClient()); + $this->_entry[] = $newEntry; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_gphotoUser != null) { + $element->appendChild($this->_gphotoUser->getDOM($element->ownerDocument)); + } + if ($this->_gphotoNickname != null) { + $element->appendChild($this->_gphotoNickname->getDOM($element->ownerDocument)); + } + if ($this->_gphotoThumbnail != null) { + $element->appendChild($this->_gphotoThumbnail->getDOM($element->ownerDocument)); + } + + return $element; + } + + /** + * Get the value for this element's gphoto:user attribute. + * + * @see setGphotoUser + * @return string The requested attribute. + */ + public function getGphotoUser() + { + return $this->_gphotoUser; + } + + /** + * Set the value for this element's gphoto:user attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_User The element being modified. + */ + public function setGphotoUser($value) + { + $this->_gphotoUser = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:nickname attribute. + * + * @see setGphotoNickname + * @return string The requested attribute. + */ + public function getGphotoNickname() + { + return $this->_gphotoNickname; + } + + /** + * Set the value for this element's gphoto:nickname attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Nickname The element being modified. + */ + public function setGphotoNickname($value) + { + $this->_gphotoNickname = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:thumbnail attribute. + * + * @see setGphotoThumbnail + * @return string The requested attribute. + */ + public function getGphotoThumbnail() + { + return $this->_gphotoThumbnail; + } + + /** + * Set the value for this element's gphoto:thumbnail attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Thumbnail The element being modified. + */ + public function setGphotoThumbnail($value) + { + $this->_gphotoThumbnail = $value; + return $this; + } + +}