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 Spreadsheets
|
---|
18 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
19 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
20 | * @version $Id: Entry.php 3941 2007-03-14 21:36:13Z darby $
|
---|
21 | */
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * @see Zend_Gdata_Entry
|
---|
25 | */
|
---|
26 | require_once 'Zend/Gdata/Entry.php';
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * @see Zend_Gdata_Extension
|
---|
30 | */
|
---|
31 | require_once 'Zend/Gdata/Extension.php';
|
---|
32 |
|
---|
33 |
|
---|
34 | /**
|
---|
35 | * Concrete class for working with cell elements.
|
---|
36 | *
|
---|
37 | * @category Zend
|
---|
38 | * @package Zend_Gdata
|
---|
39 | * @subpackage Spreadsheets
|
---|
40 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
41 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
42 | */
|
---|
43 | class Zend_Gdata_Spreadsheets_Extension_Cell extends Zend_Gdata_Extension
|
---|
44 | {
|
---|
45 | protected $_rootElement = 'cell';
|
---|
46 | protected $_rootNamespace = 'gs';
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * The row attribute of this cell
|
---|
50 | *
|
---|
51 | * @var string
|
---|
52 | */
|
---|
53 | protected $_row = null;
|
---|
54 |
|
---|
55 | /**
|
---|
56 | * The column attribute of this cell
|
---|
57 | *
|
---|
58 | * @var string
|
---|
59 | */
|
---|
60 | protected $_col = null;
|
---|
61 |
|
---|
62 | /**
|
---|
63 | * The inputValue attribute of this cell
|
---|
64 | *
|
---|
65 | * @var string
|
---|
66 | */
|
---|
67 | protected $_inputValue = null;
|
---|
68 |
|
---|
69 | /**
|
---|
70 | * The numericValue attribute of this cell
|
---|
71 | *
|
---|
72 | * @var string
|
---|
73 | */
|
---|
74 | protected $_numericValue = null;
|
---|
75 |
|
---|
76 | /**
|
---|
77 | * Constructs a new Zend_Gdata_Spreadsheets_Extension_Cell element.
|
---|
78 | *
|
---|
79 | * @param string $text (optional) Text contents of the element.
|
---|
80 | * @param string $row (optional) Row attribute of the element.
|
---|
81 | * @param string $col (optional) Column attribute of the element.
|
---|
82 | * @param string $inputValue (optional) Input value attribute of the element.
|
---|
83 | * @param string $numericValue (optional) Numeric value attribute of the element.
|
---|
84 | */
|
---|
85 | public function __construct($text = null, $row = null, $col = null, $inputValue = null, $numericValue = null)
|
---|
86 | {
|
---|
87 | $this->registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces);
|
---|
88 | parent::__construct();
|
---|
89 | $this->_text = $text;
|
---|
90 | $this->_row = $row;
|
---|
91 | $this->_col = $col;
|
---|
92 | $this->_inputValue = $inputValue;
|
---|
93 | $this->_numericValue = $numericValue;
|
---|
94 | }
|
---|
95 |
|
---|
96 | public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
---|
97 | {
|
---|
98 | $element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
---|
99 | $element->setAttribute('row', $this->_row);
|
---|
100 | $element->setAttribute('col', $this->_col);
|
---|
101 | if ($this->_inputValue) $element->setAttribute('inputValue', $this->_inputValue);
|
---|
102 | if ($this->_numericValue) $element->setAttribute('numericValue', $this->_numericValue);
|
---|
103 | return $element;
|
---|
104 | }
|
---|
105 |
|
---|
106 | protected function takeAttributeFromDOM($attribute)
|
---|
107 | {
|
---|
108 | switch ($attribute->localName) {
|
---|
109 | case 'row':
|
---|
110 | $this->_row = $attribute->nodeValue;
|
---|
111 | break;
|
---|
112 | case 'col':
|
---|
113 | $this->_col = $attribute->nodeValue;
|
---|
114 | break;
|
---|
115 | case 'inputValue':
|
---|
116 | $this->_inputValue = $attribute->nodeValue;
|
---|
117 | break;
|
---|
118 | case 'numericValue':
|
---|
119 | $this->_numericValue = $attribute->nodeValue;
|
---|
120 | break;
|
---|
121 | default:
|
---|
122 | parent::takeAttributeFromDOM($attribute);
|
---|
123 | }
|
---|
124 | }
|
---|
125 |
|
---|
126 | /**
|
---|
127 | * Gets the row attribute of the Cell element.
|
---|
128 | * @return string Row of the Cell.
|
---|
129 | */
|
---|
130 | public function getRow()
|
---|
131 | {
|
---|
132 | return $this->_row;
|
---|
133 | }
|
---|
134 |
|
---|
135 | /**
|
---|
136 | * Gets the column attribute of the Cell element.
|
---|
137 | * @return string Column of the Cell.
|
---|
138 | */
|
---|
139 | public function getColumn()
|
---|
140 | {
|
---|
141 | return $this->_col;
|
---|
142 | }
|
---|
143 |
|
---|
144 | /**
|
---|
145 | * Gets the input value attribute of the Cell element.
|
---|
146 | * @return string Input value of the Cell.
|
---|
147 | */
|
---|
148 | public function getInputValue()
|
---|
149 | {
|
---|
150 | return $this->_inputValue;
|
---|
151 | }
|
---|
152 |
|
---|
153 | /**
|
---|
154 | * Gets the numeric value attribute of the Cell element.
|
---|
155 | * @return string Numeric value of the Cell.
|
---|
156 | */
|
---|
157 | public function getNumericValue()
|
---|
158 | {
|
---|
159 | return $this->_numericValue;
|
---|
160 | }
|
---|
161 |
|
---|
162 | /**
|
---|
163 | * Sets the row attribute of the Cell element.
|
---|
164 | * @param string $row New row of the Cell.
|
---|
165 | */
|
---|
166 | public function setRow($row)
|
---|
167 | {
|
---|
168 | $this->_row = $row;
|
---|
169 | return $this;
|
---|
170 | }
|
---|
171 |
|
---|
172 | /**
|
---|
173 | * Sets the column attribute of the Cell element.
|
---|
174 | * @param string $col New column of the Cell.
|
---|
175 | */
|
---|
176 | public function setColumn($col)
|
---|
177 | {
|
---|
178 | $this->_col = $col;
|
---|
179 | return $this;
|
---|
180 | }
|
---|
181 |
|
---|
182 | /**
|
---|
183 | * Sets the input value attribute of the Cell element.
|
---|
184 | * @param string $inputValue New input value of the Cell.
|
---|
185 | */
|
---|
186 | public function setInputValue($inputValue)
|
---|
187 | {
|
---|
188 | $this->_inputValue = $inputValue;
|
---|
189 | return $this;
|
---|
190 | }
|
---|
191 |
|
---|
192 | /**
|
---|
193 | * Sets the numeric value attribute of the Cell element.
|
---|
194 | * @param string $numericValue New numeric value of the Cell.
|
---|
195 | */
|
---|
196 | public function setNumericValue($numericValue)
|
---|
197 | {
|
---|
198 | $this->_numericValue = $numericValue;
|
---|
199 | }
|
---|
200 |
|
---|
201 | }
|
---|