site_stats_utils.php
来自「GForge 3.0 协作开发平台 支持CVS, mailing lists, 」· PHP 代码 · 共 506 行 · 第 1/2 页
PHP
506 行
?> <p><table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top" align="right" style="bgcolor:#eeeeee"> <td><strong><?php echo $Language->getText('stats_site_utils','group_name'); ?></strong></td> <td colspan="2"><strong><?php echo $Language->getText('stats_site_utils','page_views'); ?></strong></td> <td><strong><?php echo $Language->getText('stats_site_utils','downloads'); ?></strong></td> <td colspan="2"><strong><?php echo $Language->getText('stats_site_utils','bugs'); ?></strong></td> <td colspan="2"><strong><?php echo $Language->getText('stats_site_utils','support'); ?></strong></td> <td colspan="2"><strong><?php echo $Language->getText('stats_site_utils','patches'); ?></strong></td> <td colspan="2"><strong><?php echo $Language->getText('stats_site_utils','all_trkr'); ?></strong></td> <td colspan="2"><strong><?php echo $Language->getText('stats_site_utils','tasks'); ?></strong></td> <td colspan="3"><strong><?php echo $Language->getText('stats_site_utils','cvs'); ?></strong></td> </tr> <?php // Build the query string to resort results. $uri_string = "projects.php?report=" . $report; if ( $trove_cat > 0 ) { $uri_string .= "&trovecatid=" . $trove_cat; } if ( $trove_cat == -1 ) { $uri_string .= "&projects=" . urlencode( implode( " ", $projects) ); } $uri_string .= "&orderby="; ?> <tr valign="top" align="right" style="bgcolor:#eeeeee"> <td> </td> <td><a href="<?php echo $uri_string; ?>site_views"><?php echo $Language->getText('stats_site_utils','site'); ?></a></td> <td><a href="<?php echo $uri_string; ?>subdomain_views"><?php echo $Language->getText('stats_site_utils','subdomain'); ?></a></td> <td><a href="<?php echo $uri_string; ?>downloads"><?php echo $Language->getText('stats_site_utils','total'); ?></a></td> <td><a href="<?php echo $uri_string; ?>bugs_opened"><?php echo $Language->getText('stats_site_utils','opn'); ?></a></td> <td><a href="<?php echo $uri_string; ?>bugs_closed"><?php echo $Language->getText('stats_site_utils','cls'); ?></a></td> <td><a href="<?php echo $uri_string; ?>support_opened"><?php echo $Language->getText('stats_site_utils','opn'); ?></a></td> <td><a href="<?php echo $uri_string; ?>support_closed"><?php echo $Language->getText('stats_site_utils','cls'); ?></a></td> <td><a href="<?php echo $uri_string; ?>patches_opened"><?php echo $Language->getText('stats_site_utils','opn'); ?></a></td> <td><a href="<?php echo $uri_string; ?>patches_closed"><?php echo $Language->getText('stats_site_utils','cls'); ?></a></td> <td><a href="<?php echo $uri_string; ?>artifacts_opened"><?php echo $Language->getText('stats_site_utils','opn'); ?></a></td> <td><a href="<?php echo $uri_string; ?>artifacts_closed"><?php echo $Language->getText('stats_site_utils','cls'); ?></a></td> <td><a href="<?php echo $uri_string; ?>tasks_opened"><?php echo $Language->getText('stats_site_utils','opn'); ?></a></td> <td><a href="<?php echo $uri_string; ?>tasks_closed"><?php echo $Language->getText('stats_site_utils','cls'); ?></a></td> <td><a href="<?php echo $uri_string; ?>cvs_checkouts"><?php echo $Language->getText('stats_site_utils','cos'); ?></a></td> <td><a href="<?php echo $uri_string; ?>cvs_commits"><?php echo $Language->getText('stats_site_utils','comms'); ?></a></td> <td><a href="<?php echo $uri_string; ?>cvs_adds"><?php echo $Language->getText('stats_site_utils','adds'); ?></a></td> </tr> <?php $i = $offset; while ( $row = db_fetch_array($res) ) { print '<tr ' . $GLOBALS['HTML']->boxGetAltRowStyle($i) . ' align="right">' . '<td>' . ($i + 1) . '. <a href="/project/stats/?group_id=' . $row["group_id"] . '">' . $row["group_name"] . '</a></td>' . '<td> ' . number_format( $row["site_views"],0 ) . '</td>' . '<td> ' . number_format( $row["subdomain_views"],0 ) . '</td>' . '<td> ' . number_format( $row["downloads"],0 ) . '</td>' . '<td> ' . number_format( $row["bugs_opened"],0 ) . '</td>' . '<td> ' . number_format( $row["bugs_closed"],0 ) . '</td>' . '<td> ' . number_format( $row["support_opened"],0 ) . '</td>' . '<td> ' . number_format( $row["support_closed"],0 ) . '</td>' . '<td> ' . number_format( $row["patches_opened"],0 ) . '</td>' . '<td> ' . number_format( $row["patches_closed"],0 ) . '</td>' . '<td> ' . number_format( $row["artifacts_opened"],0 ) . '</td>' . '<td> ' . number_format( $row["artifacts_closed"],0 ) . '</td>' . '<td> ' . number_format( $row["tasks_opened"],0 ) . '</td>' . '<td> ' . number_format( $row["tasks_opened"],0 ) . '</td>' . '<td> ' . number_format( $row["cvs_checkouts"],0 ) . '</td>' . '<td> ' . number_format( $row["cvs_commits"],0 ) . '</td>' . '<td> ' . number_format( $row["cvs_adds"],0 ) . '</td>' . '</tr>' . "\n"; $i++; $sum = stats_util_sum_array( $sum, $row ); } ?> </table></p> <?php } else { echo $Language->getText('stats_site_utils','no_valid_data')."\n"; echo "<br /><hr /><br />\n $sql \n<br /><hr /><br />\n\n"; echo db_error(); }}?><?phpfunction stats_site_projects_daily( $span ) { global $Language; // // We now only have 30 & 7-day views // if ( $span != 30 && $span != 7) { $span = 7; } $sql="SELECT * FROM stats_site_vw ORDER BY month DESC, day DESC"; if ($span == 30) { $res = db_query($sql, 30, 0, SYS_DB_STATS); } else { $res = db_query($sql, 7, 0, SYS_DB_STATS); } echo db_error(); // if there are any weeks, we have valid data. if ( ($valid_days = db_numrows( $res )) > 1 ) { ?> <p><strong><?php echo $Language->getText('stats_site_utils','statistics_for_the_past_days',array($GLOBALS['valid_days'])) ?>;</strong></p> <p> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top" align="right"> <td><strong><?php echo $Language->getText('stats_site_utils','day'); ?></strong></td> <td><strong><?php echo $Language->getText('stats_site_utils','site_views'); ?></strong></td> <td><strong><?php echo $Language->getText('stats_site_utils','subdomain_views'); ?></strong></td> <td><strong><?php echo $Language->getText('stats_site_utils','downloads'); ?></strong></td> <td><strong><?php echo $Language->getText('stats_site_utils','bugs'); ?></strong></td> <td><strong><?php echo $Language->getText('stats_site_utils','support'); ?></strong></td> <td><strong><?php echo $Language->getText('stats_site_utils','patches'); ?></strong></td> <td><strong><?php echo $Language->getText('stats_site_utils','tasks'); ?></strong></td> <td><strong><?php echo $Language->getText('stats_site_utils','cvs'); ?></strong></td> </tr> <?php while ( $row = db_fetch_array($res) ) { $i++; print '<tr ' . $GLOBALS['HTML']->boxGetAltRowStyle($i) . ' align="right">' . '<td>' . gmstrftime("%d %b %Y", mktime(0,0,1,substr($row["month"],4,2),$row["day"],substr($row["month"],0,4)) ) . '</td>' . '<td>' . number_format( $row["site_page_views"],0 ) . '</td>' . '<td>' . number_format( $row["subdomain_views"],0 ) . '</td>' . '<td>' . number_format( $row["downloads"],0 ) . '</td>' . '<td> ' . number_format($row["bugs_opened"],0) . " (" . number_format($row["bugs_closed"],0) . ')</td>' . '<td> ' . number_format($row["support_opened"],0) . " (" . number_format($row["support_closed"],0) . ')</td>' . '<td> ' . number_format($row["patches_opened"],0) . " (" . number_format($row["patches_closed"],0) . ')</td>' . '<td> ' . number_format($row["tasks_opened"],0) . " (" . number_format($row["tasks_closed"],0) . ')</td>' . '<td> ' . number_format($row["cvs_checkouts"],0) . " (" . number_format($row["cvs_commits"],0) . ')</td>' . '</tr>' . "\n"; } ?> </table></p> <?php } else { echo $Language->getText('stats_site_utils','no_data'); }}function stats_site_projects_monthly() { global $Language; $sql="SELECT * FROM stats_site_months ORDER BY month DESC"; $res=db_query($sql, -1, 0, SYS_DB_STATS); echo db_error(); // if there are any weeks, we have valid data. if ( ($valid_months = db_numrows( $res )) > 1 ) { ?> <p><strong><?php echo $Language->getText('stats_site_utils','statistics_for_the_past_months',array($GLOBALS['valid_months'])); ?>;</strong></p> <p> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top" align="right"> <td><strong><?php echo $Language->getText('stats_site_utils','month'); ?>Month</strong></td> <td><strong><?php echo $Language->getText('stats_site_utils','site_views'); ?></strong></td> <td><strong><?php echo $Language->getText('stats_site_utils','subdomain_views'); ?></strong></td> <td><strong><?php echo $Language->getText('stats_site_utils','downloads'); ?></strong></td> <td><strong><?php echo $Language->getText('stats_site_utils','bugs'); ?></strong></td> <td><strong><?php echo $Language->getText('stats_site_utils','support'); ?></strong></td> <td><strong><?php echo $Language->getText('stats_site_utils','patches'); ?></strong></td> <td><strong><?php echo $Language->getText('stats_site_utils','all_trkr'); ?></strong></td> <td><strong><?php echo $Language->getText('stats_site_utils','tasks'); ?></strong></td> <td><strong><?php echo $Language->getText('stats_site_utils','cvs'); ?></strong></td> </tr> <?php while ( $row = db_fetch_array($res) ) { $i++; print '<tr ' . $GLOBALS['HTML']->boxGetAltRowStyle($i) . 'align="right">' . '<td>' . $row['month'] . '</td>' . '<td>' . number_format( $row["site_page_views"],0 ) . '</td>' . '<td>' . number_format( $row["subdomain_views"],0 ) . '</td>' . '<td>' . number_format( $row["downloads"],0 ) . '</td>' . '<td> ' . number_format($row["bugs_opened"],0) . " (" . number_format($row["bugs_closed"],0) . ')</td>' . '<td> ' . number_format($row["support_opened"],0) . " (" . number_format($row["support_closed"],0) . ')</td>' . '<td> ' . number_format($row["patches_opened"],0) . " (" . number_format($row["patches_closed"],0) . ')</td>' . '<td> ' . number_format($row["artifacts_opened"],0) . " (" . number_format($row["artifacts_closed"],0) . ')</td>' . '<td> ' . number_format($row["tasks_opened"],0) . " (" . number_format($row["tasks_closed"],0) . ')</td>' . '<td> ' . number_format($row["cvs_checkouts"],0) . " (" . number_format($row["cvs_commits"],0) . ')</td>' . '</tr>' . "\n"; } ?> </table></p> <?php } else { echo $Language->getText('stats_site_utils','no_data'); }}function stats_site_aggregate( ) { global $Language; $res = db_query("SELECT * FROM stats_site_all_vw", -1, 0, SYS_DB_STATS); $site_totals = db_fetch_array($res); $sql = "SELECT COUNT(*) AS count FROM groups WHERE status='A'"; $res = db_query( $sql ); $groups = db_fetch_array($res); $sql = "SELECT COUNT(*) AS count FROM users WHERE status='A'"; $res = db_query( $sql ); $users = db_fetch_array($res); ?> <p><strong><?php echo $Language->getText('stats_site_utils','current_statistic_all_time'); ?></strong></p> <p><table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"> <td><strong><?php echo $Language->getText('stats_site_utils','site_views'); ?></strong></td> <td><strong><?php echo $Language->getText('stats_site_utils','subdomain_views'); ?></strong></td> <td><strong><?php echo $Language->getText('stats_site_utils','downloads'); ?></strong></td> <td><strong><?php echo $Language->getText('stats_site_utils','developers'); ?></strong></td> <td><strong><?php echo $Language->getText('stats_site_utils','projects'); ?></strong></td> </tr> <tr> <td><?php echo number_format( $site_totals["site_page_views"],0 ); ?></td> <td><?php echo number_format( $site_totals["subdomain_views"],0 ); ?></td> <td><?php echo number_format( $site_totals["downloads"],0 ); ?></td> <td><?php echo number_format( $users["count"],0 ); ?></td> <td><?php echo number_format( $groups["count"],0 ); ?></td> </tr> </table></p> <?php}?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?