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

Last change on this file since 44 was 44, checked in by luciano, 14 years ago
File size: 4.3 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 App
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_App_Extension
25 */
26require_once 'Zend/Gdata/App/Extension.php';
27
28/**
29 * @see Zend_Gdata_App_Extension_Name
30 */
31require_once 'Zend/Gdata/App/Extension/Name.php';
32
33/**
34 * @see Zend_Gdata_App_Extension_Email
35 */
36require_once 'Zend/Gdata/App/Extension/Email.php';
37
38/**
39 * @see Zend_Gdata_App_Extension_Uri
40 */
41require_once 'Zend/Gdata/App/Extension/Uri.php';
42
43/**
44 * Base class for people (currently used by atom:author, atom:contributor)
45 *
46 * @category Zend
47 * @package Zend_Gdata
48 * @subpackage App
49 * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
50 * @license http://framework.zend.com/license/new-bsd New BSD License
51 */
52abstract class Zend_Gdata_App_Extension_Person extends Zend_Gdata_App_Extension
53{
54
55 protected $_rootElement = null;
56 protected $_name = null;
57 protected $_email = null;
58 protected $_uri = null;
59
60 public function __construct($name = null, $email = null, $uri = null)
61 {
62 parent::__construct();
63 $this->_name = $name;
64 $this->_email = $email;
65 $this->_uri = $uri;
66 }
67
68 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
69 {
70 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
71 if ($this->_name != null) {
72 $element->appendChild($this->_name->getDOM($element->ownerDocument));
73 }
74 if ($this->_email != null) {
75 $element->appendChild($this->_email->getDOM($element->ownerDocument));
76 }
77 if ($this->_uri != null) {
78 $element->appendChild($this->_uri->getDOM($element->ownerDocument));
79 }
80 return $element;
81 }
82
83 protected function takeChildFromDOM($child)
84 {
85 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
86 switch ($absoluteNodeName) {
87 case $this->lookupNamespace('atom') . ':' . 'name':
88 $name = new Zend_Gdata_App_Extension_Name();
89 $name->transferFromDOM($child);
90 $this->_name = $name;
91 break;
92 case $this->lookupNamespace('atom') . ':' . 'email':
93 $email = new Zend_Gdata_App_Extension_Email();
94 $email->transferFromDOM($child);
95 $this->_email = $email;
96 break;
97 case $this->lookupNamespace('atom') . ':' . 'uri':
98 $uri = new Zend_Gdata_App_Extension_Uri();
99 $uri->transferFromDOM($child);
100 $this->_uri = $uri;
101 break;
102 default:
103 parent::takeChildFromDOM($child);
104 break;
105 }
106 }
107
108 /**
109 * @return Zend_Gdata_App_Extension_Name
110 */
111 public function getName()
112 {
113 return $this->_name;
114 }
115
116 /**
117 * @param Zend_Gdata_App_Extension_Name $value
118 * @return Zend_Gdata_App_Entry Provides a fluent interface
119 */
120 public function setName($value)
121 {
122 $this->_name = $value;
123 return $this;
124 }
125
126 /**
127 * @return Zend_Gdata_App_Extension_Email
128 */
129 public function getEmail()
130 {
131 return $this->_email;
132 }
133
134 /**
135 * @param Zend_Gdata_App_Extension_Email $value
136 * @return Zend_Gdata_App_Extension_Person Provides a fluent interface
137 */
138 public function setEmail($value)
139 {
140 $this->_email = $value;
141 return $this;
142 }
143
144 /**
145 * @return Zend_Gdata_App_Extension_Uri
146 */
147 public function getUri()
148 {
149 return $this->_uri;
150 }
151
152 /**
153 * @param Zend_Gdata_App_Extension_Uri $value
154 * @return Zend_Gdata_App_Extension_Person Provides a fluent interface
155 */
156 public function setUri($value)
157 {
158 $this->_uri = $value;
159 return $this;
160 }
161
162}
Note: See TracBrowser for help on using the repository browser.