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

  • ActionFormModel
  • ArrayUtil
  • ArrayValidator
  • AssociatedMediaBehavior
  • AuxLib
  • Changelog
  • DetailView
  • EncryptUtilTmp
  • EventsWidgetFieldFormatter
  • FailedLogins
  • FieldFormatter
  • FieldFormatterBase
  • FieldInputRenderer
  • FileFieldBehavior
  • FiltersForm
  • FilterUtil
  • FineDiff
  • FineDiffCopyOp
  • FineDiffDeleteOp
  • FineDiffInsertOp
  • FineDiffOp
  • FineDiffOps
  • FineDiffReplaceOp
  • GlobalCSSFormModel
  • GlobalImportFormModel
  • GoogleAuthenticator
  • JSONFieldsBehavior
  • JSONResponse
  • MediaFieldFormatter
  • MediaSelector
  • MobileActiveRecordFieldFormatter
  • MobileActivityFeed
  • MobileChartDashboard
  • MobileFieldFormatter
  • MobileFieldInputRenderer
  • ModuleModelNameValidator
  • MultiChildNode
  • MultiTypeAutocomplete
  • PasswordUtil
  • ProductFeature
  • ProfileWidgetLayout
  • QueryParamGenerator
  • RecordLimitBehavior
  • RecordView
  • RecordViewWidgetLayout
  • RelationshipsGridModel
  • RelationshipsJoin
  • RepairUserDataCommand
  • RequestUtil
  • RequiredIfNotSetValidator
  • ResponseUtil
  • RunMigrationScriptCommand
  • ServiceWebFormDesigner
  • Settings
  • StringUtil
  • TestEmailAction
  • TestEmailActionForm
  • ThemeGenerator
  • TimerUtil
  • TopicsFieldFormatter
  • TopicsWidgetLayout
  • TransactionalViewFieldFormatter
  • UrlUtil
  • ValidLinkValidator
  • WebFormDesigner
  • WebLeadFormDesigner
  • X2ActiveRecordBehavior
  • X2ActiveRecordFieldFormatter
  • X2ButtonColumn
  • X2ConditionList
  • X2ConsoleCommand
  • X2ControllerBehavior
  • X2DataColumn
  • X2DuplicateBehavior
  • X2Flashes
  • X2GridViewFieldFormatter
  • X2IPAddress
  • X2LeadsDataColumn
  • X2MergeableBehavior
  • X2MessageSource
  • X2MobileControllerBehavior
  • X2MobileProfileControllerBehavior
  • X2MobileQuotesControllerBehavior
  • X2MobileSiteControllerBehavior
  • X2MobileTopicsControllerBehavior
  • X2ModelConversionBehavior
  • X2ModelConversionWidget
  • X2ModelForeignKeyValidator
  • X2ModelUniqueIndexValidator
  • X2NonWebUser
  • X2StaticDropdown
  • X2StaticField
  • X2StaticFieldsBehavior
  • X2UrlManager
  • X2Validator
  • X2WidgetBehavior

Interfaces

  • AdminOwnedCredentials

Exceptions

  • CampaignMailingException
  • CodeExchangeException
  • GetCredentialsException
  • NoRefreshTokenException
  • NoUserIdException
  • StringUtilException

Functions

  • checkCurrency
  • checkDNS
  • checkServerVar
  • checkTimezone
  • decodeQuotes
  • echoIcons
  • encodeQuotes
  • exceptionForError
  • getField
  • getLanguageName
  • getModuleTitle
  • handleReqError
  • handleReqException
  • installer_t
  • installer_tr
  • isAllowedDir
  • mediaMigrationRrmdir
  • migrateMediaDir
  • printGraph
  • printR
  • renderFields
  • reqShutdown
  • RIP
  • translateOptions
  • tryGetRemote
  • 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: /**
 38:  * Widget for record conversion links which leverage X2ModelConversionBehavior.
 39:  * Designed to have multiple instances on the same page (which is useful if links for multiple
 40:  * conversion targets are needed).
 41:  */
 42: 
 43: class X2ModelConversionWidget extends X2Widget {
 44: 
 45:     /**
 46:      * @var X2Model $model
 47:      */
 48:     public $model; 
 49: 
 50:     /**
 51:      * @var string $targetClass
 52:      */
 53:     public $targetClass; 
 54: 
 55:     /**
 56:      * @var string $element
 57:      */
 58:     public $element = '#model-conversion-widget'; 
 59: 
 60:     public $buttonSelector; 
 61: 
 62:     /**
 63:      * @var string $JSClass
 64:      */
 65:     public $JSClass = 'X2ModelConversionWidget'; 
 66: 
 67:     protected $_JSClassParams;
 68:     public function getJSClassParams () {
 69:         if (!isset ($this->_JSClassParams)) {
 70:             $title = X2Model::getModelTitle (get_class ($this->model), true);
 71:             $targetClass = $this->targetClass;
 72:             $behavior = $this->model->asa ('X2ModelConversionBehavior');
 73:             $conversionFailed = 
 74:                 $behavior->conversionFailed && 
 75:                 $behavior->errorModel !== null && get_class ($behavior->errorModel) ===
 76:                 $this->targetClass;
 77:             $this->_JSClassParams = array_merge (parent::getJSClassParams (), array (
 78:                 'buttonSelector' => $this->buttonSelector,
 79:                 'translations' => array (
 80:                     'conversionError' => Yii::t('app', '{model} conversion failed.', array (
 81:                         '{model}' => $title,
 82:                     )),
 83:                     'conversionWarning' => Yii::t('app', '{model} Conversion Warning', array (
 84:                         '{model}' => $title,
 85:                     )),
 86:                     'convertAnyway' => Yii::t('app', 'Convert Anyway'),
 87:                     'Cancel' => Yii::t('app', 'Cancel'),
 88:                 ),
 89:                 'targetClass' => $this->targetClass,
 90:                 'modelId' => $this->model->id,
 91:                 'conversionFailed' => $conversionFailed,
 92:                 'conversionIncompatibilityWarnings' => 
 93:                     $this->model->getConversionIncompatibilityWarnings ($this->targetClass),
 94:                 'errorSummary' => 
 95:                     $conversionFailed ? 
 96:                         "<div class='form'>".
 97:                             CHtml::errorSummary (
 98:                                 $this->model->asa ('X2ModelConversionBehavior')->errorModel,
 99:                                 Yii::t('app', '{model} conversion failed.', 
100:                                 array (
101:                                     '{model}' => $title,
102:                                 ))).
103:                         "</div>" : '',
104: 
105:             ));
106:         }
107:         return $this->_JSClassParams;
108:     }
109: 
110:     public function getPackages () {
111:         if (!isset ($this->_packages)) {
112:             $this->_packages = array_merge (parent::getPackages (), array (
113:                 'X2ModelConversionWidgetJS' => array(
114:                     'baseUrl' => Yii::app()->request->baseUrl,
115:                     'js' => array(
116:                         'js/X2ModelConversionWidget.js',
117:                     ),
118:                     'depends' => array (
119:                         'X2Widget',
120:                     ),
121:                 ),
122:             ));
123:         }
124:         return $this->_packages;
125:     }
126: 
127:     public function run () {
128:         $this->registerPackages ();
129:         $this->instantiateJSClass ();
130:         $this->render ('application.components.views._x2ModelConversionWidget', array (
131:             'sourceModelClass' => get_class ($this->model),
132:             'targetModelClass' => $this->targetClass,
133:             'convertMultiple' => false,
134:         ));
135:     }
136: 
137: }
138: 
139: ?>
140: 
X2CRM Documentation API documentation generated by ApiGen 2.8.0