[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/zend/Zend/Gdata/Spreadsheets/ -> CellQuery.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   * Zend_Gdata_App_util
  26   */
  27  require_once('Zend/Gdata/App/Util.php');
  28  
  29  /**
  30   * Zend_Gdata_Query
  31   */
  32  require_once('Zend/Gdata/Query.php');
  33  
  34  /**
  35   * Assists in constructing queries for Google Spreadsheets cells
  36   *
  37   * @link http://code.google.com/apis/gdata/spreadsheets/
  38   *
  39   * @category   Zend
  40   * @package    Zend_Gdata
  41   * @subpackage   Spreadsheets
  42   * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  43   * @license    http://framework.zend.com/license/new-bsd     New BSD License
  44   */
  45  class Zend_Gdata_Spreadsheets_CellQuery extends Zend_Gdata_Query
  46  {
  47  
  48      const SPREADSHEETS_CELL_FEED_URI = 'http://spreadsheets.google.com/feeds/cells';
  49  
  50      protected $_defaultFeedUri = self::SPREADSHEETS_CELL_FEED_URI;
  51      protected $_visibility = 'private';
  52      protected $_projection = 'full';
  53      protected $_spreadsheetKey = null;
  54      protected $_worksheetId = 'default';
  55      protected $_cellId = null;
  56  
  57      /**
  58       * Constructs a new Zend_Gdata_Spreadsheets_CellQuery object.
  59       *
  60       * @param string $url Base URL to use for queries
  61       */
  62      public function __construct($url = null)
  63      {
  64          parent::__construct($url);
  65      }
  66  
  67      /**
  68       * Sets the spreadsheet key for this query.
  69       *
  70       * @param string $value
  71       * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
  72       */
  73      public function setSpreadsheetKey($value)
  74      {
  75          $this->_spreadsheetKey = $value;
  76          return $this;
  77      }
  78  
  79      /**
  80       * Gets the spreadsheet key for this query.
  81       *
  82       * @return string spreadsheet key
  83       */
  84      public function getSpreadsheetKey()
  85      {
  86          return $this->_spreadsheetKey;
  87      }
  88  
  89      /**
  90       * Sets the worksheet id for this query.
  91       *
  92       * @param string $value
  93       * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
  94       */
  95      public function setWorksheetId($value)
  96      {
  97          $this->_worksheetId = $value;
  98          return $this;
  99      }
 100  
 101      /**
 102       * Gets the worksheet id for this query.
 103       *
 104       * @return string worksheet id
 105       */
 106      public function getWorksheetId()
 107      {
 108          return $this->_worksheetId;
 109      }
 110  
 111      /**
 112       * Sets the cell id for this query.
 113       *
 114       * @param string $value
 115       * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
 116       */
 117      public function setCellId($value)
 118      {
 119          $this->_cellId = $value;
 120          return $this;
 121      }
 122  
 123      /**
 124       * Gets the cell id for this query.
 125       *
 126       * @return string cell id
 127       */
 128      public function getCellId()
 129      {
 130          return $this->_cellId;
 131      }
 132  
 133      /**
 134       * Sets the projection for this query.
 135       *
 136       * @param string $value
 137       * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
 138       */
 139      public function setProjection($value)
 140      {
 141          $this->_projection = $value;
 142          return $this;
 143      }
 144  
 145      /**
 146       * Sets the visibility for this query.
 147       *
 148       * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
 149       */
 150      public function setVisibility($value)
 151      {
 152          $this->_visibility = $value;
 153          return $this;
 154      }
 155  
 156      /**
 157       * Gets the projection for this query.
 158       *
 159       * @return string projection
 160       */
 161      public function getProjection()
 162      {
 163          return $this->_projection;
 164      }
 165  
 166      /**
 167       * Gets the visibility for this query.
 168       *
 169       * @return string visibility
 170       */
 171      public function getVisibility()
 172      {
 173          return $this->_visibility;
 174      }
 175  
 176      /**
 177       * Sets the min-row attribute for this query.
 178       *
 179       * @param string $value
 180       * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
 181       */
 182      public function setMinRow($value)
 183      {
 184          if ($value != null) {
 185              $this->_params['min-row'] = $value;
 186          } else {
 187              unset($this->_params['min-row']);
 188          }
 189          return $this;
 190      }
 191  
 192      /**
 193       * Gets the min-row attribute for this query.
 194       *
 195       * @return string min-row
 196       */
 197      public function getMinRow()
 198      {
 199          if (array_key_exists('min-row', $this->_params)) {
 200              return $this->_params['min-row'];
 201          } else {
 202              return null;
 203          }
 204      }
 205  
 206      /**
 207       * Sets the max-row attribute for this query.
 208       *
 209       * @param string $value
 210       * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
 211       */
 212      public function setMaxRow($value)
 213      {
 214          if ($value != null) {
 215              $this->_params['max-row'] = $value;
 216          } else {
 217              unset($this->_params['max-row']);
 218          }
 219          return $this;
 220      }
 221  
 222      /**
 223       * Gets the max-row attribute for this query.
 224       *
 225       * @return string max-row
 226       */
 227      public function getMaxRow()
 228      {
 229          if (array_key_exists('max-row', $this->_params)) {
 230              return $this->_params['max-row'];
 231          } else {
 232              return null;
 233          }
 234      }
 235  
 236      /**
 237       * Sets the min-col attribute for this query.
 238       *
 239       * @param string $value
 240       * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
 241       */
 242      public function setMinCol($value)
 243      {
 244          if ($value != null) {
 245              $this->_params['min-col'] = $value;
 246          } else {
 247              unset($this->_params['min-col']);
 248          }
 249          return $this;
 250      }
 251  
 252      /**
 253       * Gets the min-col attribute for this query.
 254       *
 255       * @return string min-col
 256       */
 257      public function getMinCol()
 258      {
 259          if (array_key_exists('min-col', $this->_params)) {
 260              return $this->_params['min-col'];
 261          } else {
 262              return null;
 263          }
 264      }
 265  
 266      /**
 267       * Sets the max-col attribute for this query.
 268       *
 269       * @param string $value
 270       * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
 271       */
 272      public function setMaxCol($value)
 273      {
 274          if ($value != null) {
 275              $this->_params['max-col'] = $value;
 276          } else {
 277              unset($this->_params['max-col']);
 278          }
 279          return $this;
 280      }
 281  
 282      /**
 283       * Gets the max-col attribute for this query.
 284       *
 285       * @return string max-col
 286       */
 287      public function getMaxCol()
 288      {
 289          if (array_key_exists('max-col', $this->_params)) {
 290              return $this->_params['max-col'];
 291          } else {
 292              return null;
 293          }
 294      }
 295  
 296      /**
 297       * Sets the range attribute for this query.
 298       *
 299       * @param string $value
 300       * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
 301       */
 302      public function setRange($value)
 303      {
 304          if ($value != null) {
 305              $this->_params['range'] = $value;
 306          } else {
 307              unset($this->_params['range']);
 308          }
 309          return $this;
 310      }
 311  
 312      /**
 313       * Gets the range attribute for this query.
 314       *
 315       * @return string range
 316       */
 317      public function getRange()
 318      {
 319          if (array_key_exists('range', $this->_params)) {
 320              return $this->_params['range'];
 321          } else {
 322              return null;
 323          }
 324      }
 325  
 326      /**
 327       * Sets the return-empty attribute for this query.
 328       *
 329       * @param mixed $value String or bool value for whether to return empty cells
 330       * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface
 331       */
 332      public function setReturnEmpty($value)
 333      {
 334          if (is_bool($value)) {
 335              $this->_params['return-empty'] = ($value?'true':'false');
 336          } else if ($value != null) {
 337              $this->_params['return-empty'] = $value;
 338          } else {
 339              unset($this->_params['return-empty']);
 340          }
 341          return $this;
 342      }
 343  
 344      /**
 345       * Gets the return-empty attribute for this query.
 346       *
 347       * @return string return-empty
 348       */
 349      public function getReturnEmpty()
 350      {
 351          if (array_key_exists('return-empty', $this->_params)) {
 352              return $this->_params['return-empty'];
 353          } else {
 354              return null;
 355          }
 356      }
 357  
 358      /**
 359       * Gets the full query URL for this query.
 360       *
 361       * @return string url
 362       */
 363      public function getQueryUrl()
 364      {
 365          if ($this->_url == null) {
 366              $uri = $this->_defaultFeedUri;
 367  
 368              if ($this->_spreadsheetKey != null) {
 369                  $uri .= '/'.$this->_spreadsheetKey;
 370              } else {
 371                  require_once 'Zend/Gdata/App/Exception.php';
 372                  throw new Zend_Gdata_App_Exception('A spreadsheet key must be provided for cell queries.');
 373              }
 374  
 375              if ($this->_worksheetId != null) {
 376                  $uri .= '/'.$this->_worksheetId;
 377              } else {
 378                  require_once 'Zend/Gdata/App/Exception.php';
 379                  throw new Zend_Gdata_App_Exception('A worksheet id must be provided for cell queries.');
 380              }
 381  
 382              if ($this->_visibility != null) {
 383                  $uri .= '/'.$this->_visibility;
 384              } else {
 385                  require_once 'Zend/Gdata/App/Exception.php';
 386                  throw new Zend_Gdata_App_Exception('A visibility must be provided for cell queries.');
 387              }
 388  
 389              if ($this->_projection != null) {
 390                  $uri .= '/'.$this->_projection;
 391              } else {
 392                  require_once 'Zend/Gdata/App/Exception.php';
 393                  throw new Zend_Gdata_App_Exception('A projection must be provided for cell queries.');
 394              }
 395  
 396              if ($this->_cellId != null) {
 397                  $uri .= '/'.$this->_cellId;
 398              }
 399          } else {
 400              $uri = $this->_url;
 401          }
 402  
 403          $uri .= $this->getQueryString();
 404          return $uri;
 405      }
 406  
 407      /**
 408       * Gets the attribute query string for this query.
 409       *
 410       * @return string query string
 411       */
 412      public function getQueryString()
 413      {
 414          return parent::getQueryString();
 415      }
 416  
 417  }


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