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 cell 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_Cell extends Zend_Gdata_Extension
0044 {
0045     protected $_rootElement = 'cell';
0046     protected $_rootNamespace = 'gs';
0047 
0048     /**
0049      * The row attribute of this cell
0050      *
0051      * @var string
0052      */
0053     protected $_row = null;
0054 
0055     /**
0056      * The column attribute of this cell
0057      *
0058      * @var string
0059      */
0060     protected $_col = null;
0061 
0062     /**
0063      * The inputValue attribute of this cell
0064      *
0065      * @var string
0066      */
0067     protected $_inputValue = null;
0068 
0069     /**
0070      * The numericValue attribute of this cell
0071      *
0072      * @var string
0073      */
0074     protected $_numericValue = null;
0075 
0076     /**
0077      * Constructs a new Zend_Gdata_Spreadsheets_Extension_Cell element.
0078      *
0079      * @param string $text (optional) Text contents of the element.
0080      * @param string $row (optional) Row attribute of the element.
0081      * @param string $col (optional) Column attribute of the element.
0082      * @param string $inputValue (optional) Input value attribute of the element.
0083      * @param string $numericValue (optional) Numeric value attribute of the element.
0084      */
0085     public function __construct($text = null, $row = null, $col = null, $inputValue = null, $numericValue = null)
0086     {
0087         $this->registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces);
0088         parent::__construct();
0089         $this->_text = $text;
0090         $this->_row = $row;
0091         $this->_col = $col;
0092         $this->_inputValue = $inputValue;
0093         $this->_numericValue = $numericValue;
0094     }
0095 
0096     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
0097     {
0098         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
0099         $element->setAttribute('row', $this->_row);
0100         $element->setAttribute('col', $this->_col);
0101         if ($this->_inputValue) $element->setAttribute('inputValue', $this->_inputValue);
0102         if ($this->_numericValue) $element->setAttribute('numericValue', $this->_numericValue);
0103         return $element;
0104     }
0105 
0106     protected function takeAttributeFromDOM($attribute)
0107     {
0108         switch ($attribute->localName) {
0109         case 'row':
0110             $this->_row = $attribute->nodeValue;
0111             break;
0112         case 'col':
0113             $this->_col = $attribute->nodeValue;
0114             break;
0115         case 'inputValue':
0116             $this->_inputValue = $attribute->nodeValue;
0117             break;
0118         case 'numericValue':
0119             $this->_numericValue = $attribute->nodeValue;
0120             break;
0121         default:
0122             parent::takeAttributeFromDOM($attribute);
0123         }
0124     }
0125 
0126     /**
0127      * Gets the row attribute of the Cell element.
0128      * @return string Row of the Cell.
0129      */
0130     public function getRow()
0131     {
0132         return $this->_row;
0133     }
0134 
0135     /**
0136      * Gets the column attribute of the Cell element.
0137      * @return string Column of the Cell.
0138      */
0139     public function getColumn()
0140     {
0141         return $this->_col;
0142     }
0143 
0144     /**
0145      * Gets the input value attribute of the Cell element.
0146      * @return string Input value of the Cell.
0147      */
0148     public function getInputValue()
0149     {
0150         return $this->_inputValue;
0151     }
0152 
0153     /**
0154      * Gets the numeric value attribute of the Cell element.
0155      * @return string Numeric value of the Cell.
0156      */
0157     public function getNumericValue()
0158     {
0159         return $this->_numericValue;
0160     }
0161 
0162     /**
0163      * Sets the row attribute of the Cell element.
0164      * @param string $row New row of the Cell.
0165      */
0166     public function setRow($row)
0167     {
0168         $this->_row = $row;
0169         return $this;
0170     }
0171 
0172     /**
0173      * Sets the column attribute of the Cell element.
0174      * @param string $col New column of the Cell.
0175      */
0176     public function setColumn($col)
0177     {
0178         $this->_col = $col;
0179         return $this;
0180     }
0181 
0182     /**
0183      * Sets the input value attribute of the Cell element.
0184      * @param string $inputValue New input value of the Cell.
0185      */
0186     public function setInputValue($inputValue)
0187     {
0188         $this->_inputValue = $inputValue;
0189         return $this;
0190     }
0191 
0192     /**
0193      * Sets the numeric value attribute of the Cell element.
0194      * @param string $numericValue New numeric value of the Cell.
0195      */
0196     public function setNumericValue($numericValue)
0197     {
0198         $this->_numericValue = $numericValue;
0199     }
0200 
0201 }