|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00027 require_once 'Zend/Gdata/Extension.php'; 00028 00039 class Zend_Gdata_Extension_ExtendedProperty extends Zend_Gdata_Extension 00040 { 00041 00042 protected $_rootElement = 'extendedProperty'; 00043 protected $_name = null; 00044 protected $_value = null; 00045 00046 public function __construct($name = null, $value = null) 00047 { 00048 parent::__construct(); 00049 $this->_name = $name; 00050 $this->_value = $value; 00051 } 00052 00053 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 00054 { 00055 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 00056 if ($this->_name !== null) { 00057 $element->setAttribute('name', $this->_name); 00058 } 00059 if ($this->_value !== null) { 00060 $element->setAttribute('value', $this->_value); 00061 } 00062 return $element; 00063 } 00064 00065 protected function takeAttributeFromDOM($attribute) 00066 { 00067 switch ($attribute->localName) { 00068 case 'name': 00069 $this->_name = $attribute->nodeValue; 00070 break; 00071 case 'value': 00072 $this->_value = $attribute->nodeValue; 00073 break; 00074 default: 00075 parent::takeAttributeFromDOM($attribute); 00076 } 00077 } 00078 00079 public function __toString() 00080 { 00081 return $this->getName() . '=' . $this->getValue(); 00082 } 00083 00084 public function getName() 00085 { 00086 return $this->_name; 00087 } 00088 00089 public function setName($value) 00090 { 00091 $this->_name = $value; 00092 return $this; 00093 } 00094 00095 public function getValue() 00096 { 00097 return $this->_value; 00098 } 00099 00100 public function setValue($value) 00101 { 00102 $this->_value = $value; 00103 return $this; 00104 } 00105 00106 }