[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/include/Zend/Gdata/Contacts/Extension/ -> Name.php (source)

   1  <?php
   2  
   3  /**
   4   * https://github.com/prasad83/Zend-Gdata-Contacts
   5   * @author prasad
   6   * 
   7   * LICENSE
   8   *
   9   * This source file is subject to the new BSD license that is bundled
  10   * with this package in the file LICENSE.txt.
  11   * It is also available through the world-wide-web at this URL:
  12   * http://framework.zend.com/license/new-bsd
  13   * If you did not receive a copy of the license and are unable to
  14   * obtain it through the world-wide-web, please send an email
  15   * to [email protected] so we can send you a copy immediately.
  16   *
  17   * @category   Zend
  18   * @package    Zend_Gdata
  19   * @subpackage Contacts
  20   */
  21  require_once  'Zend/Gdata/Contacts/Extension.php';
  22  
  23  require_once  'Zend/Gdata/Contacts/Extension/Name/FullName.php';
  24  require_once  'Zend/Gdata/Contacts/Extension/Name/NamePrefix.php';
  25  require_once  'Zend/Gdata/Contacts/Extension/Name/GivenName.php';
  26  require_once  'Zend/Gdata/Contacts/Extension/Name/FamilyName.php';
  27  
  28  class Zend_Gdata_Contacts_Extension_Name extends Zend_Gdata_Contacts_Extension {
  29      
  30      protected $_rootElement = 'name';
  31      
  32      protected $_fullName, $_namePrefix, $_givenName, $_familyName;
  33  
  34  	public function __construct($value = null) {
  35          parent::__construct();
  36          $this->_fullName = new Zend_Gdata_Contacts_Extension_Name_FullName($value);
  37      }
  38      
  39      /**
  40       * Retrieves a DOMElement which corresponds to this element and all
  41       * child properties.  This is used to build an entry back into a DOM
  42       * and eventually XML text for sending to the server upon updates, or
  43       * for application storage/persistence.
  44       *
  45       * @param DOMDocument $doc The DOMDocument used to construct DOMElements
  46       * @return DOMElement The DOMElement representing this element and all
  47       * child properties.
  48       */
  49      public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) {
  50          $element = parent::getDOM($doc, $majorVersion, $minorVersion);
  51          if ($this->_fullName !== null) {
  52              $element->appendChild($this->_fullName->getDOM($element->ownerDocument));
  53          }
  54          if ($this->_namePrefix !== null) {
  55              $element->appendChild($this->_namePrefix->getDOM($element->ownerDocument));
  56          }
  57          if ($this->_givenName !== null) {
  58              $element->appendChild($this->_givenName->getDOM($element->ownerDocument));
  59          }
  60          if ($this->_familyName !== null) {
  61              $element->appendChild($this->_familyName->getDOM($element->ownerDocument));
  62          }
  63          return $element;
  64      }
  65      
  66      /**
  67       * Creates individual Entry objects of the appropriate type and
  68       * stores them as members of this entry based upon DOM data.
  69       *
  70       * @param DOMNode $child The DOMNode to process
  71       */
  72      protected function takeChildFromDOM($child) {
  73          $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
  74          $gdNamespacePrefix = $this->lookupNamespace('gd') . ':';
  75  
  76          switch ($absoluteNodeName) {
  77              case $gdNamespacePrefix . 'fullName';
  78                  $fullName = new Zend_Gdata_Contacts_Extension_Name_FullName();
  79                  $fullName->transferFromDOM($child);
  80                  $this->_fullName = $fullName;
  81                  break;
  82              case $gdNamespacePrefix . 'namePrefix';
  83                  $namePrefix = new Zend_Gdata_Contacts_Extension_Name_NamePrefix();
  84                  $namePrefix->transferFromDOM($child);
  85                  $this->_namePrefix = $namePrefix;
  86                  break;
  87              case $gdNamespacePrefix . 'givenName';
  88                  $givenName = new Zend_Gdata_Contacts_Extension_Name_GivenName();
  89                  $givenName->transferFromDOM($child);
  90                  $this->_givenName = $givenName;
  91                  break;
  92              case $gdNamespacePrefix . 'familyName';
  93                  $familyName = new Zend_Gdata_Contacts_Extension_Name_FamilyName();
  94                  $familyName->transferFromDOM($child);
  95                  $this->_familyName = $familyName;
  96                  break;
  97          }
  98      }
  99      
 100  	public function getValue() {
 101          return $this->_fullName->getValue();
 102      }
 103      
 104  	public function setFullName($value) {
 105          $this->_fullName = $value;
 106      }
 107      
 108  	public function getFullName() {
 109          return $this->_fullName;
 110      }
 111  }


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1