2019-07-17 20:08:50 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Zend Framework
|
|
|
|
*
|
|
|
|
* LICENSE
|
|
|
|
*
|
|
|
|
* This source file is subject to the new BSD license that is bundled
|
|
|
|
* with this package in the file LICENSE.txt.
|
|
|
|
* It is also available through the world-wide-web at this URL:
|
|
|
|
* http://framework.zend.com/license/new-bsd
|
|
|
|
* If you did not receive a copy of the license and are unable to
|
|
|
|
* obtain it through the world-wide-web, please send an email
|
|
|
|
* to license@zend.com so we can send you a copy immediately.
|
|
|
|
*
|
|
|
|
* @category Zend
|
|
|
|
* @package Zend_Gdata
|
|
|
|
* @subpackage Gapps
|
2019-07-17 20:19:00 +00:00
|
|
|
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
2019-07-17 20:08:50 +00:00
|
|
|
* @license http://framework.zend.com/license/new-bsd New BSD License
|
2019-07-17 20:31:04 +00:00
|
|
|
* @version $Id: UserQuery.php 18951 2009-11-12 16:26:19Z alexander $
|
2019-07-17 20:08:50 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @see Zend_Gdata_Gapps_Query
|
|
|
|
*/
|
|
|
|
require_once('Zend/Gdata/Gapps/Query.php');
|
|
|
|
|
|
|
|
/**
|
2019-07-17 20:31:04 +00:00
|
|
|
* Assists in constructing queries for Google Apps user entries.
|
|
|
|
* Instances of this class can be provided in many places where a URL is
|
2019-07-17 20:08:50 +00:00
|
|
|
* required.
|
2019-07-17 20:31:04 +00:00
|
|
|
*
|
2019-07-17 20:08:50 +00:00
|
|
|
* For information on submitting queries to a server, see the Google Apps
|
|
|
|
* service class, Zend_Gdata_Gapps.
|
2019-07-17 20:31:04 +00:00
|
|
|
*
|
2019-07-17 20:08:50 +00:00
|
|
|
* @category Zend
|
|
|
|
* @package Zend_Gdata
|
2019-07-17 20:16:19 +00:00
|
|
|
* @subpackage Gapps
|
2019-07-17 20:19:00 +00:00
|
|
|
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
2019-07-17 20:08:50 +00:00
|
|
|
* @license http://framework.zend.com/license/new-bsd New BSD License
|
|
|
|
*/
|
|
|
|
class Zend_Gdata_Gapps_UserQuery extends Zend_Gdata_Gapps_Query
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
2019-07-17 20:31:04 +00:00
|
|
|
* If not null, specifies the username of the user who should be
|
2019-07-17 20:08:50 +00:00
|
|
|
* retrieved by this query.
|
2019-07-17 20:31:04 +00:00
|
|
|
*
|
2019-07-17 20:08:50 +00:00
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $_username = null;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new instance.
|
2019-07-17 20:31:04 +00:00
|
|
|
*
|
|
|
|
* @param string $domain (optional) The Google Apps-hosted domain to use
|
2019-07-17 20:08:50 +00:00
|
|
|
* when constructing query URIs.
|
2019-07-17 20:31:04 +00:00
|
|
|
* @param string $username (optional) Value for the username
|
2019-07-17 20:08:50 +00:00
|
|
|
* property.
|
2019-07-17 20:31:04 +00:00
|
|
|
* @param string $startUsername (optional) Value for the
|
2019-07-17 20:08:50 +00:00
|
|
|
* startUsername property.
|
|
|
|
*/
|
2019-07-17 20:31:04 +00:00
|
|
|
public function __construct($domain = null, $username = null,
|
2019-07-17 20:08:50 +00:00
|
|
|
$startUsername = null)
|
|
|
|
{
|
|
|
|
parent::__construct($domain);
|
|
|
|
$this->setUsername($username);
|
|
|
|
$this->setStartUsername($startUsername);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-07-17 20:31:04 +00:00
|
|
|
* Set the username to query for. When set, only users with a username
|
|
|
|
* matching this value will be returned in search results. Set to
|
2019-07-17 20:08:50 +00:00
|
|
|
* null to disable filtering by username.
|
2019-07-17 20:31:04 +00:00
|
|
|
*
|
2019-07-17 20:08:50 +00:00
|
|
|
* @see getUsername
|
2019-07-17 20:31:04 +00:00
|
|
|
* @param string $value The username to filter search results by, or null to
|
2019-07-17 20:08:50 +00:00
|
|
|
* disable.
|
|
|
|
*/
|
|
|
|
public function setUsername($value)
|
|
|
|
{
|
|
|
|
$this->_username = $value;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-07-17 20:31:04 +00:00
|
|
|
* Get the username to query for. If no username is set, null will be
|
2019-07-17 20:08:50 +00:00
|
|
|
* returned.
|
2019-07-17 20:31:04 +00:00
|
|
|
*
|
|
|
|
* @param string $value The username to filter search results by, or
|
2019-07-17 20:08:50 +00:00
|
|
|
* null if disabled.
|
|
|
|
*/
|
|
|
|
public function getUsername()
|
|
|
|
{
|
|
|
|
return $this->_username;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-07-17 20:31:04 +00:00
|
|
|
* Set the first username which should be displayed when retrieving
|
2019-07-17 20:08:50 +00:00
|
|
|
* a list of users.
|
2019-07-17 20:31:04 +00:00
|
|
|
*
|
|
|
|
* @param string $value The first username to be returned, or null to
|
2019-07-17 20:08:50 +00:00
|
|
|
* disable.
|
|
|
|
*/
|
|
|
|
public function setStartUsername($value)
|
|
|
|
{
|
|
|
|
if ($value !== null) {
|
|
|
|
$this->_params['startUsername'] = $value;
|
|
|
|
} else {
|
|
|
|
unset($this->_params['startUsername']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-07-17 20:31:04 +00:00
|
|
|
* Get the first username which should be displayed when retrieving
|
2019-07-17 20:08:50 +00:00
|
|
|
* a list of users.
|
2019-07-17 20:31:04 +00:00
|
|
|
*
|
2019-07-17 20:08:50 +00:00
|
|
|
* @see setStartUsername
|
2019-07-17 20:31:04 +00:00
|
|
|
* @return string The first username to be returned, or null if
|
2019-07-17 20:08:50 +00:00
|
|
|
* disabled.
|
|
|
|
*/
|
|
|
|
public function getStartUsername()
|
|
|
|
{
|
|
|
|
if (array_key_exists('startUsername', $this->_params)) {
|
|
|
|
return $this->_params['startUsername'];
|
|
|
|
} else {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the query URL generated by this query instance.
|
2019-07-17 20:31:04 +00:00
|
|
|
*
|
2019-07-17 20:08:50 +00:00
|
|
|
* @return string The query URL for this instance.
|
|
|
|
*/
|
|
|
|
public function getQueryUrl()
|
|
|
|
{
|
|
|
|
$uri = $this->getBaseUrl();
|
|
|
|
$uri .= Zend_Gdata_Gapps::APPS_USER_PATH;
|
|
|
|
if ($this->_username !== null) {
|
|
|
|
$uri .= '/' . $this->_username;
|
|
|
|
}
|
|
|
|
$uri .= $this->getQueryString();
|
|
|
|
return $uri;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|