source: extensions/Google2Piwigo/include/Zend/Gdata/Gapps/GroupQuery.php @ 17475

Last change on this file since 17475 was 17475, checked in by mistic100, 12 years ago

new extension: Google2Piwigo

File size: 6.0 KB
Line 
1<?php
2
3/**
4 * Zend Framework
5 *
6 * LICENSE
7 *
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.
15 *
16 * @category   Zend
17 * @package    Zend_Gdata
18 * @subpackage Gapps
19 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license    http://framework.zend.com/license/new-bsd     New BSD License
21 * @version    $Id:$
22 */
23
24/**
25 * @see Zend_Gdata_Gapps_Query
26 */
27require_once('Zend/Gdata/Gapps/Query.php');
28
29/**
30 * Assists in constructing queries for Google Apps group entries.
31 * Instances of this class can be provided in many places where a URL is
32 * required.
33 *
34 * For information on submitting queries to a server, see the Google Apps
35 * service class, Zend_Gdata_Gapps.
36 *
37 * @category   Zend
38 * @package    Zend_Gdata
39 * @subpackage Gapps
40 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
41 * @license    http://framework.zend.com/license/new-bsd     New BSD License
42 */
43class Zend_Gdata_Gapps_GroupQuery extends Zend_Gdata_Gapps_Query
44{
45
46    /**
47     * If not null, specifies the group id of the group who should be
48     * retrieved by this query.
49     *
50     * @var string
51     */
52    protected $_groupId = null;
53
54    /**
55     * Create a new instance.
56     *
57     * @param string $domain (optional) The Google Apps-hosted domain to use
58     *          when constructing query URIs.
59     * @param string $groupId (optional) Value for the groupId property.
60     * @param string $startGroupName (optional) Value for the
61     *          startGroupName property.
62     */
63    public function __construct($domain = null, $groupId = null,
64            $startGroupId = null)
65    {
66        parent::__construct($domain);
67        $this->setGroupId($groupId);
68        $this->setStartGroupId($startGroupId);
69    }
70
71    /**
72     * Set the group id to query for. When set, only groups with a group id
73     * matching this value will be returned in search results. Set to
74     * null to disable filtering by group id.
75     *
76     * @see getGroupId
77     * @param string $value The group id to filter search results by, or null to
78     *              disable.
79     */
80    public function setGroupId($value)
81    {
82        $this->_groupId = $value;
83    }
84
85    /**
86     * Get the group id to query for. If no group id is set, null will be
87     * returned.
88     *
89     * @param string $value The group id to filter search results by, or
90     *          null if disabled.
91     */
92    public function getGroupId()
93    {
94        return $this->_groupId;
95    }
96
97    /**
98     * Set the member to query for. When set, only subscribers with an
99     * email address matching this value will be returned in search results.
100     * Set to null to disable filtering by username.
101     *
102     * @param string $value The member email address to filter search
103     *              results by, or null to  disable.
104     */
105    public function setMember($value)
106    {
107        if ($value !== null) {
108            $this->_params['member'] = $value;
109        }
110        else {
111            unset($this->_params['member']);
112        }
113    }
114
115    /**
116     * Get the member email address to query for. If no member is set,
117     * null will be returned.
118     *
119     * @see setMember
120     * @return string The member email address to filter search
121     *              results by, or null if disabled.
122     */
123    public function getMember()
124    {
125        if (array_key_exists('member', $this->_params)) {
126            return $this->_params['member'];
127        } else {
128            return null;
129        }
130    }
131
132
133    /**
134     * Sets the query parameter directOnly
135     * @param bool $value
136     */
137    public function setDirectOnly($value)
138    {
139        if ($value !== null) {
140            if($value == true) {
141                $this->_params['directOnly'] = 'true';
142            } else {
143                $this->_params['directOnly'] = 'false';
144            }
145        } else {
146            unset($this->_params['directOnly']);
147        }
148    }
149
150    /**
151     *
152     * @see setDirectOnly
153     * @return bool
154     */
155    public function getDirectOnly()
156    {
157        if (array_key_exists('directOnly', $this->_params)) {
158
159            if($this->_params['directOnly'] == 'true') {
160                return true;
161            } else {
162                return false;
163            }
164        } else {
165            return null;
166        }
167    }
168
169    /**
170     * Set the first group id which should be displayed when retrieving
171     * a list of groups.
172     *
173     * @param string $value The first group id to be returned, or null to
174     *          disable.
175     */
176    public function setStartGroupId($value)
177    {
178        if ($value !== null) {
179            $this->_params['start'] = $value;
180        } else {
181            unset($this->_params['start']);
182        }
183    }
184
185    /**
186     * Get the first group id which should be displayed when retrieving
187     * a list of groups.
188     *
189     * @see setStartGroupId
190     * @return string The first group id to be returned, or null if
191     *          disabled.
192     */
193    public function getStartGroupId()
194    {
195        if (array_key_exists('start', $this->_params)) {
196            return $this->_params['start'];
197        } else {
198            return null;
199        }
200    }
201
202    /**
203     * Returns the query URL generated by this query instance.
204     *
205     * @return string The query URL for this instance.
206     */
207    public function getQueryUrl()
208    {
209
210        $uri  = Zend_Gdata_Gapps::APPS_BASE_FEED_URI;
211        $uri .= Zend_Gdata_Gapps::APPS_GROUP_PATH;
212        $uri .= '/' . $this->_domain;
213
214        if ($this->_groupId !== null) {
215            $uri .= '/' . $this->_groupId;
216        }
217
218        if(array_key_exists('member', $this->_params)) {
219            $uri .= '/';
220        }
221
222        $uri .= $this->getQueryString();
223        return $uri;
224    }
225
226}
Note: See TracBrowser for help on using the repository browser.