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.JSONEmbeddedModel');
 39: 
 40: /**
 41:  * Authentication data and tools for interfacing with a SMTP server, i.e. to
 42:  * send email.
 43:  * 
 44:  * @package application.models.embedded
 45:  * @author Demitri Morgan <demitri@x2engine.com>
 46:  */
 47: class EmailAccount extends JSONEmbeddedModel {
 48: 
 49:     public $email = '';
 50:     public $imapNoValidate = false;
 51:     public $imapPort = 143;
 52:     public $imapSecurity = '';
 53:     public $imapServer = '';
 54:     public $password = '';
 55:     public $port = 25;
 56:     public $security = '';
 57:     public $senderName = '';
 58:     public $server = '';
 59:     public $user = '';
 60:     public $enableVerification = true;
 61: 
 62:     public function attributeLabels(){
 63:         return array(
 64:             'senderName' => Yii::t('app', 'Sender Name'),
 65:             'email' => Yii::t('app', 'Email address'),
 66:             'server' => Yii::t('app', 'Server'),
 67:             'port' => Yii::t('app', 'Port'),
 68:             'security' => Yii::t('app', 'Security type'),
 69:             'user' => Yii::t('app', 'User name (if different from email address)'),
 70:             'password' => Yii::t('app', 'Password'),
 71:             'imapPort' => Yii::t('app','IMAP Port'),
 72:             'imapServer' => Yii::t('app','IMAP Server'),
 73:             'imapSecurity' => Yii::t('app','IMAP Security'),
 74:             'imapNoValidate' => Yii::t('app','Disable SSL Validation'),
 75:         );
 76:     }
 77: 
 78:     public function detailView(){
 79:         echo "\"{$this->senderName}\" &lt;{$this->email}&gt; &nbsp;&bull;&nbsp; {$this->server}:{$this->port}".($this->security != '' ?'&nbsp;&bull;&nbsp;'.Yii::t('app','secured with')." {$this->security}" : '');
 80:     }
 81: 
 82:     public function modelLabel() {
 83:         return Yii::t('app','Email Account');
 84:     }
 85: 
 86:     public function renderInput ($attr) {
 87:         switch($attr){
 88:             case 'senderName':
 89:                 echo CHtml::activeTextField($this, $attr, $this->htmlOptions($attr));
 90:                 break;
 91:             case 'email':
 92:                 echo CHtml::activeTextField($this, $attr, $this->htmlOptions($attr));
 93:                 break;
 94:             case 'server':
 95:                 echo CHtml::activeTextField($this, $attr, $this->htmlOptions($attr));
 96:                 break;
 97:             case 'imapServer':
 98:                 echo CHtml::activeTextField($this, $attr, $this->htmlOptions($attr));
 99:                 break;
100:             case 'port':
101:                 echo CHtml::activeNumberField($this, $attr, $this->htmlOptions($attr));
102:                 break;
103:             case 'imapPort':
104:                 echo CHtml::activeNumberField($this, $attr, $this->htmlOptions($attr));
105:                 break;
106:             case 'security':
107:                 echo CHtml::activeDropDownList($this, $attr,array(''=>'None','tls'=>'TLS','ssl'=>'SSL'), $this->htmlOptions($attr));
108:                 break;
109:             case 'imapSecurity':
110:                 echo CHtml::activeDropDownList($this, $attr,array(''=>'None','tls'=>'TLS','ssl'=>'SSL'), $this->htmlOptions($attr));
111:                 break;
112:             case 'imapNoValidate':
113:                 echo CHtml::activeCheckBox($this, $attr, $this->htmlOptions($attr));
114:                 break;
115:             case 'user':
116:                 echo CHtml::activeTextField($this, $attr, $this->htmlOptions($attr));
117:                 break;
118:             case 'password':
119:                 echo X2Html::x2ActivePasswordField ($this, $attr, $this->htmlOptions ($attr), true);
120:                 break;
121:         }
122:     }
123: 
124:     /**
125:      * Generate the form for the embedded model
126:      */
127:     public function renderInputs() {
128:         $this->password = null;
129:         echo CHtml::activeLabel ($this, 'senderName');
130:         $this->renderInput ('senderName');
131:         echo CHtml::activeLabel ($this, 'email');
132:         $this->renderInput ('email');
133:         echo CHtml::activeLabel ($this, 'server');
134:         $this->renderInput ('server');
135:         echo CHtml::activeLabel ($this, 'port');
136:         $this->renderInput ('port');
137:         echo CHtml::activeLabel ($this, 'security');
138:         $this->renderInput ('security');
139:         echo CHtml::activeLabel ($this, 'user');
140:         $this->renderInput ('user');
141:         echo CHtml::activeLabel ($this, 'password');
142:         $this->renderInput ('password');
143:         echo '<br/>';
144:         echo '<br/>';
145:         echo CHtml::tag ('h3', array (), Yii::t('app', 'IMAP Configuration'));
146:         echo '<hr/>';
147:         echo CHtml::activeLabel($this, 'imapPort');
148:         $this->renderInput ('imapPort');
149:         echo CHtml::activeLabel($this, 'imapSecurity');
150:         $this->renderInput ('imapSecurity');
151:         echo CHtml::activeLabel($this, 'imapNoValidate');
152:         $this->renderInput ('imapNoValidate');
153:         echo CHtml::activeLabel($this, 'imapServer');
154:         $this->renderInput ('imapServer');
155:         echo CHtml::errorSummary($this);
156:     }
157: 
158:     /**
159:      * Substitutes email address as username if username is empty
160:      * @param type $attribute
161:      * @param type $params
162:      */
163:     public function emailUser($attribute,$params=array()) {
164:         if(empty($this->$attribute) && !empty($this->email))
165:             $this->$attribute = $this->email;
166:     }
167: 
168:     public function rules() {
169:         return array(
170:             array('port','numerical','integerOnly'=>1,'min'=>1),
171:             array('email','email'),
172:             array('user','emailUser'),
173:             array('server,user,email','length','min'=>1,'max'=>500,'allowEmpty'=>0),
174:             array('password','required'),
175:             array('senderName,server,port,security,user,email,password,imapPort,imapServer,imapSecurity,imapNoValidate','safe'),
176:         );
177:     }
178: 
179: }
180: 
181: ?>
182: 
X2CRM Documentation API documentation generated by ApiGen 2.8.0