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 user 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_UserQuery extends Zend_Gdata_Gapps_Query
47 * If not null, specifies the username of the user who should be
48 * retrieved by this query.
52 protected $_username = 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 $username (optional) Value for the username
61 * @param string $startUsername (optional) Value for the
62 * startUsername property.
64 public function __construct($domain = null, $username = null,
65 $startUsername = null)
67 parent::__construct($domain);
68 $this->setUsername($username);
69 $this->setStartUsername($startUsername);
73 * Set the username to query for. When set, only users with a username
74 * matching this value will be returned in search results. Set to
75 * null to disable filtering by username.
78 * @param string $value The username to filter search results by, or null to
81 public function setUsername($value)
83 $this->_username = $value;
87 * Get the username to query for. If no username is set, null will be
90 * @param string $value The username to filter search results by, or
93 public function getUsername()
95 return $this->_username;
99 * Set the first username which should be displayed when retrieving
102 * @param string $value The first username to be returned, or null to
105 public function setStartUsername($value)
107 if ($value !== null) {
108 $this->_params['startUsername'] = $value;
110 unset($this->_params['startUsername']);
115 * Get the first username which should be displayed when retrieving
118 * @see setStartUsername
119 * @return string The first username to be returned, or null if
122 public function getStartUsername()
124 if (array_key_exists('startUsername', $this->_params)) {
125 return $this->_params['startUsername'];
132 * Returns the query URL generated by this query instance.
134 * @return string The query URL for this instance.
136 public function getQueryUrl()
138 $uri = $this->getBaseUrl();
139 $uri .= Zend_Gdata_Gapps::APPS_USER_PATH;
140 if ($this->_username !== null) {
141 $uri .= '/' . $this->_username;
143 $uri .= $this->getQueryString();