5 * SourceForge: Breaking Down the Barriers to Open Source Development
6 * Copyright 1999-2001 (c) VA Linux Systems
7 * http://sourceforge.net
11 require_once $gfwww.'include/HTML_Graphs.php';
14 * stats_sf_stats() - Get SourceForge stats
16 function stats_sf_stats() {
20 $sql="SELECT * FROM stats_agg_pages_by_day";
22 $result = db_query ($sql);
23 $rows = db_numrows($result);
25 if (!$result || $rows < 1) {
26 echo '<h1>Stats Problem</h1>';
30 for ($i=0; $i<$rows; $i++) {
31 //echo $i." - ".($i%7)."<br />";
34 //increment the new weekly array
35 //and set the beginning date for this week
37 $name_string[$j]=db_result($result,$i,'day');
40 //add today to the week
41 $vals[$j] += db_result($result,$i,'count');
46 GraphIt($name_string,$vals,'Page Views By Week');
54 $sql="SELECT * FROM stats_agg_pages_by_hour";
56 $result = db_query ($sql);
57 $rows = db_numrows($result);
59 if (!$result || $rows < 1) {
60 echo '<h1>Stats Problem</h1>';
63 GraphResult($result,'Page Views By Hour');
71 $sql="select (round((register_time/604800),0)*604800) AS time ,count(*) from groups group by time";
72 $result = db_query ($sql);
73 $rows = db_numrows($result);
75 if (!$result || $rows < 1) {
76 echo '<h1>Stats Problem</h1>';
81 $count=util_result_column_to_array($result,1);
83 for ($i=0;$i<$rows;$i++) {
84 //convert the dates and add to an array
85 $dates[$i]=date(_('Y-m-d H:i'),db_result($result,$i,0));
87 GraphIt($dates,$count,'New Projects Added Each Week');
94 $sql="select (round((add_date/604800),0)*604800) AS time ,count(*) from users group by time";
95 $result = db_query ($sql);
96 $rows = db_numrows($result);
98 if (!$result || $rows < 1) {
99 echo '<h1>Stats Problem</h1>';
104 $count=util_result_column_to_array($result,1);
106 for ($i=0;$i<$rows;$i++) {
107 //convert the dates and add to an array
108 $dates[$i]=date(_('Y-m-d H:i'),db_result($result,$i,0));
110 GraphIt($dates,$count,'New Users Added Each Week');
112 echo '<p> </p>';
118 * stats_project_stats() - Get project stats
120 function stats_project_stats() {
124 $sql="SELECT * FROM stats_agg_logo_by_day";
126 $result = db_query ($sql);
127 $rows = db_numrows($result);
129 if (!$result || $rows < 1) {
130 echo '<h1>Stats Problem</h1>';
133 GraphResult($result,'Logo Showings By Day');
136 echo '<p> </p>';
139 logo impressions/group
141 $sql="SELECT group_id,sum(count) as count FROM stats_agg_logo_by_group GROUP BY group_id";
143 $result = db_query ($sql);
144 $rows = db_numrows($result);
146 if (!$result || $rows < 1) {
147 echo '<h1>Stats Problem</h1>';
150 GraphResult($result,'Logo Showings By Project');
153 echo '<p> </p>';
159 * stats_browser_stats() - Get browser stats
161 function stats_browser_stats() {
165 $sql="SELECT * FROM stats_agg_pages_by_browser";
167 $result = db_query ($sql);
168 $rows = db_numrows($result);
170 if (!$result || $rows < 1) {
171 echo '<h1>Stats Problem</h1>';
174 GraphResult($result,'Page Views By Browser');
176 echo '<p> </p>';
181 $sql="SELECT * FROM stats_agg_pages_by_platform";
183 $result = db_query ($sql);
184 $rows = db_numrows($result);
186 if (!$result || $rows < 1) {
187 echo '<h1>Stats Problem</h1>';
190 GraphResult($result,'Page Views By Platform');
192 echo '<p> </p>';
197 $sql="SELECT * FROM stats_agg_pages_by_plat_brow_ver";
199 $result = db_query ($sql);
200 $rows = db_numrows($result);
202 if (!$result || $rows < 1) {
203 echo '<h1>Stats Problem</h1>';
206 ShowResultSet($result,'Page Views By Platform/Browser Version');
208 echo '<p> </p>';