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-2008 Zend Technologies USA Inc. (http://www.zend.com)
20
* @license http://framework.zend.com/license/new-bsd New BSD License
24
* @see Zend_Gdata_Gapps_Query
26
require_once('Zend/Gdata/Gapps/Query.php');
29
* Assists in constructing queries for Google Apps user entries.
30
* Instances of this class can be provided in many places where a URL is
33
* For information on submitting queries to a server, see the Google Apps
34
* service class, Zend_Gdata_Gapps.
38
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
39
* @license http://framework.zend.com/license/new-bsd New BSD License
41
class Zend_Gdata_Gapps_UserQuery extends Zend_Gdata_Gapps_Query
45
* If not null, specifies the username of the user who should be
46
* retrieved by this query.
50
protected $_username = null;
53
* Create a new instance.
55
* @param string $domain (optional) The Google Apps-hosted domain to use
56
* when constructing query URIs.
57
* @param string $username (optional) Value for the username
59
* @param string $startUsername (optional) Value for the
60
* startUsername property.
62
public function __construct($domain = null, $username = null,
63
$startUsername = null)
65
parent::__construct($domain);
66
$this->setUsername($username);
67
$this->setStartUsername($startUsername);
71
* Set the username to query for. When set, only users with a username
72
* matching this value will be returned in search results. Set to
73
* null to disable filtering by username.
76
* @param string $value The username to filter search results by, or null to
79
public function setUsername($value)
81
$this->_username = $value;
85
* Get the username to query for. If no username is set, null will be
88
* @param string $value The username to filter search results by, or
91
public function getUsername()
93
return $this->_username;
97
* Set the first username which should be displayed when retrieving
100
* @param string $value The first username to be returned, or null to
103
public function setStartUsername($value)
105
if ($value !== null) {
106
$this->_params['startUsername'] = $value;
108
unset($this->_params['startUsername']);
113
* Get the first username which should be displayed when retrieving
116
* @see setStartUsername
117
* @return string The first username to be returned, or null if
120
public function getStartUsername()
122
if (array_key_exists('startUsername', $this->_params)) {
123
return $this->_params['startUsername'];
130
* Returns the query URL generated by this query instance.
132
* @return string The query URL for this instance.
134
public function getQueryUrl()
136
$uri = $this->getBaseUrl();
137
$uri .= Zend_Gdata_Gapps::APPS_USER_PATH;
138
if ($this->_username !== null) {
139
$uri .= '/' . $this->_username;
141
$uri .= $this->getQueryString();