Skip to content

Instantly share code, notes, and snippets.

@johnrobertwilson
Created July 11, 2012 20:54
Show Gist options
  • Save johnrobertwilson/3093392 to your computer and use it in GitHub Desktop.
Save johnrobertwilson/3093392 to your computer and use it in GitHub Desktop.
alert stakeholders
public function init() {
// Initialize states
$this->create_state('draft', array('label' => t('Draft')));
$this->create_state('draft_review', array('label' => t('Draft, needs review')));
$this->create_state('draft_approved', array('label' => t('Draft, approved')));
$this->create_state('published', array(
'label' => t('Published'),
'on_enter' => array($this, 'on_enter_published'),
));
$this->create_state('published_review', array('label' => t('Published, needs review')));
$this->create_state('published_expire', array('label' => t('Draft, scheduled for expiration')));
$this->create_state('unpublished', array(
'on_enter' => array($this, 'on_enter_unpublished'),
'label' => t('Unpublished'),
));
// Initialize events
$this->create_event('send_for_review', array(
'label' => t('Send for review'),
'origin' => 'draft',
'target' => 'draft_review',
));
$this->create_event('approve', array(
'label' => t('Approve for publishing'),
'origin' => 'draft_review',
'target' => 'draft_approved',
'guard' => 'epa_workflow_guard_approver',
));
$this->create_event('return_to_author', array(
'label' => t('Return to author'),
'origin' => 'draft_review',
'target' => 'draft',
'guard' => 'epa_workflow_guard_approver',
));
$this->create_event('publish', array(
'label' => t('Publish'),
'origin' => array('draft_approved', 'published_review', 'published_expire'),
'target' => 'published',
'guard' => 'epa_workflow_guard_publisher',
));
$this->create_event('archive', array(
'label' => t('Archive'),
'origin' => array('draft_approved', 'published'),
'target' => 'unpublished',
'guard' => 'epa_workflow_guard_publisher',
));
$this->create_event('expire', array(
'label' => t('Expire'),
'origin' => 'published_expire',
'target' => 'unpublished',
'guard' => 'epa_workflow_guard_publisher',
));
$this->create_event('revert', array(
'label' => t('Revert'),
'origin' => 'unpublished',
'target' => 'published',
'guard' => 'epa_workflow_guard_publisher',
));
$this->create_event('make_updates', array(
'label' => t('Make updates'),
'origin' => 'unpublished',
'target' => 'draft',
'guard' => 'epa_workflow_guard_publisher',
));
$this->create_event('queue_for_review', array(
'label' => t('Queue for review'),
'origin' => 'published',
'target' => 'published_review',
'guard' => 'epa_workflow_guard_publisher',
));
$this->create_event('archive', array(
'label' => t('Archive'),
'origin' => array('published', 'draft_approved'),
'target' => 'unpublished',
'guard' => 'epa_workflow_guard_publisher',
));
$this->create_event('alert_stakeholders', array(
'label' => t('Alert stakeholders'),
'origin ' => array('published_review'),
'target' => 'published_expire',
'guard' => 'epa_workflow_guard_publisher',
));
$this->create_event('publish_immediately', array(
'label' => t('Publish Immediately'),
'origin' => array('draft', 'draft_review'),
'target' => 'published',
'guard' => 'epa_workflow_guard_publisher'
));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment