4 * Copyright 1999-2001 (c) VA Linux Systems
5 * Copyright 2010, FusionForge Team
6 * Copyright (C) 2010 Alain Peyrat - Alcatel-Lucent
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 $gfwww.'include/HTML_Graphs.php';
28 * stats_sf_stats() - Get SourceForge stats
30 function stats_sf_stats() {
34 $result = db_query_params ('SELECT * FROM stats_agg_pages_by_day',
36 $rows = db_numrows($result);
38 if (!$result || $rows < 1) {
39 echo '<p class="error">Stats Problem'.db_error().'</p>';
42 for ($i=0; $i<$rows; $i++) {
43 //echo $i." - ".($i%7)."<br />";
46 //increment the new weekly array
47 //and set the beginning date for this week
49 $name_string[$j]=db_result($result,$i,'day');
52 //add today to the week
53 $vals[$j] += db_result($result,$i,'count');
58 GraphIt($name_string,$vals,'Page Views By Week');
62 Projects added by week
64 $result = db_query_params ('select (round((register_time/604800),0)*604800) AS time ,count(*) from groups group by time',
66 $rows = db_numrows($result);
68 if (!$result || $rows < 1) {
69 echo '<p class="error">Stats Problem'.db_error().'</p>';
73 $count=util_result_column_to_array($result,1);
75 for ($i=0;$i<$rows;$i++) {
76 //convert the dates and add to an array
77 $dates[$i]=date(_('Y-m-d H:i'),db_result($result,$i,0));
79 GraphIt($dates,$count,'New Projects Added Each Week');
85 $result = db_query_params ('select (round((add_date/604800),0)*604800) AS time ,count(*) from users group by time',
87 $rows = db_numrows($result);
89 if (!$result || $rows < 1) {
90 echo '<p class="error">Stats Problem'.db_error().'</p>';
94 $count=util_result_column_to_array($result,1);
96 for ($i=0;$i<$rows;$i++) {
97 //convert the dates and add to an array
98 $dates[$i]=date(_('Y-m-d H:i'),db_result($result,$i,0));
100 GraphIt($dates,$count,'New Users Added Each Week');
107 * stats_project_stats() - Get project stats
109 function stats_project_stats() {
114 $result = db_query_params ('SELECT * FROM stats_agg_logo_by_day',
116 $rows = db_numrows($result);
118 if (!$result || $rows < 1) {
119 echo '<p class="error">Stats Problem'.db_error().'</p>';
121 GraphResult($result,'Logo Showings By Day');
125 logo impressions/group
128 $result = db_query_params ('SELECT group_id,sum(count) as count FROM stats_agg_logo_by_group GROUP BY group_id',
130 $rows = db_numrows($result);
132 if (!$result || $rows < 1) {
133 echo '<p class="error">Stats Problem'.db_error().'</p>';
135 GraphResult($result,'Logo Showings By Project');
141 * stats_browser_stats() - Get browser stats
143 function stats_browser_stats() {
148 $result = db_query_params ('SELECT * FROM stats_agg_pages_by_browser',
150 $rows = db_numrows($result);
152 if (!$result || $rows < 1) {
153 echo '<p class="error">Stats Problem'.db_error().'</p>';
155 GraphResult($result,'Page Views By Browser');
162 $result = db_query_params ('SELECT * FROM stats_agg_pages_by_platform',
164 $rows = db_numrows($result);
166 if (!$result || $rows < 1) {
167 echo '<p class="error">Stats Problem'.db_error().'</p>';
169 GraphResult($result,'Page Views By Platform');
176 $result = db_query_params ('SELECT * FROM stats_agg_pages_by_plat_brow_ver',
178 $rows = db_numrows($result);
180 if (!$result || $rows < 1) {
181 echo '<p class="error">Stats Problem'.db_error().'</p>';
183 ShowResultSet($result,'Page Views By Platform/Browser Version');