[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/modules/statistics/ -> statistics.pages.inc (source)

   1  <?php
   2  
   3  /**
   4   * @file
   5   * User page callbacks for the statistics module.
   6   */
   7  
   8  function statistics_node_tracker() {
   9    if ($node = node_load(arg(1))) {
  10  
  11      $header = array(
  12          array('data' => t('Time'), 'field' => 'a.timestamp', 'sort' => 'desc'),
  13          array('data' => t('Referrer'), 'field' => 'a.url'),
  14          array('data' => t('User'), 'field' => 'u.name'),
  15          array('data' => t('Operations')));
  16  
  17      $result = pager_query("SELECT a.aid, a.timestamp, a.url, a.uid, u.name FROM {accesslog} a LEFT JOIN {users} u ON a.uid = u.uid WHERE a.path = 'node/%d' OR a.path LIKE 'node/%d/%%'". tablesort_sql($header), 30, 0, NULL, $node->nid, $node->nid);
  18      $rows = array();
  19      while ($log = db_fetch_object($result)) {
  20        $rows[] = array(
  21          array('data' => format_date($log->timestamp, 'small'), 'class' => 'nowrap'),
  22          _statistics_link($log->url),
  23          theme('username', $log),
  24          l(t('details'), "admin/reports/access/$log->aid"));
  25      }
  26  
  27      if (empty($rows)) {
  28        $rows[] = array(array('data' => t('No statistics available.'), 'colspan' => 4));
  29      }
  30  
  31      drupal_set_title(check_plain($node->title));
  32      $output = theme('table', $header, $rows);
  33      $output .= theme('pager', NULL, 30, 0);
  34      return $output;
  35    }
  36    else {
  37      drupal_not_found();
  38    }
  39  }
  40  
  41  function statistics_user_tracker() {
  42    if ($account = user_load(array('uid' => arg(1)))) {
  43  
  44      $header = array(
  45          array('data' => t('Timestamp'), 'field' => 'timestamp', 'sort' => 'desc'),
  46          array('data' => t('Page'), 'field' => 'path'),
  47          array('data' => t('Operations')));
  48  
  49      $result = pager_query('SELECT aid, timestamp, path, title FROM {accesslog} WHERE uid = %d'. tablesort_sql($header), 30, 0, NULL, $account->uid);
  50      $rows = array();
  51      while ($log = db_fetch_object($result)) {
  52        $rows[] = array(
  53          array('data' => format_date($log->timestamp, 'small'), 'class' => 'nowrap'),
  54          _statistics_format_item($log->title, $log->path),
  55          l(t('details'), "admin/reports/access/$log->aid"));
  56      }
  57  
  58      if (empty($rows)) {
  59        $rows[] = array(array('data' => t('No statistics available.'), 'colspan' => 3));
  60      }
  61  
  62      drupal_set_title(check_plain($account->name));
  63      $output = theme('table', $header, $rows);
  64      $output .= theme('pager', NULL, 30, 0);
  65      return $output;
  66    }
  67    else {
  68      drupal_not_found();
  69    }
  70  }


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7