You are here

function adsense_click_top_pages in Google AdSense integration 5

Same name and namespace in other branches
  1. 5.3 contrib/adsense_click/adsense_click.logs.inc \adsense_click_top_pages()
  2. 5.2 adsense.module \adsense_click_top_pages()
  3. 6 contrib/adsense_click/adsense_click.logs.inc \adsense_click_top_pages()
  4. 7 contrib/adsense_click/adsense_click.logs.inc \adsense_click_top_pages()
1 string reference to 'adsense_click_top_pages'
adsense_menu in ./adsense.module
Implementation of hook_menu().

File

./adsense.module, line 1689

Code

function adsense_click_top_pages() {
  $header = array(
    array(
      'data' => t('Path'),
      'field' => 'path',
    ),
    array(
      'data' => t('Clicks'),
      'field' => 'count',
      'sort' => 'desc',
    ),
    array(
      'data' => t('Last'),
      'field' => 'last',
    ),
  );
  $sql = 'SELECT path, COUNT(*) AS count, MAX(timestamp) AS last FROM {adsense_clicks} GROUP BY path' . tablesort_sql($header);
  $result = pager_query($sql, 50);
  while ($log = db_fetch_object($result)) {
    $rows[] = array(
      array(
        'data' => _adsense_format_path($log->path),
      ),
      array(
        'data' => $log->count,
        'align' => 'right',
      ),
      array(
        'data' => format_date($log->last, 'small'),
        'nowrap' => 'nowrap',
      ),
    );
  }
  return theme('table', $header, $rows) . theme('pager', NULL, 50, 0);
}