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 Gapps
|
---|
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 | */
|
---|
26 | require_once 'Zend/Gdata/Entry.php';
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * @see Zend_Gdata_Extension_FeedLink
|
---|
30 | */
|
---|
31 | require_once 'Zend/Gdata/Extension/FeedLink.php';
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * @see Zend_Gdata_Gapps_Extension_EmailList
|
---|
35 | */
|
---|
36 | require_once 'Zend/Gdata/Gapps/Extension/EmailList.php';
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * Data model class for a Google Apps Email List Entry.
|
---|
40 | *
|
---|
41 | * Each email list entry describes a single email list within a Google Apps
|
---|
42 | * hosted domain. Email lists may contain multiple recipients, as
|
---|
43 | * described by instances of Zend_Gdata_Gapps_EmailListRecipient. Multiple
|
---|
44 | * entries are contained within instances of Zend_Gdata_Gapps_EmailListFeed.
|
---|
45 | *
|
---|
46 | * To transfer email list entries to and from the Google Apps servers,
|
---|
47 | * including creating new entries, refer to the Google Apps service class,
|
---|
48 | * Zend_Gdata_Gapps.
|
---|
49 | *
|
---|
50 | * This class represents <atom:entry> in the Google Data protocol.
|
---|
51 | *
|
---|
52 | * @category Zend
|
---|
53 | * @package Zend_Gdata
|
---|
54 | * @subpackage Gapps
|
---|
55 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
56 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
57 | */
|
---|
58 | class Zend_Gdata_Gapps_EmailListEntry extends Zend_Gdata_Entry
|
---|
59 | {
|
---|
60 |
|
---|
61 | protected $_entryClassName = 'Zend_Gdata_Gapps_EmailListEntry';
|
---|
62 |
|
---|
63 | /**
|
---|
64 | * <apps:emailList> child element containing general information about
|
---|
65 | * this email list.
|
---|
66 | *
|
---|
67 | * @var Zend_Gdata_Gapps_Extension_EmailList
|
---|
68 | */
|
---|
69 | protected $_emailList = null;
|
---|
70 |
|
---|
71 | /**
|
---|
72 | * <gd:feedLink> element containing information about other feeds
|
---|
73 | * relevant to this entry.
|
---|
74 | *
|
---|
75 | * @var Zend_Gdata_Extension_FeedLink
|
---|
76 | */
|
---|
77 | protected $_feedLink = array();
|
---|
78 |
|
---|
79 | /**
|
---|
80 | * Create a new instance.
|
---|
81 | *
|
---|
82 | * @param DOMElement $element (optional) DOMElement from which this
|
---|
83 | * object should be constructed.
|
---|
84 | */
|
---|
85 | public function __construct($element = null)
|
---|
86 | {
|
---|
87 | $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces);
|
---|
88 | parent::__construct($element);
|
---|
89 | }
|
---|
90 |
|
---|
91 | /**
|
---|
92 | * Retrieves a DOMElement which corresponds to this element and all
|
---|
93 | * child properties. This is used to build an entry back into a DOM
|
---|
94 | * and eventually XML text for application storage/persistence.
|
---|
95 | *
|
---|
96 | * @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
---|
97 | * @return DOMElement The DOMElement representing this element and all
|
---|
98 | * child properties.
|
---|
99 | */
|
---|
100 | public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
---|
101 | {
|
---|
102 | $element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
---|
103 | if ($this->_emailList !== null) {
|
---|
104 | $element->appendChild($this->_emailList->getDOM($element->ownerDocument));
|
---|
105 | }
|
---|
106 | foreach ($this->_feedLink as $feedLink) {
|
---|
107 | $element->appendChild($feedLink->getDOM($element->ownerDocument));
|
---|
108 | }
|
---|
109 | return $element;
|
---|
110 | }
|
---|
111 |
|
---|
112 | /**
|
---|
113 | * Creates individual Entry objects of the appropriate type and
|
---|
114 | * stores them as members of this entry based upon DOM data.
|
---|
115 | *
|
---|
116 | * @param DOMNode $child The DOMNode to process
|
---|
117 | */
|
---|
118 | protected function takeChildFromDOM($child)
|
---|
119 | {
|
---|
120 | $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
---|
121 |
|
---|
122 | switch ($absoluteNodeName) {
|
---|
123 | case $this->lookupNamespace('apps') . ':' . 'emailList';
|
---|
124 | $emailList = new Zend_Gdata_Gapps_Extension_EmailList();
|
---|
125 | $emailList->transferFromDOM($child);
|
---|
126 | $this->_emailList = $emailList;
|
---|
127 | break;
|
---|
128 | case $this->lookupNamespace('gd') . ':' . 'feedLink';
|
---|
129 | $feedLink = new Zend_Gdata_Extension_FeedLink();
|
---|
130 | $feedLink->transferFromDOM($child);
|
---|
131 | $this->_feedLink[] = $feedLink;
|
---|
132 | break;
|
---|
133 | default:
|
---|
134 | parent::takeChildFromDOM($child);
|
---|
135 | break;
|
---|
136 | }
|
---|
137 | }
|
---|
138 |
|
---|
139 | /**
|
---|
140 | * Retrieve the email list property for this entry.
|
---|
141 | *
|
---|
142 | * @see setEmailList
|
---|
143 | * @return Zend_Gdata_Gapps_Extension_EmailList The requested object
|
---|
144 | * or null if not set.
|
---|
145 | */
|
---|
146 | public function getEmailList()
|
---|
147 | {
|
---|
148 | return $this->_emailList;
|
---|
149 | }
|
---|
150 |
|
---|
151 | /**
|
---|
152 | * Set the email list property for this entry. This property contains
|
---|
153 | * information such as the name of this email list.
|
---|
154 | *
|
---|
155 | * This corresponds to the <apps:emailList> property in the Google Data
|
---|
156 | * protocol.
|
---|
157 | *
|
---|
158 | * @param Zend_Gdata_Gapps_Extension_EmailList $value The desired value
|
---|
159 | * this element, or null to unset.
|
---|
160 | * @return Zend_Gdata_Gapps_EventEntry Provides a fluent interface
|
---|
161 | */
|
---|
162 | public function setEmailList($value)
|
---|
163 | {
|
---|
164 | $this->_emailList = $value;
|
---|
165 | return $this;
|
---|
166 | }
|
---|
167 |
|
---|
168 | /**
|
---|
169 | * Get the feed link property for this entry.
|
---|
170 | *
|
---|
171 | * @see setFeedLink
|
---|
172 | * @param string $rel (optional) The rel value of the link to be found.
|
---|
173 | * If null, the array of links is returned.
|
---|
174 | * @return mixed If $rel is specified, a Zend_Gdata_Extension_FeedLink
|
---|
175 | * object corresponding to the requested rel value is returned
|
---|
176 | * if found, or null if the requested value is not found. If
|
---|
177 | * $rel is null or not specified, an array of all available
|
---|
178 | * feed links for this entry is returned, or null if no feed
|
---|
179 | * links are set.
|
---|
180 | */
|
---|
181 | public function getFeedLink($rel = null)
|
---|
182 | {
|
---|
183 | if ($rel == null) {
|
---|
184 | return $this->_feedLink;
|
---|
185 | } else {
|
---|
186 | foreach ($this->_feedLink as $feedLink) {
|
---|
187 | if ($feedLink->rel == $rel) {
|
---|
188 | return $feedLink;
|
---|
189 | }
|
---|
190 | }
|
---|
191 | return null;
|
---|
192 | }
|
---|
193 | }
|
---|
194 |
|
---|
195 | /**
|
---|
196 | * Set the feed link property for this entry. Feed links provide
|
---|
197 | * information about other feeds associated with this entry.
|
---|
198 | *
|
---|
199 | * This corresponds to the <gd:feedLink> property in the Google Data
|
---|
200 | * protocol.
|
---|
201 | *
|
---|
202 | * @param array $value A collection of Zend_Gdata_Gapps_Extension_FeedLink
|
---|
203 | * instances representing all feed links for this entry, or
|
---|
204 | * null to unset.
|
---|
205 | * @return Zend_Gdata_Gapps_EventEntry Provides a fluent interface
|
---|
206 | */
|
---|
207 | public function setFeedLink($value)
|
---|
208 | {
|
---|
209 | $this->_feedLink = $value;
|
---|
210 | return $this;
|
---|
211 | }
|
---|
212 |
|
---|
213 | }
|
---|