statistics_user_tracker

5 statistics.module statistics_user_tracker()
6 statistics.pages.inc statistics_user_tracker()
7 statistics.pages.inc statistics_user_tracker()
8 statistics.pages.inc statistics_user_tracker()

1 string reference to 'statistics_user_tracker'

File

modules/statistics/statistics.pages.inc, line 55
User page callbacks for the statistics module.

Code

function statistics_user_tracker() {
  if ($account = user_load(arg(1))) {

    $header = array(
      array(
        'data' => t('Timestamp'),
        'field' => 'timestamp',
        'sort' => 'desc',
      ),
      array(
        'data' => t('Page'),
        'field' => 'path',
      ),
      array('data' => t('Operations')),
    );
    $query = db_select('accesslog', 'a', array('target' => 'slave'))->extend('PagerDefault')->extend('TableSort');
    $query
      ->fields('a', array('aid', 'timestamp', 'path', 'title'))
      ->condition('uid', $account->uid)
      ->limit(30)
      ->orderByHeader($header);

    $result = $query->execute();
    $rows = array();
    foreach ($result as $log) {
      $rows[] = array(
        array(
          'data' => format_date($log->timestamp, 'short'),
          'class' => array('nowrap'),
        ),
        _statistics_format_item($log->title, $log->path),
        l(t('details'), "admin/reports/access/$log->aid"),
      );
    }

    drupal_set_title(format_username($account));
    $build['statistics_table'] = array(
      '#theme' => 'table', 
      '#header' => $header, 
      '#rows' => $rows, 
      '#empty' => t('No statistics available.'),
    );
    $build['statistics_pager'] = array('#theme' => 'pager');
    return $build;
  }
  else {
    drupal_not_found();
  }
}
Login or register to post comments