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-2010 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
25 * @see Zend_Gdata_Entry
27 require_once 'Zend/Gdata/Entry.php';
30 * @see Zend_Gdata_Gapps_Extension_Login
32 require_once 'Zend/Gdata/Gapps/Extension/Login.php';
35 * @see Zend_Gdata_Gapps_Extension_Nickname
37 require_once 'Zend/Gdata/Gapps/Extension/Nickname.php';
40 * Data model class for a Google Apps Nickname Entry.
42 * Each nickname entry describes a single nickname within a Google Apps
43 * hosted domain. Each user may own several nicknames, but each nickname may
44 * only belong to one user. Multiple entries are contained within instances
45 * of Zend_Gdata_Gapps_NicknameFeed.
47 * To transfer nickname entries to and from the Google Apps servers,
48 * including creating new entries, refer to the Google Apps service class,
51 * This class represents <atom:entry> in the Google Data protocol.
56 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
57 * @license http://framework.zend.com/license/new-bsd New BSD License
59 class Zend_Gdata_Gapps_NicknameEntry extends Zend_Gdata_Entry
62 protected $_entryClassName = 'Zend_Gdata_Gapps_NicknameEntry';
65 * <apps:login> element used to hold information about the owner
66 * of this nickname, including their username.
68 * @var Zend_Gdata_Gapps_Extension_Login
70 protected $_login = null;
73 * <apps:nickname> element used to hold the name of this nickname.
75 * @var Zend_Gdata_Gapps_Extension_Nickname
77 protected $_nickname = null;
80 * Create a new instance.
82 * @param DOMElement $element (optional) DOMElement from which this
83 * object should be constructed.
85 public function __construct($element = null)
87 $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces);
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;