|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00027 require_once 'Zend/Gdata/App/Extension.php'; 00028 00038 class Zend_Gdata_Media_Extension_MediaThumbnail extends Zend_Gdata_Extension 00039 { 00040 00041 protected $_rootElement = 'thumbnail'; 00042 protected $_rootNamespace = 'media'; 00043 00047 protected $_url = null; 00048 00052 protected $_width = null; 00053 00057 protected $_height = null; 00058 00062 protected $_time = null; 00063 00072 public function __construct($url = null, $width = null, $height = null, 00073 $time = null) 00074 { 00075 $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces); 00076 parent::__construct(); 00077 $this->_url = $url; 00078 $this->_width = $width; 00079 $this->_height = $height; 00080 $this->_time = $time ; 00081 } 00082 00093 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 00094 { 00095 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 00096 if ($this->_url !== null) { 00097 $element->setAttribute('url', $this->_url); 00098 } 00099 if ($this->_width !== null) { 00100 $element->setAttribute('width', $this->_width); 00101 } 00102 if ($this->_height !== null) { 00103 $element->setAttribute('height', $this->_height); 00104 } 00105 if ($this->_time !== null) { 00106 $element->setAttribute('time', $this->_time); 00107 } 00108 return $element; 00109 } 00110 00118 protected function takeAttributeFromDOM($attribute) 00119 { 00120 switch ($attribute->localName) { 00121 case 'url': 00122 $this->_url = $attribute->nodeValue; 00123 break; 00124 case 'width': 00125 $this->_width = $attribute->nodeValue; 00126 break; 00127 case 'height': 00128 $this->_height = $attribute->nodeValue; 00129 break; 00130 case 'time': 00131 $this->_time = $attribute->nodeValue; 00132 break; 00133 default: 00134 parent::takeAttributeFromDOM($attribute); 00135 } 00136 } 00137 00141 public function getUrl() 00142 { 00143 return $this->_url; 00144 } 00145 00150 public function setUrl($value) 00151 { 00152 $this->_url = $value; 00153 return $this; 00154 } 00155 00159 public function getWidth() 00160 { 00161 return $this->_width; 00162 } 00163 00168 public function setWidth($value) 00169 { 00170 $this->_width = $value; 00171 return $this; 00172 } 00173 00177 public function getHeight() 00178 { 00179 return $this->_height; 00180 } 00181 00186 public function setHeight($value) 00187 { 00188 $this->_height = $value; 00189 return $this; 00190 } 00191 00195 public function getTime() 00196 { 00197 return $this->_time; 00198 } 00199 00204 public function setTime($value) 00205 { 00206 $this->_time = $value; 00207 return $this; 00208 } 00209 00210 }