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

  • Workflow
  • WorkflowStage
  • Overview
  • Package
  • Class
  • Tree

Class Workflow

This is the model class for table "x2_workflows".

CComponent
Extended by CModel implements IteratorAggregate, ArrayAccess
Extended by CActiveRecord
Extended by Workflow
Package: application\modules\workflow\models
Located at x2engine/protected/modules/workflow/models/Workflow.php
Methods summary
public static Workflow
# model( string $className = __CLASS__ )

Returns the static model of the specified AR class.

Returns the static model of the specified AR class.

Parameters

$className
string
$className active record class name.

Returns

Workflow
the static model class

Overrides

CActiveRecord::model()
public string
# tableName( )

Returns

string
the associated database table name

Overrides

CActiveRecord::tableName()
public array
# behaviors( )

Returns a list of behaviors that this model should behave as. The return value should be an array of behavior configurations indexed by behavior names. Each behavior configuration can be either a string specifying the behavior class or an array of the following structure:

'behaviorName'=>array(
    'class'=>'path.to.BehaviorClass',
    'property1'=>'value1',
    'property2'=>'value2',
)

Returns a list of behaviors that this model should behave as. The return value should be an array of behavior configurations indexed by behavior names. Each behavior configuration can be either a string specifying the behavior class or an array of the following structure:

'behaviorName'=>array(
    'class'=>'path.to.BehaviorClass',
    'property1'=>'value1',
    'property2'=>'value2',
)

Note, the behavior classes must implement IBehavior or extend from CBehavior. Behaviors declared in this method will be attached to the model when it is instantiated.

For more details about behaviors, see CComponent.

Returns

array
the behavior configurations (behavior name=>behavior configuration)

Overrides

CModel::behaviors()
public array
# rules( )

Returns

array
validation rules for model attributes.

Overrides

CModel::rules()
public array
# relations( )

Returns

array
relational rules.

Overrides

CActiveRecord::relations()
public
# validateIsDefaultFor( mixed $attr )

isDefault should either be a boolean value or an array of module ids

isDefault should either be a boolean value or an array of module ids

public array
# attributeLabels( )

Returns

array
customized attribute labels (name=>label)

Overrides

CModel::attributeLabels()
public
# setIsDefaultFor( mixed $isDefaultFor )
public
# getIsDefaultFor( )
public
# renderAttribute( mixed $attr )
public
# afterSave( )

If this workflow is the default, unset isDefault flag on all other workflows

If this workflow is the default, unset isDefault flag on all other workflows

Overrides

CActiveRecord::afterSave()
public static array
# getList( mixed $enableNone = true )

Returns

array
workflow names indexed by id
public static
# getWorkflowOptions( )
public static
# getStageUncompletionPermissions( mixed $workflowStatus )
public static boolean
# isStarted( array $workflowStatus, integer $stageNumber )

Parameters

$workflowStatus
array
$workflowStatus
$stageNumber
integer
$stageNumber

Returns

boolean
true if stage is started, false otherwise
public static boolean
# isCompleted( array $workflowStatus, integer $stageNumber )

Parameters

$workflowStatus
array
$workflowStatus
$stageNumber
integer
$stageNumber

Returns

boolean
true if stage is completed, false otherwise
public static
# isInProgress( mixed $workflowStatus, mixed $stageNumber )
public static
# validateAction( boolean $action, mixed $workflowStatus, mixed $stage, mixed $comment = '', mixed & $message = '' )

Validates a single workflow action. Like validateStageChange () except that only one stage change is validated.

Validates a single workflow action. Like validateStageChange () except that only one stage change is validated.

Parameters

$action
boolean
$strict If true, validation will fail in the case that the specified action cannot be taken because it has already been taken before.
$workflowStatus
$stage
$comment
$message
public static array
# moveFromStageAToStageB( integer $workflowId, integer $stageA, integer $stageB, object $model, array $comments = array() )

Moves a record up or down a workflow. Assumes that stageA is started but not completed. Intermediate stages and stageB can be in any state.

Moves a record up or down a workflow. Assumes that stageA is started but not completed. Intermediate stages and stageB can be in any state.

Parameters

