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 member 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_MemberQuery extends Zend_Gdata_Gapps_Query 0044 { 0045 0046 /** 0047 * If not null, specifies the group id 0048 * 0049 * @var string 0050 */ 0051 protected $_groupId = null; 0052 0053 /** 0054 * If not null, specifies the member id of the user who should be 0055 * retrieved by this query. 0056 * 0057 * @var string 0058 */ 0059 protected $_memberId = null; 0060 0061 /** 0062 * Create a new instance. 0063 * 0064 * @param string $domain (optional) The Google Apps-hosted domain to use 0065 * when constructing query URIs. 0066 * @param string $groupId (optional) Value for the groupId property. 0067 * @param string $memberId (optional) Value for the memberId property. 0068 * @param string $startMemberId (optional) Value for the 0069 * startMemberId property. 0070 */ 0071 public function __construct($domain = null, $groupId = null, $memberId = null, 0072 $startMemberId = null) 0073 { 0074 parent::__construct($domain); 0075 $this->setGroupId($groupId); 0076 $this->setMemberId($memberId); 0077 $this->setStartMemberId($startMemberId); 0078 } 0079 0080 /** 0081 * Set the group id to query for. 0082 * 0083 * @see getGroupId 0084 * @param string $value The group id to filter search results by, or null to 0085 * disable. 0086 */ 0087 public function setGroupId($value) 0088 { 0089 $this->_groupId = $value; 0090 } 0091 0092 /** 0093 * Get the group id to query for. If no group id is set, null will be 0094 * returned. 0095 * 0096 * @param string $value The group id to filter search results by, or 0097 * null if disabled. 0098 * @return string The group id 0099 */ 0100 public function getGroupId() 0101 { 0102 return $this->_groupId; 0103 } 0104 0105 0106 /** 0107 * Set the member id to query for. When set, only users with a member id 0108 * matching this value will be returned in search results. Set to 0109 * null to disable filtering by member id. 0110 * 0111 * @see getMemberId 0112 * @param string $value The member id to filter search results by, or null to 0113 * disable. 0114 */ 0115 public function setMemberId($value) 0116 { 0117 $this->_memberId = $value; 0118 } 0119 0120 /** 0121 * Get the member id to query for. If no member id is set, null will be 0122 * returned. 0123 * 0124 * @param string $value The member id to filter search results by, or 0125 * null if disabled. 0126 * @return The member id 0127 */ 0128 public function getMemberId() 0129 { 0130 return $this->_memberId; 0131 } 0132 0133 /** 0134 * Set the first member id which should be displayed when retrieving 0135 * a list of members. 0136 * 0137 * @param string $value The first member id to be returned, or null to 0138 * disable. 0139 */ 0140 public function setStartMemberId($value) 0141 { 0142 if ($value !== null) { 0143 $this->_params['start'] = $value; 0144 } else { 0145 unset($this->_params['start']); 0146 } 0147 } 0148 0149 /** 0150 * Get the first username which should be displayed when retrieving 0151 * a list of users. 0152 * 0153 * @see setStartUsername 0154 * @return string The first username to be returned, or null if 0155 * disabled. 0156 */ 0157 public function getStartMemberId() 0158 { 0159 if (array_key_exists('start', $this->_params)) { 0160 return $this->_params['start']; 0161 } else { 0162 return null; 0163 } 0164 } 0165 0166 /** 0167 * Returns the query URL generated by this query instance. 0168 * 0169 * @return string The query URL for this instance. 0170 */ 0171 public function getQueryUrl() 0172 { 0173 0174 $uri = Zend_Gdata_Gapps::APPS_BASE_FEED_URI; 0175 $uri .= Zend_Gdata_Gapps::APPS_GROUP_PATH; 0176 $uri .= '/' . $this->_domain; 0177 if ($this->_groupId !== null) { 0178 $uri .= '/' . $this->_groupId; 0179 } else { 0180 // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; 0181 throw new Zend_Gdata_App_InvalidArgumentException( 0182 'groupId must not be null'); 0183 } 0184 0185 $uri .= '/member'; 0186 0187 if ($this->_memberId !== null) { 0188 $uri .= '/' . $this->_memberId; 0189 } 0190 $uri .= $this->getQueryString(); 0191 return $uri; 0192 } 0193 0194 }