[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/include/Zend/Gdata/Contacts/Extension/ -> Organization.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/OrgName.php';
  24  require_once  'Zend/Gdata/Contacts/Extension/OrgTitle.php';
  25  
  26  class Zend_Gdata_Contacts_Extension_Organization extends Zend_Gdata_Contacts_Extension {
  27      protected $_rootElement = 'organization';
  28  
  29      protected $_rel;
  30      protected $_orgName, $_orgTitle;
  31      
  32  	public function __construct($name = null, $title = null, $rel = 'other') {
  33          parent::__construct();
  34          $this->_rel = $rel;
  35          if ($name != null) {
  36              $this->_orgName = new Zend_Gdata_Contacts_Extension_OrgName($name);
  37          }
  38          if ($title != null) {
  39              $this->_orgTitle= new Zend_Gdata_Contacts_Extension_OrgTitle($title);
  40          }
  41      }
  42      
  43  	public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) {
  44          $element = parent::getDOM($doc, $majorVersion, $minorVersion);
  45          $element->setAttribute('rel', $this->lookupNamespace('gd').'#'.$this->_rel);
  46          if ($this->_orgName != null) {
  47              $element->appendChild($this->_orgName->getDOM($element->ownerDocument));
  48          }
  49          if ($this->_orgTitle != null) {
  50              $element->appendChild($this->_orgTitle->getDOM($element->ownerDocument));
  51          }
  52          return $element;
  53      }
  54      
  55      /**
  56       * Creates individual Entry objects of the appropriate type and
  57       * stores them as members of this entry based upon DOM data.
  58       *
  59       * @param DOMNode $child The DOMNode to process
  60       */
  61      protected function takeChildFromDOM($child) {
  62          $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
  63          $gdNamespacePrefix = $this->lookupNamespace('gd') . ':';
  64  
  65          switch ($absoluteNodeName) {
  66              case $gdNamespacePrefix . 'orgName';
  67                  $orgName = new Zend_Gdata_Contacts_Extension_OrgName();
  68                  $orgName->transferFromDOM($child);
  69                  $this->_orgName = $orgName;
  70                  break;
  71              case $gdNamespacePrefix . 'orgTitle';
  72                  $orgTitle = new Zend_Gdata_Contacts_Extension_OrgTitle();
  73                  $orgTitle->transferFromDOM($child);
  74                  $this->_orgTitle = $orgTitle;
  75                  break;
  76          }
  77      }
  78      
  79  	public function getValue() {
  80          return $this->_orgName->getValue();
  81      }
  82      
  83  }


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