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_Entry
27 require_once 'Zend/Gdata/Entry.php';
30 * @see Zend_Gdata_Extension_FeedLink
32 require_once 'Zend/Gdata/Extension/FeedLink.php';
35 * @see Zend_Gdata_Gapps_Extension_EmailList
37 require_once 'Zend/Gdata/Gapps/Extension/EmailList.php';
40 * Data model class for a Google Apps Email List Entry.
42 * Each email list entry describes a single email list within a Google Apps
43 * hosted domain. Email lists may contain multiple recipients, as
44 * described by instances of Zend_Gdata_Gapps_EmailListRecipient. Multiple
45 * entries are contained within instances of Zend_Gdata_Gapps_EmailListFeed.
47 * To transfer email list entries to and from the Google Apps servers,
48 * including creating new entries, refer to the Google Apps service class,
51 * This class represents <atom:entry> in the Google Data protocol.
56 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
57 * @license http://framework.zend.com/license/new-bsd New BSD License
59 class Zend_Gdata_Gapps_EmailListEntry extends Zend_Gdata_Entry
62 protected $_entryClassName = 'Zend_Gdata_Gapps_EmailListEntry';
65 * <apps:emailList> child element containing general information about
68 * @var Zend_Gdata_Gapps_Extension_EmailList
70 protected $_emailList = null;
73 * <gd:feedLink> element containing information about other feeds
74 * relevant to this entry.
76 * @var Zend_Gdata_Extension_FeedLink
78 protected $_feedLink = array();
81 * Create a new instance.
83 * @param DOMElement $element (optional) DOMElement from which this
84 * object should be constructed.
86 public function __construct($element = null)
88 $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces);
89 parent::__construct($element);
93 * Retrieves a DOMElement which corresponds to this element and all
94 * child properties. This is used to build an entry back into a DOM
95 * and eventually XML text for application storage/persistence.
97 * @param DOMDocument $doc The DOMDocument used to construct DOMElements
98 * @return DOMElement The DOMElement representing this element and all
101 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
103 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
104 if ($this->_emailList !== null) {
105 $element->appendChild($this->_emailList->getDOM($element->ownerDocument));
107 foreach ($this->_feedLink as $feedLink) {
108 $element->appendChild($feedLink->getDOM($element->ownerDocument));
114 * Creates individual Entry objects of the appropriate type and
115 * stores them as members of this entry based upon DOM data.
117 * @param DOMNode $child The DOMNode to process
119 protected function takeChildFromDOM($child)
121 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
123 switch ($absoluteNodeName) {
124 case $this->lookupNamespace('apps') . ':' . 'emailList';
125 $emailList = new Zend_Gdata_Gapps_Extension_EmailList();
126 $emailList->transferFromDOM($child);
127 $this->_emailList = $emailList;
129 case $this->lookupNamespace('gd') . ':' . 'feedLink';
130 $feedLink = new Zend_Gdata_Extension_FeedLink();
131 $feedLink->transferFromDOM($child);
132 $this->_feedLink[] = $feedLink;
135 parent::takeChildFromDOM($child);
141 * Retrieve the email list property for this entry.
144 * @return Zend_Gdata_Gapps_Extension_EmailList The requested object
145 * or null if not set.
147 public function getEmailList()
149 return $this->_emailList;
153 * Set the email list property for this entry. This property contains
154 * information such as the name of this email list.
156 * This corresponds to the <apps:emailList> property in the Google Data
159 * @param Zend_Gdata_Gapps_Extension_EmailList $value The desired value
160 * this element, or null to unset.
161 * @return Zend_Gdata_Gapps_EventEntry Provides a fluent interface
163 public function setEmailList($value)
165 $this->_emailList = $value;
170 * Get the feed link property for this entry.
173 * @param string $rel (optional) The rel value of the link to be found.
174 * If null, the array of links is returned.
175 * @return mixed If $rel is specified, a Zend_Gdata_Extension_FeedLink
176 * object corresponding to the requested rel value is returned
177 * if found, or null if the requested value is not found. If
178 * $rel is null or not specified, an array of all available
179 * feed links for this entry is returned, or null if no feed
182 public function getFeedLink($rel = null)
185 return $this->_feedLink;
187 foreach ($this->_feedLink as $feedLink) {
188 if ($feedLink->rel == $rel) {
197 * Set the feed link property for this entry. Feed links provide
198 * information about other feeds associated with this entry.
200 * This corresponds to the <gd:feedLink> property in the Google Data
203 * @param array $value A collection of Zend_Gdata_Gapps_Extension_FeedLink
204 * instances representing all feed links for this entry, or
206 * @return Zend_Gdata_Gapps_EventEntry Provides a fluent interface
208 public function setFeedLink($value)
210 $this->_feedLink = $value;