/[drupal]/contributions/modules/counter/counter.report.inc
ViewVC logotype

Contents of /contributions/modules/counter/counter.report.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Mon Oct 26 04:58:57 2009 UTC (4 weeks, 2 days ago) by thenicespider
Branch: MAIN
CVS Tags: DRUPAL-6--2-3, DRUPAL-6--2-2, HEAD
Changes since 1.1: +6 -4 lines
File MIME type: text/x-php
6.x-2.2: New: Show Block/Unblock Users
         New: Redesign "Counter Settings" page
         New: Variable to show how many items per page on Counter Report
         Bug fix: Error on Counter Report when i18n module enable
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 }

  ViewVC Help
Powered by ViewVC 1.1.2