A simple workflow behavior for Yii ActiveRecord
 All Data Structures Files Functions Variables Pages
SWyEdConverter Class Reference

Public Member Functions

 convert ($file)
 

Data Fields

 $mapper
 

Detailed Description

Converts a workflow created with yEd Graph Editor (freeware) and saved in graphml format into an array suitable to be used with the simpleWorkflow extension (sW).
The conversion is based on the $mapper array, which defines matches between sW attributes and properties used by yEd. Following sW values are references using a predefined name :

  • workflow - initial : is the id of the initial node
  • node - id : id of a given node
  • node - constraint : PHP expression used as constraint for a node
  • node - label : text label for a node
  • node - metadata.* : custom metadata value
  • edge - task : PHP expression executed when the transition is performed

yEd Graph Editor node attributes are referenced in two ways : by their attribute name or by an xpath expression that applies to the y:ShapeNode element used by yEd to draw each node. The later is mainly usefule to extract the node label and possibly, some other informations like for instance the background color or text color used to render each node. The former is useful to extract built-in yEd attribute and also custom attribute defined by the user.

Member Function Documentation

convert (   $file)
Parameters
string$filename of th graphml (xml) file to process
Returns
array the workflow definition

Field Documentation

$mapper
Initial value:
= array(
'workflow' => array(
'id' => 'Id',
'initial' => 'Initial-node-id',
),
'node' => array(
'id' => 'xpath|y:ShapeNode/y:NodeLabel',
'constraint' => 'Constraint',
'label' => 'Label',
'metadata.color' => 'xpath|y:ShapeNode/y:NodeLabel/@textColor',
'metadata.bgcolor' => 'xpath|y:ShapeNode/y:Fill/@color',
),
'edge' => array(
'task' => 'Task'
)
)

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