PageRenderTime 58ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/zend/Zend/Gdata/Photos/UserQuery.php

https://bitbucket.org/synergylearning/campusconnect
PHP | 355 lines | 130 code | 29 blank | 196 comment | 18 complexity | e13fe55f74e1ef0a69326c8bca37ab03 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, LGPL-3.0, GPL-3.0, LGPL-2.1, Apache-2.0, BSD-3-Clause, AGPL-3.0
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Gdata
  17. * @subpackage Photos
  18. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /**
  23. * @see Zend_Gdata_Gapps_Query
  24. */
  25. require_once('Zend/Gdata/Gapps/Query.php');
  26. /**
  27. * Assists in constructing queries for user entries.
  28. * Instances of this class can be provided in many places where a URL is
  29. * required.
  30. *
  31. * For information on submitting queries to a server, see the
  32. * service class, Zend_Gdata_Photos.
  33. *
  34. * @category Zend
  35. * @package Zend_Gdata
  36. * @subpackage Photos
  37. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  38. * @license http://framework.zend.com/license/new-bsd New BSD License
  39. */
  40. class Zend_Gdata_Photos_UserQuery extends Zend_Gdata_Query
  41. {
  42. /**
  43. * Indicates the format of data returned in Atom feeds. Can be either
  44. * 'api' or 'base'. Default value is 'api'.
  45. *
  46. * @var string
  47. */
  48. protected $_projection = 'api';
  49. /**
  50. * Indicates whether to request a feed or entry in queries. Default
  51. * value is 'feed';
  52. *
  53. * @var string
  54. */
  55. protected $_type = 'feed';
  56. /**
  57. * A string which, if not null, indicates which user should
  58. * be retrieved by this query. If null, the default user will be used
  59. * instead.
  60. *
  61. * @var string
  62. */
  63. protected $_user = Zend_Gdata_Photos::DEFAULT_USER;
  64. /**
  65. * Create a new Query object with default values.
  66. */
  67. public function __construct()
  68. {
  69. parent::__construct();
  70. }
  71. /**
  72. * Set's the format of data returned in Atom feeds. Can be either
  73. * 'api' or 'base'. Normally, 'api' will be desired. Default is 'api'.
  74. *
  75. * @param string $value
  76. * @return Zend_Gdata_Photos_UserQuery Provides a fluent interface
  77. */
  78. public function setProjection($value)
  79. {
  80. $this->_projection = $value;
  81. return $this;
  82. }
  83. /**
  84. * Gets the format of data in returned in Atom feeds.
  85. *
  86. * @see setProjection
  87. * @return string projection
  88. */
  89. public function getProjection()
  90. {
  91. return $this->_projection;
  92. }
  93. /**
  94. * Set's the type of data returned in queries. Can be either
  95. * 'feed' or 'entry'. Normally, 'feed' will be desired. Default is 'feed'.
  96. *
  97. * @param string $value
  98. * @return Zend_Gdata_Photos_UserQuery Provides a fluent interface
  99. */
  100. public function setType($value)
  101. {
  102. $this->_type = $value;
  103. return $this;
  104. }
  105. /**
  106. * Gets the type of data in returned in queries.
  107. *
  108. * @see setType
  109. * @return string type
  110. */
  111. public function getType()
  112. {
  113. return $this->_type;
  114. }
  115. /**
  116. * Set the user to query for. When set, this user's feed will be
  117. * returned. If not set or null, the default user's feed will be returned
  118. * instead.
  119. *
  120. * @param string $value The user to retrieve, or null for the default
  121. * user.
  122. */
  123. public function setUser($value)
  124. {
  125. if ($value !== null) {
  126. $this->_user = $value;
  127. } else {
  128. $this->_user = Zend_Gdata_Photos::DEFAULT_USER;
  129. }
  130. }
  131. /**
  132. * Get the user which is to be returned.
  133. *
  134. * @see setUser
  135. * @return string The visibility to retrieve.
  136. */
  137. public function getUser()
  138. {
  139. return $this->_user;
  140. }
  141. /**
  142. * Set the visibility filter for entries returned. Only entries which
  143. * match this value will be returned. If null or unset, the default
  144. * value will be used instead.
  145. *
  146. * Valid values are 'all' (default), 'public', and 'private'.
  147. *
  148. * @param string $value The visibility to filter by, or null to use the
  149. * default value.
  150. */
  151. public function setAccess($value)
  152. {
  153. if ($value !== null) {
  154. $this->_params['access'] = $value;
  155. } else {
  156. unset($this->_params['access']);
  157. }
  158. }
  159. /**
  160. * Get the visibility filter for entries returned.
  161. *
  162. * @see setAccess
  163. * @return string The visibility to filter by, or null for the default
  164. * user.
  165. */
  166. public function getAccess()
  167. {
  168. return $this->_params['access'];
  169. }
  170. /**
  171. * Set the tag for entries that are returned. Only entries which
  172. * match this value will be returned. If null or unset, this filter will
  173. * not be applied.
  174. *
  175. * See http://code.google.com/apis/picasaweb/reference.html#Parameters
  176. * for a list of valid values.
  177. *
  178. * @param string $value The tag to filter by, or null if no
  179. * filter is to be applied.
  180. */
  181. public function setTag($value)
  182. {
  183. if ($value !== null) {
  184. $this->_params['tag'] = $value;
  185. } else {
  186. unset($this->_params['tag']);
  187. }
  188. }
  189. /**
  190. * Get the tag filter for entries returned.
  191. *
  192. * @see setTag
  193. * @return string The tag to filter by, or null if no filter
  194. * is to be applied.
  195. */
  196. public function getTag()
  197. {
  198. return $this->_params['tag'];
  199. }
  200. /**
  201. * Set the kind of entries that are returned. Only entries which
  202. * match this value will be returned. If null or unset, this filter will
  203. * not be applied.
  204. *
  205. * See http://code.google.com/apis/picasaweb/reference.html#Parameters
  206. * for a list of valid values.
  207. *
  208. * @param string $value The kind to filter by, or null if no
  209. * filter is to be applied.
  210. */
  211. public function setKind($value)
  212. {
  213. if ($value !== null) {
  214. $this->_params['kind'] = $value;
  215. } else {
  216. unset($this->_params['kind']);
  217. }
  218. }
  219. /**
  220. * Get the kind of entries to be returned.
  221. *
  222. * @see setKind
  223. * @return string The kind to filter by, or null if no filter
  224. * is to be applied.
  225. */
  226. public function getKind()
  227. {
  228. return $this->_params['kind'];
  229. }
  230. /**
  231. * Set the maximum image size for entries returned. Only entries which
  232. * match this value will be returned. If null or unset, this filter will
  233. * not be applied.
  234. *
  235. * See http://code.google.com/apis/picasaweb/reference.html#Parameters
  236. * for a list of valid values.
  237. *
  238. * @param string $value The image size to filter by, or null if no
  239. * filter is to be applied.
  240. */
  241. public function setImgMax($value)
  242. {
  243. if ($value !== null) {
  244. $this->_params['imgmax'] = $value;
  245. } else {
  246. unset($this->_params['imgmax']);
  247. }
  248. }
  249. /**
  250. * Get the maximum image size filter for entries returned.
  251. *
  252. * @see setImgMax
  253. * @return string The image size size to filter by, or null if no filter
  254. * is to be applied.
  255. */
  256. public function getImgMax()
  257. {
  258. return $this->_params['imgmax'];
  259. }
  260. /**
  261. * Set the thumbnail size filter for entries returned. Only entries which
  262. * match this value will be returned. If null or unset, this filter will
  263. * not be applied.
  264. *
  265. * See http://code.google.com/apis/picasaweb/reference.html#Parameters
  266. * for a list of valid values.
  267. *
  268. * @param string $value The thumbnail size to filter by, or null if no
  269. * filter is to be applied.
  270. */
  271. public function setThumbsize($value)
  272. {
  273. if ($value !== null) {
  274. $this->_params['thumbsize'] = $value;
  275. } else {
  276. unset($this->_params['thumbsize']);
  277. }
  278. }
  279. /**
  280. * Get the thumbnail size filter for entries returned.
  281. *
  282. * @see setThumbsize
  283. * @return string The thumbnail size to filter by, or null if no filter
  284. * is to be applied.
  285. */
  286. public function getThumbsize()
  287. {
  288. return $this->_params['thumbsize'];
  289. }
  290. /**
  291. * Returns the URL generated for this query, based on it's current
  292. * parameters.
  293. *
  294. * @return string A URL generated based on the state of this query.
  295. * @throws Zend_Gdata_App_InvalidArgumentException
  296. */
  297. public function getQueryUrl($incomingUri = null)
  298. {
  299. $uri = Zend_Gdata_Photos::PICASA_BASE_URI;
  300. if ($this->getType() !== null) {
  301. $uri .= '/' . $this->getType();
  302. } else {
  303. require_once 'Zend/Gdata/App/InvalidArgumentException.php';
  304. throw new Zend_Gdata_App_InvalidArgumentException(
  305. 'Type must be feed or entry, not null');
  306. }
  307. if ($this->getProjection() !== null) {
  308. $uri .= '/' . $this->getProjection();
  309. } else {
  310. require_once 'Zend/Gdata/App/InvalidArgumentException.php';
  311. throw new Zend_Gdata_App_InvalidArgumentException(
  312. 'Projection must not be null');
  313. }
  314. if ($this->getUser() !== null) {
  315. $uri .= '/user/' . $this->getUser();
  316. } else {
  317. // Should never occur due to setter behavior
  318. require_once 'Zend/Gdata/App/InvalidArgumentException.php';
  319. throw new Zend_Gdata_App_InvalidArgumentException(
  320. 'User must not be null');
  321. }
  322. $uri .= $incomingUri;
  323. $uri .= $this->getQueryString();
  324. return $uri;
  325. }
  326. }