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_Media
32 require_once 'Zend/Gdata/Media.php';
35 * @see Zend_Gdata_Media_Extension_MediaGroup
37 require_once 'Zend/Gdata/Media/Extension/MediaGroup.php';
40 * Represents the Gdata flavor of an Atom entry
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
48 class Zend_Gdata_Media_Entry extends Zend_Gdata_Entry
51 protected $_entryClassName = 'Zend_Gdata_Media_Entry';
56 * @var Zend_Gdata_Media_Extension_MediaGroup
58 protected $_mediaGroup = null;
61 * Create a new instance.
63 * @param DOMElement $element (optional) DOMElement from which this
64 * object should be constructed.
66 public function __construct($element = null)
68 $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces);
69 parent::__construct($element);
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.
77 * @param DOMDocument $doc The DOMDocument used to construct DOMElements
78 * @return DOMElement The DOMElement representing this element and all
81 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
83 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
84 if ($this->_mediaGroup != null) {
85 $element->appendChild($this->_mediaGroup->getDOM($element->ownerDocument));
91 * Creates individual Entry objects of the appropriate type and
92 * stores them as members of this entry based upon DOM data.
94 * @param DOMNode $child The DOMNode to process
96 protected function takeChildFromDOM($child)
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;
106 parent::takeChildFromDOM($child);
112 * Returns the entry's mediaGroup object.
114 * @return Zend_Gdata_Media_Extension_MediaGroup
116 public function getMediaGroup()
118 return $this->_mediaGroup;
122 * Sets the entry's mediaGroup object.
124 * @param Zend_Gdata_Media_Extension_MediaGroup $mediaGroup
125 * @return Zend_Gdata_Media_Entry Provides a fluent interface
127 public function setMediaGroup($mediaGroup)
129 $this->_mediaGroup = $mediaGroup;