/[drupal]/contributions/modules/graphstat/graphstat_statistics.inc
ViewVC logotype

Diff of /contributions/modules/graphstat/graphstat_statistics.inc

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

revision 1.2, Wed Nov 14 22:29:56 2007 UTC revision 1.2.2.1, Sun Jan 25 14:32:28 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: graphstat_statistics.inc,v 1.0 2007/06/18 17:04:10 profix898 Exp $  // $Id: graphstat_statistics.inc,v 1.2 2007/11/14 22:29:56 profix898 Exp $
3    
4  /**  /**
5   * Implementation of hook_graphstat().   * Implementation of hook_graphstat().
# Line 25  function graphstat_statistics_nodes() { Line 25  function graphstat_statistics_nodes() {
25    // Node type distribution    // Node type distribution
26    $node_types = array();    $node_types = array();
27    $node_types_nodes = array('');    $node_types_nodes = array('');
28    $result = db_query("SELECT type, COUNT(nid) AS nodes FROM {node} WHERE nid != 0 GROUP BY type ORDER BY nodes DESC", $_SERVER['HTTP_HOST']);    $result = db_query("SELECT type, COUNT(nid) AS nodes FROM {node} WHERE nid <> 0 GROUP BY type ORDER BY nodes DESC", $_SERVER['HTTP_HOST']);
29    while ($object = db_fetch_object($result)) {    while ($object = db_fetch_object($result)) {
30      $node_types[] = db_result(db_query("SELECT name FROM {node_type} WHERE type = '%s'", $object->type));      $node_types[] = db_result(db_query("SELECT name FROM {node_type} WHERE type = '%s'", $object->type));
31      $node_types_nodes[] = $object->nodes;      $node_types_nodes[] = $object->nodes;
# Line 112  function graphstat_statistics_user_activ Line 112  function graphstat_statistics_user_activ
112    if (variable_get('statistics_enable_access_log', 0)) {    if (variable_get('statistics_enable_access_log', 0)) {
113      $top_users_hits = array('');      $top_users_hits = array('');
114      $top_users_hits_legend = array();      $top_users_hits_legend = array();
115      $result = db_query("SELECT uid, COUNT(DISTINCT(url)) AS hits FROM {accesslog} WHERE url <> '' GROUP BY uid ORDER BY hits DESC LIMIT 10", $_SERVER['HTTP_HOST']);      $result = db_query_range("SELECT uid, COUNT(DISTINCT(url)) AS hits FROM {accesslog} WHERE url <> '' GROUP BY uid ORDER BY hits DESC", $_SERVER['HTTP_HOST'], 0, 10);
116      while ($object = db_fetch_object($result)) {      while ($object = db_fetch_object($result)) {
117        $top_users_hits_legend[] = graphstat_statistics_uid2username($object->uid);        $top_users_hits_legend[] = graphstat_statistics_uid2username($object->uid);
118        $top_users_hits[] = $object->hits;        $top_users_hits[] = $object->hits;
# Line 126  function graphstat_statistics_user_activ Line 126  function graphstat_statistics_user_activ
126    // Most active users (number of nodes)    // Most active users (number of nodes)
127    $top_users_nodes = array('');    $top_users_nodes = array('');
128    $top_users_nodes_legend = array();    $top_users_nodes_legend = array();
129    $result = db_query("SELECT uid, COUNT(nid) AS nodes FROM {node} WHERE nid != 0 GROUP BY uid ORDER BY nodes DESC LIMIT 10", $_SERVER['HTTP_HOST']);    $result = db_query_range("SELECT uid, COUNT(nid) AS nodes FROM {node} WHERE nid <> 0 GROUP BY uid ORDER BY nodes DESC", $_SERVER['HTTP_HOST'], 0, 10);
130    while ($object = db_fetch_object($result)) {    while ($object = db_fetch_object($result)) {
131      $top_users_nodes_legend[] = graphstat_statistics_uid2username($object->uid);      $top_users_nodes_legend[] = graphstat_statistics_uid2username($object->uid);
132      $top_users_nodes[] = $object->nodes;      $top_users_nodes[] = $object->nodes;
# Line 156  function graphstat_statistics_user_activ Line 156  function graphstat_statistics_user_activ
156    if (module_exists('comment')) {    if (module_exists('comment')) {
157      $top_users_comments = array('');      $top_users_comments = array('');
158      $top_users_comments_legend = array();      $top_users_comments_legend = array();
159      $result = db_query("SELECT uid, COUNT(cid) AS comments FROM {comments} WHERE cid != 0 GROUP BY uid ORDER BY comments DESC LIMIT 10", $_SERVER['HTTP_HOST']);      $result = db_query_range("SELECT uid, COUNT(cid) AS comments FROM {comments} WHERE cid <> 0 GROUP BY uid ORDER BY comments DESC", $_SERVER['HTTP_HOST'], 0, 10);
160      while ($object = db_fetch_object($result)) {      while ($object = db_fetch_object($result)) {
161        $top_users_comments_legend[] = graphstat_statistics_uid2username($object->uid);        $top_users_comments_legend[] = graphstat_statistics_uid2username($object->uid);
162        $top_users_comments[] = $object->comments;        $top_users_comments[] = $object->comments;

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.2.2.1

  ViewVC Help
Powered by ViewVC 1.1.2