You are here

function queue_ui_overview_form in Queue UI 6

Same name and namespace in other branches
  1. 7.2 queue_ui.pages.inc \queue_ui_overview_form()
  2. 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 44
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'),
    ),
  );

  // Get queues defined via our hook.
  $defined_queues = queue_ui_defined_queues();

  // Get queues names.
  $queues = queue_ui_queues();
  foreach ($queues as $name => $queue) {
    $title = '';
    $operations = '';
    if (isset($defined_queues[$name])) {
      $title = $defined_queues[$name]['title'];
    }
    if (isset($defined_queues[$name]['batch'])) {
      $operations = 'batch';
    }
    $options[$name] = array(
      'name' => array(
        'data' => $name,
      ),
      'title' => array(
        'data' => $title,
      ),
      'items' => array(
        'data' => $queue['items'],
      ),
    );
  }
  $form['queues'] = array(
    '#type' => 'tableselect',
    '#header' => $header,
    '#options' => $options,
    '#empty' => t('No queues exist.'),
  );

  // @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;
}