From 40dfa7d5c0dc8e4cb2c95e403b6b4b2c4bf70644 Mon Sep 17 00:00:00 2001 From: Matthijs Kuiper Date: Sat, 4 Feb 2017 16:05:45 +0100 Subject: Original UTStats beta 4.2.8 --- html/pages/graph_pbreakdown.php | 137 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100755 html/pages/graph_pbreakdown.php (limited to 'html/pages/graph_pbreakdown.php') diff --git a/html/pages/graph_pbreakdown.php b/html/pages/graph_pbreakdown.php new file mode 100755 index 0000000..808c7cb --- /dev/null +++ b/html/pages/graph_pbreakdown.php @@ -0,0 +1,137 @@ + $hour_max) $hour_max = $r_ghours['res_count']; + $hour_sum += $r_ghours['res_count']; +} +if ($hour_max == 0) return; + +// Daily Breakdown +// We use WEEKDAY rather then DAYOFWEEK because now the week starts with Monday instead of Sunday +$sql_gdays = "SELECT WEEKDAY(time) AS res_day, COUNT(*) AS res_count +FROM uts_match m, uts_player p WHERE $bgwhere AND m.id = p.matchid GROUP by res_day"; +$q_gdays = mysql_query($sql_gdays) or die(mysql_error()); +$day_max = 0; +$day_sum = 0; +while ($r_gdays = mysql_fetch_array($q_gdays)) { + $gb_day[$r_gdays['res_day']] = $r_gdays['res_count']; + if ($r_gdays['res_count'] > $day_max) $day_max = $r_gdays['res_count']; + $day_sum += $r_gdays['res_count']; +} + +// Monthly Breakdown +$sql_gmonths = "SELECT MONTH(m.time) AS res_month, COUNT(p.id) AS res_count +FROM uts_match m, uts_player p WHERE $bgwhere AND m.id = p.matchid GROUP by res_month"; +$q_gmonths = mysql_query($sql_gmonths) or die(mysql_error()); +$month_max = 0; +$month_sum = 0; +while ($r_gmonths = mysql_fetch_array($q_gmonths)) { + $gb_month[$r_gmonths['res_month']] = $r_gmonths['res_count']; + if ($r_gmonths['res_count'] > $month_max) $month_max = $r_gmonths['res_count']; + $month_sum += $r_gmonths['res_count']; +} + + +echo' + + + + +
+ + + + + + + + + + '; + +// Hourly +for ($i = 0; $i <= 23; $i++) { + if (!isset($gb_hour[$i])) $gb_hour[$i] = 0; + $title = $gb_hour[$i] .' ('. get_dp($gb_hour[$i] / $hour_sum * 100) .' %)'; + echo ''; +} + +echo ''; + +// Daily +for ($i = 0; $i <= 6; $i++) { + if (!isset($gb_day[$i])) $gb_day[$i] = 0; + $title = $gb_day[$i] .' ('. get_dp($gb_day[$i] / $day_sum * 100) .' %)'; + echo ''; +} + +echo ''; + +// Monthly +for ($i = 1; $i <= 12; $i++) { + if (!isset($gb_month[$i])) $gb_month[$i] = 0; + $title = $gb_month[$i] .' ('. get_dp($gb_month[$i] / $month_sum * 100) .' %)'; + echo ''; +} +echo ''; +echo' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Hourly, Daily and Monthly Activity '.$gtitle.'
'. $title .''. $title .''. $title .'
01234567891011121314151617181920212223MTWTFSSJFMAMJJASOND
+
+
'; +?> \ No newline at end of file -- cgit