]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - Zend/Gdata/Spreadsheets/CellEntry.php
Release 6.5.0
[Github/sugarcrm.git] / Zend / Gdata / Spreadsheets / CellEntry.php
1 <?php
2
3 /**
4  * Zend Framework
5  *
6  * LICENSE
7  *
8  * This source file is subject to the new BSD license that is bundled
9  * with this package in the file LICENSE.txt.
10  * It is also available through the world-wide-web at this URL:
11  * http://framework.zend.com/license/new-bsd
12  * If you did not receive a copy of the license and are unable to
13  * obtain it through the world-wide-web, please send an email
14  * to license@zend.com so we can send you a copy immediately.
15  *
16  * @category     Zend
17  * @package      Zend_Gdata
18  * @subpackage   Spreadsheets
19  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
20  * @license    http://framework.zend.com/license/new-bsd     New BSD License
21
22  */
23
24 /**
25  * @see Zend_Gdata_Entry
26  */
27 require_once 'Zend/Gdata/Entry.php';
28
29 /**
30  * @see Zend_Gdata_Spreadsheets_Extension_Cell
31  */
32 require_once 'Zend/Gdata/Spreadsheets/Extension/Cell.php';
33
34 /**
35  * Concrete class for working with Cell entries.
36  *
37  * @category     Zend
38  * @package      Zend_Gdata
39  * @subpackage   Spreadsheets
40  * @copyright  Copyright (c) 2005-2010 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_CellEntry extends Zend_Gdata_Entry
44 {
45
46     protected $_entryClassName = 'Zend_Gdata_Spreadsheets_CellEntry';
47     protected $_cell;
48
49     /**
50      * Constructs a new Zend_Gdata_Spreadsheets_CellEntry object.
51      * @param string $uri (optional)
52      * @param DOMElement $element (optional) The DOMElement on which to base this object.
53      */
54     public function __construct($element = null)
55     {
56         $this->registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces);
57         parent::__construct($element);
58     }
59
60     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
61     {
62         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
63         if ($this->_cell != null) {
64             $element->appendChild($this->_cell->getDOM($element->ownerDocument));
65         }
66         return $element;
67     }
68
69     protected function takeChildFromDOM($child)
70     {
71         $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
72         switch ($absoluteNodeName) {
73         case $this->lookupNamespace('gs') . ':' . 'cell';
74             $cell = new Zend_Gdata_Spreadsheets_Extension_Cell();
75             $cell->transferFromDOM($child);
76             $this->_cell = $cell;
77             break;
78         default:
79             parent::takeChildFromDOM($child);
80             break;
81         }
82     }
83
84     /**
85      * Gets the Cell element of this Cell Entry.
86      * @return Zend_Gdata_Spreadsheets_Extension_Cell
87      */
88     public function getCell()
89     {
90         return $this->_cell;
91     }
92
93     /**
94      * Sets the Cell element of this Cell Entry.
95      * @param $cell Zend_Gdata_Spreadsheets_Extension_Cell $cell
96      */
97     public function setCell($cell)
98     {
99         $this->_cell = $cell;
100         return $this;
101     }
102
103 }