Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • None
  • system
    • base
    • caching
    • console
    • db
      • ar
      • schema
    • validators
    • web
      • actions
      • auth
      • helpers
      • widgets
        • captcha
        • pagers
  • zii
    • widgets
      • grid

Classes

  • EmailAccount
  • EmailDropboxSettings
  • GMailAccount
  • GoogleProject
  • JSONEmbeddedModel
  • MailgunAccount
  • MailjetAccount
  • MandrillAccount
  • OutlookEmailAccount
  • SendgridAccount
  • SESAccount
  • TwitterApp
  • WidgetLayout
  • YahooEmailAccount
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /*****************************************************************************************
  3:  * X2Engine Open Source Edition is a customer relationship management program developed by
  4:  * X2Engine, Inc. Copyright (C) 2011-2016 X2Engine Inc.
  5:  * 
  6:  * This program is free software; you can redistribute it and/or modify it under
  7:  * the terms of the GNU Affero General Public License version 3 as published by the
  8:  * Free Software Foundation with the addition of the following permission added
  9:  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
 10:  * IN WHICH THE COPYRIGHT IS OWNED BY X2ENGINE, X2ENGINE DISCLAIMS THE WARRANTY
 11:  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
 12:  * 
 13:  * This program is distributed in the hope that it will be useful, but WITHOUT
 14:  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 15:  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
 16:  * details.
 17:  * 
 18:  * You should have received a copy of the GNU Affero General Public License along with
 19:  * this program; if not, see http://www.gnu.org/licenses or write to the Free
 20:  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 21:  * 02110-1301 USA.
 22:  * 
 23:  * You can contact X2Engine, Inc. P.O. Box 66752, Scotts Valley,
 24:  * California 95067, USA. or at email address contact@x2engine.com.
 25:  * 
 26:  * The interactive user interfaces in modified source and object code versions
 27:  * of this program must display Appropriate Legal Notices, as required under
 28:  * Section 5 of the GNU Affero General Public License version 3.
 29:  * 
 30:  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 31:  * these Appropriate Legal Notices must retain the display of the "Powered by
 32:  * X2Engine" logo. If the display of the logo is not reasonably feasible for
 33:  * technical reasons, the Appropriate Legal Notices must display the words
 34:  * "Powered by X2Engine".
 35:  *****************************************************************************************/
 36: 
 37: class GoogleProject extends JSONEmbeddedModel implements AdminOwnedCredentials {
 38: 
 39:     public static function getAdminProperty () {
 40:         return 'googleCredentialsId'; 
 41:     }
 42: 
 43:     /**
 44:      * @var string Used for OAuth 2.0 (needed for Calendar sync and login)
 45:      */
 46:     public $clientId = '';
 47: 
 48:     /**
 49:      * @var string Used for OAuth 2.0 (needed for Calendar sync and login)
 50:      */
 51:     public $clientSecret = '';
 52: 
 53:      
 54: 
 55:     // pseudo-attributes which belong to Admin. These don't get enrypted with the other attributes,
 56:     // but do get rendered in the same form
 57:     private $_gaTracking_internal;
 58:     private $_gaTracking_public;
 59: 
 60:     public function getProtectedFields () {
 61:         return array ('clientId', 'clientSecret');
 62:     }
 63: 
 64:     public function renderForm () {
 65:         Yii::app()->controller->renderPartial (
 66:             'application.views.profile._googleProjectForm', array (
 67:                 'model' => $this
 68:             ));
 69:     }
 70: 
 71:     public function getMetaData () {
 72:         return array (
 73:             'private' => 1,
 74:             'userId' => Credentials::SYS_ID,
 75:             'name' => 'Google project',
 76:         );
 77:     }
 78: 
 79:     public function rules(){
 80:         return array(
 81:              
 82:             array('clientId,clientSecret', 'safe'),
 83:         );
 84:     }
 85: 
 86:     /**
 87:      * Ensure that if one of the OAuth 2.0 fields are set, both are
 88:      */
 89: //    public function validateOAuthCreds ($attr) {
 90: //        if ($this->$attr === null) return;
 91: //        if ($attr === 'clientSecret' && $this->clientId === null) {
 92: //            $this->addError ('clientId', Yii::t('app', 'Field required'));
 93: //        } elseif ($attr === 'clientId' && $this->clientSecret === null) {
 94: //            $this->addError ('clientSecret', Yii::t('app', 'Field required'));
 95: //        }
 96: //    }
 97: 
 98:     public function setGaTracking_internal ($gaTracking_internal) {
 99:         $this->_gaTracking_internal = $gaTracking_internal;
100:     }
101: 
102:     public function setGaTracking_public ($gaTracking_public) {
103:         $this->_gaTracking_public = $gaTracking_public;
104:     }
105: 
106:     public function getGaTracking_public () {
107:         return $this->_gaTracking_public;
108:     }
109: 
110:     public function getGaTracking_internal () {
111:         return $this->_gaTracking_internal;
112:     }
113: 
114:     public function getPageTitle () {
115:         return $this->modelLabel ();
116:     }
117: 
118:     public function modelLabel() {
119:         return Yii::t('app','Google Integration');
120:     }
121: 
122:     public function attributeLabels(){
123:         return array(
124:             'clientId' => Yii::t('app','Client ID'),
125:             'clientSecret' => Yii::t('app','Client Secret'),
126:              
127:             'gaTracking_public' => Yii::t('app','Google Analytics Property ID (public)'),
128:             'gaTracking_internal' => Yii::t('app','Google Analytics Property ID (internal)'),
129:         );
130:     }
131: 
132:     public function htmlOptions ($name, $options=array ()) {
133:         return X2Html::mergeHtmlOptions (
134:             parent::htmlOptions ($name, $options), array ('class' => 'google-credential-input'));
135:     }
136: 
137: }
138: 
139: ?>
140: 
X2CRM Documentation API documentation generated by ApiGen 2.8.0