| 1 |
<?php
|
| 2 |
// $Id: counter.report.inc,v 1.1 2009/01/03 23:31:47 thenicespider Exp $
|
| 3 |
/**
|
| 4 |
* @file
|
| 5 |
* Report page callback file for the counter module.
|
| 6 |
*/
|
| 7 |
|
| 8 |
/**
|
| 9 |
* Menu callback;
|
| 10 |
*/
|
| 11 |
function counter_report() {
|
| 12 |
|
| 13 |
$items_per_page = variable_get('counter_report_page_item',50);
|
| 14 |
|
| 15 |
$sql = "SELECT * FROM {counter} ORDER BY counter_id DESC";
|
| 16 |
//$sql_count = db_rewrite_sql('SELECT COUNT(*) FROM {counter}');
|
| 17 |
$sql_count = db_query('SELECT COUNT(*) FROM {counter}');
|
| 18 |
|
| 19 |
//$results = pager_query($sql, $items_per_page, 0, $sql_count);
|
| 20 |
$results = pager_query($sql, $items_per_page);
|
| 21 |
|
| 22 |
$rows = array();
|
| 23 |
|
| 24 |
$page = isset($_GET['page']) ? $_GET['page'] : '';
|
| 25 |
$i = 0 + ($page * $items_per_page);
|
| 26 |
|
| 27 |
$header = array(t('#'), t('ID'), t('IP Address'), t('Created Date'), t('Access page'));
|
| 28 |
|
| 29 |
while ( $data = db_fetch_object($results) ) {
|
| 30 |
$rows[] = array(
|
| 31 |
++$i,
|
| 32 |
$data->counter_id,
|
| 33 |
$data->counter_ip,
|
| 34 |
$data->counter_date,
|
| 35 |
$data->counter_page
|
| 36 |
);
|
| 37 |
}
|
| 38 |
|
| 39 |
$output = "";
|
| 40 |
$output .= theme('table', $header, $rows);
|
| 41 |
$output .= theme('pager', NULL, $items_per_page, 0);
|
| 42 |
|
| 43 |
return $output;
|
| 44 |
}
|