source: extensions/Google2Piwigo/include/Zend/Gdata/Extension/Reminder.php @ 17475

Last change on this file since 17475 was 17475, checked in by mistic100, 12 years ago

new extension: Google2Piwigo

File size: 4.5 KB
Line 
1<?php
2
3/**
4 * Zend Framework
5 *
6 * LICENSE
7 *
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.
15 *
16 * @category   Zend
17 * @package    Zend_Gdata
18 * @subpackage Gdata
19 * @copyright  Copyright (c) 2005-2012 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 24594 2012-01-05 21:27:01Z matthew $
22 */
23
24/**
25 * @see Zend_Gdata_Extension
26 */
27require_once 'Zend/Gdata/Extension.php';
28
29/**
30 * Implements the gd:reminder element used to set/retrieve notifications
31 *
32 * @category   Zend
33 * @package    Zend_Gdata
34 * @subpackage Gdata
35 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36 * @license    http://framework.zend.com/license/new-bsd     New BSD License
37 */
38class Zend_Gdata_Extension_Reminder extends Zend_Gdata_Extension
39{
40
41    protected $_rootElement = 'reminder';
42    protected $_absoluteTime = null;
43    protected $_method = null;
44    protected $_days = null;
45    protected $_hours = null;
46    protected $_minutes = null;
47
48    public function __construct($absoluteTime = null, $method = null, $days = null,
49            $hours = null, $minutes = null)
50    {
51        parent::__construct();
52        $this->_absoluteTime = $absoluteTime;
53        $this->_method = $method;
54        $this->_days = $days;
55        $this->_hours = $hours;
56        $this->_minutes = $minutes;
57    }
58
59    public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
60    {
61        $element = parent::getDOM($doc, $majorVersion, $minorVersion);
62        if ($this->_absoluteTime !== null) {
63            $element->setAttribute('absoluteTime', $this->_absoluteTime);
64        }
65        if ($this->_method !== null) {
66            $element->setAttribute('method', $this->_method);
67        }
68        if ($this->_days !== null) {
69            $element->setAttribute('days', $this->_days);
70        }
71        if ($this->_hours !== null) {
72            $element->setAttribute('hours', $this->_hours);
73        }
74        if ($this->_minutes !== null) {
75            $element->setAttribute('minutes', $this->_minutes);
76        }
77        return $element;
78    }
79
80    protected function takeAttributeFromDOM($attribute)
81    {
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);
100        }
101    }
102
103    public function __toString()
104    {
105        $s = '';
106        if ($this->_absoluteTime)
107            $s = " at " . $this->_absoluteTime;
108        else if ($this->_days)
109            $s = " in " . $this->_days . " days";
110        else if ($this->_hours)
111            $s = " in " . $this->_hours . " hours";
112        else if ($this->_minutes)
113            $s = " in " . $this->_minutes . " minutes";
114        return $this->_method . $s;
115    }
116
117    public function getAbsoluteTime()
118    {
119        return $this->_absoluteTime;
120    }
121
122    public function setAbsoluteTime($value)
123    {
124        $this->_absoluteTime = $value;
125        return $this;
126    }
127
128    public function getDays()
129    {
130        return $this->_days;
131    }
132
133    public function setDays($value)
134    {
135        $this->_days = $value;
136        return $this;
137    }
138    public function getHours()
139    {
140        return $this->_hours;
141    }
142
143    public function setHours($value)
144    {
145        $this->_hours = $value;
146        return $this;
147    }
148
149    public function getMinutes()
150    {
151        return $this->_minutes;
152    }
153
154    public function setMinutes($value)
155    {
156        $this->_minutes = $value;
157        return $this;
158    }
159
160    public function getMethod()
161    {
162        return $this->_method;
163    }
164
165    public function setMethod($value)
166    {
167        $this->_method = $value;
168        return $this;
169    }
170
171}
Note: See TracBrowser for help on using the repository browser.