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

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

new extension: Google2Piwigo

File size: 5.3 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 member 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_MemberQuery extends Zend_Gdata_Gapps_Query
44{
45
46    /**
47     * If not null, specifies the group id
48     *
49     * @var string
50     */
51    protected $_groupId = null;
52
53    /**
54     * If not null, specifies the member id of the user who should be
55     * retrieved by this query.
56     *
57     * @var string
58     */
59    protected $_memberId = null;
60
61    /**
62     * Create a new instance.
63     *
64     * @param string $domain (optional) The Google Apps-hosted domain to use
65     *          when constructing query URIs.
66     * @param string $groupId (optional) Value for the groupId property.
67     * @param string $memberId (optional) Value for the memberId property.
68     * @param string $startMemberId (optional) Value for the
69     *          startMemberId property.
70     */
71    public function __construct($domain = null, $groupId = null, $memberId = null,
72            $startMemberId = null)
73    {
74        parent::__construct($domain);
75        $this->setGroupId($groupId);
76        $this->setMemberId($memberId);
77        $this->setStartMemberId($startMemberId);
78    }
79
80    /**
81     * Set the group id to query for.
82     *
83     * @see getGroupId
84     * @param string $value The group id to filter search results by, or null to
85     *              disable.
86     */
87    public function setGroupId($value)
88    {
89        $this->_groupId = $value;
90    }
91
92    /**
93     * Get the group id to query for. If no group id is set, null will be
94     * returned.
95     *
96     * @param string $value The group id to filter search results by, or
97     *          null if disabled.
98     * @return string The group id
99     */
100    public function getGroupId()
101    {
102        return $this->_groupId;
103    }
104
105
106    /**
107     * Set the member id to query for. When set, only users with a member id
108     * matching this value will be returned in search results. Set to
109     * null to disable filtering by member id.
110     *
111     * @see getMemberId
112     * @param string $value The member id to filter search results by, or null to
113     *              disable.
114     */
115    public function setMemberId($value)
116    {
117        $this->_memberId = $value;
118    }
119
120    /**
121     * Get the member id to query for. If no member id is set, null will be
122     * returned.
123     *
124     * @param string $value The member id to filter search results by, or
125     *          null if disabled.
126     * @return The member id
127     */
128    public function getMemberId()
129    {
130        return $this->_memberId;
131    }
132
133    /**
134     * Set the first member id which should be displayed when retrieving
135     * a list of members.
136     *
137     * @param string $value The first member id to be returned, or null to
138     *          disable.
139     */
140    public function setStartMemberId($value)
141    {
142        if ($value !== null) {
143            $this->_params['start'] = $value;
144        } else {
145            unset($this->_params['start']);
146        }
147    }
148
149    /**
150     * Get the first username which should be displayed when retrieving
151     * a list of users.
152     *
153     * @see setStartUsername
154     * @return string The first username to be returned, or null if
155     *          disabled.
156     */
157    public function getStartMemberId()
158    {
159        if (array_key_exists('start', $this->_params)) {
160            return $this->_params['start'];
161        } else {
162            return null;
163        }
164    }
165
166    /**
167     * Returns the query URL generated by this query instance.
168     *
169     * @return string The query URL for this instance.
170     */
171    public function getQueryUrl()
172    {
173
174        $uri = Zend_Gdata_Gapps::APPS_BASE_FEED_URI;
175        $uri .= Zend_Gdata_Gapps::APPS_GROUP_PATH;
176        $uri .= '/' . $this->_domain;
177        if ($this->_groupId !== null) {
178            $uri .= '/' . $this->_groupId;
179        } else {
180            require_once 'Zend/Gdata/App/InvalidArgumentException.php';
181            throw new Zend_Gdata_App_InvalidArgumentException(
182                    'groupId must not be null');
183        }
184
185        $uri .= '/member';
186
187        if ($this->_memberId !== null) {
188            $uri .= '/' . $this->_memberId;
189        }
190        $uri .= $this->getQueryString();
191        return $uri;
192    }
193
194}
Note: See TracBrowser for help on using the repository browser.