]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - Zend/Gdata/Media/Entry.php
Release 6.5.0
[Github/sugarcrm.git] / Zend / Gdata / Media / Entry.php
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 Media
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
21
22  */
23
24 /**
25  * @see Zend_Gdata_Entry
26  */
27 require_once 'Zend/Gdata/Entry.php';
28
29 /**
30  * @see Zend_Gdata_Media
31  */
32 require_once 'Zend/Gdata/Media.php';
33
34 /**
35  * @see Zend_Gdata_Media_Extension_MediaGroup
36  */
37 require_once 'Zend/Gdata/Media/Extension/MediaGroup.php';
38
39 /**
40  * Represents the Gdata flavor of an Atom entry
41  *
42  * @category   Zend
43  * @package    Zend_Gdata
44  * @subpackage Media
45  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
46  * @license    http://framework.zend.com/license/new-bsd     New BSD License
47  */
48 class Zend_Gdata_Media_Entry extends Zend_Gdata_Entry
49 {
50
51     protected $_entryClassName = 'Zend_Gdata_Media_Entry';
52
53     /**
54      * media:group element
55      *
56      * @var Zend_Gdata_Media_Extension_MediaGroup
57      */
58     protected $_mediaGroup = null;
59
60     /**
61      * Create a new instance.
62      *
63      * @param DOMElement $element (optional) DOMElement from which this
64      *          object should be constructed.
65      */
66     public function __construct($element = null)
67     {
68         $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces);
69         parent::__construct($element);
70     }
71
72     /**
73      * Retrieves a DOMElement which corresponds to this element and all
74      * child properties.  This is used to build an entry back into a DOM
75      * and eventually XML text for application storage/persistence.
76      *
77      * @param DOMDocument $doc The DOMDocument used to construct DOMElements
78      * @return DOMElement The DOMElement representing this element and all
79      *          child properties.
80      */
81     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
82     {
83         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
84         if ($this->_mediaGroup != null) {
85             $element->appendChild($this->_mediaGroup->getDOM($element->ownerDocument));
86         }
87         return $element;
88     }
89
90     /**
91      * Creates individual Entry objects of the appropriate type and
92      * stores them as members of this entry based upon DOM data.
93      *
94      * @param DOMNode $child The DOMNode to process
95      */
96     protected function takeChildFromDOM($child)
97     {
98         $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
99         switch ($absoluteNodeName) {
100         case $this->lookupNamespace('media') . ':' . 'group':
101             $mediaGroup = new Zend_Gdata_Media_Extension_MediaGroup();
102             $mediaGroup->transferFromDOM($child);
103             $this->_mediaGroup = $mediaGroup;
104             break;
105         default:
106             parent::takeChildFromDOM($child);
107             break;
108         }
109     }
110
111     /**
112      * Returns the entry's mediaGroup object.
113      *
114      * @return Zend_Gdata_Media_Extension_MediaGroup
115     */
116     public function getMediaGroup()
117     {
118         return $this->_mediaGroup;
119     }
120
121     /**
122      * Sets the entry's mediaGroup object.
123      *
124      * @param Zend_Gdata_Media_Extension_MediaGroup $mediaGroup
125      * @return Zend_Gdata_Media_Entry Provides a fluent interface
126      */
127     public function setMediaGroup($mediaGroup)
128     {
129         $this->_mediaGroup = $mediaGroup;
130         return $this;
131     }
132
133
134 }