function workflow_overview in Workflow 5
Same name and namespace in other branches
- 5.2 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 1127
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/workflow/actions/{$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}",
),
);
$states = workflow_get_states($wid);
if (!(module_exists('actions') && $states)) {
unset($links['workflow_overview_actions']);
}
$row[] = array(
$name,
theme('links', $links),
);
$subrows = array();
foreach ($states as $sid => $statename) {
if (!workflow_is_system_state(t($statename))) {
$statelinks = 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}",
),
);
}
$subrows[] = array(
t($statename),
theme('links', $statelinks),
);
unset($statelinks);
}
$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);
}
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>';
}
$output .= drupal_get_form('workflow_types_form');
return $output;
}