~chroot64bit/zivios/gentoo-experimental

« back to all changes in this revision

Viewing changes to application/library/Zend/Gdata/Extension/RecurrenceException.php

  • Committer: Mustafa A. Hashmi
  • Date: 2008-12-04 13:32:21 UTC
  • Revision ID: mhashmi@zivios.org-20081204133221-0nd1trunwevijj38
Inclusion of new installation framework with ties to zend layout and dojo layout

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 * @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
 
20
 */
 
21
 
 
22
/**
 
23
 * @see Zend_Gdata_Extension
 
24
 */
 
25
require_once 'Zend/Gdata/Extension.php';
 
26
 
 
27
/**
 
28
 * Data model class to represent an entry's recurrenceException
 
29
 *
 
30
 * @category   Zend
 
31
 * @package    Zend_Gdata
 
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
 
34
 */
 
35
class Zend_Gdata_Extension_RecurrenceException extends Zend_Gdata_Extension
 
36
{
 
37
 
 
38
    protected $_rootElement = 'recurrenceException';
 
39
    protected $_specialized = null;
 
40
    protected $_entryLink = null;
 
41
    protected $_originalEvent = null;
 
42
 
 
43
    /**
 
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.
 
48
     */
 
49
    public function __construct($specialized = null, $entryLink = null,
 
50
            $originalEvent = null)
 
51
    {
 
52
        parent::__construct();
 
53
        $this->_specialized = $specialized;
 
54
        $this->_entryLink = $entryLink;
 
55
        $this->_originalEvent = $originalEvent;
 
56
    }
 
57
 
 
58
    /**
 
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.
 
63
     *
 
64
     * @param DOMDocument $doc The DOMDocument used to construct DOMElements
 
65
     * @return DOMElement The DOMElement representing this element and all
 
66
     * child properties.
 
67
     */
 
68
    public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
 
69
    {
 
70
        $element = parent::getDOM($doc, $majorVersion, $minorVersion);
 
71
        if ($this->_specialized !== null) {
 
72
            $element->setAttribute('specialized', ($this->_specialized ? "true" : "false"));
 
73
        }
 
74
        if ($this->_entryLink !== null) {
 
75
            $element->appendChild($this->_entryLink->getDOM($element->ownerDocument));
 
76
        }
 
77
        if ($this->_originalEvent !== null) {
 
78
            $element->appendChild($this->_originalEvent->getDOM($element->ownerDocument));
 
79
        }
 
80
        return $element;
 
81
    }
 
82
 
 
83
    /**
 
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
 
86
     * stored in an array.
 
87
     *
 
88
     * @param DOMNode $attribute The DOMNode attribute needed to be handled
 
89
     */
 
90
    protected function takeAttributeFromDOM($attribute)
 
91
    {
 
92
        switch ($attribute->localName) {
 
93
        case 'specialized':
 
94
            if ($attribute->nodeValue == "true") {
 
95
                $this->_specialized = true;
 
96
            }
 
97
            else if ($attribute->nodeValue == "false") {
 
98
                $this->_specialized = false;
 
99
            }
 
100
            else {
 
101
                throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value.");
 
102
            }
 
103
            break;
 
104
        default:
 
105
            parent::takeAttributeFromDOM($attribute);
 
106
        }
 
107
    }
 
108
 
 
109
    /**
 
110
     * Creates individual Entry objects of the appropriate type and
 
111
     * stores them as members of this entry based upon DOM data.
 
112
     *
 
113
     * @param DOMNode $child The DOMNode to process
 
114
     */
 
115
    protected function takeChildFromDOM($child)
 
116
    {
 
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;
 
123
            break;
 
124
        case $this->lookupNamespace('gd') . ':' . 'originalEvent':
 
125
            $originalEvent = new Zend_Gdata_Extension_OriginalEvent();
 
126
            $originalEvent->transferFromDOM($child);
 
127
            $this->_originalEvent = $originalEvent;
 
128
            break;
 
129
        default:
 
130
            parent::takeChildFromDOM($child);
 
131
            break;
 
132
        }
 
133
    }
 
134
 
 
135
    /**
 
136
     * Get the value for this element's Specialized attribute.
 
137
     *
 
138
     * @return bool The requested attribute.
 
139
     */
 
140
    public function getSpecialized()
 
141
    {
 
142
        return $this->_specialized;
 
143
    }
 
144
 
 
145
    /**
 
146
     * Set the value for this element's Specialized attribute.
 
147
     *
 
148
     * @param bool $value The desired value for this attribute.
 
149
     * @return Zend_Gdata_Extension_RecurrenceException The element being modified.
 
150
     */
 
151
    public function setSpecialized($value)
 
152
    {
 
153
        $this->_specialized = $value;
 
154
        return $this;
 
155
    }
 
156
 
 
157
    /**
 
158
     * Get the value for this element's EntryLink attribute.
 
159
     *
 
160
     * @return Zend_Gdata_Extension_EntryLink The requested attribute.
 
161
     */
 
162
    public function getEntryLink()
 
163
    {
 
164
        return $this->_entryLink;
 
165
    }
 
166
 
 
167
    /**
 
168
     * Set the value for this element's EntryLink attribute.
 
169
     *
 
170
     * @param Zend_Gdata_Extension_EntryLink $value The desired value for this attribute.
 
171
     * @return Zend_Gdata_Extension_RecurrenceException The element being modified.
 
172
     */
 
173
    public function setEntryLink($value)
 
174
    {
 
175
        $this->_entryLink = $value;
 
176
        return $this;
 
177
    }
 
178
 
 
179
    /**
 
180
     * Get the value for this element's Specialized attribute.
 
181
     *
 
182
     * @return Zend_Gdata_Extension_OriginalEvent The requested attribute.
 
183
     */
 
184
    public function getOriginalEvent()
 
185
    {
 
186
        return $this->_originalEvent;
 
187
    }
 
188
 
 
189
    /**
 
190
     * Set the value for this element's Specialized attribute.
 
191
     *
 
192
     * @param Zend_Gdata_Extension_OriginalEvent $value The desired value for this attribute.
 
193
     * @return Zend_Gdata_Extension_RecurrenceException The element being modified.
 
194
     */
 
195
    public function setOriginalEvent($value)
 
196
    {
 
197
        $this->_originalEvent = $value;
 
198
        return $this;
 
199
    }
 
200
 
 
201
}
 
202