|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00027 require_once 'Zend/Gdata/Extension.php'; 00028 00038 class Zend_Gdata_Calendar_Extension_SendEventNotifications extends Zend_Gdata_Extension 00039 { 00040 protected $_rootNamespace = 'gCal'; 00041 protected $_rootElement = 'sendEventNotifications'; 00042 protected $_value = null; 00043 00048 public function __construct($value = null) 00049 { 00050 $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); 00051 parent::__construct(); 00052 $this->_value = $value; 00053 } 00054 00065 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 00066 { 00067 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 00068 if ($this->_value !== null) { 00069 $element->setAttribute('value', ($this->_value ? "true" : "false")); 00070 } 00071 return $element; 00072 } 00073 00081 protected function takeAttributeFromDOM($attribute) 00082 { 00083 switch ($attribute->localName) { 00084 case 'value': 00085 if ($attribute->nodeValue == "true") { 00086 $this->_value = true; 00087 } 00088 else if ($attribute->nodeValue == "false") { 00089 $this->_value = false; 00090 } 00091 else { 00092 throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value."); 00093 } 00094 break; 00095 default: 00096 parent::takeAttributeFromDOM($attribute); 00097 } 00098 } 00099 00105 public function getValue() 00106 { 00107 return $this->_value; 00108 } 00109 00116 public function setValue($value) 00117 { 00118 $this->_value = $value; 00119 return $this; 00120 } 00121 00126 public function __toString() 00127 { 00128 return $this->getValue(); 00129 } 00130 00131 } 00132