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_Media_Extension_MediaGroup
27 require_once 'Zend/Gdata/Media/Extension/MediaGroup.php';
30 * @see Zend_Gdata_YouTube_Extension_MediaContent
32 require_once 'Zend/Gdata/YouTube/Extension/MediaContent.php';
35 * @see Zend_Gdata_YouTube_Extension_Duration
37 require_once 'Zend/Gdata/YouTube/Extension/Duration.php';
40 * @see Zend_Gdata_YouTube_Extension_MediaRating
42 require_once 'Zend/Gdata/YouTube/Extension/MediaRating.php';
45 * @see Zend_Gdata_YouTube_Extension_MediaCredit
47 require_once 'Zend/Gdata/YouTube/Extension/MediaCredit.php';
50 * @see Zend_Gdata_YouTube_Extension_Private
52 require_once 'Zend/Gdata/YouTube/Extension/Private.php';
55 * @see Zend_Gdata_YouTube_Extension_VideoId
57 require_once 'Zend/Gdata/YouTube/Extension/VideoId.php';
60 * @see Zend_Gdata_YouTube_Extension_Uploaded
62 require_once 'Zend/Gdata/YouTube/Extension/Uploaded.php';
65 * This class represents the media:group element of Media RSS.
66 * It allows the grouping of media:content elements that are
67 * different representations of the same content. When it exists,
68 * it is a child of an Entry (Atom) or Item (RSS).
73 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
74 * @license http://framework.zend.com/license/new-bsd New BSD License
76 class Zend_Gdata_YouTube_Extension_MediaGroup extends Zend_Gdata_Media_Extension_MediaGroup
79 protected $_rootElement = 'group';
80 protected $_rootNamespace = 'media';
83 * @var Zend_Gdata_YouTube_Extension_Duration
85 protected $_duration = null;
88 * @var Zend_Gdata_YouTube_Extension_Private
90 protected $_private = null;
93 * @var Zend_Gdata_YouTube_Extension_VideoId
95 protected $_videoid = null;
98 * @var Zend_Gdata_YouTube_Extension_MediaRating
100 protected $_mediarating = null;
103 * @var Zend_Gdata_YouTube_Extension_MediaCredit
105 protected $_mediacredit = null;
108 * @var Zend_Gdata_YouTube_Extension_Uploaded
110 protected $_uploaded = null;
112 public function __construct($element = null)
114 $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
115 parent::__construct($element);
118 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
120 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
121 if ($this->_duration !== null) {
122 $element->appendChild(
123 $this->_duration->getDOM($element->ownerDocument));
125 if ($this->_private !== null) {
126 $element->appendChild(
127 $this->_private->getDOM($element->ownerDocument));
129 if ($this->_videoid != null) {
130 $element->appendChild(
131 $this->_videoid->getDOM($element->ownerDocument));
133 if ($this->_uploaded != null) {
134 $element->appendChild(
135 $this->_uploaded->getDOM($element->ownerDocument));
137 if ($this->_mediacredit != null) {
138 $element->appendChild(
139 $this->_mediacredit->getDOM($element->ownerDocument));
141 if ($this->_mediarating != null) {
142 $element->appendChild(
143 $this->_mediarating->getDOM($element->ownerDocument));
149 * Creates individual Entry objects of the appropriate type and
150 * stores them in the $_entry array based upon DOM data.
152 * @param DOMNode $child The DOMNode to process
154 protected function takeChildFromDOM($child)
156 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
157 switch ($absoluteNodeName) {
158 case $this->lookupNamespace('media') . ':' . 'content':
159 $content = new Zend_Gdata_YouTube_Extension_MediaContent();
160 $content->transferFromDOM($child);
161 $this->_content[] = $content;
163 case $this->lookupNamespace('media') . ':' . 'rating':
164 $mediarating = new Zend_Gdata_YouTube_Extension_MediaRating();
165 $mediarating->transferFromDOM($child);
166 $this->_mediarating = $mediarating;
168 case $this->lookupNamespace('media') . ':' . 'credit':
169 $mediacredit = new Zend_Gdata_YouTube_Extension_MediaCredit();
170 $mediacredit->transferFromDOM($child);
171 $this->_mediacredit = $mediacredit;
173 case $this->lookupNamespace('yt') . ':' . 'duration':
174 $duration = new Zend_Gdata_YouTube_Extension_Duration();
175 $duration->transferFromDOM($child);
176 $this->_duration = $duration;
178 case $this->lookupNamespace('yt') . ':' . 'private':
179 $private = new Zend_Gdata_YouTube_Extension_Private();
180 $private->transferFromDOM($child);
181 $this->_private = $private;
183 case $this->lookupNamespace('yt') . ':' . 'videoid':
184 $videoid = new Zend_Gdata_YouTube_Extension_VideoId();
185 $videoid ->transferFromDOM($child);
186 $this->_videoid = $videoid;
188 case $this->lookupNamespace('yt') . ':' . 'uploaded':
189 $uploaded = new Zend_Gdata_YouTube_Extension_Uploaded();
190 $uploaded ->transferFromDOM($child);
191 $this->_uploaded = $uploaded;
194 parent::takeChildFromDOM($child);
200 * Returns the duration value of this element
202 * @return Zend_Gdata_YouTube_Extension_Duration
204 public function getDuration()
206 return $this->_duration;
210 * Sets the duration value of this element
212 * @param Zend_Gdata_YouTube_Extension_Duration $value The duration value
213 * @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent
216 public function setDuration($value)
218 $this->_duration = $value;
223 * Returns the videoid value of this element
225 * @return Zend_Gdata_YouTube_Extension_VideoId
227 public function getVideoId()
229 return $this->_videoid;
233 * Sets the videoid value of this element
235 * @param Zend_Gdata_YouTube_Extension_VideoId $value The video id value
236 * @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent
239 public function setVideoId($value)
241 $this->_videoid = $value;
246 * Returns the yt:uploaded element
248 * @return Zend_Gdata_YouTube_Extension_Uploaded
250 public function getUploaded()
252 return $this->_uploaded;
256 * Sets the yt:uploaded element
258 * @param Zend_Gdata_YouTube_Extension_Uploaded $value The uploaded value
259 * @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent
262 public function setUploaded($value)
264 $this->_uploaded = $value;
269 * Returns the private value of this element
271 * @return Zend_Gdata_YouTube_Extension_Private
273 public function getPrivate()
275 return $this->_private;
279 * Sets the private value of this element
281 * @param Zend_Gdata_YouTube_Extension_Private $value The private value
282 * @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent
285 public function setPrivate($value)
287 $this->_private = $value;
292 * Returns the rating value of this element
294 * @return Zend_Gdata_YouTube_Extension_MediaRating
296 public function getMediaRating()
298 return $this->_mediarating;
302 * Sets the media:rating value of this element
304 * @param Zend_Gdata_YouTube_Extension_MediaRating $value The rating element
305 * @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent
308 public function setMediaRating($value)
310 $this->_mediarating = $value;
315 * Returns the media:credit value of this element
317 * @return Zend_Gdata_YouTube_Extension_MediaCredit
319 public function getMediaCredit()
321 return $this->_mediacredit;
325 * Sets the media:credit value of this element
327 * @param Zend_Gdata_YouTube_Extension_MediaCredit $value The credit element
328 * @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent
331 public function setMediaCredit($value)
333 $this->_mediacredit = $value;