*prechod na novsiu verziu ZF
[sport-group.git] / library / Zend / Gdata / Gapps / NicknameQuery.php
blob0c9a97b3e4a9898ee3731cc9b02e8a9e3600ea05
1 <?php
3 /**
4 * Zend Framework
6 * LICENSE
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.
16 * @category Zend
17 * @package Zend_Gdata
18 * @subpackage Gapps
19 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
21 * @version $Id: NicknameQuery.php 16971 2009-07-22 18:05:45Z mikaelkael $
24 /**
25 * @see Zend_Gdata_Gapps_Query
27 require_once('Zend/Gdata/Gapps/Query.php');
29 /**
30 * Assists in constructing queries for Google Apps nickname entries.
31 * Instances of this class can be provided in many places where a URL is
32 * required.
34 * For information on submitting queries to a server, see the Google Apps
35 * service class, Zend_Gdata_Gapps.
37 * @category Zend
38 * @package Zend_Gdata
39 * @subpackage Gapps
40 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
41 * @license http://framework.zend.com/license/new-bsd New BSD License
43 class Zend_Gdata_Gapps_NicknameQuery extends Zend_Gdata_Gapps_Query
46 /**
47 * If not null, indicates the name of the nickname entry which
48 * should be returned by this query.
50 * @var string
52 protected $_nickname = null;
54 /**
55 * Create a new instance.
57 * @param string $domain (optional) The Google Apps-hosted domain to use
58 * when constructing query URIs.
59 * @param string $nickname (optional) Value for the nickname
60 * property.
61 * @param string $username (optional) Value for the username
62 * property.
63 * @param string $startNickname (optional) Value for the
64 * startNickname property.
66 public function __construct($domain = null, $nickname = null,
67 $username = null, $startNickname = null)
69 parent::__construct($domain);
70 $this->setNickname($nickname);
71 $this->setUsername($username);
72 $this->setStartNickname($startNickname);
75 /**
76 * Set the nickname to query for. When set, only users with a nickname
77 * matching this value will be returned in search results. Set to
78 * null to disable filtering by username.
80 * @param string $value The nickname to filter search results by, or null
81 * to disable.
83 public function setNickname($value)
85 $this->_nickname = $value;
88 /**
89 * Get the nickname to query for. If no nickname is set, null will be
90 * returned.
92 * @see setNickname
93 * @return string The nickname to filter search results by, or null if
94 * disabled.
96 public function getNickname()
98 return $this->_nickname;
102 * Set the username to query for. When set, only users with a username
103 * matching this value will be returned in search results. Set to
104 * null to disable filtering by username.
106 * @param string $value The username to filter search results by, or null
107 * to disable.
109 public function setUsername($value)
111 if ($value !== null) {
112 $this->_params['username'] = $value;
114 else {
115 unset($this->_params['username']);
120 * Get the username to query for. If no username is set, null will be
121 * returned.
123 * @see setUsername
124 * @return string The username to filter search results by, or null if
125 * disabled.
127 public function getUsername()
129 if (array_key_exists('username', $this->_params)) {
130 return $this->_params['username'];
131 } else {
132 return null;
137 * Set the first nickname which should be displayed when retrieving
138 * a list of nicknames.
140 * @param string $value The first nickname to be returned, or null to
141 * disable.
143 public function setStartNickname($value)
145 if ($value !== null) {
146 $this->_params['startNickname'] = $value;
147 } else {
148 unset($this->_params['startNickname']);
153 * Get the first nickname which should be displayed when retrieving
154 * a list of nicknames.
156 * @return string The first nickname to be returned, or null to
157 * disable.
159 public function getStartNickname()
161 if (array_key_exists('startNickname', $this->_params)) {
162 return $this->_params['startNickname'];
163 } else {
164 return null;
169 * Returns the URL generated for this query, based on it's current
170 * parameters.
172 * @return string A URL generated based on the state of this query.
174 public function getQueryUrl()
177 $uri = $this->getBaseUrl();
178 $uri .= Zend_Gdata_Gapps::APPS_NICKNAME_PATH;
179 if ($this->_nickname !== null) {
180 $uri .= '/' . $this->_nickname;
182 $uri .= $this->getQueryString();
183 return $uri;