PhotoQuery.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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-2008 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. */
  21. /**
  22. * @see Zend_Gdata_Gapps_Picasa_AlbumQuery
  23. */
  24. require_once('Zend/Gdata/Photos/AlbumQuery.php');
  25. /**
  26. * Assists in constructing queries for comment/tag entries.
  27. * Instances of this class can be provided in many places where a URL is
  28. * required.
  29. *
  30. * For information on submitting queries to a server, see the
  31. * service class, Zend_Gdata_Photos.
  32. *
  33. * @category Zend
  34. * @package Zend_Gdata
  35. * @subpackage Photos
  36. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  37. * @license http://framework.zend.com/license/new-bsd New BSD License
  38. */
  39. class Zend_Gdata_Photos_PhotoQuery extends Zend_Gdata_Photos_AlbumQuery
  40. {
  41. /**
  42. * The ID of the photo to query for.
  43. *
  44. * @var string
  45. */
  46. protected $_photoId = null;
  47. /**
  48. * Set the photo ID to query for. When set, this photo's comments/tags
  49. * will be returned. If not set or null, the default user's feed will be
  50. * returned instead.
  51. *
  52. * @param string $value The ID of the photo to retrieve, or null to
  53. * clear.
  54. */
  55. public function setPhotoId($value)
  56. {
  57. $this->_photoId = $value;
  58. }
  59. /**
  60. * Get the photo ID which is to be returned.
  61. *
  62. * @see setPhoto
  63. * @return string The ID of the photo to retrieve.
  64. */
  65. public function getPhotoId()
  66. {
  67. return $this->_photoId;
  68. }
  69. /**
  70. * Returns the URL generated for this query, based on it's current
  71. * parameters.
  72. *
  73. * @return string A URL generated based on the state of this query.
  74. * @throws Zend_Gdata_App_InvalidArgumentException
  75. */
  76. public function getQueryUrl($incomingUri = '')
  77. {
  78. $uri = '';
  79. if ($this->getPhotoId() !== null) {
  80. $uri .= '/photoid/' . $this->getPhotoId();
  81. } else {
  82. require_once 'Zend/Gdata/App/InvalidArgumentException.php';
  83. throw new Zend_Gdata_App_InvalidArgumentException(
  84. 'PhotoId cannot be null');
  85. }
  86. $uri .= $incomingUri;
  87. return parent::getQueryUrl($uri);
  88. }
  89. }