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

Static Public Member Functions

static nextStatuslistData ($model, $options=array())
 
static allStatuslistData ($model, $options=array())
 
static statusListData ($model, $statusList, $options=array())
 

Detailed Description

this class provides helper methods for the simpleWorkflow behavior

Member Function Documentation

static allStatuslistData (   $model,
  $options = array() 
)
static

Returns the list of all statuses belonging to the workflow the model passed as argument is in. see SWHelper::nextStatuslistData for argument options

Parameters
CModelthe data model attaching a simpleWorkflow behavior
arrayadditional options
Returns
array the list data that can be used in dropDownList and listBox
static nextStatuslistData (   $model,
  $options = array() 
)
static

Returns the list of all statuses that can be reached from current status of the model passed as argument. The returned array is in the form suitable for dropDownList and listBox:

   array(
    'statusId' => 'status label',
    'status Id2' => 'status label 2',
    etc ...
   )

Use the $options argument to speficy following options :

  • prompt : specifies the prompt text shown as the first list option. Its value is empty. Note, the prompt text will NOT be HTML-encoded
  • includeCurrent : boolean, if TRUE (default) the current model status is included in the list, otherwise current model status is not inserted in the returned array.
  • exclude : array, list of statuses that should not be inserted in the returned array

Note that each status label is html encode by default.

Parameters
CModel$modelthe data model attaching a simpleWorkflow behavior
array$optionsadditional options
Returns
array the list data that can be used in dropDownList and listBox
static statusListData (   $model,
  $statusList,
  $options = array() 
)
static

Create an array containing where keys are statusIds in the form workflowId/statusId and the value is the status label. Note that by default this method never inserts the status of the model passed as argument. see SWHelper::nextStatuslistData for argument options

Parameters
CModelthe data model attaching a simpleWorkflow behavior
array$statusListarray of string where each value is the statusId
array$optionsthe list data that can be used in dropDownList and listBox

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