import v1.0.0-RC4 | 2009-05-20

This commit is contained in:
2019-07-17 22:08:50 +02:00
commit b484e522e8
2459 changed files with 1038434 additions and 0 deletions

View File

@ -0,0 +1,103 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Spreadsheets
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Entry
*/
require_once 'Zend/Gdata/Entry.php';
/**
* @see Zend_Gdata_Spreadsheets_Extension_Cell
*/
require_once 'Zend/Gdata/Spreadsheets/Extension/Cell.php';
/**
* Concrete class for working with Cell entries.
*
* @category Zend
* @package Zend_Gdata
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Spreadsheets_CellEntry extends Zend_Gdata_Entry
{
protected $_entryClassName = 'Zend_Gdata_Spreadsheets_CellEntry';
protected $_cell;
/**
* Constructs a new Zend_Gdata_Spreadsheets_CellEntry object.
* @param string $uri (optional)
* @param DOMElement $element (optional) The DOMElement on which to base this object.
*/
public function __construct($element = null)
{
foreach (Zend_Gdata_Spreadsheets::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
parent::__construct($element);
}
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
if ($this->_cell != null) {
$element->appendChild($this->_cell->getDOM($element->ownerDocument));
}
return $element;
}
protected function takeChildFromDOM($child)
{
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
switch ($absoluteNodeName) {
case $this->lookupNamespace('gs') . ':' . 'cell';
$cell = new Zend_Gdata_Spreadsheets_Extension_Cell();
$cell->transferFromDOM($child);
$this->_cell = $cell;
break;
default:
parent::takeChildFromDOM($child);
break;
}
}
/**
* Gets the Cell element of this Cell Entry.
* @return Zend_Gdata_Spreadsheets_Extension_Cell
*/
public function getCell()
{
return $this->_cell;
}
/**
* Sets the Cell element of this Cell Entry.
* @param $cell Zend_Gdata_Spreadsheets_Extension_Cell $cell
*/
public function setCell($cell)
{
$this->_cell = $cell;
return $this;
}
}

View File

@ -0,0 +1,158 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Spreadsheets
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Feed
*/
require_once 'Zend/Gdata/Feed.php';
/**
* @see Zend_Gdata_Spreadsheets_Extension_RowCount
*/
require_once 'Zend/Gdata/Spreadsheets/Extension/RowCount.php';
/**
* @see Zend_Gdata_Spreadsheets_Extension_ColCount
*/
require_once 'Zend/Gdata/Spreadsheets/Extension/ColCount.php';
/**
*
* @category Zend
* @package Zend_Gdata
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Spreadsheets_CellFeed extends Zend_Gdata_Feed
{
/**
* The classname for individual feed elements.
*
* @var string
*/
protected $_entryClassName = 'Zend_Gdata_Spreadsheets_CellEntry';
/**
* The classname for the feed.
*
* @var string
*/
protected $_feedClassName = 'Zend_Gdata_Spreadsheets_CellFeed';
/**
* The row count for the feed.
*
* @var Zend_Gdata_Spreadsheets_Extension_RowCount
*/
protected $_rowCount = null;
/**
* The column count for the feed.
*
* @var Zend_Gdata_Spreadsheets_Extension_ColCount
*/
protected $_colCount = null;
/**
* Constructs a new Zend_Gdata_Spreadsheets_CellFeed object.
* @param DOMElement $element (optional) The XML Element on which to base this object.
*/
public function __construct($element = null)
{
foreach (Zend_Gdata_Spreadsheets::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
parent::__construct($element);
}
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
if ($this->rowCount != null) {
$element->appendChild($this->_rowCount->getDOM($element->ownerDocument));
}
if ($this->colCount != null) {
$element->appendChild($this->_colCount->getDOM($element->ownerDocument));
}
return $element;
}
protected function takeChildFromDOM($child)
{
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
switch ($absoluteNodeName) {
case $this->lookupNamespace('gs') . ':' . 'rowCount';
$rowCount = new Zend_Gdata_Spreadsheets_Extension_RowCount();
$rowCount->transferFromDOM($child);
$this->_rowCount = $rowCount;
break;
case $this->lookupNamespace('gs') . ':' . 'colCount';
$colCount = new Zend_Gdata_Spreadsheets_Extension_ColCount();
$colCount->transferFromDOM($child);
$this->_colCount = $colCount;
break;
default:
parent::takeChildFromDOM($child);
break;
}
}
/**
* Gets the row count for this feed.
* @return string The row count for the feed.
*/
public function getRowCount()
{
return $this->_rowCount;
}
/**
* Gets the column count for this feed.
* @return string The column count for the feed.
*/
public function getColumnCount()
{
return $this->_colCount;
}
/**
* Sets the row count for this feed.
* @param string $rowCount The new row count for the feed.
*/
public function setRowCount($rowCount)
{
$this->_rowCount = $rowCount;
return $this;
}
/**
* Sets the column count for this feed.
* @param string $colCount The new column count for the feed.
*/
public function setColumnCount($colCount)
{
$this->_colCount = $colCount;
return $this;
}
}

View File

