You are here

function prod_monitor_status in Production check & Production monitor 6

Same name and namespace in other branches
  1. 7 prod_monitor/includes/prod_monitor.admin.inc \prod_monitor_status()

Build status page.

1 string reference to 'prod_monitor_status'
prod_monitor_menu in prod_monitor/prod_monitor.module
Implementation of hook_menu() Note: do not use t() in this hook! Translation is handled by core!

File

prod_monitor/includes/prod_monitor.admin.inc, line 6

Code

function prod_monitor_status($id) {
  $site = _prod_monitor_get_site($id, 'all');
  if (!$site) {
    return drupal_not_found();
  }
  drupal_set_title(t('Production monitor status for') . ' ' . _prod_monitor_sanitize_url($site['url']));
  $functions = $site['settings']['functions'];
  $nodata = t('No data recieved yet.');
  $output = '';

  // General status block
  $modules = _prod_monitor_get_site_modules($id);
  if (!empty($modules) && isset($site['data']['prod_mon'])) {
    $prod_mon = $site['data']['prod_mon'];
    $output .= _prod_monitor_status_general($prod_mon, $modules);
  }
  unset($site['data']['prod_mon']);

  // Performance data not needed here.
  unset($site['data']['perf_data']);

  // Display results of all checks.
  foreach ($functions as $set => $data) {
    if (isset($site['data'][$set])) {
      $output .= '<h2>' . t($data['title']) . '</h2>' . "\n";
      $output .= '<div class="description"><p><em>' . t($data['description']) . '</em></p></div>' . "\n";
      if (!empty($site['data'][$set])) {
        $output .= theme('prod_monitor_status_report', $site['data'][$set]);
      }
      else {
        $output .= '<p>' . $nodata . '</p><p>&nbsp;</p>';
      }
    }
  }
  if (empty($output)) {
    $output = '<p>' . $nodata . '</p><p>&nbsp;</p>';
  }
  $output .= drupal_get_form('_prod_monitor_update_data_form', $id, $site);
  return $output;
}