2
0

OwnerQuery.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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 Gapps
  18. * @copyright Copyright (c) 2005-2015 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 Google Apps owner 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 Google Apps
  32. * service class, Zend_Gdata_Gapps.
  33. *
  34. * @category Zend
  35. * @package Zend_Gdata
  36. * @subpackage Gapps
  37. * @copyright Copyright (c) 2005-2015 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_Gapps_OwnerQuery extends Zend_Gdata_Gapps_Query
  41. {
  42. /**
  43. * Group owner is refering to
  44. *
  45. * @var string
  46. */
  47. protected $_groupId = null;
  48. /**
  49. * The email of the owner
  50. *
  51. * @var string
  52. */
  53. protected $_ownerEmail = null;
  54. /**
  55. * Create a new instance.
  56. *
  57. * @param string $domain (optional) The Google Apps-hosted domain to use
  58. * when constructing query URIs.
  59. * @param string $groupId (optional) Value for the groupId property.
  60. * @param string $ownerEmail (optional) Value for the OwnerEmail property.
  61. */
  62. public function __construct($domain = null, $groupId = null, $ownerEmail = null)
  63. {
  64. parent::__construct($domain);
  65. $this->setGroupId($groupId);
  66. $this->setOwnerEmail($ownerEmail);
  67. }
  68. /**
  69. * Set the group id to query for.
  70. *
  71. * @see getGroupId
  72. * @param string $value
  73. */
  74. public function setGroupId($value)
  75. {
  76. $this->_groupId = $value;
  77. }
  78. /**
  79. * Get the group id to query for.
  80. *
  81. * @return string
  82. *
  83. */
  84. public function getGroupId()
  85. {
  86. return $this->_groupId;
  87. }
  88. /**
  89. * Set the owner email to query for.
  90. *
  91. * @see getOwnerEmail
  92. * @param string $value
  93. */
  94. public function setOwnerEmail($value)
  95. {
  96. $this->_ownerEmail = $value;
  97. }
  98. /**
  99. * Get the owner email to query for.
  100. *
  101. * @return string
  102. *
  103. */
  104. public function getOwnerEmail()
  105. {
  106. return $this->_ownerEmail;
  107. }
  108. /**
  109. * Returns the query URL generated by this query instance.
  110. *
  111. * @return string The query URL for this instance.
  112. */
  113. public function getQueryUrl()
  114. {
  115. $uri = Zend_Gdata_Gapps::APPS_BASE_FEED_URI;
  116. $uri .= Zend_Gdata_Gapps::APPS_GROUP_PATH;
  117. $uri .= '/' . $this->_domain;
  118. if ($this->_groupId !== null) {
  119. $uri .= '/' . $this->_groupId;
  120. } else {
  121. require_once 'Zend/Gdata/App/InvalidArgumentException.php';
  122. throw new Zend_Gdata_App_InvalidArgumentException(
  123. 'groupId must not be null');
  124. }
  125. $uri .= '/owner';
  126. if ($this->_ownerEmail !== null) {
  127. $uri .= '/' . $this->_ownerEmail;
  128. }
  129. $uri .= $this->getQueryString();
  130. return $uri;
  131. }
  132. }