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