File indexing completed on 2025-03-02 05:29:27

0001 <?php
0002 
0003 /**
0004  * Zend Framework
0005  *
0006  * LICENSE
0007  *
0008  * This source file is subject to the new BSD license that is bundled
0009  * with this package in the file LICENSE.txt.
0010  * It is also available through the world-wide-web at this URL:
0011  * http://framework.zend.com/license/new-bsd
0012  * If you did not receive a copy of the license and are unable to
0013  * obtain it through the world-wide-web, please send an email
0014  * to license@zend.com so we can send you a copy immediately.
0015  *
0016  * @category   Zend
0017  * @package    Zend_Gdata
0018  * @subpackage Gapps
0019  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0020  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0021  * @version    $Id$
0022  */
0023 
0024 /**
0025  * @see Zend_Gdata_Entry
0026  */
0027 // require_once 'Zend/Gdata/Entry.php';
0028 
0029 /**
0030  * @see Zend_Gdata_Extension_FeedLink
0031  */
0032 // require_once 'Zend/Gdata/Extension/FeedLink.php';
0033 
0034 /**
0035  * @see Zend_Gdata_Gapps_Extension_EmailList
0036  */
0037 // require_once 'Zend/Gdata/Gapps/Extension/EmailList.php';
0038 
0039 /**
0040  * Data model class for a Google Apps Email List Entry.
0041  *
0042  * Each email list entry describes a single email list within a Google Apps
0043  * hosted domain. Email lists may contain multiple recipients, as
0044  * described by instances of Zend_Gdata_Gapps_EmailListRecipient. Multiple
0045  * entries are contained within instances of Zend_Gdata_Gapps_EmailListFeed.
0046  *
0047  * To transfer email list entries to and from the Google Apps servers,
0048  * including creating new entries, refer to the Google Apps service class,
0049  * Zend_Gdata_Gapps.
0050  *
0051  * This class represents <atom:entry> in the Google Data protocol.
0052  *
0053  * @category   Zend
0054  * @package    Zend_Gdata
0055  * @subpackage Gapps
0056  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0057  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0058  */
0059 class Zend_Gdata_Gapps_EmailListEntry extends Zend_Gdata_Entry
0060 {
0061 
0062     protected $_entryClassName = 'Zend_Gdata_Gapps_EmailListEntry';
0063 
0064     /**
0065      * <apps:emailList> child element containing general information about
0066      * this email list.
0067      *
0068      * @var Zend_Gdata_Gapps_Extension_EmailList
0069      */
0070     protected $_emailList = null;
0071 
0072     /**
0073      * <gd:feedLink> element containing information about other feeds
0074      * relevant to this entry.
0075      *
0076      * @var Zend_Gdata_Extension_FeedLink
0077      */
0078     protected $_feedLink = array();
0079 
0080     /**
0081      * Create a new instance.
0082      *
0083      * @param DOMElement $element (optional) DOMElement from which this
0084      *          object should be constructed.
0085      */
0086     public function __construct($element = null)
0087     {
0088         $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces);
0089         parent::__construct($element);
0090     }
0091 
0092     /**
0093      * Retrieves a DOMElement which corresponds to this element and all
0094      * child properties.  This is used to build an entry back into a DOM
0095      * and eventually XML text for application storage/persistence.
0096      *
0097      * @param DOMDocument $doc The DOMDocument used to construct DOMElements
0098      * @return DOMElement The DOMElement representing this element and all
0099      *          child properties.
0100      */
0101     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
0102     {
0103         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
0104         if ($this->_emailList !== null) {
0105             $element->appendChild($this->_emailList->getDOM($element->ownerDocument));
0106         }
0107         foreach ($this->_feedLink as $feedLink) {
0108             $element->appendChild($feedLink->getDOM($element->ownerDocument));
0109         }
0110         return $element;
0111     }
0112 
0113     /**
0114      * Creates individual Entry objects of the appropriate type and
0115      * stores them as members of this entry based upon DOM data.
0116      *
0117      * @param DOMNode $child The DOMNode to process
0118      */
0119     protected function takeChildFromDOM($child)
0120     {
0121         $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
0122 
0123         switch ($absoluteNodeName) {
0124             case $this->lookupNamespace('apps') . ':' . 'emailList';
0125                 $emailList = new Zend_Gdata_Gapps_Extension_EmailList();
0126                 $emailList->transferFromDOM($child);
0127                 $this->_emailList = $emailList;
0128                 break;
0129             case $this->lookupNamespace('gd') . ':' . 'feedLink';
0130                 $feedLink = new Zend_Gdata_Extension_FeedLink();
0131                 $feedLink->transferFromDOM($child);
0132                 $this->_feedLink[] = $feedLink;
0133                 break;
0134             default:
0135                 parent::takeChildFromDOM($child);
0136                 break;
0137         }
0138     }
0139 
0140     /**
0141      * Retrieve the email list property for this entry.
0142      *
0143      * @see setEmailList
0144      * @return Zend_Gdata_Gapps_Extension_EmailList The requested object
0145      *              or null if not set.
0146      */
0147     public function getEmailList()
0148     {
0149         return $this->_emailList;
0150     }
0151 
0152     /**
0153      * Set the email list property for this entry. This property contains
0154      * information such as the name of this email list.
0155      *
0156      * This corresponds to the <apps:emailList> property in the Google Data
0157      * protocol.
0158      *
0159      * @param Zend_Gdata_Gapps_Extension_EmailList $value The desired value
0160      *              this element, or null to unset.
0161      * @return Zend_Gdata_Gapps_EventEntry Provides a fluent interface
0162      */
0163     public function setEmailList($value)
0164     {
0165         $this->_emailList = $value;
0166         return $this;
0167     }
0168 
0169     /**
0170      * Get the feed link property for this entry.
0171      *
0172      * @see setFeedLink
0173      * @param string $rel (optional) The rel value of the link to be found.
0174      *          If null, the array of links is returned.
0175      * @return mixed If $rel is specified, a Zend_Gdata_Extension_FeedLink
0176      *          object corresponding to the requested rel value is returned
0177      *          if found, or null if the requested value is not found. If
0178      *          $rel is null or not specified, an array of all available
0179      *          feed links for this entry is returned, or null if no feed
0180      *          links are set.
0181      */
0182     public function getFeedLink($rel = null)
0183     {
0184         if ($rel == null) {
0185             return $this->_feedLink;
0186         } else {
0187             foreach ($this->_feedLink as $feedLink) {
0188                 if ($feedLink->rel == $rel) {
0189                     return $feedLink;
0190                 }
0191             }
0192             return null;
0193         }
0194     }
0195 
0196     /**
0197      * Set the feed link property for this entry. Feed links provide
0198      * information about other feeds associated with this entry.
0199      *
0200      * This corresponds to the <gd:feedLink> property in the Google Data
0201      * protocol.
0202      *
0203      * @param array $value A collection of Zend_Gdata_Gapps_Extension_FeedLink
0204      *          instances representing all feed links for this entry, or
0205      *          null to unset.
0206      * @return Zend_Gdata_Gapps_EventEntry Provides a fluent interface
0207      */
0208     public function setFeedLink($value)
0209     {
0210         $this->_feedLink = $value;
0211         return $this;
0212     }
0213 
0214 }