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-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_YouTube_VideoEntry
|
---|
25 | */
|
---|
26 | require_once 'Zend/Gdata/YouTube/VideoEntry.php';
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * @see Zend_Gdata_YouTube_Extension_Position
|
---|
30 | */
|
---|
31 | require_once 'Zend/Gdata/YouTube/Extension/Position.php';
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * Represents the YouTube video playlist flavor of an Atom entry
|
---|
35 | *
|
---|
36 | * @category Zend
|
---|
37 | * @package Zend_Gdata
|
---|
38 | * @subpackage YouTube
|
---|
39 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
40 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
41 | */
|
---|
42 | class Zend_Gdata_YouTube_PlaylistVideoEntry extends Zend_Gdata_YouTube_VideoEntry
|
---|
43 | {
|
---|
44 |
|
---|
45 | protected $_entryClassName = 'Zend_Gdata_YouTube_PlaylistVideoEntry';
|
---|
46 |
|
---|
47 | /**
|
---|
48 | * Position of the entry in the feed, as specified by the user
|
---|
49 | *
|
---|
50 | * @var Zend_Gdata_YouTube_Extension_Position
|
---|
51 | */
|
---|
52 | protected $_position = null;
|
---|
53 |
|
---|
54 | /**
|
---|
55 | * Creates a Playlist video entry, representing an individual video
|
---|
56 | * in a list of videos contained within a specific playlist
|
---|
57 | *
|
---|
58 | * @param DOMElement $element (optional) DOMElement from which this
|
---|
59 | * object should be constructed.
|
---|
60 | */
|
---|
61 | public function __construct($element = null)
|
---|
62 | {
|
---|
63 | $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces);
|
---|
64 | parent::__construct($element);
|
---|
65 | }
|
---|
66 |
|
---|
67 | /**
|
---|
68 | * Retrieves a DOMElement which corresponds to this element and all
|
---|
69 | * child properties. This is used to build an entry back into a DOM
|
---|
70 | * and eventually XML text for sending to the server upon updates, or
|
---|
71 | * for application storage/persistence.
|
---|
72 | *
|
---|
73 | * @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
---|
74 | * @return DOMElement The DOMElement representing this element and all
|
---|
75 | * child properties.
|
---|
76 | */
|
---|
77 | public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
---|
78 | {
|
---|
79 | $element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
---|
80 | if ($this->_position !== null) {
|
---|
81 | $element->appendChild($this->_position->getDOM($element->ownerDocument));
|
---|
82 | }
|
---|
83 | return $element;
|
---|
84 | }
|
---|
85 |
|
---|
86 | /**
|
---|
87 | * Creates individual Entry objects of the appropriate type and
|
---|
88 | * stores them in the $_entry array based upon DOM data.
|
---|
89 | *
|
---|
90 | * @param DOMNode $child The DOMNode to process
|
---|
91 | */
|
---|
92 | protected function takeChildFromDOM($child)
|
---|
93 | {
|
---|
94 | $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
---|
95 | switch ($absoluteNodeName) {
|
---|
96 | case $this->lookupNamespace('yt') . ':' . 'position':
|
---|
97 | $position = new Zend_Gdata_YouTube_Extension_Position();
|
---|
98 | $position->transferFromDOM($child);
|
---|
99 | $this->_position = $position;
|
---|
100 | break;
|
---|
101 | default:
|
---|
102 | parent::takeChildFromDOM($child);
|
---|
103 | break;
|
---|
104 | }
|
---|
105 | }
|
---|
106 |
|
---|
107 |
|
---|
108 | /**
|
---|
109 | * Sets the array of embedded feeds related to the video
|
---|
110 | *
|
---|
111 | * @param Zend_Gdata_YouTube_Extension_Position $position
|
---|
112 | * The position of the entry in the feed, as specified by the user.
|
---|
113 | * @return Zend_Gdata_YouTube_PlaylistVideoEntry Provides a fluent interface
|
---|
114 | */
|
---|
115 | public function setPosition($position = null)
|
---|
116 | {
|
---|
117 | $this->_position = $position;
|
---|
118 | return $this;
|
---|
119 | }
|
---|
120 |
|
---|
121 | /**
|
---|
122 | * Returns the position of the entry in the feed, as specified by the user
|
---|
123 | *
|
---|
124 | * @return Zend_Gdata_YouTube_Extension_Position The position
|
---|
125 | */
|
---|
126 | public function getPosition()
|
---|
127 | {
|
---|
128 | return $this->_position;
|
---|
129 | }
|
---|
130 |
|
---|
131 | }
|
---|