$workflowId
integer
$workflowId
$stageA
integer
$stageA Start stage (indexed by 1)
$stageB
integer
$stageB End stage (indexed by 1)
$model
object
$model model associated with workflow
$comments
array
$comments comment strings indexed by workflow stage number Precondition: $stageA !== $stageB

Returns

array
first element is success, the second is an optional message
public static array
# getWorkflowStatus( integer $workflowId, integer $modelId = 0, mixed $modelType = '' )

Retrieves information on all stages (their complete state, their stage dependencies, their stage permissions, and their comment requirements) and on the workflow itself (its complete and started state and its id)

Retrieves information on all stages (their complete state, their stage dependencies, their stage permissions, and their comment requirements) and on the workflow itself (its complete and started state and its id)

Parameters

$workflowId
integer
$workflowId id of workflow
$modelId
integer
$modelId id of model to which the workflow is related (optional)
$modelType
mixed
$modelType type of model to which the workflow is related.

Returns

array
Contains information about the workflow and its stages
public static array
# getStages( integer $id )

Parameters

$id
integer
id workflow record id

Returns

array
all stage records associated with the workflow
public static array
# getStagesByNumber( mixed $id )

Returns

array
names of stage records associated with the workflow indexed by stage number
public string
# getStageName( mixed $stageNumber )

Returns

string
Name of stage with given stage number
public static <array
# getStageNames( array $workflowStatus )

Parameters

$workflowStatus
array
return value of getWorkflowStatus

Returns

<array
of strings> one for each stage
public static <array
# getStageCommentRequirements( array $workflowStatus )

Parameters

$workflowStatus
array
return value of getWorkflowStatus

Returns

<array
of bools> One bool for each stage, true if the stage requires a comment, false otherwise
public static <array
# getStagePermissions( array $workflowStatus )

Parameters

$workflowStatus
array
return value of getWorkflowStatus

Returns

<array
of bools> One bool for each stage, true if the current user has permission for the stage, false otherwise
public array
# getWorkflowStageColors( integer $stageCount, mixed $getShaded = false )

get hex codes for each stage

get hex codes for each stage

Parameters

$stageCount
integer
$stageCount number of stages
$getShaded

Returns

array
array of hex codes, one for each stage
public static array
# getStageCounts( array & $workflowStatus, array $dateRange, string $users = '', string $modelType = 'contacts' )

Get number of records at each stage

Get number of records at each stage

Parameters

$workflowStatus
array
$workflowStatus
$dateRange
array
$dateRange return value of WorkflowController::getDateRange ()
$users
string
$users users filter
$modelType
string
$modelType model type filter

Returns

array
number of records at each stage subject to specified filters
public static
# getStageValues( mixed & $workflowStatus, mixed $dateRange, mixed $users = '', mixed $modelType = 'contacts' )
public static array
# getStageNameLinks( mixed & $workflowStatus, mixed $dateRange, mixed $users )

Helper method for the workflow view.

Helper method for the workflow view.

Returns

array
links for each of the workflow stages. When clicked, the details of a particular stage will be shown
public
# updateStages( mixed $newStages )
public CActiveDataProvider
# search( )

Retrieves a list of models based on the current search/filter conditions.

Retrieves a list of models based on the current search/filter conditions.

Returns

CActiveDataProvider
the data provider that can return the models based on the search/filter conditions.
public static
# getStageRequirements( array $workflowStatus )

Returns stage requirements for each stage in the workflow

Returns stage requirements for each stage in the workflow

Parameters

$workflowStatus
array
return value of getWorkflowStatus
public static array
# completeStage( integer $workflowId, integer $stageNumber, object $model, string $comment, boolean $autoStart = true, mixed $workflowStatus = null )

Completes a workflow stage

Completes a workflow stage

Parameters

$workflowId
integer
$workflowId
$stageNumber
integer
$stageNumber
$model
object
$model model associated with workflow
$comment
string
$comment comment to complete the stage with
$autoStart
boolean
$autoStart if true, unless this action completes the workflow, an attempt will be made to start the next unstarted stage in the case that no other stages have been started
$workflowStatus

Returns

array
(<bool, true if the stage was completed and false otherwise>, <array, the workflow status>)
public static
# startStage( integer $workflowId, integer $stageNumber, object $model, mixed $workflowStatus = null )

Starts a workflow stage

