source: trunk/www.guidonia.net/wp/wp-content/plugins/webtv/Drivers/Zend/Gdata/Media/Entry.php@ 44

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