[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/zend/Zend/Gdata/Spreadsheets/ -> WorksheetEntry.php (source)

   1  <?php
   2  
   3  /**
   4   * Zend Framework
   5   *
   6   * LICENSE
   7   *
   8   * This source file is subject to the new BSD license that is bundled
   9   * with this package in the file LICENSE.txt.
  10   * It is also available through the world-wide-web at this URL:
  11   * http://framework.zend.com/license/new-bsd
  12   * If you did not receive a copy of the license and are unable to
  13   * obtain it through the world-wide-web, please send an email
  14   * to [email protected] so we can send you a copy immediately.
  15   *
  16   * @category   Zend
  17   * @package    Zend_Gdata
  18   * @subpackage Spreadsheets
  19   * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  20   * @license    http://framework.zend.com/license/new-bsd     New BSD License
  21   * @version    $Id$
  22   */
  23  
  24  /**
  25   * @see Zend_Gdata_Entry
  26   */
  27  require_once 'Zend/Gdata/Entry.php';
  28  
  29  /**
  30   * @see Zend_Gdata_Spreadsheets_Extension_RowCount
  31   */
  32  require_once 'Zend/Gdata/Spreadsheets/Extension/RowCount.php';
  33  
  34  /**
  35   * @see Zend_Gdata_Spreadsheets_Extension_ColCount
  36   */
  37  require_once 'Zend/Gdata/Spreadsheets/Extension/ColCount.php';
  38  
  39  /**
  40   * Concrete class for working with Worksheet entries.
  41   *
  42   * @category   Zend
  43   * @package    Zend_Gdata
  44   * @subpackage Spreadsheets
  45   * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  46   * @license    http://framework.zend.com/license/new-bsd     New BSD License
  47   */
  48  class Zend_Gdata_Spreadsheets_WorksheetEntry extends Zend_Gdata_Entry
  49  {
  50  
  51      protected $_entryClassName = 'Zend_Gdata_Spreadsheets_WorksheetEntry';
  52  
  53      protected $_rowCount = null;
  54      protected $_colCount = null;
  55  
  56      /**
  57       * Constructs a new Zend_Gdata_Spreadsheets_WorksheetEntry object.
  58       *
  59       * @param DOMElement $element (optional) The DOMElement on which to base this object.
  60       */
  61      public function __construct($element = null)
  62      {
  63          $this->registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces);
  64          parent::__construct($element);
  65      }
  66  
  67      /**
  68       * Retrieves a DOMElement which corresponds to this element and all
  69       * child properties.  This is used to build an entry back into a DOM
  70       * and eventually XML text for sending to the server upon updates, or
  71       * for application storage/persistence.
  72       *
  73       * @param DOMDocument $doc The DOMDocument used to construct DOMElements
  74       * @return DOMElement The DOMElement representing this element and all
  75       * child properties.
  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  
  89      /**
  90       * Creates individual Entry objects of the appropriate type and
  91       * stores them in the $_entry array based upon DOM data.
  92       *
  93       * @param DOMNode $child The DOMNode to process
  94       */
  95      protected function takeChildFromDOM($child)
  96      {
  97          $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
  98          switch ($absoluteNodeName) {
  99              case $this->lookupNamespace('gs') . ':' . 'rowCount';
 100                  $rowCount = new Zend_Gdata_Spreadsheets_Extension_RowCount();
 101                  $rowCount->transferFromDOM($child);
 102                  $this->_rowCount = $rowCount;
 103                  break;
 104              case $this->lookupNamespace('gs') . ':' . 'colCount';
 105                  $colCount = new Zend_Gdata_Spreadsheets_Extension_ColCount();
 106                  $colCount->transferFromDOM($child);
 107                  $this->_colCount = $colCount;
 108                  break;
 109              default:
 110                  parent::takeChildFromDOM($child);
 111                  break;
 112          }
 113      }
 114  
 115  
 116      /**
 117       * Gets the row count for this entry.
 118       *
 119       * @return string The row count for the entry.
 120       */
 121      public function getRowCount()
 122      {
 123          return $this->_rowCount;
 124      }
 125  
 126      /**
 127       * Gets the column count for this entry.
 128       *
 129       * @return string The column count for the entry.
 130       */
 131      public function getColumnCount()
 132      {
 133          return $this->_colCount;
 134      }
 135  
 136      /**
 137       * Sets the row count for this entry.
 138       *
 139       * @param string $rowCount The new row count for the entry.
 140       */
 141      public function setRowCount($rowCount)
 142      {
 143          $this->_rowCount = $rowCount;
 144          return $this;
 145      }
 146  
 147      /**
 148       * Sets the column count for this entry.
 149       *
 150       * @param string $colCount The new column count for the entry.
 151       */
 152      public function setColumnCount($colCount)
 153      {
 154          $this->_colCount = $colCount;
 155          return $this;
 156      }
 157  
 158      /**
 159       * Returns the content of all rows as an associative array
 160       *
 161       * @return array An array of rows.  Each element of the array is an associative array of data
 162       */
 163      public function getContentsAsRows()
 164      {
 165          $service = new Zend_Gdata_Spreadsheets($this->getHttpClient());
 166          return $service->getSpreadsheetListFeedContents($this);
 167      }
 168  
 169      /**
 170       * Returns the content of all cells as an associative array, indexed
 171       * off the cell location  (ie 'A1', 'D4', etc).  Each element of
 172       * the array is an associative array with a 'value' and a 'function'.
 173       * Only non-empty cells are returned by default.  'range' is the
 174       * value of the 'range' query parameter specified at:
 175       * http://code.google.com/apis/spreadsheets/reference.html#cells_Parameters
 176       *
 177       * @param string $range The range of cells to retrieve
 178       * @param boolean $empty Whether to retrieve empty cells
 179       * @return array An associative array of cells
 180       */
 181      public function getContentsAsCells($range = null, $empty = false)
 182      {
 183          $service = new Zend_Gdata_Spreadsheets($this->getHttpClient());
 184          return $service->getSpreadsheetCellFeedContents($this, $range, $empty);
 185      }
 186  
 187  }


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1