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

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 Gdata
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_Extension
0026  */
0027 // require_once 'Zend/Gdata/Extension.php';
0028 
0029 /**
0030  * @see Zend_Gdata_Extension_AttendeeStatus
0031  */
0032 // require_once 'Zend/Gdata/Extension/AttendeeStatus.php';
0033 
0034 /**
0035  * @see Zend_Gdata_Extension_AttendeeType
0036  */
0037 // require_once 'Zend/Gdata/Extension/AttendeeType.php';
0038 
0039 /**
0040  * @see Zend_Gdata_Extension_EntryLink
0041  */
0042 // require_once 'Zend/Gdata/Extension/EntryLink.php';
0043 
0044 /**
0045  * Data model class to represent a participant
0046  *
0047  * @category   Zend
0048  * @package    Zend_Gdata
0049  * @subpackage Gdata
0050  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0051  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0052  */
0053 class Zend_Gdata_Extension_Who extends Zend_Gdata_Extension
0054 {
0055 
0056     protected $_rootElement = 'who';
0057     protected $_email = null;
0058     protected $_rel = null;
0059     protected $_valueString = null;
0060     protected $_attendeeStatus = null;
0061     protected $_attendeeType = null;
0062     protected $_entryLink = null;
0063 
0064     /**
0065      * Constructs a new Zend_Gdata_Extension_Who object.
0066      * @param string $email (optional) Email address.
0067      * @param string $rel (optional) Relationship description.
0068      * @param string $valueString (optional) Simple string describing this person.
0069      * @param Zend_Gdata_Extension_AttendeeStatus $attendeeStatus (optional) The status of the attendee.
0070      * @param Zend_Gdata_Extension_AttendeeType $attendeeType (optional) The type of the attendee.
0071      * @param string $entryLink URL pointing to an associated entry (Contact kind) describing this person.
0072      */
0073     public function __construct($email = null, $rel = null, $valueString = null,
0074         $attendeeStatus = null, $attendeeType = null, $entryLink = null)
0075     {
0076         parent::__construct();
0077         $this->_email = $email;
0078         $this->_rel = $rel;
0079         $this->_valueString = $valueString;
0080         $this->_attendeeStatus = $attendeeStatus;
0081         $this->_attendeeType = $attendeeType;
0082         $this->_entryLink = $entryLink;
0083     }
0084 
0085     /**
0086      * Retrieves a DOMElement which corresponds to this element and all
0087      * child properties.  This is used to build an entry back into a DOM
0088      * and eventually XML text for sending to the server upon updates, or
0089      * for application storage/persistence.
0090      *
0091      * @param DOMDocument $doc The DOMDocument used to construct DOMElements
0092      * @return DOMElement The DOMElement representing this element and all
0093      * child properties.
0094      */
0095     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
0096     {
0097         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
0098         if ($this->_email !== null) {
0099             $element->setAttribute('email', $this->_email);
0100         }
0101         if ($this->_rel !== null) {
0102             $element->setAttribute('rel', $this->_rel);
0103         }
0104         if ($this->_valueString !== null) {
0105             $element->setAttribute('valueString', $this->_valueString);
0106         }
0107         if ($this->_attendeeStatus !== null) {
0108             $element->appendChild($this->_attendeeStatus->getDOM($element->ownerDocument));
0109         }
0110         if ($this->_attendeeType !== null) {
0111             $element->appendChild($this->_attendeeType->getDOM($element->ownerDocument));
0112         }
0113         if ($this->_entryLink !== null) {
0114             $element->appendChild($this->_entryLink->getDOM($element->ownerDocument));
0115         }
0116         return $element;
0117     }
0118 
0119     /**
0120      * Given a DOMNode representing an attribute, tries to map the data into
0121      * instance members.  If no mapping is defined, the name and value are
0122      * stored in an array.
0123      *
0124      * @param DOMNode $attribute The DOMNode attribute needed to be handled
0125      */
0126     protected function takeAttributeFromDOM($attribute)
0127     {
0128         switch ($attribute->localName) {
0129         case 'email':
0130             $this->_email = $attribute->nodeValue;
0131             break;
0132         case 'rel':
0133             $this->_rel = $attribute->nodeValue;
0134             break;
0135         case 'valueString':
0136             $this->_valueString = $attribute->nodeValue;
0137             break;
0138         default:
0139             parent::takeAttributeFromDOM($attribute);
0140         }
0141     }
0142 
0143     /**
0144      * Creates individual Entry objects of the appropriate type and
0145      * stores them as members of this entry based upon DOM data.
0146      *
0147      * @param DOMNode $child The DOMNode to process
0148      */
0149     protected function takeChildFromDOM($child)
0150     {
0151         $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
0152         switch ($absoluteNodeName) {
0153         case $this->lookupNamespace('gd') . ':' . 'attendeeStatus':
0154             $attendeeStatus = new Zend_Gdata_Extension_AttendeeStatus();
0155             $attendeeStatus->transferFromDOM($child);
0156             $this->_attendeeStatus = $attendeeStatus;
0157             break;
0158         case $this->lookupNamespace('gd') . ':' . 'attendeeType':
0159             $attendeeType = new Zend_Gdata_Extension_AttendeeType();
0160             $attendeeType->transferFromDOM($child);
0161             $this->_attendeeType = $attendeeType;
0162             break;
0163         case $this->lookupNamespace('gd') . ':' . 'entryLink':
0164             $entryLink = new Zend_Gdata_Extension_EntryLink();
0165             $entryLink->transferFromDOM($child);
0166             $this->_entryLink = $entryLink;
0167             break;
0168         default:
0169             parent::takeChildFromDOM($child);
0170             break;
0171         }
0172     }
0173 
0174     /**
0175      * Retrieves a human readable string describing this attribute's value.
0176      *
0177      * @return string The attribute value.
0178      */
0179     public function __toString()
0180     {
0181         if ($this->_valueString != null) {
0182             return $this->_valueString;
0183         }
0184         else {
0185             return parent::__toString();
0186         }
0187     }
0188 
0189     /**
0190      * Get the value for this element's ValueString attribute.
0191      *
0192      * @return string The requested attribute.
0193      */
0194     public function getValueString()
0195     {
0196         return $this->_valueString;
0197     }
0198 
0199     /**
0200      * Set the value for this element's ValueString attribute.
0201      *
0202      * @param string $value The desired value for this attribute.
0203      * @return Zend_Gdata_Extension_Who The element being modified.
0204      */
0205     public function setValueString($value)
0206     {
0207         $this->_valueString = $value;
0208         return $this;
0209     }
0210 
0211     /**
0212      * Get the value for this element's Email attribute.
0213      *
0214      * @return string The requested attribute.
0215      */
0216     public function getEmail()
0217     {
0218         return $this->_email;
0219     }
0220 
0221     /**
0222      * Set the value for this element's Email attribute.
0223      *
0224      * @param string $value The desired value for this attribute.
0225      * @return Zend_Gdata_Extension_Who The element being modified.
0226      */
0227     public function setEmail($value)
0228     {
0229         $this->_email = $value;
0230         return $this;
0231     }
0232 
0233     /**
0234      * Get the value for this element's Rel attribute.
0235      *
0236      * @return string The requested attribute.
0237      */
0238     public function getRel()
0239     {
0240         return $this->_rel;
0241     }
0242 
0243     /**
0244      * Set the value for this element's Rel attribute.
0245      *
0246      * @param string $value The desired value for this attribute.
0247      * @return Zend_Gdata_Extension_Who The element being modified.
0248      */
0249     public function setRel($value)
0250     {
0251         $this->_rel = $value;
0252         return $this;
0253     }
0254 
0255     /**
0256      * Get this entry's AttendeeStatus element.
0257      *
0258      * @return Zend_Gdata_Extension_AttendeeStatus The requested entry.
0259      */
0260     public function getAttendeeStatus()
0261     {
0262         return $this->_attendeeStatus;
0263     }
0264 
0265     /**
0266      * Set the child's AttendeeStatus element.
0267      *
0268      * @param Zend_Gdata_Extension_AttendeeStatus $value The desired value for this attribute.
0269      * @return Zend_Gdata_Extension_Who The element being modified.
0270      */
0271     public function setAttendeeStatus($value)
0272     {
0273         $this->_attendeeStatus = $value;
0274         return $this;
0275     }
0276 
0277     /**
0278      * Get this entry's AttendeeType element.
0279      *
0280      * @return Zend_Gdata_Extension_AttendeeType The requested entry.
0281      */
0282     public function getAttendeeType()
0283     {
0284         return $this->_attendeeType;
0285     }
0286 
0287     /**
0288      * Set the child's AttendeeType element.
0289      *
0290      * @param Zend_Gdata_Extension_AttendeeType $value The desired value for this attribute.
0291      * @return Zend_Gdata_Extension_Who The element being modified.
0292      */
0293     public function setAttendeeType($value)
0294     {
0295         $this->_attendeeType = $value;
0296         return $this;
0297     }
0298 
0299 }