View source
<?php
function queue_ui_view_queue($queue_name) {
if ($queue = _queue_ui_queueclass($queue_name)) {
return $queue
->inspect($queue_name);
}
}
function queue_ui_view_queue_item($queue_name, $queue_item) {
if ($queue = _queue_ui_queueclass($queue_name)) {
return $queue
->view($queue_item);
}
}
function queue_ui_release_item_form($form, $form_state, $queue_name, $queue_item) {
if ($queue = _queue_ui_queueclass($queue_name)) {
return confirm_form(array(
'queue_item' => array(
'#type' => 'value',
'#value' => array(
'queue_name' => $queue_name,
'itemid' => $queue_item,
),
),
), t('Are you sure you want to remove leases from queue item %queue_item?', array(
'%queue_item' => $queue_item,
)), QUEUE_UI_BASE . "/inspect/{$queue_name}", t('This action cannot be undone and will force the removal of leases from the item even if it is currently being processed.'), t('Remove lease'), t('Cancel'));
}
}
function queue_ui_release_item_form_submit($form, &$form_state) {
$queue_data = $form_state['values']['queue_item'];
$queue_name = $queue_data['queue_name'];
$queue = _queue_ui_queueclass($queue_name);
$queue
->release($queue_data['itemid']);
$form_state['redirect'] = QUEUE_UI_BASE . "/inspect/{$queue_name}";
}
function queue_ui_delete_item_form($form, $form_state, $queue_name, $queue_item) {
if ($queue = _queue_ui_queueclass($queue_name)) {
return confirm_form(array(
'queue_item' => array(
'#type' => 'value',
'#value' => array(
'queue_name' => $queue_name,
'itemid' => $queue_item,
),
),
), t('Are you sure you want to delete queue item %queue_item?', array(
'%queue_item' => $queue_item,
)), QUEUE_UI_BASE . "/inspect/{$queue_name}", t('This action cannot be undone and will force the deletion of the item even if it is currently being processed.'), t('Delete item'), t('Cancel'));
}
}
function queue_ui_delete_item_form_submit($form, &$form_state) {
$queue_data = $form_state['values']['queue_item'];
$queue_name = $queue_data['queue_name'];
$queue = _queue_ui_queueclass($queue_name);
$queue
->delete($queue_data['itemid']);
$form_state['redirect'] = QUEUE_UI_BASE . "/inspect/{$queue_name}";
}