CellFeed.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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_Feed
  24. */
  25. require_once 'Zend/Gdata/Feed.php';
  26. /**
  27. * @see Zend_Gdata_Spreadsheets_Extension_RowCount
  28. */
  29. require_once 'Zend/Gdata/Spreadsheets/Extension/RowCount.php';
  30. /**
  31. * @see Zend_Gdata_Spreadsheets_Extension_ColCount
  32. */
  33. require_once 'Zend/Gdata/Spreadsheets/Extension/ColCount.php';
  34. /**
  35. *
  36. * @category Zend
  37. * @package Zend_Gdata
  38. * @subpackage Spreadsheets
  39. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  40. * @license http://framework.zend.com/license/new-bsd New BSD License
  41. */
  42. class Zend_Gdata_Spreadsheets_CellFeed extends Zend_Gdata_Feed
  43. {
  44. /**
  45. * The classname for individual feed elements.
  46. *
  47. * @var string
  48. */
  49. protected $_entryClassName = 'Zend_Gdata_Spreadsheets_CellEntry';
  50. /**
  51. * The classname for the feed.
  52. *
  53. * @var string
  54. */
  55. protected $_feedClassName = 'Zend_Gdata_Spreadsheets_CellFeed';
  56. /**
  57. * The row count for the feed.
  58. *
  59. * @var Zend_Gdata_Spreadsheets_Extension_RowCount
  60. */
  61. protected $_rowCount = null;
  62. /**
  63. * The column count for the feed.
  64. *
  65. * @var Zend_Gdata_Spreadsheets_Extension_ColCount
  66. */
  67. protected $_colCount = null;
  68. /**
  69. * Constructs a new Zend_Gdata_Spreadsheets_CellFeed object.
  70. * @param DOMElement $element (optional) The XML Element on which to base this object.
  71. */
  72. public function __construct($element = null)
  73. {
  74. $this->registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces);
  75. parent::__construct($element);
  76. }
  77. public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
  78. {
  79. $element = parent::getDOM($doc, $majorVersion, $minorVersion);
  80. if ($this->rowCount != null) {
  81. $element->appendChild($this->_rowCount->getDOM($element->ownerDocument));
  82. }
  83. if ($this->colCount != null) {
  84. $element->appendChild($this->_colCount->getDOM($element->ownerDocument));
  85. }
  86. return $element;
  87. }
  88. protected function takeChildFromDOM($child)
  89. {
  90. $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
  91. switch ($absoluteNodeName) {
  92. case $this->lookupNamespace('gs') . ':' . 'rowCount';
  93. $rowCount = new Zend_Gdata_Spreadsheets_Extension_RowCount();
  94. $rowCount->transferFromDOM($child);
  95. $this->_rowCount = $rowCount;
  96. break;
  97. case $this->lookupNamespace('gs') . ':' . 'colCount';
  98. $colCount = new Zend_Gdata_Spreadsheets_Extension_ColCount();
  99. $colCount->transferFromDOM($child);
  100. $this->_colCount = $colCount;
  101. break;
  102. default:
  103. parent::takeChildFromDOM($child);
  104. break;
  105. }
  106. }
  107. /**
  108. * Gets the row count for this feed.
  109. * @return string The row count for the feed.
  110. */
  111. public function getRowCount()
  112. {
  113. return $this->_rowCount;
  114. }
  115. /**
  116. * Gets the column count for this feed.
  117. * @return string The column count for the feed.
  118. */
  119. public function getColumnCount()
  120. {
  121. return $this->_colCount;
  122. }
  123. /**
  124. * Sets the row count for this feed.
  125. * @param string $rowCount The new row count for the feed.
  126. */
  127. public function setRowCount($rowCount)
  128. {
  129. $this->_rowCount = $rowCount;
  130. return $this;
  131. }
  132. /**
  133. * Sets the column count for this feed.
  134. * @param string $colCount The new column count for the feed.
  135. */
  136. public function setColumnCount($colCount)
  137. {
  138. $this->_colCount = $colCount;
  139. return $this;
  140. }
  141. }