File indexing completed on 2024-05-26 06:03:04

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_Gapps_Extension_Property
0031  */
0032 // require_once 'Zend/Gdata/Gapps/Extension/Property.php';
0033 
0034 /**
0035  * Data model class for a Google Apps Group Entry.
0036  *
0037  * Each group entry describes a single group within a Google Apps hosted
0038  * domain.
0039  *
0040  * To transfer group entries to and from the Google Apps servers, including
0041  * creating new entries, refer to the Google Apps service class,
0042  * Zend_Gdata_Gapps.
0043  *
0044  * This class represents <atom:entry> in the Google Data protocol.
0045  *
0046  * @category   Zend
0047  * @package    Zend_Gdata
0048  * @subpackage Gapps
0049  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0050  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0051  */
0052 class Zend_Gdata_Gapps_GroupEntry extends Zend_Gdata_Entry
0053 {
0054 
0055     protected $_entryClassName = 'Zend_Gdata_Gapps_GroupEntry';
0056 
0057     /**
0058      * <apps:property> element containing information about other items
0059      * relevant to this entry.
0060      *
0061      * @var Zend_Gdata_Gapps_Extension_Property
0062      */
0063     protected $_property = array();
0064 
0065     /**
0066      * Create a new instance.
0067      *
0068      * @param DOMElement $element (optional) DOMElement from which this
0069      *          object should be constructed.
0070      */
0071     public function __construct($element = null)
0072     {
0073         $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces);
0074         parent::__construct($element);
0075     }
0076 
0077     /**
0078      * Retrieves a DOMElement which corresponds to this element and all
0079      * child properties.  This is used to build an entry back into a DOM
0080      * and eventually XML text for application storage/persistence.
0081      *
0082      * @param DOMDocument $doc The DOMDocument used to construct DOMElements
0083      * @return DOMElement The DOMElement representing this element and all
0084      *          child properties.
0085      */
0086     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
0087     {
0088         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
0089 
0090         foreach ($this->_property as $p) {
0091             $element->appendChild($p->getDOM($element->ownerDocument));
0092         }
0093         return $element;
0094     }
0095 
0096     /**
0097      * Creates individual Entry objects of the appropriate type and
0098      * stores them as members of this entry based upon DOM data.
0099      *
0100      * @param DOMNode $child The DOMNode to process
0101      */
0102     protected function takeChildFromDOM($child)
0103     {
0104         $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
0105 
0106         switch ($absoluteNodeName) {
0107 
0108             case $this->lookupNamespace('apps') . ':' . 'property';
0109                 $property = new Zend_Gdata_Gapps_Extension_Property();
0110                 $property->transferFromDOM($child);
0111                 $this->_property[] = $property;
0112                 break;
0113             default:
0114                 parent::takeChildFromDOM($child);
0115                 break;
0116         }
0117     }
0118 
0119     /**
0120      * Returns all property tags for this entry
0121      *
0122      * @param string $rel The rel value of the property to be found. If null,
0123      *          the array of properties is returned instead.
0124      * @return mixed Either an array of Zend_Gdata_Gapps_Extension_Property
0125      *          objects if $rel is null, a single
0126      *          Zend_Gdata_Gapps_Extension_Property object if $rel is specified
0127      *          and a matching feed link is found, or null if $rel is
0128      *          specified and no matching property is found.
0129      */
0130     public function getProperty($rel = null)
0131     {
0132         if ($rel == null) {
0133             return $this->_property;
0134         } else {
0135             foreach ($this->_property as $p) {
0136                 if ($p->rel == $rel) {
0137                     return $p;
0138                 }
0139             }
0140             return null;
0141         }
0142     }
0143 
0144     /**
0145      * Set the value of the  property property for this object.
0146      *
0147      * @param array $value A collection of
0148      *          Zend_Gdata_Gapps_Extension_Property objects.
0149      * @return Zend_Gdata_Gapps_GroupEntry Provides a fluent interface.
0150      */
0151     public function setProperty($value)
0152     {
0153         $this->_property = $value;
0154         return $this;
0155     }
0156 
0157 }
0158