[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/zend/Zend/Gdata/Extension/ -> Who.php (source)

   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 [email protected] so we can send you a copy immediately.
  15   *
  16   * @category   Zend
  17   * @package    Zend_Gdata
  18   * @subpackage Gdata
  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
  21   * @version    $Id$
  22   */
  23  
  24  /**
  25   * @see Zend_Gdata_Extension
  26   */
  27  require_once 'Zend/Gdata/Extension.php';
  28  
  29  /**
  30   * @see Zend_Gdata_Extension_AttendeeStatus
  31   */
  32  require_once 'Zend/Gdata/Extension/AttendeeStatus.php';
  33  
  34  /**
  35   * @see Zend_Gdata_Extension_AttendeeType
  36   */
  37  require_once 'Zend/Gdata/Extension/AttendeeType.php';
  38  
  39  /**
  40   * @see Zend_Gdata_Extension_EntryLink
  41   */
  42  require_once 'Zend/Gdata/Extension/EntryLink.php';
  43  
  44  /**
  45   * Data model class to represent a participant
  46   *
  47   * @category   Zend
  48   * @package    Zend_Gdata
  49   * @subpackage Gdata
  50   * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  51   * @license    http://framework.zend.com/license/new-bsd     New BSD License
  52   */
  53  class Zend_Gdata_Extension_Who extends Zend_Gdata_Extension
  54  {
  55  
  56      protected $_rootElement = 'who';
  57      protected $_email = null;
  58      protected $_rel = null;
  59      protected $_valueString = null;
  60      protected $_attendeeStatus = null;
  61      protected $_attendeeType = null;
  62      protected $_entryLink = null;
  63  
  64      /**
  65       * Constructs a new Zend_Gdata_Extension_Who object.
  66       * @param string $email (optional) Email address.
  67       * @param string $rel (optional) Relationship description.
  68       * @param string $valueString (optional) Simple string describing this person.
  69       * @param Zend_Gdata_Extension_AttendeeStatus $attendeeStatus (optional) The status of the attendee.
  70       * @param Zend_Gdata_Extension_AttendeeType $attendeeType (optional) The type of the attendee.
  71       * @param string $entryLink URL pointing to an associated entry (Contact kind) describing this person.
  72       */
  73      public function __construct($email = null, $rel = null, $valueString = null,
  74          $attendeeStatus = null, $attendeeType = null, $entryLink = null)
  75      {
  76          parent::__construct();
  77          $this->_email = $email;
  78          $this->_rel = $rel;
  79          $this->_valueString = $valueString;
  80          $this->_attendeeStatus = $attendeeStatus;
  81          $this->_attendeeType = $attendeeType;
  82          $this->_entryLink = $entryLink;
  83      }
  84  
  85      /**
  86       * Retrieves a DOMElement which corresponds to this element and all
  87       * child properties.  This is used to build an entry back into a DOM
  88       * and eventually XML text for sending to the server upon updates, or
  89       * for application storage/persistence.
  90       *
  91       * @param DOMDocument $doc The DOMDocument used to construct DOMElements
  92       * @return DOMElement The DOMElement representing this element and all
  93       * child properties.
  94       */
  95      public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
  96      {
  97          $element = parent::getDOM($doc, $majorVersion, $minorVersion);
  98          if ($this->_email !== null) {
  99              $element->setAttribute('email', $this->_email);
 100          }
 101          if ($this->_rel !== null) {
 102              $element->setAttribute('rel', $this->_rel);
 103          }
 104          if ($this->_valueString !== null) {
 105              $element->setAttribute('valueString', $this->_valueString);
 106          }
 107          if ($this->_attendeeStatus !== null) {
 108              $element->appendChild($this->_attendeeStatus->getDOM($element->ownerDocument));
 109          }
 110          if ($this->_attendeeType !== null) {
 111              $element->appendChild($this->_attendeeType->getDOM($element->ownerDocument));
 112          }
 113          if ($this->_entryLink !== null) {
 114              $element->appendChild($this->_entryLink->getDOM($element->ownerDocument));
 115          }
 116          return $element;
 117      }
 118  
 119      /**
 120       * Given a DOMNode representing an attribute, tries to map the data into
 121       * instance members.  If no mapping is defined, the name and value are
 122       * stored in an array.
 123       *
 124       * @param DOMNode $attribute The DOMNode attribute needed to be handled
 125       */
 126      protected function takeAttributeFromDOM($attribute)
 127      {
 128          switch ($attribute->localName) {
 129          case 'email':
 130              $this->_email = $attribute->nodeValue;
 131              break;
 132          case 'rel':
 133              $this->_rel = $attribute->nodeValue;
 134              break;
 135          case 'valueString':
 136              $this->_valueString = $attribute->nodeValue;
 137              break;
 138          default:
 139              parent::takeAttributeFromDOM($attribute);
 140          }
 141      }
 142  
 143      /**
 144       * Creates individual Entry objects of the appropriate type and
 145       * stores them as members of this entry based upon DOM data.
 146       *
 147       * @param DOMNode $child The DOMNode to process
 148       */
 149      protected function takeChildFromDOM($child)
 150      {
 151          $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
 152          switch ($absoluteNodeName) {
 153          case $this->lookupNamespace('gd') . ':' . 'attendeeStatus':
 154              $attendeeStatus = new Zend_Gdata_Extension_AttendeeStatus();
 155              $attendeeStatus->transferFromDOM($child);
 156              $this->_attendeeStatus = $attendeeStatus;
 157              break;
 158          case $this->lookupNamespace('gd') . ':' . 'attendeeType':
 159              $attendeeType = new Zend_Gdata_Extension_AttendeeType();
 160              $attendeeType->transferFromDOM($child);
 161              $this->_attendeeType = $attendeeType;
 162              break;
 163          case $this->lookupNamespace('gd') . ':' . 'entryLink':
 164              $entryLink = new Zend_Gdata_Extension_EntryLink();
 165              $entryLink->transferFromDOM($child);
 166              $this->_entryLink = $entryLink;
 167              break;
 168          default:
 169              parent::takeChildFromDOM($child);
 170              break;
 171          }
 172      }
 173  
 174      /**
 175       * Retrieves a human readable string describing this attribute's value.
 176       *
 177       * @return string The attribute value.
 178       */
 179      public function __toString()
 180      {
 181          if ($this->_valueString != null) {
 182              return $this->_valueString;
 183          }
 184          else {
 185              return parent::__toString();
 186          }
 187      }
 188  
 189      /**
 190       * Get the value for this element's ValueString attribute.
 191       *
 192       * @return string The requested attribute.
 193       */
 194      public function getValueString()
 195      {
 196          return $this->_valueString;
 197      }
 198  
 199      /**
 200       * Set the value for this element's ValueString attribute.
 201       *
 202       * @param string $value The desired value for this attribute.
 203       * @return Zend_Gdata_Extension_Who The element being modified.
 204       */
 205      public function setValueString($value)
 206      {
 207          $this->_valueString = $value;
 208          return $this;
 209      }
 210  
 211      /**
 212       * Get the value for this element's Email attribute.
 213       *
 214       * @return string The requested attribute.
 215       */
 216      public function getEmail()
 217      {
 218          return $this->_email;
 219      }
 220  
 221      /**
 222       * Set the value for this element's Email attribute.
 223       *
 224       * @param string $value The desired value for this attribute.
 225       * @return Zend_Gdata_Extension_Who The element being modified.
 226       */
 227      public function setEmail($value)
 228      {
 229          $this->_email = $value;
 230          return $this;
 231      }
 232  
 233      /**
 234       * Get the value for this element's Rel attribute.
 235       *
 236       * @return string The requested attribute.
 237       */
 238      public function getRel()
 239      {
 240          return $this->_rel;
 241      }
 242  
 243      /**
 244       * Set the value for this element's Rel attribute.
 245       *
 246       * @param string $value The desired value for this attribute.
 247       * @return Zend_Gdata_Extension_Who The element being modified.
 248       */
 249      public function setRel($value)
 250      {
 251          $this->_rel = $value;
 252          return $this;
 253      }
 254  
 255      /**
 256       * Get this entry's AttendeeStatus element.
 257       *
 258       * @return Zend_Gdata_Extension_AttendeeStatus The requested entry.
 259       */
 260      public function getAttendeeStatus()
 261      {
 262          return $this->_attendeeStatus;
 263      }
 264  
 265      /**
 266       * Set the child's AttendeeStatus element.
 267       *
 268       * @param Zend_Gdata_Extension_AttendeeStatus $value The desired value for this attribute.
 269       * @return Zend_Gdata_Extension_Who The element being modified.
 270       */
 271      public function setAttendeeStatus($value)
 272      {
 273          $this->_attendeeStatus = $value;
 274          return $this;
 275      }
 276  
 277      /**
 278       * Get this entry's AttendeeType element.
 279       *
 280       * @return Zend_Gdata_Extension_AttendeeType The requested entry.
 281       */
 282      public function getAttendeeType()
 283      {
 284          return $this->_attendeeType;
 285      }
 286  
 287      /**
 288       * Set the child's AttendeeType element.
 289       *
 290       * @param Zend_Gdata_Extension_AttendeeType $value The desired value for this attribute.
 291       * @return Zend_Gdata_Extension_Who The element being modified.
 292       */
 293      public function setAttendeeType($value)
 294      {
 295          $this->_attendeeType = $value;
 296          return $this;
 297      }
 298  
 299  }


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1