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.
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
27 require_once('Zend/Gdata/Query.php');
32 require_once('Zend/Gdata/Gapps.php');
35 * Assists in constructing queries for Google Apps entries. This class
36 * provides common methods used by all other Google Apps query classes.
38 * This class should never be instantiated directly. Instead, instantiate a
39 * class which inherits from this class.
44 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
45 * @license http://framework.zend.com/license/new-bsd New BSD License
47 abstract class Zend_Gdata_Gapps_Query extends Zend_Gdata_Query
51 * The domain which is being administered via the Provisioning API.
55 protected $_domain = null;
58 * Create a new instance.
60 * @param string $domain (optional) The Google Apps-hosted domain to use
61 * when constructing query URIs.
63 public function __construct($domain = null)
65 parent::__construct();
66 $this->_domain = $domain;
70 * Set domain for this service instance. This should be a fully qualified
71 * domain, such as 'foo.example.com'.
73 * This value is used when calculating URLs for retrieving and posting
74 * entries. If no value is specified, a URL will have to be manually
75 * constructed prior to using any methods which interact with the Google
76 * Apps provisioning service.
78 * @param string $value The domain to be used for this session.
80 public function setDomain($value)
82 $this->_domain = $value;
86 * Get domain for this service instance. This should be a fully qualified
87 * domain, such as 'foo.example.com'. If no domain is set, null will be
91 * @return string The domain to be used for this session, or null if not
94 public function getDomain()
96 return $this->_domain;
100 * Returns the base URL used to access the Google Apps service, based
101 * on the current domain. The current domain can be temporarily
102 * overridden by providing a fully qualified domain as $domain.
105 * @param string $domain (optional) A fully-qualified domain to use
106 * instead of the default domain for this service instance.
108 public function getBaseUrl($domain = null)
110 if ($domain !== null) {
111 return Zend_Gdata_Gapps::APPS_BASE_FEED_URI . '/' . $domain;
113 else if ($this->_domain !== null) {
114 return Zend_Gdata_Gapps::APPS_BASE_FEED_URI . '/' . $this->_domain;
117 require_once 'Zend/Gdata/App/InvalidArgumentException.php';
118 throw new Zend_Gdata_App_InvalidArgumentException(
119 'Domain must be specified.');