File indexing completed on 2024-06-16 05:30:07

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  * @see Zend_Gdata_Extension_EntryLink
0031  */
0032 // require_once 'Zend/Gdata/Extension/EntryLink.php';
0033 
0034 /**
0035  * @see Zend_Gdata_Extension_OriginalEvent
0036  */
0037 // require_once 'Zend/Gdata/Extension/OriginalEvent.php';
0038 
0039 /**
0040  * Data model class to represent an entry's recurrenceException
0041  *
0042  * @category   Zend
0043  * @package    Zend_Gdata
0044  * @subpackage Gdata
0045  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0046  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0047  */
0048 class Zend_Gdata_Extension_RecurrenceException extends Zend_Gdata_Extension
0049 {
0050 
0051     protected $_rootElement = 'recurrenceException';
0052     protected $_specialized = null;
0053     protected $_entryLink = null;
0054     protected $_originalEvent = null;
0055 
0056     /**
0057      * Constructs a new Zend_Gdata_Extension_RecurrenceException object.
0058      * @param bool $specialized (optional) Whether this is a specialized exception or not.
0059      * @param Zend_Gdata_EntryLink (optional) An Event entry with details about the exception.
0060      * @param Zend_Gdata_OriginalEvent (optional) The origianl recurrent event this is an exeption to.
0061      */
0062     public function __construct($specialized = null, $entryLink = null,
0063             $originalEvent = null)
0064     {
0065         parent::__construct();
0066         $this->_specialized = $specialized;
0067         $this->_entryLink = $entryLink;
0068         $this->_originalEvent = $originalEvent;
0069     }
0070 
0071     /**
0072      * Retrieves a DOMElement which corresponds to this element and all
0073      * child properties.  This is used to build an entry back into a DOM
0074      * and eventually XML text for sending to the server upon updates, or
0075      * for application storage/persistence.
0076      *
0077      * @param DOMDocument $doc The DOMDocument used to construct DOMElements
0078      * @return DOMElement The DOMElement representing this element and all
0079      * child properties.
0080      */
0081     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
0082     {
0083         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
0084         if ($this->_specialized !== null) {
0085             $element->setAttribute('specialized', ($this->_specialized ? "true" : "false"));
0086         }
0087         if ($this->_entryLink !== null) {
0088             $element->appendChild($this->_entryLink->getDOM($element->ownerDocument));
0089         }
0090         if ($this->_originalEvent !== null) {
0091             $element->appendChild($this->_originalEvent->getDOM($element->ownerDocument));
0092         }
0093         return $element;
0094     }
0095 
0096     /**
0097      * Given a DOMNode representing an attribute, tries to map the data into
0098      * instance members.  If no mapping is defined, the name and value are
0099      * stored in an array.
0100      *
0101      * @param DOMNode $attribute The DOMNode attribute needed to be handled
0102      */
0103     protected function takeAttributeFromDOM($attribute)
0104     {
0105         switch ($attribute->localName) {
0106         case 'specialized':
0107             if ($attribute->nodeValue == "true") {
0108                 $this->_specialized = true;
0109             }
0110             else if ($attribute->nodeValue == "false") {
0111                 $this->_specialized = false;
0112             }
0113             else {
0114                 throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value.");
0115             }
0116             break;
0117         default:
0118             parent::takeAttributeFromDOM($attribute);
0119         }
0120     }
0121 
0122     /**
0123      * Creates individual Entry objects of the appropriate type and
0124      * stores them as members of this entry based upon DOM data.
0125      *
0126      * @param DOMNode $child The DOMNode to process
0127      */
0128     protected function takeChildFromDOM($child)
0129     {
0130         $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
0131         switch ($absoluteNodeName) {
0132         case $this->lookupNamespace('gd') . ':' . 'entryLink':
0133             $entryLink = new Zend_Gdata_Extension_EntryLink();
0134             $entryLink->transferFromDOM($child);
0135             $this->_entryLink = $entryLink;
0136             break;
0137         case $this->lookupNamespace('gd') . ':' . 'originalEvent':
0138             $originalEvent = new Zend_Gdata_Extension_OriginalEvent();
0139             $originalEvent->transferFromDOM($child);
0140             $this->_originalEvent = $originalEvent;
0141             break;
0142         default:
0143             parent::takeChildFromDOM($child);
0144             break;
0145         }
0146     }
0147 
0148     /**
0149      * Get the value for this element's Specialized attribute.
0150      *
0151      * @return bool The requested attribute.
0152      */
0153     public function getSpecialized()
0154     {
0155         return $this->_specialized;
0156     }
0157 
0158     /**
0159      * Set the value for this element's Specialized attribute.
0160      *
0161      * @param bool $value The desired value for this attribute.
0162      * @return Zend_Gdata_Extension_RecurrenceException The element being modified.
0163      */
0164     public function setSpecialized($value)
0165     {
0166         $this->_specialized = $value;
0167         return $this;
0168     }
0169 
0170     /**
0171      * Get the value for this element's EntryLink attribute.
0172      *
0173      * @return Zend_Gdata_Extension_EntryLink The requested attribute.
0174      */
0175     public function getEntryLink()
0176     {
0177         return $this->_entryLink;
0178     }
0179 
0180     /**
0181      * Set the value for this element's EntryLink attribute.
0182      *
0183      * @param Zend_Gdata_Extension_EntryLink $value The desired value for this attribute.
0184      * @return Zend_Gdata_Extension_RecurrenceException The element being modified.
0185      */
0186     public function setEntryLink($value)
0187     {
0188         $this->_entryLink = $value;
0189         return $this;
0190     }
0191 
0192     /**
0193      * Get the value for this element's Specialized attribute.
0194      *
0195      * @return Zend_Gdata_Extension_OriginalEvent The requested attribute.
0196      */
0197     public function getOriginalEvent()
0198     {
0199         return $this->_originalEvent;
0200     }
0201 
0202     /**
0203      * Set the value for this element's Specialized attribute.
0204      *
0205      * @param Zend_Gdata_Extension_OriginalEvent $value The desired value for this attribute.
0206      * @return Zend_Gdata_Extension_RecurrenceException The element being modified.
0207      */
0208     public function setOriginalEvent($value)
0209     {
0210         $this->_originalEvent = $value;
0211         return $this;
0212     }
0213 
0214 }
0215