5 * Copyright 1999-2001 (c) VA Linux Systems
6 * Copyright 2010 (c) FusionForge Team
7 * http://fusionforge.org
9 * This file is part of FusionForge. FusionForge is free software;
10 * you can redistribute it and/or modify it under the terms of the
11 * GNU General Public License as published by the Free Software
12 * Foundation; either version 2 of the Licence, or (at your option)
15 * FusionForge is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 require_once('../env.inc.php');
26 require_once $gfcommon.'include/pre.php';
27 require_once $gfwww.'include/graph_lib.php';
29 session_require_global_perm ('forge_stats', 'read') ;
31 $group_id = getIntFromRequest('group_id');
32 $year = getIntFromRequest('year');
33 $monthly = getIntFromRequest('monthly');
40 $year = gmstrftime("%Y", time() );
46 $res = db_query_params ('SELECT month,site_page_views AS site_views,subdomain_views
47 FROM stats_site_months ORDER BY month ASC',
53 $beg_year=date('Y',mktime(0,0,0,(date('m')-1),date('d'),date('Y')));
54 $beg_month=date('m',mktime(0,0,0,(date('m')-1),date('d'),date('Y')));
55 $beg_day=date('d',mktime(0,0,0,(date('m')-1),date('d'),date('Y')));
58 $res = db_query_params ('SELECT month,day,site_page_views AS site_views,subdomain_views
60 ( month = $1 AND day >= $2 ) OR ( month > $3 )
61 ORDER BY month ASC, day ASC',
62 array ("$beg_year$beg_month",
64 "$beg_year$beg_month"));
73 while ( $row = db_fetch_array($res) ) {
75 $xlabel[$i] = $row['month'] . (($row['day']) ? "/" . $row['day'] : '');
76 $ydata1[$i] = $row["site_views"] + $row["subdomain_views"];
80 $graph = new Graph( 750, 550 );
82 // Need at least 2 data points
95 $xlabel[1] = $xlabel[0];
96 $ydata1[1] = $ydata1[0];
98 $graph->SetTitle( _('Forge Page Views') );
99 $graph->SetSubTitle(sprintf(_('Total Page Views (RED) (%1$s days)'), $i));
101 $data1 = $graph->AddData( $xdata, $ydata1, $xlabel );
102 $graph->LineGraph($data1,'red');
104 $graph->DrawGrid('gray');
105 $graph->SetxTitle(_('Date'));
106 $graph->SetyTitle(_('Views (RED)'));
108 //$graph->showDebug();
109 $graph->ShowGraph('png');