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 group 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_GroupQuery extends Zend_Gdata_Gapps_Query
47 * If not null, specifies the group id of the group who should be
48 * retrieved by this query.
52 protected $_groupId = null;
55 * Create a new instance.
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 $startGroupName (optional) Value for the
61 * startGroupName property.
63 public function __construct($domain = null, $groupId = null,
66 parent::__construct($domain);
67 $this->setGroupId($groupId);
68 $this->setStartGroupId($startGroupId);
72 * Set the group id to query for. When set, only groups with a group id
73 * matching this value will be returned in search results. Set to
74 * null to disable filtering by group id.
77 * @param string $value The group id to filter search results by, or null to
80 public function setGroupId($value)
82 $this->_groupId = $value;
86 * Get the group id to query for. If no group id is set, null will be
89 * @param string $value The group id to filter search results by, or
92 public function getGroupId()
94 return $this->_groupId;
98 * Set the member to query for. When set, only subscribers with an
99 * email address matching this value will be returned in search results.
100 * Set to null to disable filtering by username.
102 * @param string $value The member email address to filter search
103 * results by, or null to disable.
105 public function setMember($value)
107 if ($value !== null) {
108 $this->_params['member'] = $value;
111 unset($this->_params['member']);
116 * Get the member email address to query for. If no member is set,
117 * null will be returned.
120 * @return string The member email address to filter search
121 * results by, or null if disabled.
123 public function getMember()
125 if (array_key_exists('member', $this->_params)) {
126 return $this->_params['member'];
134 * Sets the query parameter directOnly
137 public function setDirectOnly($value)
139 if ($value !== null) {
141 $this->_params['directOnly'] = 'true';
143 $this->_params['directOnly'] = 'false';
146 unset($this->_params['directOnly']);
155 public function getDirectOnly()
157 if (array_key_exists('directOnly', $this->_params)) {
159 if($this->_params['directOnly'] == 'true') {
170 * Set the first group id which should be displayed when retrieving
173 * @param string $value The first group id to be returned, or null to
176 public function setStartGroupId($value)
178 if ($value !== null) {
179 $this->_params['start'] = $value;
181 unset($this->_params['start']);
186 * Get the first group id which should be displayed when retrieving
189 * @see setStartGroupId
190 * @return string The first group id to be returned, or null if
193 public function getStartGroupId()
195 if (array_key_exists('start', $this->_params)) {
196 return $this->_params['start'];
203 * Returns the query URL generated by this query instance.
205 * @return string The query URL for this instance.
207 public function getQueryUrl()
210 $uri = Zend_Gdata_Gapps::APPS_BASE_FEED_URI;
211 $uri .= Zend_Gdata_Gapps::APPS_GROUP_PATH;
212 $uri .= '/' . $this->_domain;
214 if ($this->_groupId !== null) {
215 $uri .= '/' . $this->_groupId;
218 if(array_key_exists('member', $this->_params)) {
222 $uri .= $this->getQueryString();