@ -0,0 +1,415 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Spreadsheets
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* Zend_Gdata_App_util
*/
require_once('Zend/Gdata/App/Util.php');
/**
* Zend_Gdata_Query
*/
require_once('Zend/Gdata/Query.php');
/**
* Assists in constructing queries for Google Spreadsheets cells
*
* @link http://code.google.com/apis/gdata/spreadsheets/
*
* @category Zend
* @package Zend_Gdata
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Spreadsheets_CellQuery extends Zend_Gdata_Query
{
const SPREADSHEETS_CELL_FEED_URI = 'http://spreadsheets.google.com/feeds/cells';
protected $_defaultFeedUri = self::SPREADSHEETS_CELL_FEED_URI;
protected $_visibility = 'private';
protected $_projection = 'full';
protected $_spreadsheetKey = null;
protected $_worksheetId = 'default';
protected $_cellId = null;
/**
* Constructs a new Zend_Gdata_Spreadsheets_CellQuery object.
*
* @param string $url Base URL to use for queries
*/
public function __construct($url = null)
{
parent::__construct($url);
}
/**
* Sets the spreadsheet key for this query.
*
* @param string $value
* @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
*/
public function setSpreadsheetKey($value)
{
$this->_spreadsheetKey = $value;
return $this;
}
/**
* Gets the spreadsheet key for this query.
*
* @return string spreadsheet key
*/
public function getSpreadsheetKey()
{
return $this->_spreadsheetKey;
}
/**
* Sets the worksheet id for this query.
*
* @param string $value
* @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
*/
public function setWorksheetId($value)
{
$this->_worksheetId = $value;
return $this;
}
/**
* Gets the worksheet id for this query.
*
* @return string worksheet id
*/
public function getWorksheetId()
{
return $this->_worksheetId;
}
/**
* Sets the cell id for this query.
*
* @param string $value
* @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
*/
public function setCellId($value)
{
$this->_cellId = $value;
return $this;
}
/**
* Gets the cell id for this query.
*
* @return string cell id
*/
public function getCellId()
{
return $this->_cellId;
}
/**
* Sets the projection for this query.
*
* @param string $value
* @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
*/
public function setProjection($value)
{
$this->_projection = $value;
return $this;
}
/**
* Sets the visibility for this query.
*
* @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
*/
public function setVisibility($value)
{
$this->_visibility = $value;
return $this;
}
/**
* Gets the projection for this query.
*
* @return string projection
*/
public function getProjection()
{
return $this->_projection;
}
/**
* Gets the visibility for this query.
*
* @return string visibility
*/
public function getVisibility()
{
return $this->_visibility;
}
/**
* Sets the min-row attribute for this query.
*
* @param string $value
* @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
*/
public function setMinRow($value)
{
if ($value != null) {
$this->_params['min-row'] = $value;
} else {
unset($this->_params['min-row']);
}
return $this;
}
/**
* Gets the min-row attribute for this query.
*
* @return string min-row
*/
public function getMinRow()
{
if (array_key_exists('min-row', $this->_params)) {
return $this->_params['min-row'];
} else {
return null;
}
}
/**
* Sets the max-row attribute for this query.
*
* @param string $value
* @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
*/
public function setMaxRow($value)
{
if ($value != null) {
$this->_params['max-row'] = $value;
} else {
unset($this->_params['max-row']);
}
return $this;
}
/**
* Gets the max-row attribute for this query.
*
* @return string max-row
*/
public function getMaxRow()
{
if (array_key_exists('max-row', $this->_params)) {
return $this->_params['max-row'];
} else {
return null;
}
}
/**
* Sets the min-col attribute for this query.
*
* @param string $value
* @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
*/
public function setMinCol($value)
{
if ($value != null) {
$this->_params['min-col'] = $value;
} else {
unset($this->_params['min-col']);
}
return $this;
}
/**
* Gets the min-col attribute for this query.
*
* @return string min-col
*/
public function getMinCol()
{
if (array_key_exists('min-col', $this->_params)) {
return $this->_params['min-col'];
} else {
return null;
}
}
/**
* Sets the max-col attribute for this query.
*
* @param string $value
* @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
*/
public function setMaxCol($value)
{
if ($value != null) {
$this->_params['max-col'] = $value;
} else {
unset($this->_params['max-col']);
}
return $this;
}
/**
* Gets the max-col attribute for this query.
*
* @return string max-col
*/
public function getMaxCol()
{
if (array_key_exists('max-col', $this->_params)) {
return $this->_params['max-col'];
} else {
return null;
}
}
/**
* Sets the range attribute for this query.
*
* @param string $value
* @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
*/
public function setRange($value)
{
if ($value != null) {
$this->_params['range'] = $value;
} else {
unset($this->_params['range']);
}
return $this;
}
/**
* Gets the range attribute for this query.
*
* @return string range
*/
public function getRange()
{
if (array_key_exists('range', $this->_params)) {
return $this->_params['range'];
} else {
return null;
}
}
/**
* Sets the return-empty attribute for this query.
*
* @param mixed $value String or bool value for whether to return empty cells
* @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
*/
public function setReturnEmpty($value)
{
if (is_bool($value)) {
$this->_params['return-empty'] = ($value?'true':'false');
} else if ($value != null) {
$this->_params['return-empty'] = $value;
} else {
unset($this->_params['return-empty']);
}
return $this;
}
/**
* Gets the return-empty attribute for this query.
*
* @return string return-empty
*/
public function getReturnEmpty()
{
if (array_key_exists('return-empty', $this->_params)) {
return $this->_params['return-empty'];
} else {
return null;
}
}
/**
* Gets the full query URL for this query.
*
* @return string url
*/
public function getQueryUrl()
{
if ($this->_url == null) {
$uri = $this->_defaultFeedUri;
if ($this->_spreadsheetKey != null) {
$uri .= '/'.$this->_spreadsheetKey;
} else {
require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception('A spreadsheet key must be provided for cell queries.');
}
if ($this->_worksheetId != null) {
$uri .= '/'.$this->_worksheetId;
} else {
require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception('A worksheet id must be provided for cell queries.');
}
if ($this->_visibility != null) {
$uri .= '/'.$this->_visibility;
} else {
require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception('A visibility must be provided for cell queries.');
}
if ($this->_projection != null) {
$uri .= '/'.$this->_projection;
} else {
require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception('A projection must be provided for cell queries.');
}
if ($this->_cellId != null) {
$uri .= '/'.$this->_cellId;
}
} else {
$uri = $this->_url;
}
$uri .= $this->getQueryString();
return $uri;
}
/**
* Gets the attribute query string for this query.
*
* @return string query string
*/
public function getQueryString()
{
return parent::getQueryString();
}
}

