|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00027 require_once 'Zend/Gdata/Photos.php'; 00028 00032 require_once 'Zend/Gdata/Feed.php'; 00033 00037 require_once 'Zend/Gdata/Photos/UserEntry.php'; 00038 00042 require_once 'Zend/Gdata/Photos/AlbumEntry.php'; 00043 00047 require_once 'Zend/Gdata/Photos/PhotoEntry.php'; 00048 00052 require_once 'Zend/Gdata/Photos/TagEntry.php'; 00053 00057 require_once 'Zend/Gdata/Photos/CommentEntry.php'; 00058 00072 class Zend_Gdata_Photos_UserFeed extends Zend_Gdata_Feed 00073 { 00074 00080 protected $_gphotoUser = null; 00081 00087 protected $_gphotoThumbnail = null; 00088 00094 protected $_gphotoNickname = null; 00095 00096 protected $_entryClassName = 'Zend_Gdata_Photos_UserEntry'; 00097 protected $_feedClassName = 'Zend_Gdata_Photos_UserFeed'; 00098 00099 protected $_entryKindClassMapping = array( 00100 'http://schemas.google.com/photos/2007#album' => 'Zend_Gdata_Photos_AlbumEntry', 00101 'http://schemas.google.com/photos/2007#photo' => 'Zend_Gdata_Photos_PhotoEntry', 00102 'http://schemas.google.com/photos/2007#comment' => 'Zend_Gdata_Photos_CommentEntry', 00103 'http://schemas.google.com/photos/2007#tag' => 'Zend_Gdata_Photos_TagEntry' 00104 ); 00105 00106 public function __construct($element = null) 00107 { 00108 $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); 00109 parent::__construct($element); 00110 } 00111 00118 protected function takeChildFromDOM($child) 00119 { 00120 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; 00121 switch ($absoluteNodeName) { 00122 case $this->lookupNamespace('gphoto') . ':' . 'user'; 00123 $user = new Zend_Gdata_Photos_Extension_User(); 00124 $user->transferFromDOM($child); 00125 $this->_gphotoUser = $user; 00126 break; 00127 case $this->lookupNamespace('gphoto') . ':' . 'nickname'; 00128 $nickname = new Zend_Gdata_Photos_Extension_Nickname(); 00129 $nickname->transferFromDOM($child); 00130 $this->_gphotoNickname = $nickname; 00131 break; 00132 case $this->lookupNamespace('gphoto') . ':' . 'thumbnail'; 00133 $thumbnail = new Zend_Gdata_Photos_Extension_Thumbnail(); 00134 $thumbnail->transferFromDOM($child); 00135 $this->_gphotoThumbnail = $thumbnail; 00136 break; 00137 case $this->lookupNamespace('atom') . ':' . 'entry': 00138 $entryClassName = $this->_entryClassName; 00139 $tmpEntry = new Zend_Gdata_App_Entry($child); 00140 $categories = $tmpEntry->getCategory(); 00141 foreach ($categories as $category) { 00142 if ($category->scheme == Zend_Gdata_Photos::KIND_PATH && 00143 $this->_entryKindClassMapping[$category->term] != "") { 00144 $entryClassName = $this->_entryKindClassMapping[$category->term]; 00145 break; 00146 } else { 00147 require_once 'Zend/Gdata/App/Exception.php'; 00148 throw new Zend_Gdata_App_Exception('Entry is missing kind declaration.'); 00149 } 00150 } 00151 00152 $newEntry = new $entryClassName($child); 00153 $newEntry->setHttpClient($this->getHttpClient()); 00154 $this->_entry[] = $newEntry; 00155 break; 00156 default: 00157 parent::takeChildFromDOM($child); 00158 break; 00159 } 00160 } 00161 00162 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 00163 { 00164 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 00165 if ($this->_gphotoUser != null) { 00166 $element->appendChild($this->_gphotoUser->getDOM($element->ownerDocument)); 00167 } 00168 if ($this->_gphotoNickname != null) { 00169 $element->appendChild($this->_gphotoNickname->getDOM($element->ownerDocument)); 00170 } 00171 if ($this->_gphotoThumbnail != null) { 00172 $element->appendChild($this->_gphotoThumbnail->getDOM($element->ownerDocument)); 00173 } 00174 00175 return $element; 00176 } 00177 00184 public function getGphotoUser() 00185 { 00186 return $this->_gphotoUser; 00187 } 00188 00195 public function setGphotoUser($value) 00196 { 00197 $this->_gphotoUser = $value; 00198 return $this; 00199 } 00200 00207 public function getGphotoNickname() 00208 { 00209 return $this->_gphotoNickname; 00210 } 00211 00218 public function setGphotoNickname($value) 00219 { 00220 $this->_gphotoNickname = $value; 00221 return $this; 00222 } 00223 00230 public function getGphotoThumbnail() 00231 { 00232 return $this->_gphotoThumbnail; 00233 } 00234 00241 public function setGphotoThumbnail($value) 00242 { 00243 $this->_gphotoThumbnail = $value; 00244 return $this; 00245 } 00246 00247 }