You are here

function chart_visitors_browser in Visitors 7.2

Display browser chart report.

1 string reference to 'chart_visitors_browser'
visitors_browscap_menu in ./visitors_browscap.module
Menu callback. Prints a listing of active nodes on the site.

File

reports/browser.inc, line 82
Browser report for the visitors module.

Code

function chart_visitors_browser() {
  $query = db_select('visitors', 'v')
    ->extend('TableSort');
  $query
    ->addExpression('COUNT(*)', 'count');
  $query
    ->innerJoin('visitors_browscap', 'vb', 'v.visitors_user_agent=vb.user_agent');
  $query
    ->fields('vb', array(
    'comment',
  ));
  visitors_date_filter_sql_condition($query);
  $query
    ->groupBy('comment');
  $results = $query
    ->execute();
  $tmp_rows = array();
  $rows = array();
  foreach ($results as $data) {
    $rows[$data->comment] = $data->count;
  }
  $browsers = array_unique(array_keys($rows));
  if (count($rows) > 1) {
    visitors_chart($rows, $browsers);
  }
}