public function QueueUISystemQueue::inspect in Queue UI 7.2
View the queue items in a queue and expose additional methods for inspection.
Parameters
string $queue_name:
Return value
string
Overrides QueueUIInterface::inspect
File
- lib/
QueueUISystemQueue.php, line 32
Class
Code
public function inspect($queue_name) {
$query = db_select('queue', 'q')
->fields('q', array(
'item_id',
'expire',
'created',
))
->condition('q.name', $queue_name)
->extend('PagerDefault')
->limit(25)
->execute();
$result = array();
foreach ($query as $record) {
$result[] = $record;
}
if (count($result) === 0) {
drupal_set_message(t('The queue @queue has no items to inspect', array(
'@queue' => $queue_name,
)));
drupal_goto(QUEUE_UI_BASE);
}
$header = array(
t('Item ID'),
t('Expires'),
t('Created'),
array(
'data' => t('Operations'),
'colspan' => '3',
),
);
$rows = array();
foreach ($result as $item) {
$row = array();
$row[] = $item->item_id;
$row[] = $item->expire ? date(DATE_RSS, $item->expire) : $item->expire;
$row[] = date(DATE_RSS, $item->created);
foreach ($this
->getOperations() as $op => $title) {
$row[] = l($title, QUEUE_UI_BASE . "/{$queue_name}/{$op}/{$item->item_id}");
}
$rows[] = array(
'data' => $row,
);
}
$content = theme('table', array(
'header' => $header,
'rows' => $rows,
));
$content .= theme('pager');
return $content;
}