File indexing completed on 2024-06-23 05:55:23

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Gdata
0017  * @subpackage Spreadsheets
0018  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0019  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0020  * @version    $Id$
0021  */
0022 
0023 /**
0024  * @see Zend_Gdata_Entry
0025  */
0026 // require_once 'Zend/Gdata/Entry.php';
0027 
0028 /**
0029  * @see Zend_Gdata_Extension
0030  */
0031 // require_once 'Zend/Gdata/Extension.php';
0032 
0033 
0034 /**
0035  * Concrete class for working with custom gsx elements.
0036  *
0037  * @category   Zend
0038  * @package    Zend_Gdata
0039  * @subpackage Spreadsheets
0040  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0041  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0042  */
0043 class Zend_Gdata_Spreadsheets_Extension_Custom extends Zend_Gdata_Extension
0044 {
0045     // custom elements have custom names.
0046     protected $_rootElement = null; // The name of the column
0047     protected $_rootNamespace = 'gsx';
0048 
0049     /**
0050      * Constructs a new Zend_Gdata_Spreadsheets_Extension_Custom object.
0051      * @param string $column (optional) The column/tag name of the element.
0052      * @param string $value (optional) The text content of the element.
0053      */
0054     public function __construct($column = null, $value = null)
0055     {
0056         $this->registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces);
0057         parent::__construct();
0058         $this->_text = $value;
0059         $this->_rootElement = $column;
0060     }
0061 
0062     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
0063     {
0064         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
0065         return $element;
0066     }
0067 
0068     /**
0069      * Transfers each child and attribute into member variables.
0070      * This is called when XML is received over the wire and the data
0071      * model needs to be built to represent this XML.
0072      *
0073      * @param DOMNode $node The DOMNode that represents this object's data
0074      */
0075     public function transferFromDOM($node)
0076     {
0077         parent::transferFromDOM($node);
0078         $this->_rootElement = $node->localName;
0079     }
0080 
0081     /**
0082      * Sets the column/tag name of the element.
0083      * @param string $column The new column name.
0084      */
0085     public function setColumnName($column)
0086     {
0087         $this->_rootElement = $column;
0088         return $this;
0089     }
0090 
0091     /**
0092      * Gets the column name of the element
0093      * @return string The column name.
0094      */
0095     public function getColumnName()
0096     {
0097         return $this->_rootElement;
0098     }
0099 
0100 }