function workflow_tab_page in Workflow 5
Same name and namespace in other branches
- 5.2 workflow.module \workflow_tab_page()
- 6.2 workflow.pages.inc \workflow_tab_page()
- 6 workflow.pages.inc \workflow_tab_page()
- 7.2 workflow.pages.inc \workflow_tab_page()
- 7 workflow.pages.inc \workflow_tab_page()
1 string reference to 'workflow_tab_page'
- workflow_menu in ./
workflow.module - Implementation of hook_menu().
File
- ./
workflow.module, line 118
Code
function workflow_tab_page($nid) {
$node = node_load($nid);
drupal_set_title(check_plain($node->title));
$wid = workflow_get_workflow_for_type($node->type);
$states_per_page = 20;
$states = workflow_get_states($wid) + array(
t('(creation)'),
);
$current = workflow_node_current_state($node);
$output = '<p>' . t('Current state: @state', array(
'@state' => $states[$current],
)) . "</p>\n";
$output .= drupal_get_form('workflow_tab_form', $node, $wid, $states, $current);
$result = pager_query("SELECT h.*, u.name FROM {workflow_node_history} h LEFT JOIN {users} u ON h.uid = u.uid WHERE nid = %d ORDER BY stamp DESC", $states_per_page, 0, NULL, $nid);
$rows = array();
while ($history = db_fetch_object($result)) {
$rows[] = array(
format_date($history->stamp),
check_plain($states[$history->old_sid]),
check_plain($states[$history->sid]),
theme('username', $history),
check_plain($history->comment),
);
}
$output .= theme('table', array(
t('Date'),
t('Old State'),
t('New State'),
t('By'),
t('Comment'),
), $rows, array(
'class' => 'workflow_history',
), t('Workflow History'));
$output .= theme('pager', $states_per_page);
return $output;
}