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

  • ActionsWidget
  • CallsWidget
  • ChartWidget
  • CommentsWidget
  • EmailsWidget
  • EventsWidget
  • InlineRelationshipsWidget
  • InlineTagsWidget
  • LoggedTimeWidget
  • PublisherWidget
  • QuotesWidget
  • SortableWidget
  • TransactionalViewWidget
  • TwitterFeedWidget
  • WebActivityWidget
  • WorkflowStageDetailsWidget
  • 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:  * Displays the details of a workflow stage.
 39:  * 
 40:  * @package application.components.sortableWidget 
 41:  */
 42: class WorkflowStageDetailsWidget extends SortableWidget {
 43: 
 44:     public $model;
 45: 
 46:     public $template = '<div class="submenu-title-bar widget-title-bar">{widgetLabel}{workflowSelector}{closeButton}{minimizeButton}</div>{widgetContents}';
 47: 
 48:     public $viewFile = '_workflowStageDetailsWidget';
 49: 
 50:     protected $_module;
 51: 
 52:     private static $_JSONPropertiesStructure;
 53: 
 54:     private $_currentWorkflow;
 55: 
 56:     private $_associationType;
 57: 
 58:     public function getAssociationType () {
 59:         if (!isset ($this->_associationType)) {
 60:             $this->_associationType = X2Model::getAssociationType (get_class ($this->model));
 61:         }
 62:         return $this->_associationType;
 63:     }
 64: 
 65:     public function getModule () {
 66:         if (!isset ($this->_module)) {
 67:             $this->_module = Yii::app()->getModule ('workflow');
 68:         }
 69:         return $this->_module;
 70:     }
 71: 
 72:     public function getCurrentWorkflow () {
 73:         if (!isset ($this->_currentWorkflow)) {
 74:             $this->_currentWorkflow = $this->controller->getCurrentWorkflow(
 75:                 $this->model->id, $this->getAssociationType ());
 76:         }
 77:         return $this->_currentWorkflow;
 78:     }
 79: 
 80:     public function renderWorkflowSelector () {
 81:         $workflowList = Workflow::getList();
 82:         echo CHtml::dropDownList('workflowId',$this->getCurrentWorkflow (),$workflowList,    
 83:             array(
 84:                 'ajax' => array(
 85:                     'type'=>'GET', //request type
 86:                     'url'=>CHtml::normalizeUrl( //url to call.
 87:                         array(
 88:                             '/workflow/workflow/getWorkflow',
 89:                             'modelId'=>$this->model->id,
 90:                             'type'=>$this->getAssociationType ()
 91:                         )
 92:                     ), 
 93:                     'update'=>'#workflow-diagram', //selector to update
 94:                     'data'=>array('workflowId'=>'js:$(this).val()')
 95:                     //leave out the data key to pass all form values through
 96:                 ),
 97:                 'id'=>'workflowSelector',
 98:                 'class'=>'x2-select',
 99:             )); 
100: 
101:     }
102: 
103:     public function getSetupScript () {
104:         if (!isset ($this->_setupScript)) {
105:             $widgetClass = get_called_class ();
106:             $this->_setupScript = "
107:                 $(function () {
108:                     x2.".$widgetClass.$this->widgetUID." = new x2.WorkflowStageDetailsWidget ({
109:                         'widgetClass': '".$widgetClass."',
110:                         'setPropertyUrl': '".Yii::app()->controller->createUrl (
111:                             '/profile/setWidgetSetting')."',
112:                         'cssSelectorPrefix': '".$this->widgetType."',
113:                         'widgetType': '".$this->widgetType."',
114:                         'widgetUID': '".$this->widgetUID."'
115:                     });
116:                 });
117:             ";
118:         }
119:         return $this->_setupScript;
120:     }
121: 
122:     public function getViewFileParams () {
123:         if (!isset ($this->_viewFileParams)) {
124:             $this->_viewFileParams = array_merge (
125:                 parent::getViewFileParams (),
126:                 array (
127:                     'currentWorkflow'=> $this->getCurrentWorkflow (),
128:                     'model' => $this->model,
129:                 )
130:             );
131:         }
132:         return $this->_viewFileParams;
133:     } 
134: 
135:     public static function getJSONPropertiesStructure () {
136:         if (!isset (self::$_JSONPropertiesStructure)) {
137:             self::$_JSONPropertiesStructure = array_merge (
138:                 parent::getJSONPropertiesStructure (),
139:                 array (
140:                     'label' => 'Process',
141:                     'hidden' => false,
142:                 )
143:             );
144:         }
145:         return self::$_JSONPropertiesStructure;
146:     }
147: 
148: 
149:     public function getPackages () {
150:         if (!isset ($this->_packages)) {
151:             $this->_packages = array_merge (
152:                 parent::getPackages (),
153:                 array (
154:                     'WorkflowStageDetailsWorkflowJS' => array(
155:                         'baseUrl' => $this->module->assetsUrl,
156:                         'js' => array(
157:                             'js/WorkflowManagerBase.js',
158:                             'js/WorkflowManager.js',
159:                         ),
160:                         'depends' => array ('auxlib')
161:                     ),
162:                     'WorkflowStageDetailsWidgetJS' => array(
163:                         'baseUrl' => Yii::app()->request->baseUrl,
164:                         'js' => array(
165:                             'js/sortableWidgets/WorkflowStageDetailsWidget.js',
166:                         ),
167:                         'depends' => array ('SortableWidgetJS')
168:                     ),
169:                     'WorkflowStageDetailsWidgetCSS' => array(
170:                         'baseUrl' => Yii::app()->getTheme ()->getBaseUrl (),
171:                         'css' => array(
172:                             'css/workflowFunnel.css',
173:                         )
174:                     ),
175:                 )
176:             );
177:             if (AuxLib::isIE8 ()) {
178:                 $this->_packages['WorkflowExcanvas'] = array (
179:                     'baseUrl' => Yii::app()->request->baseUrl,
180:                     'js' => array(
181:                         'js/jqplot/excanvas.js',
182:                     ),
183:                 );
184:             }
185:         }
186:         return $this->_packages;
187:     }
188: 
189:     public function init() {
190: 
191:         Yii::app()->clientScript->registerScriptFile(
192:             $this->module->assetsUrl.'/js/WorkflowManagerBase.js'); 
193:         Yii::app()->clientScript->registerScriptFile(
194:             $this->module->assetsUrl.'/js/WorkflowManager.js'); 
195:         
196:         Yii::app()->clientScript->registerScript('workflowDialog_'.$this->id,'
197:     
198:             x2.workflowManager = new x2.WorkflowManager ({
199:                 translations: '.CJSON::encode (array (
200:                     'Comment Required' => Yii::t('workflow', 'Comment Required'),
201:                     'Stage {n}' => Yii::t('workflow', 'Stage {n}'),
202:                     'Save' => Yii::t('app', 'Save'),
203:                     'Edit' => Yii::t('app', 'Edit'),
204:                     'Cancel' => Yii::t('app', 'Cancel'),
205:                     'Close' => Yii::t('app', 'Close'),
206:                     'Submit' => Yii::t('app', 'Submit'),
207:                 )).',
208:                 modelId: '.$this->model->id.',
209:                 modelName: "'.$this->getAssociationType ().'",
210:                 startStageUrl: "'.
211:                     CHtml::normalizeUrl(array('/workflow/workflow/startStage')).
212:                 '",
213:                 revertStageUrl: "'.
214:                     CHtml::normalizeUrl(array('/workflow/workflow/revertStage')).
215:                 '",
216:                 getStageDetailsUrl: "'.
217:                     CHtml::normalizeUrl(array('/workflow/workflow/getStageDetails')).
218:                 '",
219:                 completeStageUrl: "'.
220:                     CHtml::normalizeUrl(array('/workflow/workflow/completeStage')).
221:                 '"
222:             });
223: 
224:         ',CClientScript::POS_END);
225:         
226: 
227:         parent::init();
228:     }
229: 
230:     protected function getCss () {
231:         if (!isset ($this->_css)) {
232:             $this->_css = array_merge (
233:                 parent::getCss (),
234:                 array (
235:                 'WorkflowStageDetailsWidgetCSS' => "
236: 
237:                     #workflowSelector {
238:                         margin-left: 13px;
239:                     }
240: 
241:                     #funnel-container {
242:                         position: relative;
243:                         width: auto;
244:                         margin-left: 12px;
245:                         margin-top: 9px;
246:                         max-width: 500px;
247:                     }
248: 
249:                     #funnel-container .interaction-buttons > a {
250:                         margin-right: 3px;
251:                         display: inline-block;
252:                         vertical-align: middle;
253:                         text-decoration: none;
254:                     }
255: 
256:                     #funnel-container .interaction-buttons {
257:                         height: 17px;
258:                     }
259: 
260: 
261:                     #funnel-container img {
262:                         margin-right: 4px;
263:                         opacity: 0.8;
264:                     }
265: 
266:                     #funnel-container img:hover {
267:                         opacity: 1;
268:                     }
269: 
270:                     div.workflow-status {
271:                         overflow: hidden;
272:                         display: block;
273:                         line-height: 20px;
274:                         height: 24px;
275:                         max-width: 340px;
276:                         margin-right: 10px;
277:                     }
278: 
279:                     div.workflow-status b {
280:                         float: left;
281:                     }
282: 
283:                     div.workflow-status a {
284:                         float: right;
285:                     }
286:                 ")
287:             );
288:         }
289:         return $this->_css;
290:     }
291: 
292: 
293: }
294: 
X2CRM Documentation API documentation generated by ApiGen 2.8.0