View File

@ -0,0 +1,286 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Spreadsheets
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* Zend_Gdata_App_util
*/
require_once('Zend/Gdata/App/Util.php');
/**
* Zend_Gdata_Query
*/
require_once('Zend/Gdata/Query.php');
/**
* Assists in constructing queries for Google Spreadsheets documents
*
* @link http://code.google.com/apis/gdata/spreadsheets/
*
* @category Zend
* @package Zend_Gdata
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Spreadsheets_DocumentQuery extends Zend_Gdata_Query
{
const SPREADSHEETS_FEED_URI = 'http://spreadsheets.google.com/feeds';
protected $_defaultFeedUri = self::SPREADSHEETS_FEED_URI;
protected $_documentType;
protected $_visibility = 'private';
protected $_projection = 'full';
protected $_spreadsheetKey = null;
protected $_worksheetId = null;
/**
* Constructs a new Zend_Gdata_Spreadsheets_DocumentQuery object.
*/
public function __construct()
{
parent::__construct();
}
/**
* Sets the spreadsheet key for this query.
* @param string $value
* @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
*/
public function setSpreadsheetKey($value)
{
$this->_spreadsheetKey = $value;
return $this;
}
/**
* Gets the spreadsheet key for this query.
* @return string spreadsheet key
*/
public function getSpreadsheetKey()
{
return $this->_spreadsheetKey;
}
/**
* Sets the worksheet id for this query.
* @param string $value
* @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
*/
public function setWorksheetId($value)
{
$this->_worksheetId = $value;
return $this;
}
/**
* Gets the worksheet id for this query.
* @return string worksheet id
*/
public function getWorksheetId()
{
return $this->_worksheetId;
}
/**
* Sets the document type for this query.
* @param string $value spreadsheets or worksheets
* @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface
*/
public function setDocumentType($value)
{
$this->_documentType = $value;
return $this;
}
/**
* Gets the document type for this query.
* @return string document type
*/
public function getDocumentType()
{
return $this->_documentType;
}
/**
* Sets the projection for this query.
* @param string $value
* @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface
*/
public function setProjection($value)
{
$this->_projection = $value;
return $this;
}
/**
* Sets the visibility for this query.
* @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface
*/
public function setVisibility($value)
{
$this->_visibility = $value;
return $this;
}
/**
* Gets the projection for this query.
* @return string projection
*/
public function getProjection()
{
return $this->_projection;
}
/**
* Gets the visibility for this query.
* @return string visibility
*/
public function getVisibility()
{
return $this->_visibility;
}
/**
* Sets the title attribute for this query.
* @param string $value
* @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface
*/
public function setTitle($value)
{
if ($value != null) {
$this->_params['title'] = $value;
} else {
unset($this->_params['title']);
}
return $this;
}
/**
* Sets the title-exact attribute for this query.
* @param string $value
* @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface
*/
public function setTitleExact($value)
{
if ($value != null) {
$this->_params['title-exact'] = $value;
} else {
unset($this->_params['title-exact']);
}
return $this;
}
/**
* Gets the title attribute for this query.
* @return string title
*/
public function getTitle()
{
if (array_key_exists('title', $this->_params)) {
return $this->_params['title'];
} else {
return null;
}
}
/**
* Gets the title-exact attribute for this query.
* @return string title-exact
*/
public function getTitleExact()
{
if (array_key_exists('title-exact', $this->_params)) {
return $this->_params['title-exact'];
} else {
return null;
}
}
private function appendVisibilityProjection()
{
$uri = '';
if ($this->_visibility != null) {
$uri .= '/'.$this->_visibility;
} else {
require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception('A visibility must be provided for document queries.');
}
if ($this->_projection != null) {
$uri .= '/'.$this->_projection;
} else {
require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception('A projection must be provided for document queries.');
}
return $uri;
}
/**
* Gets the full query URL for this query.
* @return string url
*/
public function getQueryUrl()
{
$uri = $this->_defaultFeedUri;
if ($this->_documentType != null) {
$uri .= '/'.$this->_documentType;
} else {
require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception('A document type must be provided for document queries.');
}
if ($this->_documentType == 'spreadsheets') {
$uri .= $this->appendVisibilityProjection();
if ($this->_spreadsheetKey != null) {
$uri .= '/'.$this->_spreadsheetKey;
}
} else if ($this->_documentType == 'worksheets') {
if ($this->_spreadsheetKey != null) {
$uri .= '/'.$this->_spreadsheetKey;
} else {
require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception('A spreadsheet key must be provided for worksheet document queries.');
}
$uri .= $this->appendVisibilityProjection();
if ($this->_worksheetId != null) {
$uri .= '/'.$this->_worksheetId;
}
}
$uri .= $this->getQueryString();
return $uri;
}
/**
* Gets the attribute query string for this query.
* @return string query string
*/
public function getQueryString()
{
return parent::getQueryString();
}
}

