source: trunk/www.guidonia.net/wp/wp-content/plugins/webtv/Drivers/Zend/Gdata/Extension/OriginalEvent.php@ 44

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