4 * SourceForge Sitewide Statistics - stats common module
6 * SourceForge: Breaking Down the Barriers to Open Source Development
7 * Copyright 1999-2001 (c) VA Linux Systems
8 * http://sourceforge.net
15 require_once('../env.inc.php');
16 require_once $gfwww.'include/pre.php';
17 require_once $gfwww.'include/graph_lib.php';
19 // require you to be a member of the sfstats group (group_id = 11084)
20 session_require( array('group'=>$sys_stats_group) );
22 $group_id = getIntFromRequest('group_id');
23 $year = getIntFromRequest('year');
24 $monthly = getIntFromRequest('monthly');
31 $year = gmstrftime("%Y", time() );
36 $sql = "SELECT month,site_page_views AS site_views,subdomain_views
37 FROM stats_site_months ORDER BY month ASC";
42 $beg_year=date('Y',mktime(0,0,0,(date('m')-1),date('d'),date('Y')));
43 $beg_month=date('m',mktime(0,0,0,(date('m')-1),date('d'),date('Y')));
44 $beg_day=date('d',mktime(0,0,0,(date('m')-1),date('d'),date('Y')));
46 $sql = "SELECT month,day,site_page_views AS site_views,subdomain_views
48 ( month = '$beg_year$beg_month' AND day >= '$beg_day' ) OR ( month > '$beg_year$beg_month' )
49 ORDER BY month ASC, day ASC";
54 $res = db_query($sql, -1, 0, SYS_DB_STATS);
60 while ( $row = db_fetch_array($res) ) {
62 $xlabel[$i] = $row['month'] . (($row['day']) ? "/" . $row['day'] : '');
63 $ydata1[$i] = $row["site_views"] + $row["subdomain_views"];
67 $graph = new Graph( 750, 550 );
69 // Need at least 2 data points
82 $xlabel[1] = $xlabel[0];
83 $ydata1[1] = $ydata1[0];
85 $graph->SetTitle( _('Gforge Page Views') );
86 $graph->SetSubTitle(sprintf(_('Total Page Views (RED) (%1$s days)'), $i));
88 $data1 = $graph->AddData( $xdata, $ydata1, $xlabel );
89 $graph->LineGraph($data1,'red');
91 $graph->DrawGrid('gray');
92 $graph->SetxTitle(_('Date'));
93 $graph->SetyTitle(_('Views (RED)'));
95 //$graph->showDebug();
96 $graph->ShowGraph('png');