View File

@ -0,0 +1,201 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Entry.php 3941 2007-03-14 21:36:13Z darby $
*/
/**
* @see Zend_Gdata_Entry
*/
require_once 'Zend/Gdata/Entry.php';
/**
* @see Zend_Gdata_Extension
*/
require_once 'Zend/Gdata/Extension.php';
/**
* Concrete class for working with cell elements.
*
* @category Zend
* @package Zend_Gdata
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Spreadsheets_Extension_Cell extends Zend_Gdata_Extension
{
protected $_rootElement = 'cell';
protected $_rootNamespace = 'gs';
/**
* The row attribute of this cell
*
* @var string
*/
protected $_row = null;
/**
* The column attribute of this cell
*
* @var string
*/
protected $_col = null;
/**
* The inputValue attribute of this cell
*
* @var string
*/
protected $_inputValue = null;
/**
* The numericValue attribute of this cell
*
* @var string
*/
protected $_numericValue = null;
/**
* Constructs a new Zend_Gdata_Spreadsheets_Extension_Cell element.
*
* @param string $text (optional) Text contents of the element.
* @param string $row (optional) Row attribute of the element.
* @param string $col (optional) Column attribute of the element.
* @param string $inputValue (optional) Input value attribute of the element.
* @param string $numericValue (optional) Numeric value attribute of the element.
*/
public function __construct($text = null, $row = null, $col = null, $inputValue = null, $numericValue = null)
{
foreach (Zend_Gdata_Spreadsheets::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
parent::__construct();
$this->_text = $text;
$this->_row = $row;
$this->_col = $col;
$this->_inputValue = $inputValue;
$this->_numericValue = $numericValue;
}
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
$element->setAttribute('row', $this->_row);
$element->setAttribute('col', $this->_col);
if ($this->_inputValue) $element->setAttribute('inputValue', $this->_inputValue);
if ($this->_numericValue) $element->setAttribute('numericValue', $this->_numericValue);
return $element;
}
protected function takeAttributeFromDOM($attribute)
{
switch ($attribute->localName) {
case 'row':
$this->_row = $attribute->nodeValue;
break;
case 'col':
$this->_col = $attribute->nodeValue;
break;
case 'inputValue':
$this->_inputValue = $attribute->nodeValue;
break;
case 'numericValue':
$this->_numericValue = $attribute->nodeValue;
break;
default:
parent::takeAttributeFromDOM($attribute);
}
}
/**
* Gets the row attribute of the Cell element.
* @return string Row of the Cell.
*/
public function getRow()
{
return $this->_row;
}
/**
* Gets the column attribute of the Cell element.
* @return string Column of the Cell.
*/
public function getColumn()
{
return $this->_col;
}
/**
* Gets the input value attribute of the Cell element.
* @return string Input value of the Cell.
*/
public function getInputValue()
{
return $this->_inputValue;
}
/**
* Gets the numeric value attribute of the Cell element.
* @return string Numeric value of the Cell.
*/
public function getNumericValue()
{
return $this->_numericValue;
}
/**
* Sets the row attribute of the Cell element.
* @param string $row New row of the Cell.
*/
public function setRow($row)
{
$this->_row = $row;
return $this;
}
/**
* Sets the column attribute of the Cell element.
* @param string $col New column of the Cell.
*/
public function setColumn($col)
{
$this->_col = $col;
return $this;
}
/**
* Sets the input value attribute of the Cell element.
* @param string $inputValue New input value of the Cell.
*/
public function setInputValue($inputValue)
{
$this->_inputValue = $inputValue;
return $this;
}
/**
* Sets the numeric value attribute of the Cell element.
* @param string $numericValue New numeric value of the Cell.
*/
public function setNumericValue($numericValue)
{
$this->_numericValue = $numericValue;
}
}

View File

