2
0

CellEntry.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. */
  21. /**
  22. * @see Zend_Gdata_Entry
  23. */
  24. require_once 'Zend/Gdata/Entry.php';
  25. /**
  26. * @see Zend_Gdata_Spreadsheets_Extension_Cell
  27. */
  28. require_once 'Zend/Gdata/Spreadsheets/Extension/Cell.php';
  29. /**
  30. * Concrete class for working with Cell entries.
  31. *
  32. * @category Zend
  33. * @package Zend_Gdata
  34. * @subpackage Spreadsheets
  35. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  36. * @license http://framework.zend.com/license/new-bsd New BSD License
  37. */
  38. class Zend_Gdata_Spreadsheets_CellEntry extends Zend_Gdata_Entry
  39. {
  40. protected $_entryClassName = 'Zend_Gdata_Spreadsheets_CellEntry';
  41. protected $_cell;
  42. /**
  43. * Constructs a new Zend_Gdata_Spreadsheets_CellEntry object.
  44. * @param string $uri (optional)
  45. * @param DOMElement $element (optional) The DOMElement on which to base this object.
  46. */
  47. public function __construct($element = null)
  48. {
  49. $this->registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces);
  50. parent::__construct($element);
  51. }
  52. public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
  53. {
  54. $element = parent::getDOM($doc, $majorVersion, $minorVersion);
  55. if ($this->_cell != null) {
  56. $element->appendChild($this->_cell->getDOM($element->ownerDocument));
  57. }
  58. return $element;
  59. }
  60. protected function takeChildFromDOM($child)
  61. {
  62. $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
  63. switch ($absoluteNodeName) {
  64. case $this->lookupNamespace('gs') . ':' . 'cell';
  65. $cell = new Zend_Gdata_Spreadsheets_Extension_Cell();
  66. $cell->transferFromDOM($child);
  67. $this->_cell = $cell;
  68. break;
  69. default:
  70. parent::takeChildFromDOM($child);
  71. break;
  72. }
  73. }
  74. /**
  75. * Gets the Cell element of this Cell Entry.
  76. * @return Zend_Gdata_Spreadsheets_Extension_Cell
  77. */
  78. public function getCell()
  79. {
  80. return $this->_cell;
  81. }
  82. /**
  83. * Sets the Cell element of this Cell Entry.
  84. * @param $cell Zend_Gdata_Spreadsheets_Extension_Cell $cell
  85. */
  86. public function setCell($cell)
  87. {
  88. $this->_cell = $cell;
  89. return $this;
  90. }
  91. }