|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00027 require_once 'Zend/Gdata/App/Extension.php'; 00028 00038 class Zend_Gdata_YouTube_Extension_MediaCredit extends Zend_Gdata_Extension 00039 { 00040 00041 protected $_rootElement = 'credit'; 00042 protected $_rootNamespace = 'media'; 00043 00047 protected $_role = null; 00048 00052 protected $_scheme = null; 00053 00062 protected $_yttype = null; 00063 00071 public function __construct($text = null, $role = null, $scheme = null, 00072 $yttype = null) 00073 { 00074 $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces); 00075 parent::__construct(); 00076 $this->_text = $text; 00077 $this->_role = $role; 00078 $this->_scheme = $scheme; 00079 $this->_yttype = $yttype; 00080 } 00081 00092 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 00093 { 00094 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 00095 if ($this->_role !== null) { 00096 $element->setAttribute('role', $this->_role); 00097 } 00098 if ($this->_scheme !== null) { 00099 $element->setAttribute('scheme', $this->_scheme); 00100 } 00101 if ($this->_yttype !== null) { 00102 $element->setAttributeNS('http://gdata.youtube.com/schemas/2007', 00103 'yt:type', $this->_yttype); 00104 } 00105 return $element; 00106 } 00107 00115 protected function takeAttributeFromDOM($attribute) 00116 { 00117 switch ($attribute->localName) { 00118 case 'role': 00119 $this->_role = $attribute->nodeValue; 00120 break; 00121 case 'scheme': 00122 $this->_scheme = $attribute->nodeValue; 00123 break; 00124 case 'type': 00125 $this->_yttype = $attribute->nodeValue; 00126 break; 00127 default: 00128 parent::takeAttributeFromDOM($attribute); 00129 } 00130 } 00131 00135 public function getRole() 00136 { 00137 return $this->_role; 00138 } 00139 00145 public function setRole($value) 00146 { 00147 $this->_role = $value; 00148 return $this; 00149 } 00150 00154 public function getScheme() 00155 { 00156 return $this->_scheme; 00157 } 00158 00164 public function setScheme($value) 00165 { 00166 $this->_scheme = $value; 00167 return $this; 00168 } 00169 00173 public function getYTtype() 00174 { 00175 return $this->_yttype; 00176 } 00177 00183 public function setYTtype($value) 00184 { 00185 $this->_yttype = $value; 00186 return $this; 00187 } 00188 00189 }