Merge file:///media/external_data/workspace/web/sport-group
[sport-group.git] / library / Zend / Gdata / Extension / Reminder.php
blob0e7760f0c764fd5a85488640dc51318015102722
1 <?php
3 /**
4 * Zend Framework
6 * LICENSE
8 * This source file is subject to the new BSD license that is bundled
9 * with this package in the file LICENSE.txt.
10 * It is also available through the world-wide-web at this URL:
11 * http://framework.zend.com/license/new-bsd
12 * If you did not receive a copy of the license and are unable to
13 * obtain it through the world-wide-web, please send an email
14 * to license@zend.com so we can send you a copy immediately.
16 * @category Zend
17 * @package Zend_Gdata
18 * @subpackage Gdata
19 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
21 * @version $Id: Reminder.php 16971 2009-07-22 18:05:45Z mikaelkael $
24 /**
25 * @see Zend_Gdata_Extension
27 require_once 'Zend/Gdata/Extension.php';
29 /**
30 * Implements the gd:reminder element used to set/retrieve notifications
32 * @category Zend
33 * @package Zend_Gdata
34 * @subpackage Gdata
35 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
36 * @license http://framework.zend.com/license/new-bsd New BSD License
38 class Zend_Gdata_Extension_Reminder extends Zend_Gdata_Extension
41 protected $_rootElement = 'reminder';
42 protected $_absoluteTime = null;
43 protected $_method = null;
44 protected $_days = null;
45 protected $_hours = null;
46 protected $_minutes = null;
48 public function __construct($absoluteTime = null, $method = null, $days = null,
49 $hours = null, $minutes = null)
51 parent::__construct();
52 $this->_absoluteTime = $absoluteTime;
53 $this->_method = $method;
54 $this->_days = $days;
55 $this->_hours = $hours;
56 $this->_minutes = $minutes;
59 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
61 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
62 if ($this->_absoluteTime !== null) {
63 $element->setAttribute('absoluteTime', $this->_absoluteTime);
65 if ($this->_method !== null) {
66 $element->setAttribute('method', $this->_method);
68 if ($this->_days !== null) {
69 $element->setAttribute('days', $this->_days);
71 if ($this->_hours !== null) {
72 $element->setAttribute('hours', $this->_hours);
74 if ($this->_minutes !== null) {
75 $element->setAttribute('minutes', $this->_minutes);
77 return $element;
80 protected function takeAttributeFromDOM($attribute)
82 switch ($attribute->localName) {
83 case 'absoluteTime':
84 $this->_absoluteTime = $attribute->nodeValue;
85 break;
86 case 'method':
87 $this->_method = $attribute->nodeValue;
88 break;
89 case 'days':
90 $this->_days = $attribute->nodeValue;
91 break;
92 case 'hours':
93 $this->_hours = $attribute->nodeValue;
94 break;
95 case 'minutes':
96 $this->_minutes = $attribute->nodeValue;
97 break;
98 default:
99 parent::takeAttributeFromDOM($attribute);
103 public function __toString()
106 if ($absoluteTime)
107 $s = "at" . $absoluteTime;
108 else if ($days)
109 $s = "in" . $days . "days";
110 else if ($hours)
111 $s = "in" . $hours . "hours";
112 else if ($minutes)
113 $s = "in" . $minutes . "minutes";
114 return $method . $s;
117 public function getAbsoluteTime()
119 return $this->_absoluteTime;
122 public function setAbsoluteTime($value)
124 $this->_absoluteTime = $value;
125 return $this;
128 public function getDays()
130 return $this->_days;
133 public function setDays($value)
135 $this->_days = $value;
136 return $this;
138 public function getHours()
140 return $this->_hours;
143 public function setHours($value)
145 $this->_hours = $value;
146 return $this;
149 public function getMinutes()
151 return $this->_minutes;
154 public function setMinutes($value)
156 $this->_minutes = $value;
157 return $this;
160 public function getMethod()
162 return $this->_method;
165 public function setMethod($value)
167 $this->_method = $value;
168 return $this;