function queue_ui_overview_form in Queue UI 7.2
Same name and namespace in other branches
- 6 queue_ui.pages.inc \queue_ui_overview_form()
- 7 queue_ui.pages.inc \queue_ui_overview_form()
1 string reference to 'queue_ui_overview_form'
- queue_ui_page in ./
queue_ui.pages.inc - Queue form handler.
File
- ./
queue_ui.pages.inc, line 54 - queue_ui.pages.inc
Code
function queue_ui_overview_form() {
$queues = $options = array();
// @todo activation status
$header = array(
'name' => array(
'data' => t('Name'),
),
'title' => array(
'data' => t('Title'),
),
'items' => array(
'data' => t('Number of items'),
),
'class' => array(
'data' => t('Class'),
),
'inspect' => array(
'data' => t('Inspect'),
),
);
// Get queues defined via our hook.
$defined_queues = queue_ui_defined_queues();
// Get queues names.
$queues = queue_ui_queues();
foreach ($queues as $class => $classed_queues) {
$options = array();
$class_info = QueueUI::get('QueueUI' . $class);
// Output information for each queue of the current class
foreach ($classed_queues as $name => $queue) {
$title = '';
$operations = '';
$inspect = FALSE;
if (isset($defined_queues[$name])) {
$title = $defined_queues[$name]['title'];
}
if (isset($defined_queues[$name]['batch'])) {
$operations = 'batch';
}
if (is_object($class_info) && $class_info->inspect) {
$inspect = TRUE;
}
$options[$name] = array(
'name' => array(
'data' => $name,
),
'title' => array(
'data' => $title,
),
'items' => array(
'data' => $queue['items'],
),
'class' => array(
'data' => $class,
),
);
// If queue inspection is enabled for this class, add to the options array.
if ($inspect) {
$options[$name]['inspect'] = array(
'data' => l(t('Inspect'), QUEUE_UI_BASE . "/inspect/{$name}"),
);
}
else {
$options[$name]['inspect'] = '';
}
}
$form[$class] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#title' => $class,
);
$form[$class]['queues_' . $class] = array(
'#type' => 'tableselect',
'#header' => $header,
'#options' => $options,
'#empty' => t('No queues exist for @class.', array(
'@class' => $class,
)),
);
}
// @todo deactivate options
// Option to run batch.
$form['batch'] = array(
'#type' => 'submit',
'#value' => t('Batch process'),
);
// Option to remove lease timestamps.
$form['release'] = array(
'#type' => 'submit',
'#value' => t('Remove leases'),
);
// Option to run via cron.
$form['cron'] = array(
'#type' => 'submit',
'#value' => t('Cron process'),
);
// Option to delete queue.
$form['delete'] = array(
'#type' => 'submit',
'#value' => t('Delete queues'),
);
// Specify our step submit callback.
$form['step_submit'] = array(
'#type' => 'value',
'#value' => 'queue_ui_overview_submit',
);
return $form;
}