@ -0,0 +1,59 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Entry.php 3941 2007-03-14 21:36:13Z darby $
*/
/**
* @see Zend_Gdata_Entry
*/
require_once 'Zend/Gdata/Entry.php';
/**
* @see Zend_Gdata_Extension
*/
require_once 'Zend/Gdata/Extension.php';
/**
* Concrete class for working with colCount elements.
*
* @category Zend
* @package Zend_Gdata
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Spreadsheets_Extension_ColCount extends Zend_Gdata_Extension
{
protected $_rootElement = 'colCount';
protected $_rootNamespace = 'gs';
/**
* Constructs a new Zend_Gdata_Spreadsheets_Extension_ColCount element.
* @param string $text (optional) Text contents of the element.
*/
public function __construct($text = null)
{
foreach (Zend_Gdata_Spreadsheets::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
parent::__construct();
$this->_text = $text;
}
}

View File

@ -0,0 +1,100 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Entry.php 3941 2007-03-14 21:36:13Z darby $
*/
/**
* @see Zend_Gdata_Entry
*/
require_once 'Zend/Gdata/Entry.php';
/**
* @see Zend_Gdata_Extension
*/
require_once 'Zend/Gdata/Extension.php';
/**
* Concrete class for working with custom gsx elements.
*
* @category Zend
* @package Zend_Gdata
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Spreadsheets_Extension_Custom extends Zend_Gdata_Extension
{
// custom elements have custom names.
protected $_rootElement = null; // The name of the column
protected $_rootNamespace = 'gsx';
/**
* Constructs a new Zend_Gdata_Spreadsheets_Extension_Custom object.
* @param string $column (optional) The column/tag name of the element.
* @param string $value (optional) The text content of the element.
*/
public function __construct($column = null, $value = null)
{
foreach (Zend_Gdata_Spreadsheets::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
parent::__construct();
$this->_text = $value;
$this->_rootElement = $column;
}
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
return $element;
}
/**
* Transfers each child and attribute into member variables.
* This is called when XML is received over the wire and the data
* model needs to be built to represent this XML.
*
* @param DOMNode $node The DOMNode that represents this object's data
*/
public function transferFromDOM($node)
{
parent::transferFromDOM($node);
$this->_rootElement = $node->localName;
}
/**
* Sets the column/tag name of the element.
* @param string $column The new column name.
*/
public function setColumnName($column)
{
$this->_rootElement = $column;
return $this;
}
/**
* Gets the column name of the element
* @return string The column name.
*/
public function getColumnName()
{
return $this->_rootElement;
}
}

View File

@ -0,0 +1,60 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Entry.php 3941 2007-03-14 21:36:13Z darby $
*/
/**
* @see Zend_Gdata_Entry
*/
require_once 'Zend/Gdata/Entry.php';
/**
* @see Zend_Gdata_Extension
*/
require_once 'Zend/Gdata/Extension.php';
/**
* Concrete class for working with RowCount elements.
*
* @category Zend
* @package Zend_Gdata
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Spreadsheets_Extension_RowCount extends Zend_Gdata_Extension
{
protected $_rootElement = 'rowCount';
protected $_rootNamespace = 'gs';
/**
* Constructs a new Zend_Gdata_Spreadsheets_Extension_RowCount object.
* @param string $text (optional) The text content of the element.
*/
public function __construct($text = null)
{
foreach (Zend_Gdata_Spreadsheets::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
parent::__construct();
$this->_text = $text;
}
}

View File

