[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/zend/Zend/Gdata/Docs/ -> Query.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 Docs
  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_Query
  26   */
  27  require_once('Zend/Gdata/Query.php');
  28  
  29  /**
  30   * Assists in constructing queries for Google Document List documents
  31   *
  32   * @link http://code.google.com/apis/gdata/spreadsheets/
  33   *
  34   * @category   Zend
  35   * @package    Zend_Gdata
  36   * @subpackage Docs
  37   * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  38   * @license    http://framework.zend.com/license/new-bsd     New BSD License
  39   */
  40  class Zend_Gdata_Docs_Query extends Zend_Gdata_Query
  41  {
  42  
  43      /**
  44       * The base URL for retrieving a document list
  45       *
  46       * @var string
  47       */
  48      const DOCUMENTS_LIST_FEED_URI = 'http://docs.google.com/feeds/documents';
  49  
  50      /**
  51       * The generic base URL used by some inherited methods
  52       *
  53       * @var string
  54       */
  55      protected $_defaultFeedUri = self::DOCUMENTS_LIST_FEED_URI;
  56  
  57      /**
  58       * The visibility to be used when querying for the feed. A request for a
  59       * feed with private visbility requires the user to be authenricated.
  60       * Private is the only avilable visibility for the documents list.
  61       *
  62       * @var string
  63       */
  64      protected $_visibility = 'private';
  65  
  66      /**
  67       * The projection determines how much detail should be given in the
  68       * result of the query. Full is the only valid projection for the
  69       * documents list.
  70       *
  71       * @var string
  72       */
  73      protected $_projection = 'full';
  74  
  75      /**
  76       * Constructs a new instance of a Zend_Gdata_Docs_Query object.
  77       */
  78      public function __construct()
  79      {
  80          parent::__construct();
  81      }
  82  
  83      /**
  84       * Sets the projection for this query. Common values for projection
  85       * include 'full'.
  86       *
  87       * @param string $value
  88       * @return Zend_Gdata_Docs_Query Provides a fluent interface
  89       */
  90      public function setProjection($value)
  91      {
  92          $this->_projection = $value;
  93          return $this;
  94      }
  95  
  96      /**
  97       * Sets the visibility for this query. Common values for visibility
  98       * include 'private'.
  99       *
 100       * @return Zend_Gdata_Docs_Query Provides a fluent interface
 101       */
 102      public function setVisibility($value)
 103      {
 104          $this->_visibility = $value;
 105          return $this;
 106      }
 107  
 108      /**
 109       * Gets the projection for this query.
 110       *
 111       * @return string projection
 112       */
 113      public function getProjection()
 114      {
 115          return $this->_projection;
 116      }
 117  
 118      /**
 119       * Gets the visibility for this query.
 120       *
 121       * @return string visibility
 122       */
 123      public function getVisibility()
 124      {
 125          return $this->_visibility;
 126      }
 127  
 128      /**
 129       * Sets the title attribute for this query. The title parameter is used
 130       * to restrict the results to documents whose titles either contain or
 131       * completely match the title.
 132       *
 133       * @param string $value
 134       * @return Zend_Gdata_Docs_Query Provides a fluent interface
 135       */
 136      public function setTitle($value)
 137      {
 138          if ($value !== null) {
 139              $this->_params['title'] = $value;
 140          } else {
 141              unset($this->_params['title']);
 142          }
 143          return $this;
 144      }
 145  
 146      /**
 147       * Gets the title attribute for this query.
 148       *
 149       * @return string title
 150       */
 151      public function getTitle()
 152      {
 153          if (array_key_exists('title', $this->_params)) {
 154              return $this->_params['title'];
 155          } else {
 156              return null;
 157          }
 158      }
 159  
 160      /**
 161       * Sets the title-exact attribute for this query.
 162       * If title-exact is set to true, the title query parameter will be used
 163       * in an exact match. Only documents with a title identical to the
 164       * title parameter will be returned.
 165       *
 166       * @param boolean $value Use either true or false
 167       * @return Zend_Gdata_Docs_Query Provides a fluent interface
 168       */
 169      public function setTitleExact($value)
 170      {
 171          if ($value) {
 172              $this->_params['title-exact'] = $value;
 173          } else {
 174              unset($this->_params['title-exact']);
 175          }
 176          return $this;
 177      }
 178  
 179      /**
 180       * Gets the title-exact attribute for this query.
 181       *
 182       * @return string title-exact
 183       */
 184      public function getTitleExact()
 185      {
 186          if (array_key_exists('title-exact', $this->_params)) {
 187              return $this->_params['title-exact'];
 188          } else {
 189              return false;
 190          }
 191      }
 192  
 193      /**
 194       * Gets the full query URL for this query.
 195       *
 196       * @return string url
 197       */
 198      public function getQueryUrl()
 199      {
 200          $uri = $this->_defaultFeedUri;
 201  
 202          if ($this->_visibility !== null) {
 203              $uri .= '/' . $this->_visibility;
 204          } else {
 205              require_once 'Zend/Gdata/App/Exception.php';
 206              throw new Zend_Gdata_App_Exception(
 207                  'A visibility must be provided for cell queries.');
 208          }
 209  
 210          if ($this->_projection !== null) {
 211              $uri .= '/' . $this->_projection;
 212          } else {
 213              require_once 'Zend/Gdata/App/Exception.php';
 214              throw new Zend_Gdata_App_Exception(
 215                  'A projection must be provided for cell queries.');
 216          }
 217  
 218          $uri .= $this->getQueryString();
 219          return $uri;
 220      }
 221  
 222  }


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