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 | * @subpackage Gdata |
---|
19 | * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
---|
20 | * @license http://framework.zend.com/license/new-bsd New BSD License |
---|
21 | * @version $Id: OriginalEvent.php 24594 2012-01-05 21:27:01Z matthew $ |
---|
22 | */ |
---|
23 | |
---|
24 | /** |
---|
25 | * @see Zend_Gdata_Extension |
---|
26 | */ |
---|
27 | require_once 'Zend/Gdata/Extension.php'; |
---|
28 | |
---|
29 | /** |
---|
30 | * @see Zend_Gdata_Feed |
---|
31 | */ |
---|
32 | require_once 'Zend/Gdata/Feed.php'; |
---|
33 | |
---|
34 | /** |
---|
35 | * @see Zend_Gdata_When |
---|
36 | */ |
---|
37 | require_once 'Zend/Gdata/Extension/When.php'; |
---|
38 | |
---|
39 | /** |
---|
40 | * Represents the gd:originalEvent element |
---|
41 | * |
---|
42 | * @category Zend |
---|
43 | * @package Zend_Gdata |
---|
44 | * @subpackage Gdata |
---|
45 | * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
---|
46 | * @license http://framework.zend.com/license/new-bsd New BSD License |
---|
47 | */ |
---|
48 | class Zend_Gdata_Extension_OriginalEvent extends Zend_Gdata_Extension |
---|
49 | { |
---|
50 | |
---|
51 | protected $_rootElement = 'originalEvent'; |
---|
52 | protected $_id = null; |
---|
53 | protected $_href = null; |
---|
54 | protected $_when = null; |
---|
55 | |
---|
56 | public function __construct($id = null, $href = null, $when = null) |
---|
57 | { |
---|
58 | parent::__construct(); |
---|
59 | $this->_id = $id; |
---|
60 | $this->_href = $href; |
---|
61 | $this->_when = $when; |
---|
62 | } |
---|
63 | |
---|
64 | public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) |
---|
65 | { |
---|
66 | $element = parent::getDOM($doc, $majorVersion, $minorVersion); |
---|
67 | if ($this->_id !== null) { |
---|
68 | $element->setAttribute('id', $this->_id); |
---|
69 | } |
---|
70 | if ($this->_href !== null) { |
---|
71 | $element->setAttribute('href', $this->_href); |
---|
72 | } |
---|
73 | if ($this->_when !== null) { |
---|
74 | $element->appendChild($this->_when->getDOM($element->ownerDocument)); |
---|
75 | } |
---|
76 | return $element; |
---|
77 | } |
---|
78 | |
---|
79 | protected function takeAttributeFromDOM($attribute) |
---|
80 | { |
---|
81 | switch ($attribute->localName) { |
---|
82 | case 'id': |
---|
83 | $this->_id = $attribute->nodeValue; |
---|
84 | break; |
---|
85 | case 'href': |
---|
86 | $this->_href = $attribute->nodeValue; |
---|
87 | break; |
---|
88 | default: |
---|
89 | parent::takeAttributeFromDOM($attribute); |
---|
90 | } |
---|
91 | } |
---|
92 | |
---|
93 | protected function takeChildFromDOM($child) |
---|
94 | { |
---|
95 | $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; |
---|
96 | switch ($absoluteNodeName) { |
---|
97 | case $this->lookupNamespace('gd') . ':' . 'when'; |
---|
98 | $when = new Zend_Gdata_Extension_When(); |
---|
99 | $when->transferFromDOM($child); |
---|
100 | $this->_when = $when; |
---|
101 | break; |
---|
102 | default: |
---|
103 | parent::takeChildFromDOM($child); |
---|
104 | break; |
---|
105 | } |
---|
106 | } |
---|
107 | |
---|
108 | public function getId() |
---|
109 | { |
---|
110 | return $this->_id; |
---|
111 | } |
---|
112 | |
---|
113 | public function setId($value) |
---|
114 | { |
---|
115 | $this->_id = $value; |
---|
116 | return $this; |
---|
117 | } |
---|
118 | |
---|
119 | public function getHref() |
---|
120 | { |
---|
121 | return $this->_href; |
---|
122 | } |
---|
123 | |
---|
124 | public function setHref($value) |
---|
125 | { |
---|
126 | $this->_href = $value; |
---|
127 | return $this; |
---|
128 | } |
---|
129 | |
---|
130 | public function getWhen() |
---|
131 | { |
---|
132 | return $this->_when; |
---|
133 | } |
---|
134 | |
---|
135 | public function setWhen($value) |
---|
136 | { |
---|
137 | $this->_when = $value; |
---|
138 | return $this; |
---|
139 | } |
---|
140 | |
---|
141 | |
---|
142 | } |
---|