|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00027 require_once 'Zend/Gdata/Extension.php'; 00028 00039 class Zend_Gdata_Extension_Rating extends Zend_Gdata_Extension 00040 { 00041 00042 protected $_rootElement = 'rating'; 00043 protected $_min = null; 00044 protected $_max = null; 00045 protected $_numRaters = null; 00046 protected $_average = null; 00047 protected $_value = null; 00048 00058 public function __construct($average = null, $min = null, 00059 $max = null, $numRaters = null, $value = null) 00060 { 00061 parent::__construct(); 00062 $this->_average = $average; 00063 $this->_min = $min; 00064 $this->_max = $max; 00065 $this->_numRaters = $numRaters; 00066 $this->_value = $value; 00067 } 00068 00079 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 00080 { 00081 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 00082 if ($this->_min !== null) { 00083 $element->setAttribute('min', $this->_min); 00084 } 00085 if ($this->_max !== null) { 00086 $element->setAttribute('max', $this->_max); 00087 } 00088 if ($this->_numRaters !== null) { 00089 $element->setAttribute('numRaters', $this->_numRaters); 00090 } 00091 if ($this->_average !== null) { 00092 $element->setAttribute('average', $this->_average); 00093 } 00094 if ($this->_value !== null) { 00095 $element->setAttribute('value', $this->_value); 00096 } 00097 00098 return $element; 00099 } 00100 00108 protected function takeAttributeFromDOM($attribute) 00109 { 00110 switch ($attribute->localName) { 00111 case 'min': 00112 $this->_min = $attribute->nodeValue; 00113 break; 00114 case 'max': 00115 $this->_max = $attribute->nodeValue; 00116 break; 00117 case 'numRaters': 00118 $this->_numRaters = $attribute->nodeValue; 00119 break; 00120 case 'average': 00121 $this->_average = $attribute->nodeValue; 00122 break; 00123 case 'value': 00124 $this->_value = $attribute->nodeValue; 00125 default: 00126 parent::takeAttributeFromDOM($attribute); 00127 } 00128 } 00129 00135 public function getMin() 00136 { 00137 return $this->_min; 00138 } 00139 00146 public function setMin($value) 00147 { 00148 $this->_min = $value; 00149 return $this; 00150 } 00151 00157 public function getNumRaters() 00158 { 00159 return $this->_numRaters; 00160 } 00161 00168 public function setNumRaters($value) 00169 { 00170 $this->_numRaters = $value; 00171 return $this; 00172 } 00173 00179 public function getAverage() 00180 { 00181 return $this->_average; 00182 } 00183 00190 public function setAverage($value) 00191 { 00192 $this->_average = $value; 00193 return $this; 00194 } 00195 00201 public function getMax() 00202 { 00203 return $this->_max; 00204 } 00205 00212 public function setMax($value) 00213 { 00214 $this->_max = $value; 00215 return $this; 00216 } 00217 00223 public function getValue() 00224 { 00225 return $this->_value; 00226 } 00227 00234 public function setValue($value) 00235 { 00236 $this->_value = $value; 00237 return $this; 00238 } 00239 00240 }