@ -0,0 +1,208 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Spreadsheets
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Entry
*/
require_once 'Zend/Gdata/Entry.php';
/**
* @see Zend_Gdata_Spreadsheets_Extension_Custom
*/
require_once 'Zend/Gdata/Spreadsheets/Extension/Custom.php';
/**
* Concrete class for working with List entries.
*
* @category Zend
* @package Zend_Gdata
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Spreadsheets_ListEntry extends Zend_Gdata_Entry
{
protected $_entryClassName = 'Zend_Gdata_Spreadsheets_ListEntry';
/**
* List of custom row elements (Zend_Gdata_Spreadsheets_Extension_Custom),
* indexed by order added to this entry.
* @var array
*/
protected $_custom = array();
/**
* List of custom row elements (Zend_Gdata_Spreadsheets_Extension_Custom),
* indexed by element name.
* @var array
*/
protected $_customByName = array();
/**
* Constructs a new Zend_Gdata_Spreadsheets_ListEntry object.
* @param DOMElement $element An existing XML element on which to base this new object.
*/
public function __construct($element = null)
{
foreach (Zend_Gdata_Spreadsheets::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
parent::__construct($element);
}
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
if (!empty($this->_custom)) {
foreach ($this->_custom as $custom) {
$element->appendChild($custom->getDOM($element->ownerDocument));
}
}
return $element;
}
protected function takeChildFromDOM($child)
{
switch ($child->namespaceURI) {
case $this->lookupNamespace('gsx');
$custom = new Zend_Gdata_Spreadsheets_Extension_Custom($child->localName);
$custom->transferFromDOM($child);
$this->addCustom($custom);
break;
default:
parent::takeChildFromDOM($child);
break;
}
}
/**
* Gets the row elements contained by this list entry.
* @return array The custom row elements in this list entry
*/
public function getCustom()
{
return $this->_custom;
}
/**
* Gets a single row element contained by this list entry using its name.
* @param string $name The name of a custom element to return. If null
* or not defined, an array containing all custom elements
* indexed by name will be returned.
* @return mixed If a name is specified, the
* Zend_Gdata_Spreadsheets_Extension_Custom element requested,
* is returned or null if not found. Otherwise, an array of all
* Zend_Gdata_Spreadsheets_Extension_Custom elements is returned
* indexed by name.
*/
public function getCustomByName($name = null)
{
if ($name === null) {
return $this->_customByName;
} else {
if (array_key_exists($name, $this->customByName)) {
return $this->_customByName[$name];
} else {
return null;
}
}
}
/**
* Sets the row elements contained by this list entry. If any
* custom row elements were previously stored, they will be overwritten.
* @param array $custom The custom row elements to be contained in this
* list entry.
* @return Zend_Gdata_Spreadsheets_ListEntry Provides a fluent interface.
*/
public function setCustom($custom)
{
$this->_custom = array();
foreach ($custom as $c) {
$this->addCustom($c);
}
return $this;
}
/**
* Add an individual custom row element to this list entry.
* @param Zend_Gdata_Spreadsheets_Extension_Custom $custom The custom
* element to be added.
* @return Zend_Gdata_Spreadsheets_ListEntry Provides a fluent interface.
*/
public function addCustom($custom)
{
$this->_custom[] = $custom;
$this->_customByName[$custom->getColumnName()] = $custom;
return $this;
}
/**
* Remove an individual row element from this list entry by index. This
* will cause the array to be re-indexed.
* @param int $index The index of the custom element to be deleted.
* @return Zend_Gdata_Spreadsheets_ListEntry Provides a fluent interface.
* @throws Zend_Gdata_App_InvalidArgumentException
*/
public function removeCustom($index)
{
if (array_key_exists($index, $this->_custom)) {
$element = $this->_custom[$index];
// Remove element
unset($this->_custom[$index]);
// Re-index the array
$this->_custom = array_values($this->_custom);
// Be sure to delete form both arrays!
$key = array_search($element, $this->_customByName);
unset($this->_customByName[$key]);
} else {
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
throw new Zend_Gdata_App_InvalidArgumentException(
'Element does not exist.');
}
return $this;
}
/**
* Remove an individual row element from this list entry by name.
* @param string $name The name of the custom element to be deleted.
* @return Zend_Gdata_Spreadsheets_ListEntry Provides a fluent interface.
* @throws Zend_Gdata_App_InvalidArgumentException
*/
public function removeCustomByName($name)
{
if (array_key_exists($name, $this->_customByName)) {
$element = $this->_customByName[$name];
// Remove element
unset($this->_customByName[$name]);
// Be sure to delete from both arrays!
$key = array_search($element, $this->_custom);
unset($this->_custom[$key]);
} else {
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
throw new Zend_Gdata_App_InvalidArgumentException(
'Element does not exist.');
}
return $this;
}
}

View File

@ -0,0 +1,64 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Spreadsheets
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Feed
*/
require_once 'Zend/Gdata/Feed.php';
/**
*
* @category Zend
* @package Zend_Gdata
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Spreadsheets_ListFeed extends Zend_Gdata_Feed
{
/**
* The classname for individual feed elements.
*
* @var string
*/
protected $_entryClassName = 'Zend_Gdata_Spreadsheets_ListEntry';
/**
* The classname for the feed.
*
* @var string
*/
protected $_feedClassName = 'Zend_Gdata_Spreadsheets_ListFeed';
/**
* Constructs a new Zend_Gdata_Spreadsheets_ListFeed object.
* @param DOMElement $element An existing XML element on which to base this new object.
*/
public function __construct($element = null)
{
foreach (Zend_Gdata_Spreadsheets::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
parent::__construct($element);
}
}

View File

