You are here

function statspro_overview in Statistics Pro 6

Same name and namespace in other branches
  1. 6.2 statspro_overview.inc \statspro_overview()

Callback function for overview page

1 string reference to 'statspro_overview'
statspro_menu in ./statspro.module
Implementation of hook_menu().

File

./statspro.reports.inc, line 14
Include file for statistics report page

Code

function statspro_overview() {
  $statspro = new statspro();
  $last_run = variable_get('statspro_last_run', 0);
  $updated = $last_run ? format_date($last_run) : t('never');
  $output = t('Last statistics update: @updated', array(
    '@updated' => $updated,
  ));

  // add settings form
  $output .= drupal_get_form('statspro_settings_form');
  if ($last_run) {
    $periods = statspro_get_period_items();
    $period = variable_get('statspro_period', 'today');
    $start_date = variable_get('statspro_start_date', date('Y-m-d', strtotime('-1 week')));
    $end_date = variable_get('statspro_end_date', date('Y-m-d'));

    ////////////////////////

    // common
    $output .= theme('statspro_content', t('General view - @period', array(
      '@period' => $periods[$period],
    )), $statspro
      ->get_stats($period, $start_date, $end_date, NULL, $statspro->absolute_amounts));

    ////////////////////////

    // pi, error and warnings
    $output .= theme('statspro_log', t('PIs, errors and warnings - @period', array(
      '@period' => $periods[$period],
    )), $statspro
      ->get_stats($period, $start_date, $end_date, $statspro->absolute_amounts));
  }
  return $output;
}