[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/include/Zend/Gdata/Analytics/ -> AccountQuery.php (source)

   1  <?php
   2  /**
   3   * Zend Framework
   4   *
   5   * LICENSE
   6   *
   7   * This source file is subject to the new BSD license that is bundled
   8   * with this package in the file LICENSE.txt.
   9   * It is also available through the world-wide-web at this URL:
  10   * http://framework.zend.com/license/new-bsd
  11   * If you did not receive a copy of the license and are unable to
  12   * obtain it through the world-wide-web, please send an email
  13   * to [email protected] so we can send you a copy immediately.
  14   *
  15   * @category   Zend
  16   * @package    Zend_Gdata
  17   * @subpackage Analytics
  18   * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  19   * @license    http://framework.zend.com/license/new-bsd     New BSD License
  20   * @version    $Id$
  21   */
  22  
  23  /**
  24   * @see Zend_Gdata_Query
  25   */
  26  require_once  'Zend/Gdata/Query.php';
  27  
  28  /**
  29   * @category   Zend
  30   * @package    Zend_Gdata
  31   * @subpackage Analytics
  32   */
  33  class Zend_Gdata_Analytics_AccountQuery extends Zend_Gdata_Query
  34  {
  35      const ANALYTICS_FEED_URI = 'https://www.googleapis.com/analytics/v2.4/management/accounts';
  36  
  37      /**
  38       * The default URI used for feeds.
  39       */
  40      protected $_defaultFeedUri = self::ANALYTICS_FEED_URI;
  41      
  42      /**
  43       * @var string
  44       */
  45      protected $_accountId = '~all';
  46      /**
  47       * @var string
  48       */
  49      protected $_webpropertyId = '~all';
  50      /**
  51       * @var string
  52       */
  53      protected $_profileId = '~all';
  54     
  55      /**
  56       * @var bool
  57       */ 
  58      protected $_webproperties = false;
  59      /**
  60       * @var bool
  61       */
  62      protected $_profiles = false;
  63      /**
  64       * @var bool
  65       */
  66      protected $_goals = false;
  67      
  68      /**
  69       * @param string $accountId
  70       * @return Zend_Gdata_Analytics_AccountQuery
  71       */
  72      public function setAccountId($accountId)
  73      {
  74          $this->_accountId = $accountId;
  75          return $this;
  76      }
  77      
  78      /**
  79       * @return string
  80       */
  81      public function getAccountId()
  82      {
  83          return $this->_accountId;
  84      }
  85  
  86      /**
  87       * @param string $webpropertyId
  88       * @return Zend_Gdata_Analytics_AccountQuery
  89       */
  90      public function setWebpropertyId($webpropertyId)
  91      {
  92          $this->_webpropertyId = $webpropertyId;
  93          return $this;
  94      }
  95      
  96      /**
  97       * @return string
  98       */
  99      public function getWebpropertyId()
 100      {
 101          return $this->_webpropertyId;
 102      }
 103      
 104      /**
 105       * @param string $profileId
 106       * @return Zend_Gdata_Analytics_AccountQuery
 107       */
 108      public function setProfileId($profileId)
 109      {
 110          $this->_profileId = $profileId;
 111          return $this;
 112      }
 113  
 114      /**
 115       * @return string
 116       */
 117      public function getProfileId()
 118      {
 119          return $this->_profileId;
 120      }
 121      
 122      /**
 123       * @param string $accountId
 124       * @return Zend_Gdata_Analytics_AccountQuery
 125       */
 126      public function webproperties($accountId = '~all')
 127      {
 128          $this->_webproperties = true;
 129          $this->setAccountId($accountId);    
 130          return $this;
 131      }
 132      
 133      /**
 134       * @param string $webpropertyId
 135       * @param string $accountId
 136       * @return Zend_Gdata_Analytics_AccountQuery
 137       */
 138      public function profiles($webpropertyId = '~all', $accountId = '~all')
 139      {
 140          $this->_profiles = true;
 141          if (null !== $accountId) {
 142              $this->setAccountId($accountId);    
 143          }
 144          $this->setWebpropertyId($webpropertyId);
 145          return $this;
 146      }
 147      
 148      /**
 149       * @param string $webpropertyId
 150       * @param string $accountId
 151       * @param string $accountId
 152       * @return Zend_Gdata_Analytics_AccountQuery
 153       */
 154      public function goals($profileId = '~all', $webpropertyId = '~all', $accountId = '~all')
 155      {
 156          $this->_goals = true;
 157          if (null !== $accountId) {
 158              $this->setAccountId($accountId);    
 159          }
 160          if (null !== $webpropertyId) {
 161              $this->setWebpropertyId($webpropertyId);    
 162          }
 163          $this->setProfileId($profileId);
 164          return $this;
 165      }
 166      
 167      /**
 168       * @return string url
 169       */
 170      public function getQueryUrl()
 171      {
 172          $url = $this->_defaultFeedUri;
 173          
 174          // add account id
 175          if ($this->_webproperties or $this->_profiles or $this->_goals) {
 176              $url .= '/' . $this->_accountId . '/webproperties';
 177          }
 178          
 179          if ($this->_profiles or $this->_goals) {
 180              $url .= '/' . $this->_webpropertyId . '/profiles';
 181          }
 182          
 183          if ($this->_goals) {
 184              $url .= '/' . $this->_profileId . '/goals';
 185          }
 186  
 187          $url .= $this->getQueryString();
 188          return $url;
 189      }
 190  }


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1