@ -0,0 +1,303 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Spreadsheets
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* Zend_Gdata_App_util
*/
require_once('Zend/Gdata/App/Util.php');
/**
* Zend_Gdata_Query
*/
require_once('Zend/Gdata/Query.php');
/**
* Assists in constructing queries for Google Spreadsheets lists
*
* @link http://code.google.com/apis/gdata/calendar/
*
* @category Zend
* @package Zend_Gdata
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Spreadsheets_ListQuery extends Zend_Gdata_Query
{
const SPREADSHEETS_LIST_FEED_URI = 'http://spreadsheets.google.com/feeds/list';
protected $_defaultFeedUri = self::SPREADSHEETS_LIST_FEED_URI;
protected $_visibility = 'private';
protected $_projection = 'full';
protected $_spreadsheetKey = null;
protected $_worksheetId = 'default';
protected $_rowId = null;
/**
* Constructs a new Zend_Gdata_Spreadsheets_ListQuery object.
*/
public function __construct()
{
parent::__construct();
}
/**
* Sets the spreadsheet key for the query.
* @param string $value
* @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
*/
public function setSpreadsheetKey($value)
{
$this->_spreadsheetKey = $value;
return $this;
}
/**
* Gets the spreadsheet key for the query.
* @return string spreadsheet key
*/
public function getSpreadsheetKey()
{
return $this->_spreadsheetKey;
}
/**
* Sets the worksheet id for the query.
* @param string $value
* @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
*/
public function setWorksheetId($value)
{
$this->_worksheetId = $value;
return $this;
}
/**
* Gets the worksheet id for the query.
* @return string worksheet id
*/
public function getWorksheetId()
{
return $this->_worksheetId;
}
/**
* Sets the row id for the query.
* @param string $value row id
* @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
*/
public function setRowId($value)
{
$this->_rowId = $value;
return $this;
}
/**
* Gets the row id for the query.
* @return string row id
*/
public function getRowId()
{
return $this->_rowId;
}
/**
* Sets the projection for the query.
* @param string $value Projection
* @return Zend_Gdata_Spreadsheets_ListQuery Provides a fluent interface
*/
public function setProjection($value)
{
$this->_projection = $value;
return $this;
}
/**
* Sets the visibility for this query.
* @param string $value visibility
* @return Zend_Gdata_Spreadsheets_ListQuery Provides a fluent interface
*/
public function setVisibility($value)
{
$this->_visibility = $value;
return $this;
}
/**
* Gets the projection for this query.
* @return string projection
*/
public function getProjection()
{
return $this->_projection;
}
/**
* Gets the visibility for this query.
* @return string visibility
*/
public function getVisibility()
{
return $this->_visibility;
}
/**
* Sets the spreadsheet key for this query.
* @param string $value
* @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface
*/
public function setSpreadsheetQuery($value)
{
if ($value != null) {
$this->_params['sq'] = $value;
} else {
unset($this->_params['sq']);
}
return $this;
}
/**
* Gets the spreadsheet key for this query.
* @return string spreadsheet query
*/
public function getSpreadsheetQuery()
{
if (array_key_exists('sq', $this->_params)) {
return $this->_params['sq'];
} else {
return null;
}
}
/**
* Sets the orderby attribute for this query.
* @param string $value
* @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface
*/
public function setOrderBy($value)
{
if ($value != null) {
$this->_params['orderby'] = $value;
} else {
unset($this->_params['orderby']);
}
return $this;
}
/**
* Gets the orderby attribute for this query.
* @return string orderby
*/
public function getOrderBy()
{
if (array_key_exists('orderby', $this->_params)) {
return $this->_params['orderby'];
} else {
return null;
}
}
/**
* Sets the reverse attribute for this query.
* @param string $value
* @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface
*/
public function setReverse($value)
{
if ($value != null) {
$this->_params['reverse'] = $value;
} else {
unset($this->_params['reverse']);
}
return $this;
}
/**
* Gets the reverse attribute for this query.
* @return string reverse
*/
public function getReverse()
{
if (array_key_exists('reverse', $this->_params)) {
return $this->_params['reverse'];
} else {
return null;
}
}
/**
* Gets the full query URL for this query.
* @return string url
*/
public function getQueryUrl()
{
$uri = $this->_defaultFeedUri;
if ($this->_spreadsheetKey != null) {
$uri .= '/'.$this->_spreadsheetKey;
} else {
require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception('A spreadsheet key must be provided for list queries.');
}
if ($this->_worksheetId != null) {
$uri .= '/'.$this->_worksheetId;
} else {
require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception('A worksheet id must be provided for list queries.');
}
if ($this->_visibility != null) {
$uri .= '/'.$this->_visibility;
} else {
require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception('A visibility must be provided for list queries.');
}
if ($this->_projection != null) {
$uri .= '/'.$this->_projection;
} else {
require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception('A projection must be provided for list queries.');
}
if ($this->_rowId != null) {
$uri .= '/'.$this->_rowId;
}
$uri .= $this->getQueryString();
return $uri;
}
/**
* Gets the attribute query string for this query.
* @return string query string
*/
public function getQueryString()
{
return parent::getQueryString();
}
}

View File

@ -0,0 +1,64 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Spreadsheets
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Entry
*/
require_once 'Zend/Gdata/Entry.php';
/**
* Concrete class for working with Atom entries.
*
* @category Zend
* @package Zend_Gdata
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Spreadsheets_SpreadsheetEntry extends Zend_Gdata_Entry
{
protected $_entryClassName = 'Zend_Gdata_Spreadsheets_SpreadsheetEntry';
/**
* Constructs a new Zend_Gdata_Spreadsheets_SpreadsheetEntry object.
* @param DOMElement $element (optional) The DOMElement on which to base this object.
*/
public function __construct($element = null)
{
foreach (Zend_Gdata_Spreadsheets::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
parent::__construct($element);
}
/**
* Returns the worksheets in this spreadsheet
*
* @return Zend_Gdata_Spreadsheets_WorksheetFeed The worksheets
*/
public function getWorksheets()
{
$service = new Zend_Gdata_Spreadsheets($this->getHttpClient());
return $service->getWorksheetFeed($this);
}
}

View File

@ -0,0 +1,64 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Spreadsheets
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Feed
*/
require_once 'Zend/Gdata/Feed.php';
/**
*
* @category Zend
* @package Zend_Gdata
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Spreadsheets_SpreadsheetFeed extends Zend_Gdata_Feed
{
/**
* The classname for individual feed elements.
*
* @var string
*/
protected $_entryClassName = 'Zend_Gdata_Spreadsheets_SpreadsheetEntry';
/**
* The classname for the feed.
*
* @var string
*/
protected $_feedClassName = 'Zend_Gdata_Spreadsheets_SpreadsheetFeed';
/**
* Constructs a new Zend_Gdata_Spreadsheets_SpreadsheetFeed object.
* @param DOMElement $element (optional) The DOMElement on which to base this object.
*/
public function __construct($element = null)
{
foreach (Zend_Gdata_Spreadsheets::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
parent::__construct($element);
}
}

