source: trunk/www.guidonia.net/wp/wp-content/plugins/webtv/Drivers/Zend/Gdata/Gapps/NicknameQuery.php@ 44

Last change on this file since 44 was 44, checked in by luciano, 14 years ago
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-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 */
26require_once('Zend/Gdata/Gapps/Query.php');
27
28/**
29 * Assists in constructing queries for Google Apps nickname 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 * @subpackage Gapps
39 * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
40 * @license http://framework.zend.com/license/new-bsd New BSD License
41 */
42class Zend_Gdata_Gapps_NicknameQuery extends Zend_Gdata_Gapps_Query
43{
44
45 /**
46 * If not null, indicates the name of the nickname entry which
47 * should be returned by this query.
48 *
49 * @var string
50 */
51 protected $_nickname = null;
52
53 /**
54 * Create a new instance.
55 *
56 * @param string $domain (optional) The Google Apps-hosted domain to use
57 * when constructing query URIs.
58 * @param string $nickname (optional) Value for the nickname
59 * property.
60 * @param string $username (optional) Value for the username
61 * property.
62 * @param string $startNickname (optional) Value for the
63 * startNickname property.
64 */
65 public function __construct($domain = null, $nickname = null,
66 $username = null, $startNickname = null)
67 {
68 parent::__construct($domain);
69 $this->setNickname($nickname);
70 $this->setUsername($username);
71 $this->setStartNickname($startNickname);
72 }
73
74 /**
75 * Set the nickname to query for. When set, only users with a nickname
76 * matching this value will be returned in search results. Set to
77 * null to disable filtering by username.
78 *
79 * @param string $value The nickname to filter search results by, or null
80 * to disable.
81 */
82 public function setNickname($value)
83 {
84 $this->_nickname = $value;
85 }
86
87 /**
88 * Get the nickname to query for. If no nickname is set, null will be
89 * returned.
90 *
91 * @see setNickname
92 * @return string The nickname to filter search results by, or null if
93 * disabled.
94 */
95 public function getNickname()
96 {
97 return $this->_nickname;
98 }
99
100 /**
101 * Set the username to query for. When set, only users with a username
102 * matching this value will be returned in search results. Set to
103 * null to disable filtering by username.
104 *
105 * @param string $value The username to filter search results by, or null
106 * to disable.
107 */
108 public function setUsername($value)
109 {
110 if ($value !== null) {
111 $this->_params['username'] = $value;
112 }
113 else {
114 unset($this->_params['username']);
115 }
116 }
117
118 /**
119 * Get the username to query for. If no username is set, null will be
120 * returned.
121 *
122 * @see setUsername
123 * @return string The username to filter search results by, or null if
124 * disabled.
125 */
126 public function getUsername()
127 {
128 if (array_key_exists('username', $this->_params)) {
129 return $this->_params['username'];
130 } else {
131 return null;
132 }
133 }
134
135 /**
136 * Set the first nickname which should be displayed when retrieving
137 * a list of nicknames.
138 *
139 * @param string $value The first nickname to be returned, or null to
140 * disable.
141 */
142 public function setStartNickname($value)
143 {
144 if ($value !== null) {
145 $this->_params['startNickname'] = $value;
146 } else {
147 unset($this->_params['startNickname']);
148 }
149 }
150
151 /**
152 * Get the first nickname which should be displayed when retrieving
153 * a list of nicknames.
154 *
155 * @return string The first nickname to be returned, or null to
156 * disable.
157 */
158 public function getStartNickname()
159 {
160 if (array_key_exists('startNickname', $this->_params)) {
161 return $this->_params['startNickname'];
162 } else {
163 return null;
164 }
165 }
166
167 /**
168 * Returns the URL generated for this query, based on it's current
169 * parameters.
170 *
171 * @return string A URL generated based on the state of this query.
172 */
173 public function getQueryUrl()
174 {
175
176 $uri = $this->getBaseUrl();
177 $uri .= Zend_Gdata_Gapps::APPS_NICKNAME_PATH;
178 if ($this->_nickname !== null) {
179 $uri .= '/' . $this->_nickname;
180 }
181 $uri .= $this->getQueryString();
182 return $uri;
183 }
184
185}
Note: See TracBrowser for help on using the repository browser.