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.
18
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
19
* @license http://framework.zend.com/license/new-bsd New BSD License
23
* @see Zend_Gdata_Extension
25
require_once 'Zend/Gdata/Extension.php';
28
* Data model class to represent an entry's recurrenceException
32
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
33
* @license http://framework.zend.com/license/new-bsd New BSD License
35
class Zend_Gdata_Extension_RecurrenceException extends Zend_Gdata_Extension
38
protected $_rootElement = 'recurrenceException';
39
protected $_specialized = null;
40
protected $_entryLink = null;
41
protected $_originalEvent = null;
44
* Constructs a new Zend_Gdata_Extension_RecurrenceException object.
45
* @param bool $specialized (optional) Whether this is a specialized exception or not.
46
* @param Zend_Gdata_EntryLink (optional) An Event entry with details about the exception.
47
* @param Zend_Gdata_OriginalEvent (optional) The origianl recurrent event this is an exeption to.
49
public function __construct($specialized = null, $entryLink = null,
50
$originalEvent = null)
52
parent::__construct();
53
$this->_specialized = $specialized;
54
$this->_entryLink = $entryLink;
55
$this->_originalEvent = $originalEvent;
59
* Retrieves a DOMElement which corresponds to this element and all
60
* child properties. This is used to build an entry back into a DOM
61
* and eventually XML text for sending to the server upon updates, or
62
* for application storage/persistence.
64
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
65
* @return DOMElement The DOMElement representing this element and all
68
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
70
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
71
if ($this->_specialized !== null) {
72
$element->setAttribute('specialized', ($this->_specialized ? "true" : "false"));
74
if ($this->_entryLink !== null) {
75
$element->appendChild($this->_entryLink->getDOM($element->ownerDocument));
77
if ($this->_originalEvent !== null) {
78
$element->appendChild($this->_originalEvent->getDOM($element->ownerDocument));
84
* Given a DOMNode representing an attribute, tries to map the data into
85
* instance members. If no mapping is defined, the name and value are
88
* @param DOMNode $attribute The DOMNode attribute needed to be handled
90
protected function takeAttributeFromDOM($attribute)
92
switch ($attribute->localName) {
94
if ($attribute->nodeValue == "true") {
95
$this->_specialized = true;
97
else if ($attribute->nodeValue == "false") {
98
$this->_specialized = false;
101
throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value.");
105
parent::takeAttributeFromDOM($attribute);
110
* Creates individual Entry objects of the appropriate type and
111
* stores them as members of this entry based upon DOM data.
113
* @param DOMNode $child The DOMNode to process
115
protected function takeChildFromDOM($child)
117
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
118
switch ($absoluteNodeName) {
119
case $this->lookupNamespace('gd') . ':' . 'entryLink':
120
$entryLink = new Zend_Gdata_Extension_EntryLink();
121
$entryLink->transferFromDOM($child);
122
$this->_entryLink = $entryLink;
124
case $this->lookupNamespace('gd') . ':' . 'originalEvent':
125
$originalEvent = new Zend_Gdata_Extension_OriginalEvent();
126
$originalEvent->transferFromDOM($child);
127
$this->_originalEvent = $originalEvent;
130
parent::takeChildFromDOM($child);
136
* Get the value for this element's Specialized attribute.
138
* @return bool The requested attribute.
140
public function getSpecialized()
142
return $this->_specialized;
146
* Set the value for this element's Specialized attribute.
148
* @param bool $value The desired value for this attribute.
149
* @return Zend_Gdata_Extension_RecurrenceException The element being modified.
151
public function setSpecialized($value)
153
$this->_specialized = $value;
158
* Get the value for this element's EntryLink attribute.
160
* @return Zend_Gdata_Extension_EntryLink The requested attribute.
162
public function getEntryLink()
164
return $this->_entryLink;
168
* Set the value for this element's EntryLink attribute.
170
* @param Zend_Gdata_Extension_EntryLink $value The desired value for this attribute.
171
* @return Zend_Gdata_Extension_RecurrenceException The element being modified.
173
public function setEntryLink($value)
175
$this->_entryLink = $value;
180
* Get the value for this element's Specialized attribute.
182
* @return Zend_Gdata_Extension_OriginalEvent The requested attribute.
184
public function getOriginalEvent()
186
return $this->_originalEvent;
190
* Set the value for this element's Specialized attribute.
192
* @param Zend_Gdata_Extension_OriginalEvent $value The desired value for this attribute.
193
* @return Zend_Gdata_Extension_RecurrenceException The element being modified.
195
public function setOriginalEvent($value)
197
$this->_originalEvent = $value;