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: Yii::import('zii.widgets.grid.CDataColumn');
 38: 
 39: /**
 40:  * Display column for attributes of X2Model subclasses.
 41:  */
 42: class X2DataColumn extends CDataColumn {
 43: 
 44:     private $_fieldType;
 45: 
 46:     protected $_data;
 47: 
 48:     public $fieldModel;
 49: 
 50:     public function getFieldType() {
 51:         return isset($this->fieldModel['type']) ? $this->fieldModel['type'] : null;
 52:     }
 53: 
 54:     /**
 55:      * Renders the data cell content.
 56:      * This method evaluates {@link value} or {@link name} and renders the result.
 57:      * @param integer $row the row number (zero-based)
 58:      * @param mixed $data the data associated with the row
 59:      */
 60:     protected function renderDataCellContent($row, $data){
 61:         $this->data = $data;
 62:         $value = null;
 63:         if($this->value !== null) {
 64:             $value = $this->evaluateExpression(
 65:                 $this->value, array('data' => $this->data, 'row' => $row));
 66:         } elseif($this->name !== null){
 67:             $value = $this->data->renderAttribute(
 68:                 $this->name, false, true); 
 69:             if($this->data->getField($this->name)->type == 'text')
 70:                 $value = preg_replace("/\<br ?\/?\>/"," ",$value);
 71:         }
 72:         echo $value === null ? $this->grid->nullDisplay : $value; 
 73:     }
 74: 
 75:     /**
 76:      * Overridden to allow title attribute to be evaluated.
 77:      * TODO: remove this and use method in X2DataColumnGeneric instead. Refactor will involve 
 78:      *  prepending 'php:' to all titles that need to be evaluated.
 79:      * This method is Copyright (c) 2008-2014 by Yii Software LLC
 80:      * http://www.yiiframework.com/license/ 
 81:      */
 82:     public function renderDataCell($row)
 83:     {
 84:         $data=$this->grid->dataProvider->data[$row];
 85:         $options=$this->htmlOptions;
 86:         /* x2modstart */  
 87:         if (isset ($options['title'])) 
 88:             $options['title'] = Expression::evaluate (
 89:                 $options['title'], array('row'=>$row,'data'=>$data));
 90:         /* x2modend */ 
 91:         if($this->cssClassExpression!==null)
 92:         {
 93:             $class=$this->evaluateExpression($this->cssClassExpression,array('row'=>$row,'data'=>$data));
 94:             if(!empty($class))
 95:             {
 96:                 if(isset($options['class']))
 97:                     $options['class'].=' '.$class;
 98:                 else
 99:                     $options['class']=$class;
100:             }
101:         }
102:         echo CHtml::openTag('td',$options);
103:         $this->renderDataCellContent($row,$data);
104:         echo '</td>';
105:     }
106:     public function getData(){
107:         return $this->_data;
108:     }
109: 
110:     public function setData($data){
111:         if(is_array($data)){
112:             if(isset($this->grid, $this->grid->modelName)){
113:                 $model = X2Model::model($this->grid->modelName);
114:                 foreach($data as $key=>$value){
115:                     if($model->hasAttribute($key)){
116:                         $model->$key=$value;
117:                     }
118:                 }
119:                 $this->_data = $model;
120:             }
121:         }else{
122:             $this->_data = $data;
123:         }
124:     }
125: 
126:     public function renderFilterCellContent() {
127:         switch($this->fieldType){
128:             case 'boolean':
129:                 echo CHtml::activeDropdownList(
130:                     $this->grid->filter, $this->name, 
131:                     array(
132:                         '' => '- '.Yii::t('app', 'Select').' -', 
133:                         '1' => Yii::t('app', 'Yes'),
134:                         'false' => Yii::t('app', "No")
135:                     ), 
136:                     array(
137:                         'class' => 'x2-minimal-select-filtercol'
138:                     )
139:                 );
140:                 break;
141:             case 'dropdown':
142:                 $dropdown = Dropdowns::model()->findByPk($this->fieldModel['linkType']);
143:                 if($dropdown instanceof Dropdowns) {
144:                     $options = json_decode($dropdown->options,1);
145:                     if (!$dropdown->multi) {
146:                     $defaultOption = array('' => '- '.Yii::t('app', 'Select').' -');
147:                     $options = is_array($options) ? 
148:                         array_merge($defaultOption,$options) : $defaultOption;
149:                     }
150:                     //$selected = isset($options[$this->grid->filter->{$this->name}]) ? 
151:                         //$this->grid->filter->{$this->name} : '';
152:                     echo CHtml::activeDropdownList(
153:                         $this->grid->filter, $this->name, $options,
154:                         array(
155:                             'class' => 'x2-minimal-select-filtercol'.
156:                                 ($dropdown->multi ? 
157:                                  ' x2-multiselect-dropdown x2-datacolumn-multiselect' : ''),
158:                             'multiple' => $dropdown->multi ? 'multiple' : '',
159:                             'data-selected-text' => $dropdown->multi ? 'option(s)' : '',
160:                         )
161:                     );
162:                 } else {
163:                     parent::renderFilterCellContent();
164:                 }
165:                 break;
166:             case 'visibility':
167:                 echo CHtml::activeDropDownList($this->grid->filter, $this->name,
168:                     array(
169:                         '' => '- '.Yii::t('app', 'Select').' -', 1 => Yii::t('app', 'Public'),
170:                         0 => Yii::t('app', 'Private'), 2 => Yii::t('app', 'User\'s Groups')),
171:                     array('class' => 'x2-minimal-select-filtercol'));
172:                 break;
173:             case 'dateTime':
174:             case 'date':
175:                 Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
176:                 $that = $this;
177:                 $renderWidget = function () use ($that) {
178:                     echo Yii::app()->controller->widget('CJuiDateTimePicker', 
179:                         array(
180:                             'model' => $that->grid->filter, //Model object
181:                             'attribute' => $that->name, //attribute name
182:                             'mode' => 'date', //use "time","date" or "datetime" (default)
183:                             'options' => array(// jquery options
184:                                 'dateFormat' => Formatter::formatDatePicker ('medium'),
185:                             ),
186:                             'htmlOptions' => array(
187:                                 'id' => 'datePicker'.$that->name,
188:                                 'class' => 'datePicker x2-gridview-filter-datepicker'
189:                             ),
190:                             'language' => (Yii::app()->language == 'en') ? 
191:                                 '' : Yii::app()->getLanguage(),
192:                         ), true);
193:                 };
194:                 if ($this->grid->ajax) {
195:                     X2Widget::ajaxRender ($renderWidget);
196:                 } else {
197:                     $renderWidget ();
198:                 }
199:                 break;
200:             default:
201:                 parent::renderFilterCellContent();
202:         }
203:     }
204: }
205: 
X2CRM Documentation API documentation generated by ApiGen 2.8.0