]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - Zend/Gdata/Gapps/OwnerQuery.php
Release 6.5.0
[Github/sugarcrm.git] / Zend / Gdata / Gapps / OwnerQuery.php
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-2010 Zend Technologies USA Inc. (http://www.zend.com)
20  * @license    http://framework.zend.com/license/new-bsd     New BSD License
21
22  */
23
24 /**
25  * @see Zend_Gdata_Gapps_Query
26  */
27 require_once('Zend/Gdata/Gapps/Query.php');
28
29 /**
30  * Assists in constructing queries for Google Apps owner 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-2010 Zend Technologies USA Inc. (http://www.zend.com)
41  * @license    http://framework.zend.com/license/new-bsd     New BSD License
42  */
43 class Zend_Gdata_Gapps_OwnerQuery extends Zend_Gdata_Gapps_Query
44 {
45
46     /**
47      * Group owner is refering to
48      *
49      * @var string
50      */
51     protected $_groupId = null;
52
53     /**
54      * The email of the owner
55      *
56      * @var string
57      */
58     protected $_ownerEmail = null;
59
60     /**
61      * Create a new instance.
62      *
63      * @param string $domain (optional) The Google Apps-hosted domain to use
64      *          when constructing query URIs.
65      * @param string $groupId (optional) Value for the groupId property.
66      * @param string $ownerEmail (optional) Value for the OwnerEmail property.
67      */
68     public function __construct($domain = null, $groupId = null, $ownerEmail = null)
69     {
70         parent::__construct($domain);
71         $this->setGroupId($groupId);
72         $this->setOwnerEmail($ownerEmail);
73     }
74
75     /**
76      * Set the group id to query for.
77      *
78      * @see getGroupId
79      * @param string $value 
80      */
81     public function setGroupId($value)
82     {
83         $this->_groupId = $value;
84     }
85
86     /**
87      * Get the group id to query for.
88      *
89      * @return string
90      *
91      */
92     public function getGroupId()
93     {
94         return $this->_groupId;
95     }
96
97     /**
98      * Set the owner email to query for.
99      *
100      * @see getOwnerEmail
101      * @param string $value
102      */
103     public function setOwnerEmail($value)
104     {
105         $this->_ownerEmail = $value;
106     }
107
108     /**
109      * Get the owner email to query for.
110      *
111      * @return string
112      *
113      */
114     public function getOwnerEmail()
115     {
116         return $this->_ownerEmail;
117     }
118
119     /**
120      * Returns the query URL generated by this query instance.
121      *
122      * @return string The query URL for this instance.
123      */
124     public function getQueryUrl()
125     {
126         $uri = Zend_Gdata_Gapps::APPS_BASE_FEED_URI;
127         $uri .= Zend_Gdata_Gapps::APPS_GROUP_PATH;
128         $uri .= '/' . $this->_domain;
129         if ($this->_groupId !== null) {
130             $uri .= '/' . $this->_groupId;
131         } else {
132             require_once 'Zend/Gdata/App/InvalidArgumentException.php';
133             throw new Zend_Gdata_App_InvalidArgumentException(
134                     'groupId must not be null');
135         }
136         
137         $uri .= '/owner';
138         
139         if ($this->_ownerEmail !== null) {
140             $uri .= '/' . $this->_ownerEmail;
141         }
142
143         $uri .= $this->getQueryString();
144         return $uri;
145     }
146
147 }