8
* This source file is subject to the new BSD license that is bundled
9
* with this package in the file LICENSE.txt.
10
* It is also available through the world-wide-web at this URL:
11
* http://framework.zend.com/license/new-bsd
12
* If you did not receive a copy of the license and are unable to
13
* obtain it through the world-wide-web, please send an email
14
* to license@zend.com so we can send you a copy immediately.
19
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
20
* @license http://framework.zend.com/license/new-bsd New BSD License
24
* @see Zend_Gdata_Photos
26
require_once 'Zend/Gdata/Photos.php';
29
* @see Zend_Gdata_Feed
31
require_once 'Zend/Gdata/Feed.php';
34
* @see Zend_Gdata_Photos_UserEntry
36
require_once 'Zend/Gdata/Photos/UserEntry.php';
39
* @see Zend_Gdata_Photos_AlbumEntry
41
require_once 'Zend/Gdata/Photos/AlbumEntry.php';
44
* @see Zend_Gdata_Photos_PhotoEntry
46
require_once 'Zend/Gdata/Photos/PhotoEntry.php';
49
* @see Zend_Gdata_Photos_TagEntry
51
require_once 'Zend/Gdata/Photos/TagEntry.php';
54
* @see Zend_Gdata_Photos_CommentEntry
56
require_once 'Zend/Gdata/Photos/CommentEntry.php';
59
* Data model for a collection of entries for a specific user, usually
60
* provided by the servers.
62
* For information on requesting this feed from a server, see the
63
* service class, Zend_Gdata_Photos.
67
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
68
* @license http://framework.zend.com/license/new-bsd New BSD License
70
class Zend_Gdata_Photos_UserFeed extends Zend_Gdata_Feed
76
* @var Zend_Gdata_Photos_Extension_User
78
protected $_gphotoUser = null;
81
* gphoto:thumbnail element
83
* @var Zend_Gdata_Photos_Extension_Thumbnail
85
protected $_gphotoThumbnail = null;
88
* gphoto:nickname element
90
* @var Zend_Gdata_Photos_Extension_Nickname
92
protected $_gphotoNickname = null;
94
protected $_entryClassName = 'Zend_Gdata_Photos_UserEntry';
95
protected $_feedClassName = 'Zend_Gdata_Photos_UserFeed';
97
protected $_entryKindClassMapping = array(
98
'http://schemas.google.com/photos/2007#album' => 'Zend_Gdata_Photos_AlbumEntry',
99
'http://schemas.google.com/photos/2007#photo' => 'Zend_Gdata_Photos_PhotoEntry',
100
'http://schemas.google.com/photos/2007#comment' => 'Zend_Gdata_Photos_CommentEntry',
101
'http://schemas.google.com/photos/2007#tag' => 'Zend_Gdata_Photos_TagEntry'
104
public function __construct($element = null)
106
foreach (Zend_Gdata_Photos::$namespaces as $nsPrefix => $nsUri) {
107
$this->registerNamespace($nsPrefix, $nsUri);
109
parent::__construct($element);
113
* Creates individual Entry objects of the appropriate type and
114
* stores them in the $_entry array based upon DOM data.
116
* @param DOMNode $child The DOMNode to process
118
protected function takeChildFromDOM($child)
120
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
121
switch ($absoluteNodeName) {
122
case $this->lookupNamespace('gphoto') . ':' . 'user';
123
$user = new Zend_Gdata_Photos_Extension_User();
124
$user->transferFromDOM($child);
125
$this->_gphotoUser = $user;
127
case $this->lookupNamespace('gphoto') . ':' . 'nickname';
128
$nickname = new Zend_Gdata_Photos_Extension_Nickname();
129
$nickname->transferFromDOM($child);
130
$this->_gphotoNickname = $nickname;
132
case $this->lookupNamespace('gphoto') . ':' . 'thumbnail';
133
$thumbnail = new Zend_Gdata_Photos_Extension_Thumbnail();
134
$thumbnail->transferFromDOM($child);
135
$this->_gphotoThumbnail = $thumbnail;
137
case $this->lookupNamespace('atom') . ':' . 'entry':
138
$entryClassName = $this->_entryClassName;
139
$tmpEntry = new Zend_Gdata_App_Entry($child);
140
$categories = $tmpEntry->getCategory();
141
foreach ($categories as $category) {
142
if ($category->scheme == Zend_Gdata_Photos::KIND_PATH &&
143
$this->_entryKindClassMapping[$category->term] != "") {
144
$entryClassName = $this->_entryKindClassMapping[$category->term];
147
require_once 'Zend/Gdata/App/Exception.php';
148
throw new Zend_Gdata_App_Exception('Entry is missing kind declaration.');
152
$newEntry = new $entryClassName($child);
153
$newEntry->setHttpClient($this->getHttpClient());
154
$this->_entry[] = $newEntry;
157
parent::takeChildFromDOM($child);
162
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
164
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
165
if ($this->_gphotoUser != null) {
166
$element->appendChild($this->_gphotoUser->getDOM($element->ownerDocument));
168
if ($this->_gphotoNickname != null) {
169
$element->appendChild($this->_gphotoNickname->getDOM($element->ownerDocument));
171
if ($this->_gphotoThumbnail != null) {
172
$element->appendChild($this->_gphotoThumbnail->getDOM($element->ownerDocument));
179
* Get the value for this element's gphoto:user attribute.
182
* @return string The requested attribute.
184
public function getGphotoUser()
186
return $this->_gphotoUser;
190
* Set the value for this element's gphoto:user attribute.
192
* @param string $value The desired value for this attribute.
193
* @return Zend_Gdata_Photos_Extension_User The element being modified.
195
public function setGphotoUser($value)
197
$this->_gphotoUser = $value;
202
* Get the value for this element's gphoto:nickname attribute.
204
* @see setGphotoNickname
205
* @return string The requested attribute.
207
public function getGphotoNickname()
209
return $this->_gphotoNickname;
213
* Set the value for this element's gphoto:nickname attribute.
215
* @param string $value The desired value for this attribute.
216
* @return Zend_Gdata_Photos_Extension_Nickname The element being modified.
218
public function setGphotoNickname($value)
220
$this->_gphotoNickname = $value;
225
* Get the value for this element's gphoto:thumbnail attribute.
227
* @see setGphotoThumbnail
228
* @return string The requested attribute.
230
public function getGphotoThumbnail()
232
return $this->_gphotoThumbnail;
236
* Set the value for this element's gphoto:thumbnail attribute.
238
* @param string $value The desired value for this attribute.
239
* @return Zend_Gdata_Photos_Extension_Thumbnail The element being modified.
241
public function setGphotoThumbnail($value)
243
$this->_gphotoThumbnail = $value;