You are here

function visitors_platform_data in Visitors 7.2

Get data for platform report order the query based on a header array.

Parameters

header: Table header array. If header is NULL - data is not sorted.

Return value

platforms data array

2 calls to visitors_platform_data()
chart_visitors_platform in reports/platform.inc
Display platform chart report.
visitors_platform in reports/platform.inc
Display platform report.

File

reports/platform.inc, line 32
Platform report for the visitors module.

Code

function visitors_platform_data($header) {
  $query = db_select('visitors', 'v');
  $query
    ->addExpression('COUNT(*)', 'count');
  $query
    ->innerJoin('visitors_browscap', 'vb', 'v.visitors_user_agent=vb.user_agent');
  $query
    ->fields('vb', array(
    'platform',
  ));
  visitors_date_filter_sql_condition($query);
  $query
    ->groupBy('platform');
  if (!is_null($header)) {
    $query
      ->extend('TableSort')
      ->orderByHeader($header);
  }
  return $query
    ->execute();
}