~chroot64bit/zivios/gentoo-experimental

« back to all changes in this revision

Viewing changes to application/library/Zend/Gdata/Gapps/NicknameEntry.php

  • Committer: Mustafa A. Hashmi
  • Date: 2008-12-04 13:32:21 UTC
  • Revision ID: mhashmi@zivios.org-20081204133221-0nd1trunwevijj38
Inclusion of new installation framework with ties to zend layout and dojo layout

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 */
 
26
require_once 'Zend/Gdata/Entry.php';
 
27
 
 
28
/**
 
29
 * @see Zend_Gdata_Gapps_Extension_Login
 
30
 */
 
31
require_once 'Zend/Gdata/Gapps/Extension/Login.php';
 
32
 
 
33
/**
 
34
 * @see Zend_Gdata_Gapps_Extension_Nickname
 
35
 */
 
36
require_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
 * @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
 
56
 */
 
57
class Zend_Gdata_Gapps_NicknameEntry extends Zend_Gdata_Entry
 
58
{
 
59
 
 
60
    protected $_entryClassName = 'Zend_Gdata_Gapps_NicknameEntry';
 
61
 
 
62
    /**
 
63
     * <apps:login> element used to hold information about the owner 
 
64
     * of this nickname, including their username.
 
65
     * 
 
66
     * @var Zend_Gdata_Gapps_Extension_Login
 
67
     */
 
68
    protected $_login = null;
 
69
    
 
70
    /**
 
71
     * <apps:nickname> element used to hold the name of this nickname.
 
72
     * 
 
73
     * @var Zend_Gdata_Gapps_Extension_Nickname
 
74
     */
 
75
    protected $_nickname = null;
 
76
    
 
77
    /**
 
78
     * Create a new instance.
 
79
     * 
 
80
     * @param DOMElement $element (optional) DOMElement from which this
 
81
     *          object should be constructed.
 
82
     */
 
83
    public function __construct($element = null)
 
84
    {
 
85
        foreach (Zend_Gdata_Gapps::$namespaces as $nsPrefix => $nsUri) {
 
86
            $this->registerNamespace($nsPrefix, $nsUri);
 
87
        }
 
88
        parent::__construct($element);
 
89
    }
 
90
 
 
91
    /**
 
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.
 
95
     *
 
96
     * @param DOMDocument $doc The DOMDocument used to construct DOMElements
 
97
     * @return DOMElement The DOMElement representing this element and all
 
98
     *          child properties.
 
99
     */
 
100
    public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
 
101
    {
 
102
        $element = parent::getDOM($doc, $majorVersion, $minorVersion);
 
103
        if ($this->_login !== null) {
 
104
            $element->appendChild($this->_login->getDOM($element->ownerDocument));
 
105
        }
 
106
        if ($this->_nickname !== null) {
 
107
            $element->appendChild($this->_nickname->getDOM($element->ownerDocument));
 
108
        }
 
109
        return $element;
 
110
    }
 
111
    
 
112
    /**
 
113
     * Creates individual Entry objects of the appropriate type and
 
114
     * stores them as members of this entry based upon DOM data.
 
115
     *
 
116
     * @param DOMNode $child The DOMNode to process
 
117
     */
 
118
    protected function takeChildFromDOM($child)
 
119
    {
 
120
        $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
 
121
        
 
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;
 
127
                break;
 
128
            case $this->lookupNamespace('apps') . ':' . 'nickname'; 
 
129
                $nickname = new Zend_Gdata_Gapps_Extension_Nickname();
 
130
                $nickname->transferFromDOM($child);
 
131
                $this->_nickname = $nickname;
 
132
                break;
 
133
            default:
 
134
                parent::takeChildFromDOM($child);
 
135
                break;
 
136
        }
 
137
    }
 
138
 
 
139
    /**
 
140
     * Get the value of the login property for this object.
 
141
     *
 
142
     * @see setLogin
 
143
     * @return Zend_Gdata_Gapps_Extension_Login The requested object.
 
144
     */
 
145
    public function getLogin()
 
146
    {
 
147
        return $this->_login;
 
148
    }
 
149
 
 
150
    /**
 
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.
 
153
     * 
 
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.
 
157
     */
 
158
    public function setLogin($value)
 
159
    {
 
160
        $this->_login = $value;
 
161
        return $this;
 
162
    }
 
163
 
 
164
    /**
 
165
     * Get the value of the nickname property for this object.
 
166
     *
 
167
     * @see setNickname
 
168
     * @return Zend_Gdata_Gapps_Extension_Nickname The requested object.
 
169
     */
 
170
    public function getNickname()
 
171
    {
 
172
        return $this->_nickname;
 
173
    }
 
174
 
 
175
    /**
 
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.
 
178
     * 
 
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.
 
182
     */
 
183
    public function setNickname($value)
 
184
    {
 
185
        $this->_nickname = $value;
 
186
        return $this;
 
187
    }
 
188
 
 
189
}