~chroot64bit/zivios/gentoo-experimental

« back to all changes in this revision

Viewing changes to application/library/Zend/Gdata/Photos/CommentEntry.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 Photos
 
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_Photos_Extension_Id
 
30
 */
 
31
require_once 'Zend/Gdata/Photos/Extension/Id.php';
 
32
 
 
33
/**
 
34
 * @see Zend_Gdata_Photos_Extension_PhotoId
 
35
 */
 
36
require_once 'Zend/Gdata/Photos/Extension/PhotoId.php';
 
37
 
 
38
/**
 
39
 * @see Zend_Gdata_Photos_Extension_Weight
 
40
 */
 
41
require_once 'Zend/Gdata/Photos/Extension/Weight.php';
 
42
 
 
43
/**
 
44
 * @see Zend_Gdata_App_Extension_Category
 
45
 */
 
46
require_once 'Zend/Gdata/App/Extension/Category.php';
 
47
 
 
48
/**
 
49
 * Data model class for a Comment Entry.
 
50
 * 
 
51
 * To transfer user entries to and from the servers, including 
 
52
 * creating new entries, refer to the service class,
 
53
 * Zend_Gdata_Photos.
 
54
 *
 
55
 * This class represents <atom:entry> in the Google Data protocol.
 
56
 *
 
57
 * @category   Zend
 
58
 * @package    Zend_Gdata
 
59
 * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
 
60
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 
61
 */
 
62
class Zend_Gdata_Photos_CommentEntry extends Zend_Gdata_Entry
 
63
{
 
64
 
 
65
    protected $_entryClassName = 'Zend_Gdata_Photos_CommentEntry';
 
66
    
 
67
    /**
 
68
     * gphoto:id element
 
69
     *
 
70
     * @var Zend_Gdata_Photos_Extension_Id
 
71
     */
 
72
    protected $_gphotoId = null;
 
73
    
 
74
    /**
 
75
     * gphoto:photoid element, differs from gphoto:id as this is an
 
76
     * actual identification number unique exclusively to photo entries,
 
77
     * whereas gphoto:id can refer to all gphoto objects
 
78
     *
 
79
     * @var Zend_Gdata_Photos_Extension_PhotoId
 
80
     */
 
81
    protected $_gphotoPhotoId = null;
 
82
 
 
83
    /**
 
84
     * Create a new instance.
 
85
     * 
 
86
     * @param DOMElement $element (optional) DOMElement from which this
 
87
     *          object should be constructed.
 
88
     */
 
89
    public function __construct($element = null)
 
90
    {
 
91
        foreach (Zend_Gdata_Photos::$namespaces as $nsPrefix => $nsUri) {
 
92
            $this->registerNamespace($nsPrefix, $nsUri);
 
93
        }
 
94
        parent::__construct($element);
 
95
        
 
96
        $category = new Zend_Gdata_App_Extension_Category(
 
97
            'http://schemas.google.com/photos/2007#comment',
 
98
            'http://schemas.google.com/g/2005#kind');
 
99
        $this->setCategory(array($category));
 
100
    }
 
101
 
 
102
    /**
 
103
     * Retrieves a DOMElement which corresponds to this element and all
 
104
     * child properties.  This is used to build an entry back into a DOM
 
105
     * and eventually XML text for application storage/persistence.
 
106
     *
 
107
     * @param DOMDocument $doc The DOMDocument used to construct DOMElements
 
108
     * @return DOMElement The DOMElement representing this element and all
 
109
     *          child properties.
 
110
     */
 
111
    public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
 
112
    {
 
113
        $element = parent::getDOM($doc, $majorVersion, $minorVersion);
 
114
        if ($this->_gphotoId !== null) {
 
115
            $element->appendChild($this->_gphotoId->getDOM($element->ownerDocument));
 
116
        }
 
117
        if ($this->_gphotoPhotoId !== null) {
 
118
            $element->appendChild($this->_gphotoPhotoId->getDOM($element->ownerDocument));
 
119
        }
 
120
        return $element;
 
121
    }
 
122
 
 
123
    /**
 
124
     * Creates individual Entry objects of the appropriate type and
 
125
     * stores them as members of this entry based upon DOM data.
 
126
     *
 
127
     * @param DOMNode $child The DOMNode to process
 
128
     */
 
129
    protected function takeChildFromDOM($child)
 
130
    {
 
131
        $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
 
132
        
 
133
        switch ($absoluteNodeName) {
 
134
            case $this->lookupNamespace('gphoto') . ':' . 'id'; 
 
135
                $id = new Zend_Gdata_Photos_Extension_Id();
 
136
                $id->transferFromDOM($child);
 
137
                $this->_gphotoId = $id;
 
138
                break;
 
139
            case $this->lookupNamespace('gphoto') . ':' . 'photoid'; 
 
140
                $photoid = new Zend_Gdata_Photos_Extension_PhotoId();
 
141
                $photoid->transferFromDOM($child);
 
142
                $this->_gphotoPhotoId = $photoid;
 
143
                break;
 
144
            default:
 
145
                parent::takeChildFromDOM($child);
 
146
                break;
 
147
        }
 
148
    }
 
149
 
 
150
    /**
 
151
     * Get the value for this element's gphoto:photoid attribute.
 
152
     *
 
153
     * @see setGphotoPhotoId
 
154
     * @return string The requested attribute.
 
155
     */
 
156
    public function getGphotoPhotoId()
 
157
    {
 
158
        return $this->_gphotoPhotoId;
 
159
    }
 
160
 
 
161
    /**
 
162
     * Set the value for this element's gphoto:photoid attribute.
 
163
     *
 
164
     * @param string $value The desired value for this attribute.
 
165
     * @return Zend_Gdata_Photos_Extension_PhotoId The element being modified.
 
166
     */
 
167
    public function setGphotoPhotoId($value)
 
168
    {
 
169
        $this->_gphotoPhotoId = $value;
 
170
        return $this;
 
171
    }
 
172
 
 
173
    /**
 
174
     * Get the value for this element's gphoto:id attribute.
 
175
     *
 
176
     * @see setGphotoId
 
177
     * @return string The requested attribute.
 
178
     */
 
179
    public function getGphotoId()
 
180
    {
 
181
        return $this->_gphotoId;
 
182
    }
 
183
 
 
184
    /**
 
185
     * Set the value for this element's gphoto:id attribute.
 
186
     *
 
187
     * @param string $value The desired value for this attribute.
 
188
     * @return Zend_Gdata_Photos_Extension_Id The element being modified.
 
189
     */
 
190
    public function setGphotoId($value)
 
191
    {
 
192
        $this->_gphotoId = $value;
 
193
        return $this;
 
194
    }
 
195
}