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

  • CalendarEvent
  • X2CalendarPermissions
  • 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: /** Copy of Actions
 38:  *  Used for diferentiating between calendar event and actions (same in the database, difforent to users)
 39:  */
 40: 
 41: /**
 42:  * This is the model class for table "x2_actions".
 43:  *
 44:  * @package application.modules.calendar.models
 45:  * @property integer $id
 46:  * @property string $assignedTo
 47:  * @property string $actionDescription
 48:  * @property integer $visibility
 49:  * @property integer $associationId
 50:  * @property string $associationType
 51:  * @property string $associationName
 52:  * @property integer $dueDate
 53:  * @property integer $showTime
 54:  * @property string $priority
 55:  * @property string $type
 56:  * @property integer $createDate
 57:  * @property string $complete
 58:  * @property string $reminder
 59:  * @property string $completedBy
 60:  * @property integer $completeDate
 61:  * @property integer $lastUpdated
 62:  * @property string $updatedBy
 63:  * @property integer $workflowId
 64:  * @property integer $stageNumber
 65:  */
 66: class CalendarEvent extends CFormModel
 67: {
 68:     public $dueDate;
 69:     public $completeDate;
 70:     public $associationType;
 71:     public $associationId;
 72:     public $assignedTo;
 73:     public $priority;
 74:     public $visibility;
 75:     public $reminder;
 76:     public $type;
 77:     public $recurrence;
 78:     public $endRecurrence;
 79:     public $allDay;
 80:     public $color;
 81:     
 82:     /**
 83:      * @return array validation rules for model attributes.
 84:      */
 85:     public function rules()
 86:     {
 87:         // NOTE: you should only define rules for those attributes that
 88:         // will receive user inputs.
 89:             
 90:                 $fields=Fields::model()->findAllByAttributes(array('modelName'=>'Calendar'));
 91:                 $arr=array(
 92:                     'varchar'=>array(),
 93:                     'text'=>array(),
 94:                     'date'=>array(),
 95:                     'dropdown'=>array(),
 96:                     'int'=>array(),
 97:                     'email'=>array(),
 98:                     'currency'=>array(),
 99:                     'url'=>array(),
100:                     'float'=>array(),
101:                     'boolean'=>array(),
102:                     'required'=>array(),
103:                     
104:                 );
105:                 $return=array();
106:                 foreach($fields as $field){
107:                     $arr[$field->type][]=$field->fieldName;
108:                     if($field->required) {
109:                         if(!($field->fieldName == 'actionDescription' && $this->scenario == 'workflow'))
110:                             $arr['required'][]=$field->fieldName;
111:                     }
112:                 }
113:                 foreach($arr as $key=>$array){
114:                     switch($key){
115:                         case 'email':
116:                             $return[]=array(implode(", ",$array),$key);
117:                             break;
118:                         case 'required':
119:                             $return[]=array(implode(", ",$array),$key);
120:                             break;
121:                         case 'int':
122:                             $return[]=array(implode(", ",$array),'numerical','integerOnly'=>true);
123:                             break;
124:                         case 'float':
125:                             $return[]=array(implode(", ",$array),'type','type'=>'float');
126:                             break;
127:                         case 'boolean':
128:                             $return[]=array(implode(", ",$array),$key);
129:                             break;
130:                         default:
131:                             break;
132:                         
133:                     }
134:                     
135:                 } 
136:                 return $return;
137:     }
138:     
139:     /**
140:      * @return array customized attribute labels (name=>label)
141:      */
142:     
143:     public function attributeLabels() {
144:         $fields=Fields::model()->findAllByAttributes(array('modelName'=>'Actions'));
145:         $arr=array();
146:         foreach($fields as &$field)
147:             $arr[$field->fieldName] = Yii::t('actions',$field->attributeLabel);
148:         $arr['startDate']=Yii::t('actions','Start Date');
149:         $arr['endDate']=Yii::t('actions','End Date');
150:         return $arr;
151:     }
152:     
153:     public function getRecurrence() {
154:         return array(
155:             1=>Yii::t('calendar', 'Once'),
156:             2=>Yii::t('calendar', 'Daily'),
157:             3=>Yii::t('calendar', 'Weekly'),
158:             4=>Yii::t('calendar', 'Monthly'),
159:             5=>Yii::t('calendar', 'Yearly'),
160:         );
161:     }
162: }
X2CRM Documentation API documentation generated by ApiGen 2.8.0