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.
19 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
25 * @see Zend_Gdata_Gapps_Query
27 require_once('Zend/Gdata/Gapps/Query.php');
30 * Assists in constructing queries for Google Apps member entries.
31 * Instances of this class can be provided in many places where a URL is
34 * For information on submitting queries to a server, see the Google Apps
35 * service class, Zend_Gdata_Gapps.
40 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
41 * @license http://framework.zend.com/license/new-bsd New BSD License
43 class Zend_Gdata_Gapps_MemberQuery extends Zend_Gdata_Gapps_Query
47 * If not null, specifies the group id
51 protected $_groupId = null;
54 * If not null, specifies the member id of the user who should be
55 * retrieved by this query.
59 protected $_memberId = null;
62 * Create a new instance.
64 * @param string $domain (optional) The Google Apps-hosted domain to use
65 * when constructing query URIs.
66 * @param string $groupId (optional) Value for the groupId property.
67 * @param string $memberId (optional) Value for the memberId property.
68 * @param string $startMemberId (optional) Value for the
69 * startMemberId property.
71 public function __construct($domain = null, $groupId = null, $memberId = null,
72 $startMemberId = null)
74 parent::__construct($domain);
75 $this->setGroupId($groupId);
76 $this->setMemberId($memberId);
77 $this->setStartMemberId($startMemberId);
81 * Set the group id to query for.
84 * @param string $value The group id to filter search results by, or null to
87 public function setGroupId($value)
89 $this->_groupId = $value;
93 * Get the group id to query for. If no group id is set, null will be
96 * @param string $value The group id to filter search results by, or
98 * @return string The group id
100 public function getGroupId()
102 return $this->_groupId;
107 * Set the member id to query for. When set, only users with a member id
108 * matching this value will be returned in search results. Set to
109 * null to disable filtering by member id.
112 * @param string $value The member id to filter search results by, or null to
115 public function setMemberId($value)
117 $this->_memberId = $value;
121 * Get the member id to query for. If no member id is set, null will be
124 * @param string $value The member id to filter search results by, or
126 * @return The member id
128 public function getMemberId()
130 return $this->_memberId;
134 * Set the first member id which should be displayed when retrieving
137 * @param string $value The first member id to be returned, or null to
140 public function setStartMemberId($value)
142 if ($value !== null) {
143 $this->_params['start'] = $value;
145 unset($this->_params['start']);
150 * Get the first username which should be displayed when retrieving
153 * @see setStartUsername
154 * @return string The first username to be returned, or null if
157 public function getStartMemberId()
159 if (array_key_exists('start', $this->_params)) {
160 return $this->_params['start'];
167 * Returns the query URL generated by this query instance.
169 * @return string The query URL for this instance.
171 public function getQueryUrl()
174 $uri = Zend_Gdata_Gapps::APPS_BASE_FEED_URI;
175 $uri .= Zend_Gdata_Gapps::APPS_GROUP_PATH;
176 $uri .= '/' . $this->_domain;
177 if ($this->_groupId !== null) {
178 $uri .= '/' . $this->_groupId;
180 require_once 'Zend/Gdata/App/InvalidArgumentException.php';
181 throw new Zend_Gdata_App_InvalidArgumentException(
182 'groupId must not be null');
187 if ($this->_memberId !== null) {
188 $uri .= '/' . $this->_memberId;
190 $uri .= $this->getQueryString();