|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00027 require_once 'Zend/Gdata/Extension.php'; 00028 00038 class Zend_Gdata_Extension_Reminder extends Zend_Gdata_Extension 00039 { 00040 00041 protected $_rootElement = 'reminder'; 00042 protected $_absoluteTime = null; 00043 protected $_method = null; 00044 protected $_days = null; 00045 protected $_hours = null; 00046 protected $_minutes = null; 00047 00048 public function __construct($absoluteTime = null, $method = null, $days = null, 00049 $hours = null, $minutes = null) 00050 { 00051 parent::__construct(); 00052 $this->_absoluteTime = $absoluteTime; 00053 $this->_method = $method; 00054 $this->_days = $days; 00055 $this->_hours = $hours; 00056 $this->_minutes = $minutes; 00057 } 00058 00059 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 00060 { 00061 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 00062 if ($this->_absoluteTime !== null) { 00063 $element->setAttribute('absoluteTime', $this->_absoluteTime); 00064 } 00065 if ($this->_method !== null) { 00066 $element->setAttribute('method', $this->_method); 00067 } 00068 if ($this->_days !== null) { 00069 $element->setAttribute('days', $this->_days); 00070 } 00071 if ($this->_hours !== null) { 00072 $element->setAttribute('hours', $this->_hours); 00073 } 00074 if ($this->_minutes !== null) { 00075 $element->setAttribute('minutes', $this->_minutes); 00076 } 00077 return $element; 00078 } 00079 00080 protected function takeAttributeFromDOM($attribute) 00081 { 00082 switch ($attribute->localName) { 00083 case 'absoluteTime': 00084 $this->_absoluteTime = $attribute->nodeValue; 00085 break; 00086 case 'method': 00087 $this->_method = $attribute->nodeValue; 00088 break; 00089 case 'days': 00090 $this->_days = $attribute->nodeValue; 00091 break; 00092 case 'hours': 00093 $this->_hours = $attribute->nodeValue; 00094 break; 00095 case 'minutes': 00096 $this->_minutes = $attribute->nodeValue; 00097 break; 00098 default: 00099 parent::takeAttributeFromDOM($attribute); 00100 } 00101 } 00102 00103 public function __toString() 00104 { 00105 $s = ''; 00106 if ($this->_absoluteTime) 00107 $s = " at " . $this->_absoluteTime; 00108 else if ($this->_days) 00109 $s = " in " . $this->_days . " days"; 00110 else if ($this->_hours) 00111 $s = " in " . $this->_hours . " hours"; 00112 else if ($this->_minutes) 00113 $s = " in " . $this->_minutes . " minutes"; 00114 return $this->_method . $s; 00115 } 00116 00117 public function getAbsoluteTime() 00118 { 00119 return $this->_absoluteTime; 00120 } 00121 00122 public function setAbsoluteTime($value) 00123 { 00124 $this->_absoluteTime = $value; 00125 return $this; 00126 } 00127 00128 public function getDays() 00129 { 00130 return $this->_days; 00131 } 00132 00133 public function setDays($value) 00134 { 00135 $this->_days = $value; 00136 return $this; 00137 } 00138 public function getHours() 00139 { 00140 return $this->_hours; 00141 } 00142 00143 public function setHours($value) 00144 { 00145 $this->_hours = $value; 00146 return $this; 00147 } 00148 00149 public function getMinutes() 00150 { 00151 return $this->_minutes; 00152 } 00153 00154 public function setMinutes($value) 00155 { 00156 $this->_minutes = $value; 00157 return $this; 00158 } 00159 00160 public function getMethod() 00161 { 00162 return $this->_method; 00163 } 00164 00165 public function setMethod($value) 00166 { 00167 $this->_method = $value; 00168 return $this; 00169 } 00170 00171 }