[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/zend/Zend/Gdata/Photos/ -> AlbumQuery.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 Photos
  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_Photos_UserQuery
  26   */
  27  require_once('Zend/Gdata/Photos/UserQuery.php');
  28  
  29  /**
  30   * Assists in constructing album queries for various entries.
  31   * Instances of this class can be provided in many places where a URL is
  32   * required.
  33   *
  34   * For information on submitting queries to a server, see the service
  35   * class, Zend_Gdata_Photos.
  36   *
  37   * @category   Zend
  38   * @package    Zend_Gdata
  39   * @subpackage Photos
  40   * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  41   * @license    http://framework.zend.com/license/new-bsd     New BSD License
  42   */
  43  class Zend_Gdata_Photos_AlbumQuery extends Zend_Gdata_Photos_UserQuery
  44  {
  45  
  46      /**
  47       * The name of the album to query for. Mutually exclusive with AlbumId.
  48       *
  49       * @var string
  50       */
  51      protected $_albumName = null;
  52  
  53      /**
  54       * The ID of the album to query for. Mutually exclusive with AlbumName.
  55       *
  56       * @var string
  57       */
  58      protected $_albumId = null;
  59  
  60      /**
  61       * Set the album name to query for. When set, this album's photographs
  62       * be returned. If not set or null, the default user's feed will be
  63       * returned instead.
  64       *
  65       * NOTE: AlbumName and AlbumId are mutually exclusive. Setting one will
  66       *       automatically set the other to null.
  67       *
  68       * @param string $value The name of the album to retrieve, or null to
  69       *          clear.
  70       * @return Zend_Gdata_Photos_AlbumQuery The query object.
  71       */
  72       public function setAlbumName($value)
  73       {
  74           $this->_albumId = null;
  75           $this->_albumName = $value;
  76  
  77           return $this;
  78       }
  79  
  80      /**
  81       * Get the album name which is to be returned.
  82       *
  83       * @see setAlbumName
  84       * @return string The name of the album to retrieve.
  85       */
  86      public function getAlbumName()
  87      {
  88          return $this->_albumName;
  89      }
  90  
  91      /**
  92       * Set the album ID to query for. When set, this album's photographs
  93       * be returned. If not set or null, the default user's feed will be
  94       * returned instead.
  95       *
  96       * NOTE: Album and AlbumId are mutually exclusive. Setting one will
  97       *       automatically set the other to null.
  98       *
  99       * @param string $value The ID of the album to retrieve, or null to
 100       *          clear.
 101       * @return Zend_Gdata_Photos_AlbumQuery The query object.
 102       */
 103       public function setAlbumId($value)
 104       {
 105           $this->_albumName = null;
 106           $this->_albumId = $value;
 107  
 108           return $this;
 109       }
 110  
 111      /**
 112       * Get the album ID which is to be returned.
 113       *
 114       * @see setAlbum
 115       * @return string The ID of the album to retrieve.
 116       */
 117      public function getAlbumId()
 118      {
 119          return $this->_albumId;
 120      }
 121  
 122      /**
 123       * Returns the URL generated for this query, based on it's current
 124       * parameters.
 125       *
 126       * @return string A URL generated based on the state of this query.
 127       * @throws Zend_Gdata_App_InvalidArgumentException
 128       */
 129      public function getQueryUrl($incomingUri = '')
 130      {
 131          $uri = '';
 132          if ($this->getAlbumName() !== null && $this->getAlbumId() === null) {
 133              $uri .= '/album/' . $this->getAlbumName();
 134          } elseif ($this->getAlbumName() === null && $this->getAlbumId() !== null) {
 135              $uri .= '/albumid/' . $this->getAlbumId();
 136          } elseif ($this->getAlbumName() !== null && $this->getAlbumId() !== null) {
 137              require_once 'Zend/Gdata/App/InvalidArgumentException.php';
 138              throw new Zend_Gdata_App_InvalidArgumentException(
 139                      'AlbumName and AlbumId cannot both be non-null');
 140          } else {
 141              require_once 'Zend/Gdata/App/InvalidArgumentException.php';
 142              throw new Zend_Gdata_App_InvalidArgumentException(
 143                      'AlbumName and AlbumId cannot both be null');
 144          }
 145          $uri .= $incomingUri;
 146          return parent::getQueryUrl($uri);
 147      }
 148  
 149  }


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