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.
19 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
25 * @see Zend_Gdata_Extension
27 require_once 'Zend/Gdata/Extension.php';
30 * @see Zend_Gdata_Extension_EntryLink
32 require_once 'Zend/Gdata/Extension/EntryLink.php';
35 * @see Zend_Gdata_Extension_OriginalEvent
37 require_once 'Zend/Gdata/Extension/OriginalEvent.php';
40 * Data model class to represent an entry's recurrenceException
45 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
46 * @license http://framework.zend.com/license/new-bsd New BSD License
48 class Zend_Gdata_Extension_RecurrenceException extends Zend_Gdata_Extension
51 protected $_rootElement = 'recurrenceException';
52 protected $_specialized = null;
53 protected $_entryLink = null;
54 protected $_originalEvent = null;
57 * Constructs a new Zend_Gdata_Extension_RecurrenceException object.
58 * @param bool $specialized (optional) Whether this is a specialized exception or not.
59 * @param Zend_Gdata_EntryLink (optional) An Event entry with details about the exception.
60 * @param Zend_Gdata_OriginalEvent (optional) The origianl recurrent event this is an exeption to.
62 public function __construct($specialized = null, $entryLink = null,
63 $originalEvent = null)
65 parent::__construct();
66 $this->_specialized = $specialized;
67 $this->_entryLink = $entryLink;
68 $this->_originalEvent = $originalEvent;
72 * Retrieves a DOMElement which corresponds to this element and all
73 * child properties. This is used to build an entry back into a DOM
74 * and eventually XML text for sending to the server upon updates, or
75 * for application storage/persistence.
77 * @param DOMDocument $doc The DOMDocument used to construct DOMElements
78 * @return DOMElement The DOMElement representing this element and all
81 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
83 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
84 if ($this->_specialized !== null) {
85 $element->setAttribute('specialized', ($this->_specialized ? "true" : "false"));
87 if ($this->_entryLink !== null) {
88 $element->appendChild($this->_entryLink->getDOM($element->ownerDocument));
90 if ($this->_originalEvent !== null) {
91 $element->appendChild($this->_originalEvent->getDOM($element->ownerDocument));
97 * Given a DOMNode representing an attribute, tries to map the data into
98 * instance members. If no mapping is defined, the name and value are
101 * @param DOMNode $attribute The DOMNode attribute needed to be handled
103 protected function takeAttributeFromDOM($attribute)
105 switch ($attribute->localName) {
107 if ($attribute->nodeValue == "true") {
108 $this->_specialized = true;
110 else if ($attribute->nodeValue == "false") {
111 $this->_specialized = false;
114 throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value.");
118 parent::takeAttributeFromDOM($attribute);
123 * Creates individual Entry objects of the appropriate type and
124 * stores them as members of this entry based upon DOM data.
126 * @param DOMNode $child The DOMNode to process
128 protected function takeChildFromDOM($child)
130 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
131 switch ($absoluteNodeName) {
132 case $this->lookupNamespace('gd') . ':' . 'entryLink':
133 $entryLink = new Zend_Gdata_Extension_EntryLink();
134 $entryLink->transferFromDOM($child);
135 $this->_entryLink = $entryLink;
137 case $this->lookupNamespace('gd') . ':' . 'originalEvent':
138 $originalEvent = new Zend_Gdata_Extension_OriginalEvent();
139 $originalEvent->transferFromDOM($child);
140 $this->_originalEvent = $originalEvent;
143 parent::takeChildFromDOM($child);
149 * Get the value for this element's Specialized attribute.
151 * @return bool The requested attribute.
153 public function getSpecialized()
155 return $this->_specialized;
159 * Set the value for this element's Specialized attribute.
161 * @param bool $value The desired value for this attribute.
162 * @return Zend_Gdata_Extension_RecurrenceException The element being modified.
164 public function setSpecialized($value)
166 $this->_specialized = $value;
171 * Get the value for this element's EntryLink attribute.
173 * @return Zend_Gdata_Extension_EntryLink The requested attribute.
175 public function getEntryLink()
177 return $this->_entryLink;
181 * Set the value for this element's EntryLink attribute.
183 * @param Zend_Gdata_Extension_EntryLink $value The desired value for this attribute.
184 * @return Zend_Gdata_Extension_RecurrenceException The element being modified.
186 public function setEntryLink($value)
188 $this->_entryLink = $value;
193 * Get the value for this element's Specialized attribute.
195 * @return Zend_Gdata_Extension_OriginalEvent The requested attribute.
197 public function getOriginalEvent()
199 return $this->_originalEvent;
203 * Set the value for this element's Specialized attribute.
205 * @param Zend_Gdata_Extension_OriginalEvent $value The desired value for this attribute.
206 * @return Zend_Gdata_Extension_RecurrenceException The element being modified.
208 public function setOriginalEvent($value)
210 $this->_originalEvent = $value;