source: trunk/www.guidonia.net/wp/wp-content/plugins/webtv/Drivers/Zend/Gdata/Photos/AlbumQuery.php@ 44

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