function background_batch_overview_page in Background Process 6
Same name and namespace in other branches
- 7.2 background_batch/background_batch.pages.inc \background_batch_overview_page()
- 7 background_batch/background_batch.pages.inc \background_batch_overview_page()
Overview of current and recent batch jobs.
1 string reference to 'background_batch_overview_page'
- background_batch_menu in background_batch/
background_batch.module - Implements hook_menu().
File
- background_batch/
background_batch.pages.inc, line 41 - Pages for background batch.
Code
function background_batch_overview_page() {
$data = array();
$sql = "\nSELECT b.bid\nFROM {batch} b\nORDER BY b.bid\n";
$result = db_query($sql);
$bids = array();
while ($row = db_fetch_object($result)) {
$bids[] = $row->bid;
}
foreach ($bids as $bid) {
$progress = progress_get_progress('_background_batch:' . $bid);
$eta = progress_estimate_completion($progress);
$data[] = array(
$progress->end ? $bid : l($bid, 'batch', array(
'query' => array(
'op' => 'start',
'id' => $bid,
),
)),
sprintf("%.2f%%", $progress->progress * 100),
$progress->message,
$progress->start ? format_date((int) $progress->start, 'small') : t('N/A'),
$progress->end ? format_date((int) $progress->end, 'small') : ($eta ? format_date((int) $eta, 'small') : t('N/A')),
);
}
$header = array(
'Batch ID',
'Progress',
'Message',
'Started',
'Finished/ETA',
);
return theme('table', $header, $data);
}