A simple workflow behavior for Yii ActiveRecord
 All Data Structures Files Functions Variables Pages
SWPhpWorkflowSource Class Reference
Inheritance diagram for SWPhpWorkflowSource:
SWWorkflowSource

Public Member Functions

 init ()
 
 isWorkflowLoaded ($workflowId)
 
 loadWorkflow ($workflowId, $forceReload=false)
 
 addWorkflow ($definition, $id)
 
 getNodeDefinition ($node, $defaultWorkflowId=null)
 
 getNextNodes ($sourceNode, $workflowId=null)
 
 isNextNode ($sourceNode, $targetNode, $workflowId=null)
 
 getInitialNode ($workflowId)
 
 getAllNodes ($workflowId)
 
- Public Member Functions inherited from SWWorkflowSource
 createSWNode ($node, $workflowId)
 
 addWorkflow ($definition, $id)
 
 loadWorkflow ($workflowId, $forceReload=false)
 
 getNodeDefinition ($node, $defaultWorkflowId=null)
 
 getNextNodes ($sourceNode, $workflowId=null)
 
 isNextNode ($sourceNode, $targetNode, $workflowId=null)
 
 getInitialNode ($workflowId)
 
 getAllNodes ($workflowId)
 

Data Fields

 $basePath = 'application.models.workflows'
 
 $definitionType = 'array'
 
- Data Fields inherited from SWWorkflowSource
 $preload =array()
 
 $workflowNamePrefix ='sw'
 

Detailed Description

This class gives access to workflow and statuses stored as PHP files. Following attributes can be initialized when the component is configured:

  • basePath (string) : the base path alias where all workflow are stored.By default, it is set to application.models.workflows (folder "protected/models/workflows").
  • definitionType (string) : Defines the type of PHP file to load. A Workflow can be defined in a PHP file that contains a simple array definition (definitionType = 'array'), or by a class (definitionType = 'class'). By default this attribute is set to 'array'.

Member Function Documentation

addWorkflow (   $definition,
  $id 
)

This method is used to add a new workflow definition to the current workflow collection.

Parameters
array$definitionthe workflow definition in its array form
string$idthe workflow id
getAllNodes (   $workflowId)

(non-PHPdoc)

See Also
SWWorkflowSource::getAllNodes()
getInitialNode (   $workflowId)

(non-PHPdoc)

See Also
SWWorkflowSource::getInitialNode()
getNextNodes (   $sourceNode,
  $workflowId = null 
)

(non-PHPdoc)

See Also
SWWorkflowSource::getNextNodes()
getNodeDefinition (   $node,
  $defaultWorkflowId = null 
)
init ( )

Initialize the component with configured values. To preload workflows, set configuration setting 'preload' to an array containing all workflows to preload. If no preload is set workflows are loaded on demand.

See Also
SWWorkflowSource
isNextNode (   $sourceNode,
  $targetNode,
  $workflowId = null 
)

(non-PHPdoc)

See Also
SWWorkflowSource::isNextNode()
isWorkflowLoaded (   $workflowId)

Verify if a workflow has been loaded.

Parameters
string$workflowIdworkflow id
Returns
boolean TRUE if the workflow whose id is $workflowId has already been loaded, FALSE otherwise
loadWorkflow (   $workflowId,
  $forceReload = false 
)

Loads the workflow whose id is passed as argument. By default, if the workflow has already been loaded it is not reloaded unless $forceReload is TRUE

Parameters
string$workflowIdthe workflow id
boolean$forceReloadTRUE to force workflow loading, FALSE otherwise

Field Documentation

$basePath = 'application.models.workflows'
$definitionType = 'array'

The documentation for this class was generated from the following file: