File indexing completed on 2025-03-02 05:29:27
0001 <?php 0002 0003 /** 0004 * Zend Framework 0005 * 0006 * LICENSE 0007 * 0008 * This source file is subject to the new BSD license that is bundled 0009 * with this package in the file LICENSE.txt. 0010 * It is also available through the world-wide-web at this URL: 0011 * http://framework.zend.com/license/new-bsd 0012 * If you did not receive a copy of the license and are unable to 0013 * obtain it through the world-wide-web, please send an email 0014 * to license@zend.com so we can send you a copy immediately. 0015 * 0016 * @category Zend 0017 * @package Zend_Gdata 0018 * @subpackage Gapps 0019 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0020 * @license http://framework.zend.com/license/new-bsd New BSD License 0021 * @version $Id$ 0022 */ 0023 0024 /** 0025 * @see Zend_Gdata_Gapps_Query 0026 */ 0027 // require_once('Zend/Gdata/Gapps/Query.php'); 0028 0029 /** 0030 * Assists in constructing queries for Google Apps user entries. 0031 * Instances of this class can be provided in many places where a URL is 0032 * required. 0033 * 0034 * For information on submitting queries to a server, see the Google Apps 0035 * service class, Zend_Gdata_Gapps. 0036 * 0037 * @category Zend 0038 * @package Zend_Gdata 0039 * @subpackage Gapps 0040 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0041 * @license http://framework.zend.com/license/new-bsd New BSD License 0042 */ 0043 class Zend_Gdata_Gapps_UserQuery extends Zend_Gdata_Gapps_Query 0044 { 0045 0046 /** 0047 * If not null, specifies the username of the user who should be 0048 * retrieved by this query. 0049 * 0050 * @var string 0051 */ 0052 protected $_username = null; 0053 0054 /** 0055 * Create a new instance. 0056 * 0057 * @param string $domain (optional) The Google Apps-hosted domain to use 0058 * when constructing query URIs. 0059 * @param string $username (optional) Value for the username 0060 * property. 0061 * @param string $startUsername (optional) Value for the 0062 * startUsername property. 0063 */ 0064 public function __construct($domain = null, $username = null, 0065 $startUsername = null) 0066 { 0067 parent::__construct($domain); 0068 $this->setUsername($username); 0069 $this->setStartUsername($startUsername); 0070 } 0071 0072 /** 0073 * Set the username to query for. When set, only users with a username 0074 * matching this value will be returned in search results. Set to 0075 * null to disable filtering by username. 0076 * 0077 * @see getUsername 0078 * @param string $value The username to filter search results by, or null to 0079 * disable. 0080 */ 0081 public function setUsername($value) 0082 { 0083 $this->_username = $value; 0084 } 0085 0086 /** 0087 * Get the username to query for. If no username is set, null will be 0088 * returned. 0089 * 0090 * @param string $value The username to filter search results by, or 0091 * null if disabled. 0092 */ 0093 public function getUsername() 0094 { 0095 return $this->_username; 0096 } 0097 0098 /** 0099 * Set the first username which should be displayed when retrieving 0100 * a list of users. 0101 * 0102 * @param string $value The first username to be returned, or null to 0103 * disable. 0104 */ 0105 public function setStartUsername($value) 0106 { 0107 if ($value !== null) { 0108 $this->_params['startUsername'] = $value; 0109 } else { 0110 unset($this->_params['startUsername']); 0111 } 0112 } 0113 0114 /** 0115 * Get the first username which should be displayed when retrieving 0116 * a list of users. 0117 * 0118 * @see setStartUsername 0119 * @return string The first username to be returned, or null if 0120 * disabled. 0121 */ 0122 public function getStartUsername() 0123 { 0124 if (array_key_exists('startUsername', $this->_params)) { 0125 return $this->_params['startUsername']; 0126 } else { 0127 return null; 0128 } 0129 } 0130 0131 /** 0132 * Returns the query URL generated by this query instance. 0133 * 0134 * @return string The query URL for this instance. 0135 */ 0136 public function getQueryUrl() 0137 { 0138 $uri = $this->getBaseUrl(); 0139 $uri .= Zend_Gdata_Gapps::APPS_USER_PATH; 0140 if ($this->_username !== null) { 0141 $uri .= '/' . $this->_username; 0142 } 0143 $uri .= $this->getQueryString(); 0144 return $uri; 0145 } 0146 0147 }