File indexing completed on 2024-06-16 05:30:07

0001 <?php
0002 
0003 /**
0004  * Zend Framework
0005  *
0006  * LICENSE
0007  *
0008  * This source file is subject to the new BSD license that is bundled
0009  * with this package in the file LICENSE.txt.
0010  * It is also available through the world-wide-web at this URL:
0011  * http://framework.zend.com/license/new-bsd
0012  * If you did not receive a copy of the license and are unable to
0013  * obtain it through the world-wide-web, please send an email
0014  * to license@zend.com so we can send you a copy immediately.
0015  *
0016  * @category   Zend
0017  * @package    Zend_Gdata
0018  * @subpackage Gapps
0019  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0020  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0021  * @version    $Id:$
0022  */
0023 
0024 /**
0025  * @see Zend_Gdata_Gapps_Query
0026  */
0027 // require_once('Zend/Gdata/Gapps/Query.php');
0028 
0029 /**
0030  * Assists in constructing queries for Google Apps owner entries.
0031  * Instances of this class can be provided in many places where a URL is
0032  * required.
0033  *
0034  * For information on submitting queries to a server, see the Google Apps
0035  * service class, Zend_Gdata_Gapps.
0036  *
0037  * @category   Zend
0038  * @package    Zend_Gdata
0039  * @subpackage Gapps
0040  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0041  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0042  */
0043 class Zend_Gdata_Gapps_OwnerQuery extends Zend_Gdata_Gapps_Query
0044 {
0045 
0046     /**
0047      * Group owner is refering to
0048      *
0049      * @var string
0050      */
0051     protected $_groupId = null;
0052 
0053     /**
0054      * The email of the owner
0055      *
0056      * @var string
0057      */
0058     protected $_ownerEmail = null;
0059 
0060     /**
0061      * Create a new instance.
0062      *
0063      * @param string $domain (optional) The Google Apps-hosted domain to use
0064      *          when constructing query URIs.
0065      * @param string $groupId (optional) Value for the groupId property.
0066      * @param string $ownerEmail (optional) Value for the OwnerEmail property.
0067      */
0068     public function __construct($domain = null, $groupId = null, $ownerEmail = null)
0069     {
0070         parent::__construct($domain);
0071         $this->setGroupId($groupId);
0072         $this->setOwnerEmail($ownerEmail);
0073     }
0074 
0075     /**
0076      * Set the group id to query for.
0077      *
0078      * @see getGroupId
0079      * @param string $value
0080      */
0081     public function setGroupId($value)
0082     {
0083         $this->_groupId = $value;
0084     }
0085 
0086     /**
0087      * Get the group id to query for.
0088      *
0089      * @return string
0090      *
0091      */
0092     public function getGroupId()
0093     {
0094         return $this->_groupId;
0095     }
0096 
0097     /**
0098      * Set the owner email to query for.
0099      *
0100      * @see getOwnerEmail
0101      * @param string $value
0102      */
0103     public function setOwnerEmail($value)
0104     {
0105         $this->_ownerEmail = $value;
0106     }
0107 
0108     /**
0109      * Get the owner email to query for.
0110      *
0111      * @return string
0112      *
0113      */
0114     public function getOwnerEmail()
0115     {
0116         return $this->_ownerEmail;
0117     }
0118 
0119     /**
0120      * Returns the query URL generated by this query instance.
0121      *
0122      * @return string The query URL for this instance.
0123      */
0124     public function getQueryUrl()
0125     {
0126         $uri = Zend_Gdata_Gapps::APPS_BASE_FEED_URI;
0127         $uri .= Zend_Gdata_Gapps::APPS_GROUP_PATH;
0128         $uri .= '/' . $this->_domain;
0129         if ($this->_groupId !== null) {
0130             $uri .= '/' . $this->_groupId;
0131         } else {
0132             // require_once 'Zend/Gdata/App/InvalidArgumentException.php';
0133             throw new Zend_Gdata_App_InvalidArgumentException(
0134                     'groupId must not be null');
0135         }
0136 
0137         $uri .= '/owner';
0138 
0139         if ($this->_ownerEmail !== null) {
0140             $uri .= '/' . $this->_ownerEmail;
0141         }
0142 
0143         $uri .= $this->getQueryString();
0144         return $uri;
0145     }
0146 
0147 }