|
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_MediaPlayer extends Zend_Gdata_Extension 00039 { 00040 00041 protected $_rootElement = 'player'; 00042 protected $_rootNamespace = 'media'; 00043 00047 protected $_url = null; 00048 00052 protected $_width = null; 00053 00057 protected $_height = null; 00058 00066 public function __construct($url = null, $width = null, $height = null) 00067 { 00068 $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces); 00069 parent::__construct(); 00070 $this->_url = $url; 00071 $this->_width = $width; 00072 $this->_height = $height; 00073 } 00074 00085 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 00086 { 00087 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 00088 if ($this->_url !== null) { 00089 $element->setAttribute('url', $this->_url); 00090 } 00091 if ($this->_width !== null) { 00092 $element->setAttribute('width', $this->_width); 00093 } 00094 if ($this->_height !== null) { 00095 $element->setAttribute('height', $this->_height); 00096 } 00097 return $element; 00098 } 00099 00107 protected function takeAttributeFromDOM($attribute) 00108 { 00109 switch ($attribute->localName) { 00110 case 'url': 00111 $this->_url = $attribute->nodeValue; 00112 break; 00113 case 'width': 00114 $this->_width = $attribute->nodeValue; 00115 break; 00116 case 'height': 00117 $this->_height = $attribute->nodeValue; 00118 break; 00119 default: 00120 parent::takeAttributeFromDOM($attribute); 00121 } 00122 } 00123 00127 public function getUrl() 00128 { 00129 return $this->_url; 00130 } 00131 00136 public function setUrl($value) 00137 { 00138 $this->_url = $value; 00139 return $this; 00140 } 00141 00145 public function getWidth() 00146 { 00147 return $this->_width; 00148 } 00149 00154 public function setWidth($value) 00155 { 00156 $this->_width = $value; 00157 return $this; 00158 } 00159 00163 public function getHeight() 00164 { 00165 return $this->_height; 00166 } 00167 00172 public function setHeight($value) 00173 { 00174 $this->_height = $value; 00175 return $this; 00176 } 00177 00178 }