Starts a workflow stage

Parameters

$workflowId
integer
$workflowId
$stageNumber
integer
$stageNumber the stage to start
$model
object
$model model associated with workflow
$workflowStatus
public static
# revertStage( mixed $workflowId, mixed $stageNumber, mixed $model, mixed $unstart = true, mixed $workflowStatus = null )

Uncompletes a stage (if completed) or unstarts it (if started).

Uncompletes a stage (if completed) or unstarts it (if started).

Parameters

$workflowId
mixed
$unstarts bool If false, will not attempt to unstart an ongoing stage
$stageNumber
$model
$unstart
$workflowStatus
public static
# updateWorkflowChangelog( mixed & $action, mixed $changeType, mixed & $model )
public
# getStageNameAutoCompleteSource( )
public static array
# getPipelineListItemColors( array $colors )

Parameters

$colors
array
$colors an array of color hex values, 1 for each stage

Returns

array
css color strings to be used for pipeline list item backgrounds
public
# getDisplayName( mixed $plural = true, mixed $ofModule = true )
public static
# getCurrencyFields( mixed $model = 'contacts' )
Methods inherited from CActiveRecord
__call(), __construct(), __get(), __isset(), __set(), __sleep(), __unset(), addRelatedRecord(), afterDelete(), afterFind(), afterFindInternal(), applyScopes(), attributeNames(), beforeCount(), beforeDelete(), beforeFind(), beforeFindInternal(), beforeSave(), cache(), count(), countByAttributes(), countBySql(), defaultScope(), delete(), deleteAll(), deleteAllByAttributes(), deleteByPk(), equals(), exists(), find(), findAll(), findAllByAttributes(), findAllByPk(), findAllBySql(), findByAttributes(), findByPk(), findBySql(), getActiveFinder(), getActiveRelation(), getAttribute(), getAttributeLabel(), getAttributes(), getCommandBuilder(), getDbConnection(), getDbCriteria(), getIsNewRecord(), getMetaData(), getOldPrimaryKey(), getPrimaryKey(), getRelated(), getTableAlias(), getTableSchema(), hasAttribute(), hasRelated(), init(), insert(), instantiate(), offsetExists(), onAfterDelete(), onAfterFind(), onAfterSave(), onBeforeCount(), onBeforeDelete(), onBeforeFind(), onBeforeSave(), populateRecord(), populateRecords(), primaryKey(), query(), refresh(), refreshMetaData(), resetScope(), save(), saveAttributes(), saveCounters(), scopes(), setAttribute(), setDbCriteria(), setIsNewRecord(), setOldPrimaryKey(), setPrimaryKey(), setTableAlias(), together(), update(), updateAll(), updateByPk(), updateCounters(), with()
Methods inherited from CModel
addError(), addErrors(), afterConstruct(), afterValidate(), beforeValidate(), clearErrors(), createValidators(), generateAttributeLabel(), getError(), getErrors(), getIterator(), getSafeAttributeNames(), getScenario(), getValidatorList(), getValidators(), hasErrors(), isAttributeRequired(), isAttributeSafe(), offsetGet(), offsetSet(), offsetUnset(), onAfterConstruct(), onAfterValidate(), onBeforeValidate(), onUnsafeAttribute(), setAttributes(), setScenario(), unsetAttributes(), validate()
Methods inherited from CComponent
asa(), attachBehavior(), attachBehaviors(), attachEventHandler(), canGetProperty(), canSetProperty(), detachBehavior(), detachBehaviors(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), getEventHandlers(), hasEvent(), hasEventHandler(), hasProperty(), raiseEvent()
Constants summary
string DEFAULT_ALL_MODULES '-1'
#
Constants inherited from CActiveRecord
BELONGS_TO, HAS_MANY, HAS_ONE, MANY_MANY, STAT
Properties inherited from CActiveRecord
$db
Magic properties inherited from CActiveRecord
$attributes, $commandBuilder, $dbConnection, $dbCriteria, $isNewRecord, $metaData, $oldPrimaryKey, $primaryKey, $tableAlias, $tableSchema
Magic properties inherited from CModel
$errors, $iterator, $safeAttributeNames, $scenario, $validatorList, $validators
X2CRM Documentation API documentation generated by ApiGen 2.8.0