|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00027 require_once 'Zend/Gdata/Media/Entry.php'; 00028 00032 require_once 'Zend/Gdata/Extension/Rating.php'; 00033 00037 require_once 'Zend/Gdata/Extension/Comments.php'; 00038 00042 require_once 'Zend/Gdata/YouTube/Extension/Statistics.php'; 00043 00047 require_once 'Zend/Gdata/YouTube/Extension/Description.php'; 00048 00049 00059 class Zend_Gdata_YouTube_InboxEntry extends Zend_Gdata_Media_Entry 00060 { 00061 00062 protected $_entryClassName = 'Zend_Gdata_YouTube_InboxEntry'; 00063 00069 protected $_comments = null; 00070 00076 protected $_rating = null; 00077 00083 protected $_statistics = null; 00084 00090 protected $_description = null; 00091 00099 public function __construct($element = null) 00100 { 00101 $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); 00102 parent::__construct($element); 00103 } 00104 00115 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 00116 { 00117 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 00118 if ($this->_description != null) { 00119 $element->appendChild( 00120 $this->_description->getDOM($element->ownerDocument)); 00121 } 00122 if ($this->_rating != null) { 00123 $element->appendChild( 00124 $this->_rating->getDOM($element->ownerDocument)); 00125 } 00126 if ($this->_statistics != null) { 00127 $element->appendChild( 00128 $this->_statistics->getDOM($element->ownerDocument)); 00129 } 00130 if ($this->_comments != null) { 00131 $element->appendChild( 00132 $this->_comments->getDOM($element->ownerDocument)); 00133 } 00134 return $element; 00135 } 00136 00143 protected function takeChildFromDOM($child) 00144 { 00145 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; 00146 switch ($absoluteNodeName) { 00147 case $this->lookupNamespace('gd') . ':' . 'comments': 00148 $comments = new Zend_Gdata_Extension_Comments(); 00149 $comments->transferFromDOM($child); 00150 $this->_comments = $comments; 00151 break; 00152 case $this->lookupNamespace('gd') . ':' . 'rating': 00153 $rating = new Zend_Gdata_Extension_Rating(); 00154 $rating->transferFromDOM($child); 00155 $this->_rating = $rating; 00156 break; 00157 case $this->lookupNamespace('yt') . ':' . 'description': 00158 $description = new Zend_Gdata_YouTube_Extension_Description(); 00159 $description->transferFromDOM($child); 00160 $this->_description = $description; 00161 break; 00162 case $this->lookupNamespace('yt') . ':' . 'statistics': 00163 $statistics = new Zend_Gdata_YouTube_Extension_Statistics(); 00164 $statistics->transferFromDOM($child); 00165 $this->_statistics = $statistics; 00166 break; 00167 default: 00168 parent::takeChildFromDOM($child); 00169 break; 00170 } 00171 } 00172 00179 public function getDescription() 00180 { 00181 if ($this->getMajorProtocolVersion() == 2) { 00182 require_once 'Zend/Gdata/App/VersionException.php'; 00183 throw new Zend_Gdata_App_VersionException('The getDescription ' . 00184 ' method is only supported in version 1 of the YouTube ' . 00185 'API.'); 00186 } else { 00187 return $this->_description; 00188 } 00189 } 00190 00199 public function setDescription($description = null) 00200 { 00201 if ($this->getMajorProtocolVersion() == 2) { 00202 require_once 'Zend/Gdata/App/VersionException.php'; 00203 throw new Zend_Gdata_App_VersionException('The setDescription ' . 00204 ' method is only supported in version 1 of the YouTube ' . 00205 'API.'); 00206 } else { 00207 $this->_description = $description; 00208 return $this; 00209 } 00210 } 00211 00217 public function getRating() 00218 { 00219 return $this->_rating; 00220 } 00221 00229 public function setRating($rating = null) 00230 { 00231 $this->_rating = $rating; 00232 return $this; 00233 } 00234 00240 public function getComments() 00241 { 00242 return $this->_comments; 00243 } 00244 00251 public function setComments($comments = null) 00252 { 00253 $this->_comments = $comments; 00254 return $this; 00255 } 00256 00262 public function getStatistics() 00263 { 00264 return $this->_statistics; 00265 } 00266 00274 public function setStatistics($statistics = null) 00275 { 00276 $this->_statistics = $statistics; 00277 return $this; 00278 } 00279 00280 00281 }