|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00027 require_once 'Zend/Gdata/Extension.php'; 00028 00038 class Zend_Gdata_YouTube_Extension_Statistics extends Zend_Gdata_Extension 00039 { 00040 00041 protected $_rootNamespace = 'yt'; 00042 protected $_rootElement = 'statistics'; 00043 00052 protected $_videoWatchCount = null; 00053 00063 protected $_viewCount = null; 00064 00073 protected $_subscriberCount = null; 00074 00081 protected $_lastWebAccess = null; 00082 00091 protected $_favoriteCount = null; 00092 00101 public function __construct($viewCount = null, $videoWatchCount = null, 00102 $subscriberCount = null, $lastWebAccess = null, 00103 $favoriteCount = null) 00104 { 00105 $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); 00106 parent::__construct(); 00107 $this->_viewCount = $viewCount; 00108 $this->_videoWatchCount = $videoWatchCount; 00109 $this->_subscriberCount = $subscriberCount; 00110 $this->_lastWebAccess = $lastWebAccess; 00111 $this->_favoriteCount = $favoriteCount; 00112 } 00113 00124 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 00125 { 00126 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 00127 if ($this->_videoWatchCount !== null) { 00128 $element->setAttribute('watchCount', $this->_videoWatchCount); 00129 } 00130 if ($this->_viewCount !== null) { 00131 $element->setAttribute('viewCount', $this->_viewCount); 00132 } 00133 if ($this->_subscriberCount !== null) { 00134 $element->setAttribute('subscriberCount', 00135 $this->_subscriberCount); 00136 } 00137 if ($this->_lastWebAccess !== null) { 00138 $element->setAttribute('lastWebAccess', 00139 $this->_lastWebAccess); 00140 } 00141 if ($this->_favoriteCount !== null) { 00142 $element->setAttribute('favoriteCount', 00143 $this->_favoriteCount); 00144 } 00145 return $element; 00146 } 00147 00156 protected function takeAttributeFromDOM($attribute) 00157 { 00158 switch ($attribute->localName) { 00159 case 'videoWatchCount': 00160 $this->_videoWatchCount = $attribute->nodeValue; 00161 break; 00162 case 'viewCount': 00163 $this->_viewCount = $attribute->nodeValue; 00164 break; 00165 case 'subscriberCount': 00166 $this->_subscriberCount = $attribute->nodeValue; 00167 break; 00168 case 'lastWebAccess': 00169 $this->_lastWebAccess = $attribute->nodeValue; 00170 break; 00171 case 'favoriteCount': 00172 $this->_favoriteCount = $attribute->nodeValue; 00173 break; 00174 default: 00175 parent::takeAttributeFromDOM($attribute); 00176 } 00177 } 00178 00184 public function getViewCount() 00185 { 00186 return $this->_viewCount; 00187 } 00188 00196 public function setViewCount($value) 00197 { 00198 $this->_viewCount = $value; 00199 return $this; 00200 } 00201 00207 public function getVideoWatchCount() 00208 { 00209 return $this->_videoWatchCount; 00210 } 00211 00219 public function setVideoWatchCount($value) 00220 { 00221 $this->_videoWatchCount = $value; 00222 return $this; 00223 } 00224 00230 public function getSubscriberCount() 00231 { 00232 return $this->_subscriberCount; 00233 } 00234 00242 public function setSubscriberCount($value) 00243 { 00244 $this->_subscriberCount = $value; 00245 return $this; 00246 } 00247 00253 public function getLastWebAccess() 00254 { 00255 return $this->_lastWebAccess; 00256 } 00257 00265 public function setLastWebAccess($value) 00266 { 00267 $this->_lastWebAccess = $value; 00268 return $this; 00269 } 00270 00276 public function getFavoriteCount() 00277 { 00278 return $this->_favoriteCount; 00279 } 00280 00288 public function setFavoriteCount($value) 00289 { 00290 $this->_favoriteCount = $value; 00291 return $this; 00292 } 00293 00300 public function __toString() 00301 { 00302 return 'View Count=' . $this->_viewCount . 00303 ' VideoWatchCount=' . $this->_videoWatchCount . 00304 ' SubscriberCount=' . $this->_subscriberCount . 00305 ' LastWebAccess=' . $this->_lastWebAccess . 00306 ' FavoriteCount=' . $this->_favoriteCount; 00307 } 00308 00309 }