*prechod na novsiu verziu ZF
[sport-group.git] / library / Zend / Gdata / Photos / AlbumQuery.php
blobe2f28ee0568c1ccb2ebae4c6375c77f51b5d4234
1 <?php
3 /**
4 * Zend Framework
6 * LICENSE
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.
16 * @category Zend
17 * @package Zend_Gdata
18 * @subpackage Photos
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 $
24 /**
25 * @see Zend_Gdata_Photos_UserQuery
27 require_once('Zend/Gdata/Photos/UserQuery.php');
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.
34 * For information on submitting queries to a server, see the service
35 * class, Zend_Gdata_Photos.
37 * @category Zend
38 * @package Zend_Gdata
39 * @subpackage 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
46 /**
47 * The name of the album to query for. Mutually exclusive with AlbumId.
49 * @var string
51 protected $_albumName = null;
53 /**
54 * The ID of the album to query for. Mutually exclusive with AlbumName.
56 * @var string
58 protected $_albumId = null;
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.
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
69 * clear.
70 * @return Zend_Gdata_Photos_AlbumQuery The query object.
72 public function setAlbumName($value)
74 $this->_albumId = null;
75 $this->_albumName = $value;
77 return $this;
80 /**
81 * Get the album name which is to be returned.
83 * @see setAlbumName
84 * @return string The name of the album to retrieve.
86 public function getAlbumName()
88 return $this->_albumName;
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.
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
100 * clear.
101 * @return Zend_Gdata_Photos_AlbumQuery The query object.
103 public function setAlbumId($value)
105 $this->_albumName = null;
106 $this->_albumId = $value;
108 return $this;
112 * Get the album ID which is to be returned.
114 * @see setAlbum
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
124 * parameters.
126 * @return string A URL generated based on the state of this query.
127 * @throws Zend_Gdata_App_InvalidArgumentException
129 public function getQueryUrl($incomingUri = '')
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');
145 $uri .= $incomingUri;
146 return parent::getQueryUrl($uri);