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 group 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_GroupQuery extends Zend_Gdata_Gapps_Query 0044 { 0045 0046 /** 0047 * If not null, specifies the group id of the group who should be 0048 * retrieved by this query. 0049 * 0050 * @var string 0051 */ 0052 protected $_groupId = 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 $groupId (optional) Value for the groupId property. 0060 * @param string $startGroupName (optional) Value for the 0061 * startGroupName property. 0062 */ 0063 public function __construct($domain = null, $groupId = null, 0064 $startGroupId = null) 0065 { 0066 parent::__construct($domain); 0067 $this->setGroupId($groupId); 0068 $this->setStartGroupId($startGroupId); 0069 } 0070 0071 /** 0072 * Set the group id to query for. When set, only groups with a group id 0073 * matching this value will be returned in search results. Set to 0074 * null to disable filtering by group id. 0075 * 0076 * @see getGroupId 0077 * @param string $value The group id to filter search results by, or null to 0078 * disable. 0079 */ 0080 public function setGroupId($value) 0081 { 0082 $this->_groupId = $value; 0083 } 0084 0085 /** 0086 * Get the group id to query for. If no group id is set, null will be 0087 * returned. 0088 * 0089 * @param string $value The group id to filter search results by, or 0090 * null if disabled. 0091 */ 0092 public function getGroupId() 0093 { 0094 return $this->_groupId; 0095 } 0096 0097 /** 0098 * Set the member to query for. When set, only subscribers with an 0099 * email address matching this value will be returned in search results. 0100 * Set to null to disable filtering by username. 0101 * 0102 * @param string $value The member email address to filter search 0103 * results by, or null to disable. 0104 */ 0105 public function setMember($value) 0106 { 0107 if ($value !== null) { 0108 $this->_params['member'] = $value; 0109 } 0110 else { 0111 unset($this->_params['member']); 0112 } 0113 } 0114 0115 /** 0116 * Get the member email address to query for. If no member is set, 0117 * null will be returned. 0118 * 0119 * @see setMember 0120 * @return string The member email address to filter search 0121 * results by, or null if disabled. 0122 */ 0123 public function getMember() 0124 { 0125 if (array_key_exists('member', $this->_params)) { 0126 return $this->_params['member']; 0127 } else { 0128 return null; 0129 } 0130 } 0131 0132 0133 /** 0134 * Sets the query parameter directOnly 0135 * @param bool $value 0136 */ 0137 public function setDirectOnly($value) 0138 { 0139 if ($value !== null) { 0140 if($value == true) { 0141 $this->_params['directOnly'] = 'true'; 0142 } else { 0143 $this->_params['directOnly'] = 'false'; 0144 } 0145 } else { 0146 unset($this->_params['directOnly']); 0147 } 0148 } 0149 0150 /** 0151 * 0152 * @see setDirectOnly 0153 * @return bool 0154 */ 0155 public function getDirectOnly() 0156 { 0157 if (array_key_exists('directOnly', $this->_params)) { 0158 0159 if($this->_params['directOnly'] == 'true') { 0160 return true; 0161 } else { 0162 return false; 0163 } 0164 } else { 0165 return null; 0166 } 0167 } 0168 0169 /** 0170 * Set the first group id which should be displayed when retrieving 0171 * a list of groups. 0172 * 0173 * @param string $value The first group id to be returned, or null to 0174 * disable. 0175 */ 0176 public function setStartGroupId($value) 0177 { 0178 if ($value !== null) { 0179 $this->_params['start'] = $value; 0180 } else { 0181 unset($this->_params['start']); 0182 } 0183 } 0184 0185 /** 0186 * Get the first group id which should be displayed when retrieving 0187 * a list of groups. 0188 * 0189 * @see setStartGroupId 0190 * @return string The first group id to be returned, or null if 0191 * disabled. 0192 */ 0193 public function getStartGroupId() 0194 { 0195 if (array_key_exists('start', $this->_params)) { 0196 return $this->_params['start']; 0197 } else { 0198 return null; 0199 } 0200 } 0201 0202 /** 0203 * Returns the query URL generated by this query instance. 0204 * 0205 * @return string The query URL for this instance. 0206 */ 0207 public function getQueryUrl() 0208 { 0209 0210 $uri = Zend_Gdata_Gapps::APPS_BASE_FEED_URI; 0211 $uri .= Zend_Gdata_Gapps::APPS_GROUP_PATH; 0212 $uri .= '/' . $this->_domain; 0213 0214 if ($this->_groupId !== null) { 0215 $uri .= '/' . $this->_groupId; 0216 } 0217 0218 if(array_key_exists('member', $this->_params)) { 0219 $uri .= '/'; 0220 } 0221 0222 $uri .= $this->getQueryString(); 0223 return $uri; 0224 } 0225 0226 }