File indexing completed on 2025-03-09 05:25:55

0001 <?php
0002 
0003 /**
0004  * Zend Framework
0005  *
0006  * LICENSE
0007  *
0008  * This source file is subject to the new BSD license that is bundled
0009  * with this package in the file LICENSE.txt.
0010  * It is also available through the world-wide-web at this URL:
0011  * http://framework.zend.com/license/new-bsd
0012  * If you did not receive a copy of the license and are unable to
0013  * obtain it through the world-wide-web, please send an email
0014  * to license@zend.com so we can send you a copy immediately.
0015  *
0016  * @category   Zend
0017  * @package    Zend_Gdata
0018  * @subpackage Gdata
0019  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0020  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0021  * @version    $Id$
0022  */
0023 
0024 /**
0025  * @see Zend_Gdata_Extension
0026  */
0027 // require_once 'Zend/Gdata/Extension.php';
0028 
0029 /**
0030  * Implements the gd:reminder element used to set/retrieve notifications
0031  *
0032  * @category   Zend
0033  * @package    Zend_Gdata
0034  * @subpackage Gdata
0035  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0036  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0037  */
0038 class Zend_Gdata_Extension_Reminder extends Zend_Gdata_Extension
0039 {
0040 
0041     protected $_rootElement = 'reminder';
0042     protected $_absoluteTime = null;
0043     protected $_method = null;
0044     protected $_days = null;
0045     protected $_hours = null;
0046     protected $_minutes = null;
0047 
0048     public function __construct($absoluteTime = null, $method = null, $days = null,
0049             $hours = null, $minutes = null)
0050     {
0051         parent::__construct();
0052         $this->_absoluteTime = $absoluteTime;
0053         $this->_method = $method;
0054         $this->_days = $days;
0055         $this->_hours = $hours;
0056         $this->_minutes = $minutes;
0057     }
0058 
0059     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
0060     {
0061         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
0062         if ($this->_absoluteTime !== null) {
0063             $element->setAttribute('absoluteTime', $this->_absoluteTime);
0064         }
0065         if ($this->_method !== null) {
0066             $element->setAttribute('method', $this->_method);
0067         }
0068         if ($this->_days !== null) {
0069             $element->setAttribute('days', $this->_days);
0070         }
0071         if ($this->_hours !== null) {
0072             $element->setAttribute('hours', $this->_hours);
0073         }
0074         if ($this->_minutes !== null) {
0075             $element->setAttribute('minutes', $this->_minutes);
0076         }
0077         return $element;
0078     }
0079 
0080     protected function takeAttributeFromDOM($attribute)
0081     {
0082         switch ($attribute->localName) {
0083             case 'absoluteTime':
0084                 $this->_absoluteTime = $attribute->nodeValue;
0085                 break;
0086             case 'method':
0087                 $this->_method = $attribute->nodeValue;
0088                 break;
0089             case 'days':
0090                 $this->_days = $attribute->nodeValue;
0091                 break;
0092             case 'hours':
0093                 $this->_hours = $attribute->nodeValue;
0094                 break;
0095             case 'minutes':
0096                 $this->_minutes = $attribute->nodeValue;
0097                 break;
0098             default:
0099                 parent::takeAttributeFromDOM($attribute);
0100         }
0101     }
0102 
0103     public function __toString()
0104     {
0105         $s = '';
0106         if ($this->_absoluteTime)
0107             $s = " at " . $this->_absoluteTime;
0108         else if ($this->_days)
0109             $s = " in " . $this->_days . " days";
0110         else if ($this->_hours)
0111             $s = " in " . $this->_hours . " hours";
0112         else if ($this->_minutes)
0113             $s = " in " . $this->_minutes . " minutes";
0114         return $this->_method . $s;
0115     }
0116 
0117     public function getAbsoluteTime()
0118     {
0119         return $this->_absoluteTime;
0120     }
0121 
0122     public function setAbsoluteTime($value)
0123     {
0124         $this->_absoluteTime = $value;
0125         return $this;
0126     }
0127 
0128     public function getDays()
0129     {
0130         return $this->_days;
0131     }
0132 
0133     public function setDays($value)
0134     {
0135         $this->_days = $value;
0136         return $this;
0137     }
0138     public function getHours()
0139     {
0140         return $this->_hours;
0141     }
0142 
0143     public function setHours($value)
0144     {
0145         $this->_hours = $value;
0146         return $this;
0147     }
0148 
0149     public function getMinutes()
0150     {
0151         return $this->_minutes;
0152     }
0153 
0154     public function setMinutes($value)
0155     {
0156         $this->_minutes = $value;
0157         return $this;
0158     }
0159 
0160     public function getMethod()
0161     {
0162         return $this->_method;
0163     }
0164 
0165     public function setMethod($value)
0166     {
0167         $this->_method = $value;
0168         return $this;
0169     }
0170 
0171 }