CellEntry.php 3.0 KB

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