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.
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
24
* @see Zend_Gdata_Entry
26
require_once 'Zend/Gdata/Entry.php';
29
* @see Zend_Gdata_Gapps_Extension_Login
31
require_once 'Zend/Gdata/Gapps/Extension/Login.php';
34
* @see Zend_Gdata_Gapps_Extension_Nickname
36
require_once 'Zend/Gdata/Gapps/Extension/Nickname.php';
39
* Data model class for a Google Apps Nickname Entry.
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.
46
* To transfer nickname entries to and from the Google Apps servers,
47
* including creating new entries, refer to the Google Apps service class,
50
* This class represents <atom:entry> in the Google Data protocol.
54
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
55
* @license http://framework.zend.com/license/new-bsd New BSD License
57
class Zend_Gdata_Gapps_NicknameEntry extends Zend_Gdata_Entry
60
protected $_entryClassName = 'Zend_Gdata_Gapps_NicknameEntry';
63
* <apps:login> element used to hold information about the owner
64
* of this nickname, including their username.
66
* @var Zend_Gdata_Gapps_Extension_Login
68
protected $_login = null;
71
* <apps:nickname> element used to hold the name of this nickname.
73
* @var Zend_Gdata_Gapps_Extension_Nickname
75
protected $_nickname = null;
78
* Create a new instance.
80
* @param DOMElement $element (optional) DOMElement from which this
81
* object should be constructed.
83
public function __construct($element = null)
85
foreach (Zend_Gdata_Gapps::$namespaces as $nsPrefix => $nsUri) {
86
$this->registerNamespace($nsPrefix, $nsUri);
88
parent::__construct($element);
92
* Retrieves a DOMElement which corresponds to this element and all
93
* child properties. This is used to build an entry back into a DOM
94
* and eventually XML text for application storage/persistence.
96
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
97
* @return DOMElement The DOMElement representing this element and all
100
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
102
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
103
if ($this->_login !== null) {
104
$element->appendChild($this->_login->getDOM($element->ownerDocument));
106
if ($this->_nickname !== null) {
107
$element->appendChild($this->_nickname->getDOM($element->ownerDocument));
113
* Creates individual Entry objects of the appropriate type and
114
* stores them as members of this entry based upon DOM data.
116
* @param DOMNode $child The DOMNode to process
118
protected function takeChildFromDOM($child)
120
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
122
switch ($absoluteNodeName) {
123
case $this->lookupNamespace('apps') . ':' . 'login';
124
$login = new Zend_Gdata_Gapps_Extension_Login();
125
$login->transferFromDOM($child);
126
$this->_login = $login;
128
case $this->lookupNamespace('apps') . ':' . 'nickname';
129
$nickname = new Zend_Gdata_Gapps_Extension_Nickname();
130
$nickname->transferFromDOM($child);
131
$this->_nickname = $nickname;
134
parent::takeChildFromDOM($child);
140
* Get the value of the login property for this object.
143
* @return Zend_Gdata_Gapps_Extension_Login The requested object.
145
public function getLogin()
147
return $this->_login;
151
* Set the value of the login property for this object. This property
152
* is used to store the username address of the current user.
154
* @param Zend_Gdata_Gapps_Extension_Login $value The desired value for
155
* this instance's login property.
156
* @return Zend_Gdata_Gapps_NicknameEntry Provides a fluent interface.
158
public function setLogin($value)
160
$this->_login = $value;
165
* Get the value of the nickname property for this object.
168
* @return Zend_Gdata_Gapps_Extension_Nickname The requested object.
170
public function getNickname()
172
return $this->_nickname;
176
* Set the value of the nickname property for this object. This property
177
* is used to store the the name of the current nickname.
179
* @param Zend_Gdata_Gapps_Extension_Nickname $value The desired value for
180
* this instance's nickname property.
181
* @return Zend_Gdata_Gapps_NicknameEntry Provides a fluent interface.
183
public function setNickname($value)
185
$this->_nickname = $value;