| 1 |
<?php |
<?php |
| 2 |
// $Id: graphstat_statistics.inc,v 1.2.2.1 2009/01/25 14:32:28 profix898 Exp $ |
// $Id: graphstat.node.inc,v 1.1.2.1 2009/01/25 21:08:34 profix898 Exp $ |
| 3 |
|
|
| 4 |
require_once(drupal_get_path('module', 'graphstat') .'/modules/graphstat.system.inc'); |
require_once(drupal_get_path('module', 'graphstat') .'/modules/graphstat.system.inc'); |
| 5 |
|
|
| 9 |
function graphstat_node_graphstat() { |
function graphstat_node_graphstat() { |
| 10 |
$graphs = array(); |
$graphs = array(); |
| 11 |
|
|
|
// Node type distribution |
|
|
$node_types = array(); |
|
|
$result = db_query("SELECT type, COUNT(nid) AS nodes FROM {node} WHERE nid <> 0 GROUP BY type ORDER BY nodes DESC", $_SERVER['HTTP_HOST']); |
|
|
while ($object = db_fetch_object($result)) { |
|
|
$node_types[] = db_result(db_query("SELECT name FROM {node_type} WHERE type = '%s'", $object->type)); |
|
|
} |
|
|
|
|
| 12 |
$graphs['nodes'] = array( |
$graphs['nodes'] = array( |
| 13 |
'#title' => t('Nodes'), |
'#title' => t('Nodes'), |
| 14 |
'graph_node_types' => array( |
'graph_node_types' => array( |
| 15 |
'#type' => 'pie', |
'#type' => 'pie', |
| 16 |
'#title' => t('Node Type Distribution'), |
'#title' => t('Node Type Distribution'), |
|
'#legend' => $node_types, |
|
| 17 |
'#description' => t('Number of nodes for each node type.') |
'#description' => t('Number of nodes for each node type.') |
| 18 |
), |
), |
| 19 |
'graph_nodes_details' => array( |
'graph_nodes_details' => array( |
| 36 |
$data = array(); |
$data = array(); |
| 37 |
|
|
| 38 |
// Node type distribution |
// Node type distribution |
| 39 |
|
$node_types = array(); |
| 40 |
$data['nodes']['graph_node_types'] = array(0 => array('')); |
$data['nodes']['graph_node_types'] = array(0 => array('')); |
| 41 |
$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']); |
| 42 |
while ($object = db_fetch_object($result)) { |
while ($object = db_fetch_object($result)) { |
| 43 |
$data['nodes']['graph_node_types'][0][] = $object->nodes; |
$data['nodes']['graph_node_types'][0][] = $object->nodes; |
| 44 |
|
$node_types[] = db_result(db_query("SELECT name FROM {node_type} WHERE type = '%s'", $object->type)); |
| 45 |
} |
} |
| 46 |
|
$data['nodes']['graph_node_types']['#legend'] = $node_types; |
| 47 |
|
|
| 48 |
// Node details (total, published, queued) of the last two weeks |
// Node details (total, published, queued) of the last two weeks |
| 49 |
$start_date = time() - (60*60*24*14); |
$start_date = time() - (60*60*24*14); |