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 license@zend.com so we can send you a copy immediately.
19 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
21 * @version $Id: AlbumQuery.php 16971 2009-07-22 18:05:45Z mikaelkael $
25 * @see Zend_Gdata_Photos_UserQuery
27 require_once('Zend/Gdata/Photos/UserQuery.php');
30 * Assists in constructing album queries for various entries.
31 * Instances of this class can be provided in many places where a URL is
34 * For information on submitting queries to a server, see the service
35 * class, Zend_Gdata_Photos.
40 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
41 * @license http://framework.zend.com/license/new-bsd New BSD License
43 class Zend_Gdata_Photos_AlbumQuery
extends Zend_Gdata_Photos_UserQuery
47 * The name of the album to query for. Mutually exclusive with AlbumId.
51 protected $_albumName = null;
54 * The ID of the album to query for. Mutually exclusive with AlbumName.
58 protected $_albumId = null;
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
65 * NOTE: AlbumName and AlbumId are mutually exclusive. Setting one will
66 * automatically set the other to null.
68 * @param string $value The name of the album to retrieve, or null to
70 * @return Zend_Gdata_Photos_AlbumQuery The query object.
72 public function setAlbumName($value)
74 $this->_albumId
= null;
75 $this->_albumName
= $value;
81 * Get the album name which is to be returned.
84 * @return string The name of the album to retrieve.
86 public function getAlbumName()
88 return $this->_albumName
;
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
96 * NOTE: Album and AlbumId are mutually exclusive. Setting one will
97 * automatically set the other to null.
99 * @param string $value The ID of the album to retrieve, or null to
101 * @return Zend_Gdata_Photos_AlbumQuery The query object.
103 public function setAlbumId($value)
105 $this->_albumName
= null;
106 $this->_albumId
= $value;
112 * Get the album ID which is to be returned.
115 * @return string The ID of the album to retrieve.
117 public function getAlbumId()
119 return $this->_albumId
;
123 * Returns the URL generated for this query, based on it's current
126 * @return string A URL generated based on the state of this query.
127 * @throws Zend_Gdata_App_InvalidArgumentException
129 public function getQueryUrl($incomingUri = '')
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');
141 require_once 'Zend/Gdata/App/InvalidArgumentException.php';
142 throw new Zend_Gdata_App_InvalidArgumentException(
143 'AlbumName and AlbumId cannot both be null');
145 $uri .= $incomingUri;
146 return parent
::getQueryUrl($uri);