You are here

function computing_overview_form in Drupal Computing 7.2

Generate the overview page.

1 string reference to 'computing_overview_form'
computing_menu in ./computing.module
Implements hook_menu().

File

./computing.admin.inc, line 7

Code

function computing_overview_form($form, &$form_state) {
  $apps = computing_get_applications();
  $app_stats = array();
  $records_stats = db_query("SELECT application, status, COUNT(*) AS num FROM {computing_record} GROUP BY application, status")
    ->fetchAll();
  foreach ($records_stats as $rs) {
    $app_stats[$rs->application][$rs->status] = $rs->num;
  }
  $table_rows = array();
  foreach ($apps as $app) {
    $table_rows[] = array(
      "{$app->label} ({$app->application})",
      $app->description,
      @$app_stats[$app->application]['RDY'] ?: 0,
      @$app_stats[$app->application]['SCF'] ?: 0,
      @$app_stats[$app->application]['FLD'] ?: 0,
      @array_sum(@$app_stats[$app->application]) ?: 0,
    );
  }
  $form['table'] = array(
    '#markup' => theme('table', array(
      'header' => array(
        t('Application (machine name)'),
        t('Description'),
        t('Unhandled'),
        t('Accomplished'),
        t('Failed'),
        t('Total'),
      ),
      'rows' => $table_rows,
      'caption' => t('Application Summary'),
    )),
  );

  //  $form['actions'] = array(
  //    'purge' => array(
  //      '#type' => 'submit',
  //      '#value' => t('Purge old records'),
  //    ),
  //    'abort' => array(
  //      '#type' => 'submit',
  //      '#value' => t('Abort long running records'),
  //    )
  //  );
  return $form;
}