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: /**
 39:  * Settings for the email dropbox.
 40:  * 
 41:  * @package application.models.embedded
 42:  * @author Demitri Morgan <demitri@x2engine.com>
 43:  */
 44: class EmailDropboxSettings extends JSONEmbeddedModel {
 45: 
 46:     public $alias = null;
 47:     public $createContact = 1;
 48:     public $zapLineBreaks = 0;
 49:     public $emptyContact = 1;
 50:     public $logging = 0;
 51:     public $ignoreEmptyName = 0;
 52:     public $caseFlag = 'case #';
 53: 
 54:     public function attributeLabels() {
 55:         return array(
 56:             'alias' => Yii::t('admin', 'Email capture address'),
 57:             'createContact' => Yii::t('admin', "Create contacts from emails"),
 58:             'zapLineBreaks' => Yii::t('admin', 'Zap line breaks'),
 59:             'emptyContact' => Yii::t('admin', 'Create contacts when first and last name are missing'),
 60:             'logging' => Yii::t('admin', 'Enable logging'),
 61:             'ignoreEmptyName' => Yii::t('admin','Ignore empty sender name in forwarded message parse'),
 62:             'caseFlag' => Yii::t('admin','Case attachment flag')
 63:         );
 64:     }
 65: 
 66:     public function rules() {
 67:         return array(
 68:             array('alias','email','allowEmpty'=>true),
 69:             array('createContact,zapLineBreaks,emptyContact,logging,ignoreEmptyName','boolean'),
 70:             array('alias,caseFlag,createContact,zapLineBreaks,emptyContact,logging,ignoreEmptyName','safe'),
 71:         );
 72:     }
 73: 
 74:     public function attributeNames() {
 75:         return array_keys($this->attributeLabels());
 76:     }
 77: 
 78:     public function detailView() {
 79: 
 80:     }
 81: 
 82:     /**
 83:      * Generate HTML options for attribute labels.
 84:      * @param type $name
 85:      * @param type $htmlOptions
 86:      * @return type
 87:      */
 88:     public function labelOptions($name,$htmlOptions) {
 89:         return array_merge(array('for'=>$this->resolveName($name)),$htmlOptions);
 90:     }
 91: 
 92:     public function modelLabel() {
 93:         return Yii::t('admin','Email Capture Settings');
 94:     }
 95: 
 96:     public function renderInputs() {
 97:         $htmlOptions = array('style'=>'display:inline-block;margin-right: 10px;');
 98:         echo CHtml::activeCheckBox($this,'createContact',$this->htmlOptions('createContact',$htmlOptions));
 99:         echo CHtml::activeLabel($this,'createContact',$this->labelOptions('createContact',$htmlOptions));
100:         echo X2Html::hint(Yii::t('admin', 'If disabled, the email dropbox will ignore any emails that are to or from addresses not matching any contacts in X2Engine. If enabled, new contacts will be created automatically using name info contained in the email.'));
101:         echo '<br />';
102:         echo '<div style="margin-left:20px;'.((bool) $this->createContact ? '' : 'display:none').'" id="empty-contact">';
103:         echo CHtml::activeCheckBox($this,'emptyContact',$this->htmlOptions('emptyContact',$htmlOptions));
104:         echo CHtml::activeLabel($this,'emptyContact',$this->labelOptions('emptyContact',$htmlOptions));
105:         echo X2Html::hint(Yii::t('admin', "If enabled, the email dropbox will create a new contact record associated with a new unique email address even if the first and last name cannot be found in the email. If disabled, it ignores all email that does not contain contacts' first and last names. This setting has no effect if {ccfe} is disabled.", array('{ccfe}' => '"' . Yii::t('admin', 'Create contacts from emails') . '"')));
106:         echo '</div>';
107:         echo CHtml::activeCheckBox($this,'zapLineBreaks',$this->htmlOptions('zapLineBreaks',$htmlOptions));
108:         echo CHtml::activeLabel($this,'zapLineBreaks',$this->labelOptions('zapLineBreaks',$htmlOptions));
109:         echo X2Html::hint(Yii::t('admin', 'If enabled, the mail parser will (when extracting the body of an email) attempt to clear the text of artificial line breaks induced by RFC email format specifications (which limit lines to 78 characters). If disabled, the email parser will not do this.'));
110:         echo '<br />';
111:         echo CHtml::activeCheckBox($this,'logging',$this->htmlOptions('logging',$htmlOptions));
112:         echo CHtml::activeLabel($this,'logging',$this->labelOptions('logging',$htmlOptions));
113:         echo X2Html::hint(Yii::t('admin', 'If enabled, the email dropbox will record email capture events in a log file in protected/runtime. This option is useful for troubleshooting but will take up some extra disk space on a system that captures a high volume of emails.'));
114:         echo '<br />';
115:         echo CHtml::activeCheckBox($this,'ignoreEmptyName',$this->htmlOptions('ignoreEmptyName',$htmlOptions));
116:         echo CHtml::activeLabel($this,'ignoreEmptyName',$this->labelOptions('ignoreEmptyName',$htmlOptions));
117:         echo X2Html::hint(Yii::t('admin', "If disabled, the import will exit and send an error message email if the forwarded message header does not contain the sender's full name."));
118:         echo '<br />';
119:         echo CHtml::activeLabel($this, 'caseFlag', $this->labelOptions('caseFlag', $htmlOptions));
120:         echo CHtml::activeTextField($this, 'caseFlag', $this->htmlOptions('caseFlag', $htmlOptions));
121:         echo X2Html::hint(Yii::t('admin', 'When sending an email, you can specify a case to attach the email to by putting this code, followed immediately by the case ID, into the email body before the forwarded message, or without any case ID to create a new case from the email.'));
122:         echo '<br />';
123:         echo CHtml::activeLabel($this,'alias',$this->labelOptions('alias',$htmlOptions));
124:         echo CHtml::activeTextField($this,'alias',$this->htmlOptions('alias',$htmlOptions));
125:         echo X2Html::hint(Yii::t('admin', 'The address to use as the sender when sending error notification emails, if no default is set for system notifications. By default, if left blank, the email dropbox will use the first addresses in the {tohf} or {cchf} field that contains {dbat}.', array('{tohf}' => 'To:', '{cchf}' => 'CC:', '{dbat}' => '"dropbox@"')));
126:         echo '<br />';
127:         echo "<script type=\"text/javascript\">
128:                 (function($) {
129:                     $(\"[name='".$this->resolveName('createContact')."']\").change(function() {
130:                         if($(this).is(':checked'))
131:                             $('#empty-contact').fadeIn(300);
132:                         else
133:                             $('#empty-contact').fadeOut(300);
134:                     }).each(function(){
135:                         if(!$(this).is(':checked'))
136:                             $('#empty-contact').hide();
137:                         else
138:                             $('#empty-contact').show();
139:                     });
140:                 })(jQuery);
141:               </script>";
142:     }
143: 
144: }
145: 
146: ?>
147: 
X2CRM Documentation API documentation generated by ApiGen 2.8.0