]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - Zend/Gdata/YouTube/Extension/MediaGroup.php
Release 6.5.0
[Github/sugarcrm.git] / Zend / Gdata / YouTube / Extension / MediaGroup.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 YouTube
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_Media_Extension_MediaGroup
26  */
27 require_once 'Zend/Gdata/Media/Extension/MediaGroup.php';
28
29 /**
30  * @see Zend_Gdata_YouTube_Extension_MediaContent
31  */
32 require_once 'Zend/Gdata/YouTube/Extension/MediaContent.php';
33
34 /**
35  * @see Zend_Gdata_YouTube_Extension_Duration
36  */
37 require_once 'Zend/Gdata/YouTube/Extension/Duration.php';
38
39 /**
40  * @see Zend_Gdata_YouTube_Extension_MediaRating
41  */
42 require_once 'Zend/Gdata/YouTube/Extension/MediaRating.php';
43
44 /**
45  * @see Zend_Gdata_YouTube_Extension_MediaCredit
46  */
47 require_once 'Zend/Gdata/YouTube/Extension/MediaCredit.php';
48
49 /**
50  * @see Zend_Gdata_YouTube_Extension_Private
51  */
52 require_once 'Zend/Gdata/YouTube/Extension/Private.php';
53
54 /**
55  * @see Zend_Gdata_YouTube_Extension_VideoId
56  */
57 require_once 'Zend/Gdata/YouTube/Extension/VideoId.php';
58
59 /**
60  * @see Zend_Gdata_YouTube_Extension_Uploaded
61  */
62 require_once 'Zend/Gdata/YouTube/Extension/Uploaded.php';
63
64 /**
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).
69  *
70  * @category   Zend
71  * @package    Zend_Gdata
72  * @subpackage YouTube
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
75  */
76 class Zend_Gdata_YouTube_Extension_MediaGroup extends Zend_Gdata_Media_Extension_MediaGroup
77 {
78
79     protected $_rootElement = 'group';
80     protected $_rootNamespace = 'media';
81
82     /**
83      * @var Zend_Gdata_YouTube_Extension_Duration
84      */
85     protected $_duration = null;
86
87     /**
88      * @var Zend_Gdata_YouTube_Extension_Private
89      */
90     protected $_private = null;
91
92     /**
93      * @var Zend_Gdata_YouTube_Extension_VideoId
94      */
95     protected $_videoid = null;
96
97     /**
98      * @var Zend_Gdata_YouTube_Extension_MediaRating
99      */
100     protected $_mediarating = null;
101
102     /**
103      * @var Zend_Gdata_YouTube_Extension_MediaCredit
104      */
105     protected $_mediacredit = null;
106
107     /**
108      * @var Zend_Gdata_YouTube_Extension_Uploaded
109      */
110     protected $_uploaded = null;
111
112     public function __construct($element = null)
113     {
114         $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
115         parent::__construct($element);
116     }
117
118     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
119     {
120         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
121         if ($this->_duration !== null) {
122             $element->appendChild(
123                 $this->_duration->getDOM($element->ownerDocument));
124         }
125         if ($this->_private !== null) {
126             $element->appendChild(
127                 $this->_private->getDOM($element->ownerDocument));
128         }
129         if ($this->_videoid != null) {
130             $element->appendChild(
131                 $this->_videoid->getDOM($element->ownerDocument));
132         }
133         if ($this->_uploaded != null) {
134             $element->appendChild(
135                 $this->_uploaded->getDOM($element->ownerDocument));
136         }
137         if ($this->_mediacredit != null) {
138             $element->appendChild(
139                 $this->_mediacredit->getDOM($element->ownerDocument));
140         }
141         if ($this->_mediarating != null) {
142             $element->appendChild(
143                 $this->_mediarating->getDOM($element->ownerDocument));
144         }
145         return $element;
146     }
147
148     /**
149      * Creates individual Entry objects of the appropriate type and
150      * stores them in the $_entry array based upon DOM data.
151      *
152      * @param DOMNode $child The DOMNode to process
153      */
154     protected function takeChildFromDOM($child)
155     {
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;
162                 break;
163             case $this->lookupNamespace('media') . ':' . 'rating':
164                 $mediarating = new Zend_Gdata_YouTube_Extension_MediaRating();
165                 $mediarating->transferFromDOM($child);
166                 $this->_mediarating = $mediarating;
167                 break;
168             case $this->lookupNamespace('media') . ':' . 'credit':
169                 $mediacredit = new Zend_Gdata_YouTube_Extension_MediaCredit();
170                 $mediacredit->transferFromDOM($child);
171                 $this->_mediacredit = $mediacredit;
172                 break;
173             case $this->lookupNamespace('yt') . ':' . 'duration':
174                 $duration = new Zend_Gdata_YouTube_Extension_Duration();
175                 $duration->transferFromDOM($child);
176                 $this->_duration = $duration;
177                 break;
178             case $this->lookupNamespace('yt') . ':' . 'private':
179                 $private = new Zend_Gdata_YouTube_Extension_Private();
180                 $private->transferFromDOM($child);
181                 $this->_private = $private;
182                 break;
183             case $this->lookupNamespace('yt') . ':' . 'videoid':
184                 $videoid = new Zend_Gdata_YouTube_Extension_VideoId();
185                 $videoid ->transferFromDOM($child);
186                 $this->_videoid = $videoid;
187                 break;
188             case $this->lookupNamespace('yt') . ':' . 'uploaded':
189                 $uploaded = new Zend_Gdata_YouTube_Extension_Uploaded();
190                 $uploaded ->transferFromDOM($child);
191                 $this->_uploaded = $uploaded;
192                 break;
193         default:
194             parent::takeChildFromDOM($child);
195             break;
196         }
197     }
198
199     /**
200      * Returns the duration value of this element
201      *
202      * @return Zend_Gdata_YouTube_Extension_Duration
203      */
204     public function getDuration()
205     {
206         return $this->_duration;
207     }
208
209     /**
210      * Sets the duration value of this element
211      *
212      * @param Zend_Gdata_YouTube_Extension_Duration $value The duration value
213      * @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent
214      *         interface
215      */
216     public function setDuration($value)
217     {
218         $this->_duration = $value;
219         return $this;
220     }
221
222     /**
223      * Returns the videoid value of this element
224      *
225      * @return Zend_Gdata_YouTube_Extension_VideoId
226      */
227     public function getVideoId()
228     {
229         return $this->_videoid;
230     }
231
232     /**
233      * Sets the videoid value of this element
234      *
235      * @param Zend_Gdata_YouTube_Extension_VideoId $value The video id value
236      * @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent
237      *         interface
238      */
239     public function setVideoId($value)
240     {
241         $this->_videoid = $value;
242         return $this;
243     }
244
245     /**
246      * Returns the yt:uploaded element
247      *
248      * @return Zend_Gdata_YouTube_Extension_Uploaded
249      */
250     public function getUploaded()
251     {
252         return $this->_uploaded;
253     }
254
255     /**
256      * Sets the yt:uploaded element
257      *
258      * @param Zend_Gdata_YouTube_Extension_Uploaded $value The uploaded value
259      * @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent
260      *         interface
261      */
262     public function setUploaded($value)
263     {
264         $this->_uploaded = $value;
265         return $this;
266     }
267
268     /**
269      * Returns the private value of this element
270      *
271      * @return Zend_Gdata_YouTube_Extension_Private
272      */
273     public function getPrivate()
274     {
275         return $this->_private;
276     }
277
278     /**
279      * Sets the private value of this element
280      *
281      * @param Zend_Gdata_YouTube_Extension_Private $value The private value
282      * @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent
283      *         interface
284      */
285     public function setPrivate($value)
286     {
287         $this->_private = $value;
288         return $this;
289     }
290
291     /**
292      * Returns the rating value of this element
293      *
294      * @return Zend_Gdata_YouTube_Extension_MediaRating
295      */
296     public function getMediaRating()
297     {
298         return $this->_mediarating;
299     }
300
301     /**
302      * Sets the media:rating value of this element
303      *
304      * @param Zend_Gdata_YouTube_Extension_MediaRating $value The rating element
305      * @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent
306      *         interface
307      */
308     public function setMediaRating($value)
309     {
310         $this->_mediarating = $value;
311         return $this;
312     }
313
314     /**
315      * Returns the media:credit value of this element
316      *
317      * @return Zend_Gdata_YouTube_Extension_MediaCredit
318      */
319     public function getMediaCredit()
320     {
321         return $this->_mediacredit;
322     }
323
324     /**
325      * Sets the media:credit value of this element
326      *
327      * @param Zend_Gdata_YouTube_Extension_MediaCredit $value The credit element
328      * @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent
329      *         interface
330      */
331     public function setMediaCredit($value)
332     {
333         $this->_mediacredit = $value;
334         return $this;
335     }
336 }