2
0

CellFeed.php 4.3 KB

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