|
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_MediaRestriction extends Zend_Gdata_Extension 00039 { 00040 00041 protected $_rootElement = 'restriction'; 00042 protected $_rootNamespace = 'media'; 00043 00047 protected $_relationship = null; 00048 00052 protected $_type = null; 00053 00061 public function __construct($text = null, $relationship = null, $type = null) 00062 { 00063 $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces); 00064 parent::__construct(); 00065 $this->_text = $text; 00066 $this->_relationship = $relationship; 00067 $this->_type = $type; 00068 } 00069 00080 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 00081 { 00082 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 00083 if ($this->_relationship !== null) { 00084 $element->setAttribute('relationship', $this->_relationship); 00085 } 00086 if ($this->_type !== null) { 00087 $element->setAttribute('type', $this->_type); 00088 } 00089 return $element; 00090 } 00091 00099 protected function takeAttributeFromDOM($attribute) 00100 { 00101 switch ($attribute->localName) { 00102 case 'relationship': 00103 $this->_relationship = $attribute->nodeValue; 00104 break; 00105 case 'type': 00106 $this->_type = $attribute->nodeValue; 00107 break; 00108 default: 00109 parent::takeAttributeFromDOM($attribute); 00110 } 00111 } 00112 00116 public function getRelationship() 00117 { 00118 return $this->_relationship; 00119 } 00120 00125 public function setRelationship($value) 00126 { 00127 $this->_relationship = $value; 00128 return $this; 00129 } 00130 00134 public function getType() 00135 { 00136 return $this->_type; 00137 } 00138 00143 public function setType($value) 00144 { 00145 $this->_type = $value; 00146 return $this; 00147 } 00148 00149 }