File indexing completed on 2024-12-22 05:36:46
0001 <?php 0002 0003 /** 0004 * Zend Framework 0005 * 0006 * LICENSE 0007 * 0008 * This source file is subject to the new BSD license that is bundled 0009 * with this package in the file LICENSE.txt. 0010 * It is also available through the world-wide-web at this URL: 0011 * http://framework.zend.com/license/new-bsd 0012 * If you did not receive a copy of the license and are unable to 0013 * obtain it through the world-wide-web, please send an email 0014 * to license@zend.com so we can send you a copy immediately. 0015 * 0016 * @category Zend 0017 * @package Zend_Gdata 0018 * @subpackage Photos 0019 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0020 * @license http://framework.zend.com/license/new-bsd New BSD License 0021 * @version $Id$ 0022 */ 0023 0024 /** 0025 * @see Zend_Gdata_Gapps_Query 0026 */ 0027 // require_once('Zend/Gdata/Gapps/Query.php'); 0028 0029 /** 0030 * Assists in constructing queries for user entries. 0031 * Instances of this class can be provided in many places where a URL is 0032 * required. 0033 * 0034 * For information on submitting queries to a server, see the 0035 * service class, Zend_Gdata_Photos. 0036 * 0037 * @category Zend 0038 * @package Zend_Gdata 0039 * @subpackage Photos 0040 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0041 * @license http://framework.zend.com/license/new-bsd New BSD License 0042 */ 0043 class Zend_Gdata_Photos_UserQuery extends Zend_Gdata_Query 0044 { 0045 0046 /** 0047 * Indicates the format of data returned in Atom feeds. Can be either 0048 * 'api' or 'base'. Default value is 'api'. 0049 * 0050 * @var string 0051 */ 0052 protected $_projection = 'api'; 0053 0054 /** 0055 * Indicates whether to request a feed or entry in queries. Default 0056 * value is 'feed'; 0057 * 0058 * @var string 0059 */ 0060 protected $_type = 'feed'; 0061 0062 /** 0063 * A string which, if not null, indicates which user should 0064 * be retrieved by this query. If null, the default user will be used 0065 * instead. 0066 * 0067 * @var string 0068 */ 0069 protected $_user = Zend_Gdata_Photos::DEFAULT_USER; 0070 0071 /** 0072 * Create a new Query object with default values. 0073 */ 0074 public function __construct() 0075 { 0076 parent::__construct(); 0077 } 0078 0079 /** 0080 * Set's the format of data returned in Atom feeds. Can be either 0081 * 'api' or 'base'. Normally, 'api' will be desired. Default is 'api'. 0082 * 0083 * @param string $value 0084 * @return Zend_Gdata_Photos_UserQuery Provides a fluent interface 0085 */ 0086 public function setProjection($value) 0087 { 0088 $this->_projection = $value; 0089 return $this; 0090 } 0091 0092 /** 0093 * Gets the format of data in returned in Atom feeds. 0094 * 0095 * @see setProjection 0096 * @return string projection 0097 */ 0098 public function getProjection() 0099 { 0100 return $this->_projection; 0101 } 0102 0103 /** 0104 * Set's the type of data returned in queries. Can be either 0105 * 'feed' or 'entry'. Normally, 'feed' will be desired. Default is 'feed'. 0106 * 0107 * @param string $value 0108 * @return Zend_Gdata_Photos_UserQuery Provides a fluent interface 0109 */ 0110 public function setType($value) 0111 { 0112 $this->_type = $value; 0113 return $this; 0114 } 0115 0116 /** 0117 * Gets the type of data in returned in queries. 0118 * 0119 * @see setType 0120 * @return string type 0121 */ 0122 public function getType() 0123 { 0124 return $this->_type; 0125 } 0126 0127 /** 0128 * Set the user to query for. When set, this user's feed will be 0129 * returned. If not set or null, the default user's feed will be returned 0130 * instead. 0131 * 0132 * @param string $value The user to retrieve, or null for the default 0133 * user. 0134 */ 0135 public function setUser($value) 0136 { 0137 if ($value !== null) { 0138 $this->_user = $value; 0139 } else { 0140 $this->_user = Zend_Gdata_Photos::DEFAULT_USER; 0141 } 0142 } 0143 0144 /** 0145 * Get the user which is to be returned. 0146 * 0147 * @see setUser 0148 * @return string The visibility to retrieve. 0149 */ 0150 public function getUser() 0151 { 0152 return $this->_user; 0153 } 0154 0155 /** 0156 * Set the visibility filter for entries returned. Only entries which 0157 * match this value will be returned. If null or unset, the default 0158 * value will be used instead. 0159 * 0160 * Valid values are 'all' (default), 'public', and 'private'. 0161 * 0162 * @param string $value The visibility to filter by, or null to use the 0163 * default value. 0164 */ 0165 public function setAccess($value) 0166 { 0167 if ($value !== null) { 0168 $this->_params['access'] = $value; 0169 } else { 0170 unset($this->_params['access']); 0171 } 0172 } 0173 0174 /** 0175 * Get the visibility filter for entries returned. 0176 * 0177 * @see setAccess 0178 * @return string The visibility to filter by, or null for the default 0179 * user. 0180 */ 0181 public function getAccess() 0182 { 0183 return $this->_params['access']; 0184 } 0185 0186 /** 0187 * Set the tag for entries that are returned. Only entries which 0188 * match this value will be returned. If null or unset, this filter will 0189 * not be applied. 0190 * 0191 * See http://code.google.com/apis/picasaweb/reference.html#Parameters 0192 * for a list of valid values. 0193 * 0194 * @param string $value The tag to filter by, or null if no 0195 * filter is to be applied. 0196 */ 0197 public function setTag($value) 0198 { 0199 if ($value !== null) { 0200 $this->_params['tag'] = $value; 0201 } else { 0202 unset($this->_params['tag']); 0203 } 0204 } 0205 0206 /** 0207 * Get the tag filter for entries returned. 0208 * 0209 * @see setTag 0210 * @return string The tag to filter by, or null if no filter 0211 * is to be applied. 0212 */ 0213 public function getTag() 0214 { 0215 return $this->_params['tag']; 0216 } 0217 0218 /** 0219 * Set the kind of entries that are returned. Only entries which 0220 * match this value will be returned. If null or unset, this filter will 0221 * not be applied. 0222 * 0223 * See http://code.google.com/apis/picasaweb/reference.html#Parameters 0224 * for a list of valid values. 0225 * 0226 * @param string $value The kind to filter by, or null if no 0227 * filter is to be applied. 0228 */ 0229 public function setKind($value) 0230 { 0231 if ($value !== null) { 0232 $this->_params['kind'] = $value; 0233 } else { 0234 unset($this->_params['kind']); 0235 } 0236 } 0237 0238 /** 0239 * Get the kind of entries to be returned. 0240 * 0241 * @see setKind 0242 * @return string The kind to filter by, or null if no filter 0243 * is to be applied. 0244 */ 0245 public function getKind() 0246 { 0247 return $this->_params['kind']; 0248 } 0249 0250 /** 0251 * Set the maximum image size for entries returned. Only entries which 0252 * match this value will be returned. If null or unset, this filter will 0253 * not be applied. 0254 * 0255 * See http://code.google.com/apis/picasaweb/reference.html#Parameters 0256 * for a list of valid values. 0257 * 0258 * @param string $value The image size to filter by, or null if no 0259 * filter is to be applied. 0260 */ 0261 public function setImgMax($value) 0262 { 0263 if ($value !== null) { 0264 $this->_params['imgmax'] = $value; 0265 } else { 0266 unset($this->_params['imgmax']); 0267 } 0268 } 0269 0270 /** 0271 * Get the maximum image size filter for entries returned. 0272 * 0273 * @see setImgMax 0274 * @return string The image size size to filter by, or null if no filter 0275 * is to be applied. 0276 */ 0277 public function getImgMax() 0278 { 0279 return $this->_params['imgmax']; 0280 } 0281 0282 /** 0283 * Set the thumbnail size filter for entries returned. Only entries which 0284 * match this value will be returned. If null or unset, this filter will 0285 * not be applied. 0286 * 0287 * See http://code.google.com/apis/picasaweb/reference.html#Parameters 0288 * for a list of valid values. 0289 * 0290 * @param string $value The thumbnail size to filter by, or null if no 0291 * filter is to be applied. 0292 */ 0293 public function setThumbsize($value) 0294 { 0295 if ($value !== null) { 0296 $this->_params['thumbsize'] = $value; 0297 } else { 0298 unset($this->_params['thumbsize']); 0299 } 0300 } 0301 0302 /** 0303 * Get the thumbnail size filter for entries returned. 0304 * 0305 * @see setThumbsize 0306 * @return string The thumbnail size to filter by, or null if no filter 0307 * is to be applied. 0308 */ 0309 public function getThumbsize() 0310 { 0311 return $this->_params['thumbsize']; 0312 } 0313 0314 /** 0315 * Returns the URL generated for this query, based on it's current 0316 * parameters. 0317 * 0318 * @return string A URL generated based on the state of this query. 0319 * @throws Zend_Gdata_App_InvalidArgumentException 0320 */ 0321 public function getQueryUrl($incomingUri = null) 0322 { 0323 $uri = Zend_Gdata_Photos::PICASA_BASE_URI; 0324 0325 if ($this->getType() !== null) { 0326 $uri .= '/' . $this->getType(); 0327 } else { 0328 // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; 0329 throw new Zend_Gdata_App_InvalidArgumentException( 0330 'Type must be feed or entry, not null'); 0331 } 0332 0333 if ($this->getProjection() !== null) { 0334 $uri .= '/' . $this->getProjection(); 0335 } else { 0336 // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; 0337 throw new Zend_Gdata_App_InvalidArgumentException( 0338 'Projection must not be null'); 0339 } 0340 0341 if ($this->getUser() !== null) { 0342 $uri .= '/user/' . $this->getUser(); 0343 } else { 0344 // Should never occur due to setter behavior 0345 // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; 0346 throw new Zend_Gdata_App_InvalidArgumentException( 0347 'User must not be null'); 0348 } 0349 0350 $uri .= $incomingUri; 0351 $uri .= $this->getQueryString(); 0352 return $uri; 0353 } 0354 0355 }