function workflow_overview in Workflow 5.2
Same name and namespace in other branches
- 5 workflow.module \workflow_overview()
Create the main workflow page, which gives an overview of workflows and workflow states.
Return value
HTML form.
1 string reference to 'workflow_overview'
- workflow_menu in ./
workflow.module - Implementation of hook_menu().
File
- ./
workflow.module, line 1374
Code
function workflow_overview() {
$workflows = workflow_get_all();
$row = array();
foreach ($workflows as $wid => $name) {
$links = array(
'workflow_overview_add_state' => array(
'title' => t('Add state'),
'href' => "admin/build/workflow/state/{$wid}",
),
'workflow_overview_actions' => array(
'title' => t('Actions'),
'href' => "admin/build/trigger/workflow/{$wid}",
),
'workflow_overview_edit' => array(
'title' => t('Edit'),
'href' => "admin/build/workflow/edit/{$wid}",
),
'workflow_overview_delete' => array(
'title' => t('Delete'),
'href' => "admin/build/workflow/delete/{$wid}",
),
);
// Allow modules to insert their own workflow operations.
$links = array_merge($links, module_invoke_all('workflow_operations', 'workflow', $wid));
$states = workflow_get_states($wid);
if (!module_exists('actions')) {
unset($links['workflow_overview_actions']);
}
$row[] = array(
check_plain(t($name)),
theme('links', $links),
);
$subrows = array();
foreach ($states as $sid => $state_name) {
$state_links = array();
if (!workflow_is_system_state(check_plain(t($state_name)))) {
$state_links = array(
'workflow_overview_edit_state' => array(
'title' => t('Edit'),
'href' => "admin/build/workflow/state/{$wid}/{$sid}",
),
'workflow_overview_delete_state' => array(
'title' => t('Delete'),
'href' => "admin/build/workflow/state/delete/{$wid}/{$sid}",
),
);
}
// Allow modules to insert state operations.
$state_links = array_merge($state_links, module_invoke_all('workflow_operations', 'state', $wid, $sid));
$subrows[] = array(
check_plain(t($state_name)),
theme('links', $state_links),
);
unset($state_links);
}
$subheader_state = array(
'data' => t('State'),
'style' => 'width: 30%',
);
$subheader_operations = array(
'data' => t('Operations'),
'style' => 'width: 70%',
);
$subheader_style = array(
'style' => 'width: 100%; margin: 3px 20px 20px;',
);
$subtable = theme('table', array(
$subheader_state,
$subheader_operations,
), $subrows, $subheader_style);
$row[] = array(
array(
'data' => $subtable,
'colspan' => '2',
),
);
}
if ($row) {
$output = theme('table', array(
t('Workflow'),
t('Operations'),
), $row);
$output .= drupal_get_form('workflow_types_form');
}
else {
$output = '<p>' . t('No workflows have been added. Would you like to <a href="@link">add a workflow</a>?', array(
'@link' => url('admin/build/workflow/add'),
)) . '</p>';
}
return $output;
}