|
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/EntryLink.php'; 00033 00043 class Zend_Gdata_Extension_Where extends Zend_Gdata_Extension 00044 { 00045 00046 protected $_rootElement = 'where'; 00047 protected $_label = null; 00048 protected $_rel = null; 00049 protected $_valueString = null; 00050 protected $_entryLink = null; 00051 00052 public function __construct($valueString = null, $label = null, $rel = null, $entryLink = null) 00053 { 00054 parent::__construct(); 00055 $this->_valueString = $valueString; 00056 $this->_label = $label; 00057 $this->_rel = $rel; 00058 $this->_entryLink = $entryLink; 00059 } 00060 00061 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 00062 { 00063 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 00064 if ($this->_label !== null) { 00065 $element->setAttribute('label', $this->_label); 00066 } 00067 if ($this->_rel !== null) { 00068 $element->setAttribute('rel', $this->_rel); 00069 } 00070 if ($this->_valueString !== null) { 00071 $element->setAttribute('valueString', $this->_valueString); 00072 } 00073 if ($this->entryLink !== null) { 00074 $element->appendChild($this->_entryLink->getDOM($element->ownerDocument)); 00075 } 00076 return $element; 00077 } 00078 00079 protected function takeAttributeFromDOM($attribute) 00080 { 00081 switch ($attribute->localName) { 00082 case 'label': 00083 $this->_label = $attribute->nodeValue; 00084 break; 00085 case 'rel': 00086 $this->_rel = $attribute->nodeValue; 00087 break; 00088 case 'valueString': 00089 $this->_valueString = $attribute->nodeValue; 00090 break; 00091 default: 00092 parent::takeAttributeFromDOM($attribute); 00093 } 00094 } 00095 00102 protected function takeChildFromDOM($child) 00103 { 00104 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; 00105 switch ($absoluteNodeName) { 00106 case $this->lookupNamespace('gd') . ':' . 'entryLink': 00107 $entryLink = new Zend_Gdata_Extension_EntryLink(); 00108 $entryLink->transferFromDOM($child); 00109 $this->_entryLink = $entryLink; 00110 break; 00111 default: 00112 parent::takeChildFromDOM($child); 00113 break; 00114 } 00115 } 00116 00117 public function __toString() 00118 { 00119 if ($this->_valueString != null) { 00120 return $this->_valueString; 00121 } 00122 else { 00123 return parent::__toString(); 00124 } 00125 } 00126 00127 public function getLabel() 00128 { 00129 return $this->_label; 00130 } 00131 00132 public function setLabel($value) 00133 { 00134 $this->_label = $value; 00135 return $this; 00136 } 00137 00138 public function getRel() 00139 { 00140 return $this->_rel; 00141 } 00142 00143 public function setRel($value) 00144 { 00145 $this->_rel = $value; 00146 return $this; 00147 } 00148 00149 public function getValueString() 00150 { 00151 return $this->_valueString; 00152 } 00153 00154 public function setValueString($value) 00155 { 00156 $this->_valueString = $value; 00157 return $this; 00158 } 00159 00160 public function getEntryLink() 00161 { 00162 return $this->_entryLink; 00163 } 00164 00165 public function setEntryLink($value) 00166 { 00167 $this->_entryLink = $value; 00168 return $this; 00169 } 00170 00171 }