web/lib/Zend/Gdata/Analytics/Extension/TableId.php
changeset 808 6b6c2214f778
child 1230 68c69c656a2c
equal deleted inserted replaced
807:877f952ae2bd 808:6b6c2214f778
       
     1 <?php
       
     2 /**
       
     3  * Zend Framework
       
     4  *
       
     5  * LICENSE
       
     6  *
       
     7  * This source file is subject to the new BSD license that is bundled
       
     8  * with this package in the file LICENSE.txt.
       
     9  * It is also available through the world-wide-web at this URL:
       
    10  * http://framework.zend.com/license/new-bsd
       
    11  * If you did not receive a copy of the license and are unable to
       
    12  * obtain it through the world-wide-web, please send an email
       
    13  * to license@zend.com so we can send you a copy immediately.
       
    14  *
       
    15  * @category   Zend
       
    16  * @package    Zend_Gdata
       
    17  * @subpackage Analytics
       
    18  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
       
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    20  * @version    $Id$
       
    21  */
       
    22 
       
    23 /**
       
    24  * @see Zend_Gdata_Extension
       
    25  */
       
    26 require_once 'Zend/Gdata/Extension.php';
       
    27 
       
    28 /**
       
    29  * @category   Zend
       
    30  * @package    Zend_Gdata
       
    31  * @subpackage Analytics
       
    32  */
       
    33 class Zend_Gdata_Analytics_Extension_TableId extends Zend_Gdata_Extension
       
    34 {
       
    35 
       
    36     protected $_rootNamespace = 'ga';
       
    37     protected $_rootElement = 'tableId';
       
    38     protected $_value = null;
       
    39 
       
    40     /**
       
    41      * Constructs a new Zend_Gdata_Calendar_Extension_Timezone object.
       
    42      * @param string $value (optional) The text content of the element.
       
    43      */
       
    44     public function __construct($value = null)
       
    45     {
       
    46         $this->registerAllNamespaces(Zend_Gdata_Analytics::$namespaces);
       
    47         parent::__construct();
       
    48         $this->_value = $value;
       
    49     }
       
    50 
       
    51     /**
       
    52      * Retrieves a DOMElement which corresponds to this element and all
       
    53      * child properties.  This is used to build an entry back into a DOM
       
    54      * and eventually XML text for sending to the server upon updates, or
       
    55      * for application storage/persistence.
       
    56      *
       
    57      * @param DOMDocument $doc The DOMDocument used to construct DOMElements
       
    58      * @return DOMElement The DOMElement representing this element and all
       
    59      * child properties.
       
    60      */
       
    61     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
       
    62     {
       
    63         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
       
    64         if ($this->_value != null) {
       
    65             $element->setAttribute('value', $this->_value);
       
    66         }
       
    67         return $element;
       
    68     }
       
    69 
       
    70     /**
       
    71      * Given a DOMNode representing an attribute, tries to map the data into
       
    72      * instance members.  If no mapping is defined, the name and value are
       
    73      * stored in an array.
       
    74      *
       
    75      * @param DOMNode $attribute The DOMNode attribute needed to be handled
       
    76      */
       
    77     protected function takeChildFromDOM($child)
       
    78     {
       
    79        $this->_value = $child->nodeValue;
       
    80     }
       
    81 
       
    82     /**
       
    83      * Get the value for this element's value attribute.
       
    84      *
       
    85      * @return string The value associated with this attribute.
       
    86      */
       
    87     public function getValue()
       
    88     {
       
    89         return $this->_value;
       
    90     }
       
    91 
       
    92     /**
       
    93      * Set the value for this element's value attribute.
       
    94      *
       
    95      * @param string $value The desired value for this attribute.
       
    96      * @return Zend_Gdata_Calendar_Extension_Timezone The element being modified.
       
    97      */
       
    98     public function setValue($value)
       
    99     {
       
   100         $this->_value = $value;
       
   101         return $this;
       
   102     }
       
   103 
       
   104     /**
       
   105      * Magic toString method allows using this directly via echo
       
   106      * Works best in PHP >= 4.2.0
       
   107      */
       
   108     public function __toString()
       
   109     {
       
   110         return $this->getValue();
       
   111     }
       
   112 }