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: /*****************************************************************************************
  4:  * X2Engine Open Source Edition is a customer relationship management program developed by
  5:  * X2Engine, Inc. Copyright (C) 2011-2016 X2Engine Inc.
  6:  * 
  7:  * This program is free software; you can redistribute it and/or modify it under
  8:  * the terms of the GNU Affero General Public License version 3 as published by the
  9:  * Free Software Foundation with the addition of the following permission added
 10:  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
 11:  * IN WHICH THE COPYRIGHT IS OWNED BY X2ENGINE, X2ENGINE DISCLAIMS THE WARRANTY
 12:  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
 13:  * 
 14:  * This program is distributed in the hope that it will be useful, but WITHOUT
 15:  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 16:  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
 17:  * details.
 18:  * 
 19:  * You should have received a copy of the GNU Affero General Public License along with
 20:  * this program; if not, see http://www.gnu.org/licenses or write to the Free
 21:  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 22:  * 02110-1301 USA.
 23:  * 
 24:  * You can contact X2Engine, Inc. P.O. Box 66752, Scotts Valley,
 25:  * California 95067, USA. or at email address contact@x2engine.com.
 26:  * 
 27:  * The interactive user interfaces in modified source and object code versions
 28:  * of this program must display Appropriate Legal Notices, as required under
 29:  * Section 5 of the GNU Affero General Public License version 3.
 30:  * 
 31:  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 32:  * these Appropriate Legal Notices must retain the display of the "Powered by
 33:  * X2Engine" logo. If the display of the logo is not reasonably feasible for
 34:  * technical reasons, the Appropriate Legal Notices must display the words
 35:  * "Powered by X2Engine".
 36:  *****************************************************************************************/
 37: 
 38: Yii::import('application.models.embedded.*');
 39: 
 40: /**
 41:  * Authentication data for using a Twitter app to enable Twitter integration.
 42:  *
 43:  * @package application.models.embedded
 44:  */
 45: class TwitterApp extends JSONEmbeddedModel implements AdminOwnedCredentials {
 46:     
 47:     public static function getAdminProperty () {
 48:         return 'twitterCredentialsId'; 
 49:     }
 50: 
 51:     public function getMetaData () {
 52:         return array (
 53:             'private' => 1,
 54:             'userId' => Credentials::SYS_ID,
 55:             'name' => 'Twitter app',
 56:         );
 57:     }
 58: 
 59:     public $oauthAccessToken = '';
 60:     public $oauthAccessTokenSecret = '';
 61:     public $consumerKey = '';
 62:     public $consumerSecret = '';
 63: 
 64:     public function rules(){
 65:         return array(
 66:             array('oauthAccessToken,oauthAccessTokenSecret,consumerKey,consumerSecret', 'safe'),
 67:         );
 68:     }
 69: 
 70:     public function getProtectedFields () {
 71:         return array (
 72:             'oauthAccessToken', 'oauthAccessTokenSecret', 'consumerSecret', 'consumerKey');
 73:     }
 74: 
 75:     public function renderForm () {
 76:         $this->renderInputs();
 77:         echo '<br />';
 78:         echo '<br />';
 79:     }
 80: 
 81:     public function attributeLabels(){
 82:         return array(
 83:             'oauthAccessToken' => Yii::t('app','Access Token'),
 84:             'oauthAccessTokenSecret' => Yii::t('app','Access Token Secret'),
 85:             'consumerKey' => Yii::t('app','Consumer Key (API Key)'),
 86:             'consumerSecret' => Yii::t('app','Consumer Secret (API Secret)'),
 87:         );
 88:     }
 89: 
 90:     public function getPageTitle () {
 91:         return $this->modelLabel ();
 92:     }
 93: 
 94:     public function modelLabel() {
 95:         return Yii::t('app','Twitter Integration');
 96:     }
 97: 
 98:     public function htmlOptions ($name, $options=array ()) {
 99:         return X2Html::mergeHtmlOptions (
100:             parent::htmlOptions ($name, $options), array ('class' => 'twitter-credential-input'));
101:     }
102: 
103:     public function renderInputs(){
104:         echo $this->getInstructions ();
105:         echo CHtml::tag ('h3', array (), $this->exoModel->getAttributeLabel ($this->exoAttr));
106:         echo '<hr />';
107:         echo CHtml::activeLabel($this, 'consumerKey');
108:         $this->renderInput ('consumerKey');
109:         echo CHtml::activeLabel($this, 'consumerSecret');
110:         $this->renderInput ('consumerSecret');
111:         echo CHtml::activeLabel($this, 'oauthAccessToken');
112:         $this->renderInput ('oauthAccessToken');
113:         echo CHtml::activeLabel($this, 'oauthAccessTokenSecret');
114:         $this->renderInput ('oauthAccessTokenSecret');
115:         echo CHtml::errorSummary($this);
116:         echo '<br>';
117:         echo '<br>';
118:     }
119: 
120:     private function getInstructions () {
121:         return 
122:             '
123:             <h3>'.Yii::t('app', 'Configuring Twitter Integration').'</h3>
124:             <hr>
125:             <ol>
126:                 <li>'.Yii::t('app', 'Visit {link} and create a new Twitter app.', array (
127:                     '{link}' => 
128:                         '<a href="https://apps.twitter.com/">https://apps.twitter.com</a>'
129:                 )).'
130:                 </li>
131:                 <li>'.Yii::t ('app', 'From your app\'s management page, navigate to the "Keys and Access Tokens" tab.').'
132:                 </li>
133:                 <li>'.Yii::t('app', 'Click the button labelled "Create my access token".').'
134:                 </li>
135:                 <li>'.Yii::t('app', 'Copy your "Consumer Key", "Consumer Secret", "Access Token", and "Access Token Secret" into the corresponding fields below.').'
136:                 </li>
137:                 <li>'.Yii::t('app', 'Save your X2CRM Twitter Integration settings.').'</li>
138:             </ol>
139:             ';
140:     }
141: 
142: }
143: 
144: ?>
145: 
X2CRM Documentation API documentation generated by ApiGen 2.8.0