You are here

function visitors_days_of_week in Visitors 7.2

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

Display days of week report.

Return value

string days of week report html source

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

File

reports/days_of_week.inc, line 64
Days of week report for the visitors module.

Code

function visitors_days_of_week() {
  $header = array(
    t('#'),
    t('Day'),
    t('Pages'),
  );
  $results = visitors_days_of_week_data();
  $tmp_rows = array();
  $count = 0;
  foreach ($results as $data) {
    $tmp_rows[$data->n] = array(
      $data->d,
      $data->count,
      $data->n,
    );
    $count += $data->count;
  }
  $rows = array();
  $sort_days = visitors_get_days_of_week();
  foreach ($sort_days as $day => $value) {
    $rows[$value] = array(
      $value,
      t($day),
      0,
    );
  }
  foreach ($tmp_rows as $tmp_item) {
    $day_of_week = drupal_ucfirst(drupal_strtolower($tmp_item[0]));
    $rows[$sort_days[$day_of_week]][2] = $tmp_item[1];
  }
  $output = visitors_date_filter();
  if ($count > 0) {
    $output .= sprintf('<img src="%s" alt="%s" width="%d" height="%d">', url('visitors/days_of_week/chart'), t('Days of week'), visitors_get_chart_width(), visitors_get_chart_height());
  }
  $output .= theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
  return $output;
}