~chroot64bit/zivios/gentoo-experimental

« back to all changes in this revision

Viewing changes to application/library/Zend/Gdata/Gapps/UserQuery.php

  • Committer: Mustafa A. Hashmi
  • Date: 2008-12-04 13:32:21 UTC
  • Revision ID: mhashmi@zivios.org-20081204133221-0nd1trunwevijj38
Inclusion of new installation framework with ties to zend layout and dojo layout

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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-2008 Zend Technologies USA Inc. (http://www.zend.com)
 
20
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 
21
 */
 
22
 
 
23
/**
 
24
 * @see Zend_Gdata_Gapps_Query
 
25
 */
 
26
require_once('Zend/Gdata/Gapps/Query.php');
 
27
 
 
28
/**
 
29
 * Assists in constructing queries for Google Apps user entries. 
 
30
 * Instances of this class can be provided in many places where a URL is 
 
31
 * required.
 
32
 * 
 
33
 * For information on submitting queries to a server, see the Google Apps
 
34
 * service class, Zend_Gdata_Gapps.
 
35
 * 
 
36
 * @category   Zend
 
37
 * @package    Zend_Gdata
 
38
 * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
 
39
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 
40
 */
 
41
class Zend_Gdata_Gapps_UserQuery extends Zend_Gdata_Gapps_Query
 
42
{
 
43
 
 
44
    /**
 
45
     * If not null, specifies the username of the user who should be 
 
46
     * retrieved by this query.
 
47
     * 
 
48
     * @var string
 
49
     */
 
50
    protected $_username = null;
 
51
 
 
52
    /**
 
53
     * Create a new instance.
 
54
     * 
 
55
     * @param string $domain (optional) The Google Apps-hosted domain to use 
 
56
     *          when constructing query URIs.
 
57
     * @param string $username (optional) Value for the username 
 
58
     *          property.
 
59
     * @param string $startUsername (optional) Value for the 
 
60
     *          startUsername property.
 
61
     */
 
62
    public function __construct($domain = null, $username = null, 
 
63
            $startUsername = null)
 
64
    {
 
65
        parent::__construct($domain);
 
66
        $this->setUsername($username);
 
67
        $this->setStartUsername($startUsername);
 
68
    }
 
69
 
 
70
    /**
 
71
     * Set the username to query for. When set, only users with a username 
 
72
     * matching this value will be returned in search results. Set to 
 
73
     * null to disable filtering by username.
 
74
     * 
 
75
     * @see getUsername
 
76
     * @param string $value The username to filter search results by, or null to 
 
77
     *              disable.
 
78
     */
 
79
    public function setUsername($value)
 
80
    {
 
81
        $this->_username = $value;
 
82
    }
 
83
 
 
84
    /**
 
85
     * Get the username to query for. If no username is set, null will be 
 
86
     * returned.
 
87
     * 
 
88
     * @param string $value The username to filter search results by, or 
 
89
     *          null if disabled.
 
90
     */
 
91
    public function getUsername()
 
92
    {
 
93
        return $this->_username;
 
94
    }
 
95
 
 
96
    /**
 
97
     * Set the first username which should be displayed when retrieving 
 
98
     * a list of users.
 
99
     * 
 
100
     * @param string $value The first username to be returned, or null to 
 
101
     *          disable.
 
102
     */
 
103
    public function setStartUsername($value)
 
104
    {
 
105
        if ($value !== null) {
 
106
            $this->_params['startUsername'] = $value;
 
107
        } else {
 
108
            unset($this->_params['startUsername']);
 
109
        }
 
110
    }
 
111
 
 
112
    /**
 
113
     * Get the first username which should be displayed when retrieving 
 
114
     * a list of users.
 
115
     * 
 
116
     * @see setStartUsername
 
117
     * @return string The first username to be returned, or null if 
 
118
     *          disabled.
 
119
     */
 
120
    public function getStartUsername()
 
121
    {
 
122
        if (array_key_exists('startUsername', $this->_params)) {
 
123
            return $this->_params['startUsername'];
 
124
        } else {
 
125
            return null;
 
126
        }
 
127
    }
 
128
 
 
129
    /**
 
130
     * Returns the query URL generated by this query instance.
 
131
     * 
 
132
     * @return string The query URL for this instance.
 
133
     */
 
134
    public function getQueryUrl()
 
135
    {
 
136
        $uri = $this->getBaseUrl();
 
137
        $uri .= Zend_Gdata_Gapps::APPS_USER_PATH;
 
138
        if ($this->_username !== null) {
 
139
            $uri .= '/' . $this->_username;
 
140
        }
 
141
        $uri .= $this->getQueryString();
 
142
        return $uri;
 
143
    }
 
144
 
 
145
}