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

Last change on this file since 44 was 44, checked in by luciano, 14 years ago
File size: 5.8 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 Gapps
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_Entry
25 */
26require_once 'Zend/Gdata/Entry.php';
27
28/**
29 * @see Zend_Gdata_Gapps_Extension_Login
30 */
31require_once 'Zend/Gdata/Gapps/Extension/Login.php';
32
33/**
34 * @see Zend_Gdata_Gapps_Extension_Nickname
35 */
36require_once 'Zend/Gdata/Gapps/Extension/Nickname.php';
37
38/**
39 * Data model class for a Google Apps Nickname Entry.
40 *
41 * Each nickname entry describes a single nickname within a Google Apps
42 * hosted domain. Each user may own several nicknames, but each nickname may
43 * only belong to one user. Multiple entries are contained within instances
44 * of Zend_Gdata_Gapps_NicknameFeed.
45 *
46 * To transfer nickname entries to and from the Google Apps servers,
47 * including creating new entries, refer to the Google Apps service class,
48 * Zend_Gdata_Gapps.
49 *
50 * This class represents <atom:entry> in the Google Data protocol.
51 *
52 * @category Zend
53 * @package Zend_Gdata
54 * @subpackage Gapps
55 * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
56 * @license http://framework.zend.com/license/new-bsd New BSD License
57 */
58class Zend_Gdata_Gapps_NicknameEntry extends Zend_Gdata_Entry
59{
60
61 protected $_entryClassName = 'Zend_Gdata_Gapps_NicknameEntry';
62
63 /**
64 * <apps:login> element used to hold information about the owner
65 * of this nickname, including their username.
66 *
67 * @var Zend_Gdata_Gapps_Extension_Login
68 */
69 protected $_login = null;
70
71 /**
72 * <apps:nickname> element used to hold the name of this nickname.
73 *
74 * @var Zend_Gdata_Gapps_Extension_Nickname
75 */
76 protected $_nickname = null;
77
78 /**
79 * Create a new instance.
80 *
81 * @param DOMElement $element (optional) DOMElement from which this
82 * object should be constructed.
83 */
84 public function __construct($element = null)
85 {
86 $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces);
87 parent::__construct($element);
88 }
89
90 /**
91 * Retrieves a DOMElement which corresponds to this element and all
92 * child properties. This is used to build an entry back into a DOM
93 * and eventually XML text for application storage/persistence.
94 *
95 * @param DOMDocument $doc The DOMDocument used to construct DOMElements
96 * @return DOMElement The DOMElement representing this element and all
97 * child properties.
98 */
99 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
100 {
101 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
102 if ($this->_login !== null) {
103 $element->appendChild($this->_login->getDOM($element->ownerDocument));
104 }
105 if ($this->_nickname !== null) {
106 $element->appendChild($this->_nickname->getDOM($element->ownerDocument));
107 }
108 return $element;
109 }
110
111 /**
112 * Creates individual Entry objects of the appropriate type and
113 * stores them as members of this entry based upon DOM data.
114 *
115 * @param DOMNode $child The DOMNode to process
116 */
117 protected function takeChildFromDOM($child)
118 {
119 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
120
121 switch ($absoluteNodeName) {
122 case $this->lookupNamespace('apps') . ':' . 'login';
123 $login = new Zend_Gdata_Gapps_Extension_Login();
124 $login->transferFromDOM($child);
125 $this->_login = $login;
126 break;
127 case $this->lookupNamespace('apps') . ':' . 'nickname';
128 $nickname = new Zend_Gdata_Gapps_Extension_Nickname();
129 $nickname->transferFromDOM($child);
130 $this->_nickname = $nickname;
131 break;
132 default:
133 parent::takeChildFromDOM($child);
134 break;
135 }
136 }
137
138 /**
139 * Get the value of the login property for this object.
140 *
141 * @see setLogin
142 * @return Zend_Gdata_Gapps_Extension_Login The requested object.
143 */
144 public function getLogin()
145 {
146 return $this->_login;
147 }
148
149 /**
150 * Set the value of the login property for this object. This property
151 * is used to store the username address of the current user.
152 *
153 * @param Zend_Gdata_Gapps_Extension_Login $value The desired value for
154 * this instance's login property.
155 * @return Zend_Gdata_Gapps_NicknameEntry Provides a fluent interface.
156 */
157 public function setLogin($value)
158 {
159 $this->_login = $value;
160 return $this;
161 }
162
163 /**
164 * Get the value of the nickname property for this object.
165 *
166 * @see setNickname
167 * @return Zend_Gdata_Gapps_Extension_Nickname The requested object.
168 */
169 public function getNickname()
170 {
171 return $this->_nickname;
172 }
173
174 /**
175 * Set the value of the nickname property for this object. This property
176 * is used to store the the name of the current nickname.
177 *
178 * @param Zend_Gdata_Gapps_Extension_Nickname $value The desired value for
179 * this instance's nickname property.
180 * @return Zend_Gdata_Gapps_NicknameEntry Provides a fluent interface.
181 */
182 public function setNickname($value)
183 {
184 $this->_nickname = $value;
185 return $this;
186 }
187
188}
Note: See TracBrowser for help on using the repository browser.