diff -r 5b37998e522e -r 162c1de6545a web/lib/Zend/Gdata/Gapps/Query.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Gdata/Gapps/Query.php Fri Mar 11 15:05:35 2011 +0100 @@ -0,0 +1,123 @@ +_domain = $domain; + } + + /** + * Set domain for this service instance. This should be a fully qualified + * domain, such as 'foo.example.com'. + * + * This value is used when calculating URLs for retrieving and posting + * entries. If no value is specified, a URL will have to be manually + * constructed prior to using any methods which interact with the Google + * Apps provisioning service. + * + * @param string $value The domain to be used for this session. + */ + public function setDomain($value) + { + $this->_domain = $value; + } + + /** + * Get domain for this service instance. This should be a fully qualified + * domain, such as 'foo.example.com'. If no domain is set, null will be + * returned. + * + * @see setDomain + * @return string The domain to be used for this session, or null if not + * set. + */ + public function getDomain() + { + return $this->_domain; + } + + /** + * Returns the base URL used to access the Google Apps service, based + * on the current domain. The current domain can be temporarily + * overridden by providing a fully qualified domain as $domain. + * + * @see setDomain + * @param string $domain (optional) A fully-qualified domain to use + * instead of the default domain for this service instance. + */ + public function getBaseUrl($domain = null) + { + if ($domain !== null) { + return Zend_Gdata_Gapps::APPS_BASE_FEED_URI . '/' . $domain; + } + else if ($this->_domain !== null) { + return Zend_Gdata_Gapps::APPS_BASE_FEED_URI . '/' . $this->_domain; + } + else { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'Domain must be specified.'); + } + } + +}