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

Last change on this file since 44 was 44, checked in by luciano, 14 years ago
File size: 4.7 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 email list recipient
30 * entries. Instances of this class can be provided in many places where a
31 * URL is 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_EmailListRecipientQuery extends Zend_Gdata_Gapps_Query
43{
44
45 /**
46 * If not null, specifies the name of the email list which
47 * should be requested by this query.
48 *
49 * @var string
50 */
51 protected $_emailListName = 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 $emailListName (optional) Value for the emailListName
59 * property.
60 * @param string $startRecipient (optional) Value for the
61 * startRecipient property.
62 */
63 public function __construct($domain = null, $emailListName = null,
64 $startRecipient = null)
65 {
66 parent::__construct($domain);
67 $this->setEmailListName($emailListName);
68 $this->setStartRecipient($startRecipient);
69 }
70
71 /**
72 * Set the email list name to query for. When set, only lists with a name
73 * matching this value will be returned in search results. Set to
74 * null to disable filtering by list name.
75 *
76 * @param string $value The email list name to filter search results by,
77 * or null to disable.
78 */
79 public function setEmailListName($value)
80 {
81 $this->_emailListName = $value;
82 }
83
84 /**
85 * Get the email list name to query for. If no name is set, null will be
86 * returned.
87 *
88 * @param string $value The email list name to filter search results by,
89 * or null if disabled.
90 */
91 public function getEmailListName()
92 {
93 return $this->_emailListName;
94 }
95
96 /**
97 * Set the first recipient which should be displayed when retrieving
98 * a list of email list recipients.
99 *
100 * @param string $value The first recipient to be returned, or null to
101 * disable.
102 */
103 public function setStartRecipient($value)
104 {
105 if ($value !== null) {
106 $this->_params['startRecipient'] = $value;
107 } else {
108 unset($this->_params['startRecipient']);
109 }
110 }
111
112 /**
113 * Get the first recipient which should be displayed when retrieving
114 * a list of email list recipients.
115 *
116 * @return string The first recipient to be returned, or null if
117 * disabled.
118 */
119 public function getStartRecipient()
120 {
121 if (array_key_exists('startRecipient', $this->_params)) {
122 return $this->_params['startRecipient'];
123 } else {
124 return null;
125 }
126 }
127
128 /**
129 * Returns the URL generated for this query, based on it's current
130 * parameters.
131 *
132 * @return string A URL generated based on the state of this query.
133 * @throws Zend_Gdata_App_InvalidArgumentException
134 */
135 public function getQueryUrl()
136 {
137
138 $uri = $this->getBaseUrl();
139 $uri .= Zend_Gdata_Gapps::APPS_EMAIL_LIST_PATH;
140 if ($this->_emailListName !== null) {
141 $uri .= '/' . $this->_emailListName;
142 } else {
143 require_once 'Zend/Gdata/App/InvalidArgumentException.php';
144 throw new Zend_Gdata_App_InvalidArgumentException(
145 'EmailListName must not be null');
146 }
147 $uri .= Zend_Gdata_Gapps::APPS_EMAIL_LIST_RECIPIENT_POSTFIX . '/';
148 $uri .= $this->getQueryString();
149 return $uri;
150 }
151
152}
Note: See TracBrowser for help on using the repository browser.