View File

@ -0,0 +1,187 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Spreadsheets
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Entry
*/
require_once 'Zend/Gdata/Entry.php';
/**
* @see Zend_Gdata_Spreadsheets_Extension_RowCount
*/
require_once 'Zend/Gdata/Spreadsheets/Extension/RowCount.php';
/**
* @see Zend_Gdata_Spreadsheets_Extension_ColCount
*/
require_once 'Zend/Gdata/Spreadsheets/Extension/ColCount.php';
/**
* Concrete class for working with Worksheet entries.
*
* @category Zend
* @package Zend_Gdata
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Spreadsheets_WorksheetEntry extends Zend_Gdata_Entry
{
protected $_entryClassName = 'Zend_Gdata_Spreadsheets_WorksheetEntry';
protected $_rowCount = null;
protected $_colCount = null;
/**
* Constructs a new Zend_Gdata_Spreadsheets_WorksheetEntry object.
*
* @param DOMElement $element (optional) The DOMElement on which to base this object.
*/
public function __construct($element = null)
{
foreach (Zend_Gdata_Spreadsheets::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
parent::__construct($element);
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for sending to the server upon updates, or
* for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
if ($this->_rowCount != null) {
$element->appendChild($this->_rowCount->getDOM($element->ownerDocument));
}
if ($this->_colCount != null) {
$element->appendChild($this->_colCount->getDOM($element->ownerDocument));
}
return $element;
}
/**
* Creates individual Entry objects of the appropriate type and
* stores them in the $_entry array based upon DOM data.
*
* @param DOMNode $child The DOMNode to process
*/
protected function takeChildFromDOM($child)
{
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
switch ($absoluteNodeName) {
case $this->lookupNamespace('gs') . ':' . 'rowCount';
$rowCount = new Zend_Gdata_Spreadsheets_Extension_RowCount();
$rowCount->transferFromDOM($child);
$this->_rowCount = $rowCount;
break;
case $this->lookupNamespace('gs') . ':' . 'colCount';
$colCount = new Zend_Gdata_Spreadsheets_Extension_ColCount();
$colCount->transferFromDOM($child);
$this->_colCount = $colCount;
break;
default:
parent::takeChildFromDOM($child);
break;
}
}
/**
* Gets the row count for this entry.
*
* @return string The row count for the entry.
*/
public function getRowCount()
{
return $this->_rowCount;
}
/**
* Gets the column count for this entry.
*
* @return string The column count for the entry.
*/
public function getColumnCount()
{
return $this->_colCount;
}
/**
* Sets the row count for this entry.
*
* @param string $rowCount The new row count for the entry.
*/
public function setRowCount($rowCount)
{
$this->_rowCount = $rowCount;
return $this;
}
/**
* Sets the column count for this entry.
*
* @param string $colCount The new column count for the entry.
*/
public function setColumnCount($colCount)
{
$this->_colCount = $colCount;
return $this;
}
/**
* Returns the content of all rows as an associative array
*
* @return array An array of rows. Each element of the array is an associative array of data
*/
public function getContentsAsRows()
{
$service = new Zend_Gdata_Spreadsheets($this->getHttpClient());
return $service->getSpreadsheetListFeedContents($this);
}
/**
* Returns the content of all cells as an associative array, indexed
* off the cell location (ie 'A1', 'D4', etc). Each element of
* the array is an associative array with a 'value' and a 'function'.
* Only non-empty cells are returned by default. 'range' is the
* value of the 'range' query parameter specified at:
* http://code.google.com/apis/spreadsheets/reference.html#cells_Parameters
*
* @param string $range The range of cells to retrieve
* @param boolean $empty Whether to retrieve empty cells
* @return array An associative array of cells
*/
public function getContentsAsCells($range = null, $empty = false)
{
$service = new Zend_Gdata_Spreadsheets($this->getHttpClient());
return $service->getSpreadsheetCellFeedContents($this, $range, $empty);
}
}

View File

@ -0,0 +1,64 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Spreadsheets
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Feed
*/
require_once 'Zend/Gdata/Feed.php';
/**
*
* @category Zend
* @package Zend_Gdata
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Spreadsheets_WorksheetFeed extends Zend_Gdata_Feed
{
/**
* Constructs a new Zend_Gdata_Spreadsheets_WorksheetFeed object.
* @param DOMElement $element (optional) The DOMElement on whick to base this element.
*/
public function __construct($element = null)
{
foreach (Zend_Gdata_Spreadsheets::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
parent::__construct($element);
}
/**
* The classname for individual feed elements.
*
* @var string
*/
protected $_entryClassName = 'Zend_Gdata_Spreadsheets_WorksheetEntry';
/**
* The classname for the feed.
*
* @var string
*/
protected $_feedClassName = 'Zend_Gdata_Spreadsheets_WorksheetFeed';
}