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

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