summaryrefslogtreecommitdiff
path: root/data/tpl/vnpage_stats
diff options
context:
space:
mode:
authoryorhel <yorhel@1fe2e327-d9db-4752-bcf7-ef0cb4a1748b>2008-04-13 13:45:20 +0000
committeryorhel <yorhel@1fe2e327-d9db-4752-bcf7-ef0cb4a1748b>2008-04-13 13:45:20 +0000
commitd7046f5d38004ff20739798c18f5796c31676546 (patch)
tree1639e6a8c3b74588bff7be6aaf6cf5e04e3bc63f /data/tpl/vnpage_stats
W00t, VNDB on SVN!
git-svn-id: svn://vndb.org/vndb@1 1fe2e327-d9db-4752-bcf7-ef0cb4a1748b
Diffstat (limited to 'data/tpl/vnpage_stats')
-rw-r--r--data/tpl/vnpage_stats68
1 files changed, 68 insertions, 0 deletions
diff --git a/data/tpl/vnpage_stats b/data/tpl/vnpage_stats
new file mode 100644
index 00000000..dde9aed3
--- /dev/null
+++ b/data/tpl/vnpage_stats
@@ -0,0 +1,68 @@
+<ul id="stats">
+[[
+ my $max = 1; my $total = 0; my $sum = 0;
+ for (0..$#{$d{votes}{graph}}) {
+ $total += $d{votes}{graph}[$_];
+ $max = $d{votes}{graph}[$_] if $d{votes}{graph}[$_] > $max;
+ $sum += ($_+1) * $d{votes}{graph}[$_];
+ }
+]]
+[[ if(!$d{user} || ($d{pv} && $d{user}{votes})) { ]]-
+<li><h3>Vote graph <b class="actions">[[= $total ]]- vote[[= $total==1?'':'s' ]]- total
+ [[= $total ? sprintf(', average: %.1f.', $sum/$total) : '' ]]</b></h3>
+<table id="tvg">
+[[ for (0..$#{$d{votes}{graph}}) { ]]-
+ <tr>
+ <td class="tc1">[[= $_+1 ]]</td>
+ <td class="tc2"><div style="width: -[[= ($d{votes}{graph}[$_]/$max)*270 + 5 ]]px">&nbsp;</div>[[= $d{votes}{graph}[$_] ]]</td>
+ </tr>
+[[ } ]]-
+</table></li>
+
+[[ if($#{$d{votes}{latest}} >= 0) { ]]
+<li><h3>Recent votes</h3>
+<table id="tvr">
+[[ for (@{$d{votes}{latest}}) { ]]-
+ <tr>
+ [[ if(!$d{user}) { ]]-
+ <td class="tc1"><a href="/u[[= $_->{uid} ]]">[[: $_->{username} ]]</a></td>
+ [[ } else { ]]-
+ <td class="tc1"><a href="/v[[= $_->{vid} ]]">[[: length($_->{title})>30?substr($_->{title},0,27).'...':$_->{title} ]]</a></td>
+ [[ } ]]-
+ <td class="tc2">[[= $_->{vote} ]]</td>
+ <td class="tc3">[[= formatdate('%Y-%m-%d %R', $_->{date}, 'dh') ]]</td>
+ </tr>
+[[ } ]]-
+</table></li>
+[[ } } ]]-
+
+-[[ $max = 1; $total = 0;
+ for (@{$d{lists}{graph}}) { $total += $_; $max = $_ if $_ > $max; } ]]
+[[ if(!$d{user} || ($d{pl} && $d{user}{vnlist})) { ]]-
+<li class="break"><h3>VN List stats <b class="actions">[[= $total ]]- -[[= $d{user}?'visual novel':'user' ]][[= $total==1?'':'s' ]]- total</b></h3>
+<table id="tus">
+ [[ for (0..$#$VNDB::LSTAT) { ]]-
+ <tr>
+ <td class="tc1">[[= $VNDB::LSTAT->[$_] ]]</td>
+ <td class="tc2"><div style="width: -[[= ($d{lists}{graph}[$_]/$max)*235 + 5 ]]px">&nbsp;</div>[[= $d{lists}{graph}[$_] ]]</td>
+ </tr>
+ [[ } ]]-
+</table></li>
+
+[[ if($#{$d{lists}{latest}} >= 0) { ]]
+<li><h3>Recent VN list additions</h3>
+<table id="tur">
+[[ for (@{$d{lists}{latest}}) { ]]-
+ <tr>
+ [[ if(!$d{user}) { ]]-
+ <td class="tc1"><a href="/u[[= $_->{uid} ]]">[[: $_->{username} ]]</a></td>
+ [[ } else { ]]-
+ <td class="tc1"><a href="/v[[= $_->{vid} ]]">[[: length($_->{title})>25?substr($_->{title},0,23).'...':$_->{title} ]]</a></td>
+ [[ } ]]-
+ <td class="tc2">[[= $VNDB::LSTAT->[$_->{status}] ]]</td>
+ <td class="tc3">[[= formatdate('%Y-%m-%d %R', $_->{date}, 'dh') ]]</td>
+ </tr>
+[[ } ]]-
+</table></li>
+[[ } } ]]-
+</ul>