You are here

function visitors_days_of_month in Visitors 7.2

Same name and namespace in other branches
  1. 8 reports/days_of_month.inc \visitors_days_of_month()
  2. 7 reports/days_of_month.inc \visitors_days_of_month()
  3. 7.0 reports/days_of_month.inc \visitors_days_of_month()

Display days of month report.

Return value

string days of month report html source

1 string reference to 'visitors_days_of_month'
visitors_menu in ./visitors.module
Menu callback. Prints a listing of active nodes on the site.

File

reports/days_of_month.inc, line 38
Days of month report for the visitors module.

Code

function visitors_days_of_month() {
  $header = array(
    array(
      'data' => t('#'),
    ),
    array(
      'data' => t('Day'),
      'field' => 'day',
      'sort' => 'asc',
    ),
    array(
      'data' => t('Pages'),
      'field' => 'count',
    ),
  );
  $results = visitors_days_of_month_data($header);
  $rows = array();
  $i = 0;
  $count = 0;
  foreach ($results as $data) {
    $rows[] = array(
      ++$i,
      (int) $data->day,
      $data->count,
    );
    $count += $data->count;
  }
  $output = visitors_date_filter();
  if ($count > 0) {
    $output .= sprintf('<img src="%s" alt="%s" width="%d" height="%d">', url('visitors/days_of_month/chart'), t('Days of month'), visitors_get_chart_width(), visitors_get_chart_height());
  }
  $output .= theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
  return $output;
}