|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00027 require_once 'Zend/Gdata/Extension.php'; 00028 00032 require_once 'Zend/Gdata/Extension/FeedLink.php'; 00033 00043 class Zend_Gdata_Extension_Comments extends Zend_Gdata_Extension 00044 { 00045 00046 protected $_rootElement = 'comments'; 00047 protected $_rel = null; 00048 protected $_feedLink = null; 00049 00050 public function __construct($rel = null, $feedLink = null) 00051 { 00052 parent::__construct(); 00053 $this->_rel = $rel; 00054 $this->_feedLink = $feedLink; 00055 } 00056 00057 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 00058 { 00059 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 00060 if ($this->_rel !== null) { 00061 $element->setAttribute('rel', $this->_rel); 00062 } 00063 if ($this->_feedLink !== null) { 00064 $element->appendChild($this->_feedLink->getDOM($element->ownerDocument)); 00065 } 00066 return $element; 00067 } 00068 00069 protected function takeChildFromDOM($child) 00070 { 00071 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; 00072 switch ($absoluteNodeName) { 00073 case $this->lookupNamespace('gd') . ':' . 'feedLink'; 00074 $feedLink = new Zend_Gdata_Extension_FeedLink(); 00075 $feedLink->transferFromDOM($child); 00076 $this->_feedLink = $feedLink; 00077 break; 00078 default: 00079 parent::takeChildFromDOM($child); 00080 break; 00081 } 00082 } 00083 00084 protected function takeAttributeFromDOM($attribute) 00085 { 00086 switch ($attribute->localName) { 00087 case 'rel': 00088 $this->_rel = $attribute->nodeValue; 00089 break; 00090 default: 00091 parent::takeAttributeFromDOM($attribute); 00092 } 00093 } 00094 00095 public function getRel() 00096 { 00097 return $this->_rel; 00098 } 00099 00100 public function setRel($value) 00101 { 00102 $this->_rel = $value; 00103 return $this; 00104 } 00105 00106 public function getFeedLink() 00107 { 00108 return $this->_feedLink; 00109 } 00110 00111 public function setFeedLink($value) 00112 { 00113 $this->_feedLink = $value; 00114 return $this; 00115 } 00116 00117 }