|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00027 require_once 'Zend/Gdata/Extension.php'; 00028 00032 require_once 'Zend/Gdata/Entry.php'; 00033 00043 class Zend_Gdata_Extension_EntryLink extends Zend_Gdata_Extension 00044 { 00045 00046 protected $_rootElement = 'entryLink'; 00047 protected $_href = null; 00048 protected $_readOnly = null; 00049 protected $_rel = null; 00050 protected $_entry = null; 00051 00052 public function __construct($href = null, $rel = null, 00053 $readOnly = null, $entry = null) 00054 { 00055 parent::__construct(); 00056 $this->_href = $href; 00057 $this->_readOnly = $readOnly; 00058 $this->_rel = $rel; 00059 $this->_entry = $entry; 00060 } 00061 00062 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 00063 { 00064 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 00065 if ($this->_href !== null) { 00066 $element->setAttribute('href', $this->_href); 00067 } 00068 if ($this->_readOnly !== null) { 00069 $element->setAttribute('readOnly', ($this->_readOnly ? "true" : "false")); 00070 } 00071 if ($this->_rel !== null) { 00072 $element->setAttribute('rel', $this->_rel); 00073 } 00074 if ($this->_entry !== null) { 00075 $element->appendChild($this->_entry->getDOM($element->ownerDocument)); 00076 } 00077 return $element; 00078 } 00079 00080 protected function takeChildFromDOM($child) 00081 { 00082 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; 00083 switch ($absoluteNodeName) { 00084 case $this->lookupNamespace('atom') . ':' . 'entry'; 00085 $entry = new Zend_Gdata_Entry(); 00086 $entry->transferFromDOM($child); 00087 $this->_entry = $entry; 00088 break; 00089 default: 00090 parent::takeChildFromDOM($child); 00091 break; 00092 } 00093 } 00094 00095 protected function takeAttributeFromDOM($attribute) 00096 { 00097 switch ($attribute->localName) { 00098 case 'href': 00099 $this->_href = $attribute->nodeValue; 00100 break; 00101 case 'readOnly': 00102 if ($attribute->nodeValue == "true") { 00103 $this->_readOnly = true; 00104 } 00105 else if ($attribute->nodeValue == "false") { 00106 $this->_readOnly = false; 00107 } 00108 else { 00109 throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value."); 00110 } 00111 break; 00112 case 'rel': 00113 $this->_rel = $attribute->nodeValue; 00114 break; 00115 default: 00116 parent::takeAttributeFromDOM($attribute); 00117 } 00118 } 00119 00123 public function getHref() 00124 { 00125 return $this->_href; 00126 } 00127 00128 public function setHref($value) 00129 { 00130 $this->_href = $value; 00131 return $this; 00132 } 00133 00134 public function getReadOnly() 00135 { 00136 return $this->_readOnly; 00137 } 00138 00139 public function setReadOnly($value) 00140 { 00141 $this->_readOnly = $value; 00142 return $this; 00143 } 00144 00145 public function getRel() 00146 { 00147 return $this->_rel; 00148 } 00149 00150 public function setRel($value) 00151 { 00152 $this->_rel = $value; 00153 return $this; 00154 } 00155 00156 public function getEntry() 00157 { 00158 return $this->_entry; 00159 } 00160 00161 public function setEntry($value) 00162 { 00163 $this->_entry = $value; 00164 return $this; 00165 } 00166 00167 }