+ if (@{$nick_data->{$nick}{'longterm'}})
+ {
+ my $num_fields = scalar (@{$nick_data->{$nick}{'longterm'}});
+ my $now_epoch = get_most_recent_time ();
+ my $now_day = int ($now_epoch / 86400);
+ my $last_day;
+
+ my @weekdays = (qw(sun mon tue wed thu fri sat));
+
+ $LongtermDays = $num_fields if ($LongtermDays > $num_fields);
+ $last_day = 1 + $now_day - $LongtermDays;
+
+ print $fh qq# <table class="longterm">\n#,
+ qq# <tr class="bars">\n#;
+
+ for (my $i = $num_fields - $LongtermDays; $i < $num_fields; $i++)
+ {
+ for (my $j = 0; $j < 4; $j++)
+ {
+ my $num = $nick_data->{$nick}{'longterm'}[$i][$j];
+ my $height = sprintf ("%.2f", 95 * $num / $max_longterm);
+ my $img = $V_IMAGES[$j];
+
+ print $fh qq# <td class="bar vertical">#,
+ qq#<img src="$img" alt="" class="first last" style="height: $height\%;" />#,
+ qq#</td>\n#;
+ }
+ }
+
+ print $fh qq# </tr>\n#,
+ qq# <tr class="numeration">\n#;
+
+ for (my $i = 0; $i < $LongtermDays; $i++)
+ {
+ my $epoch = ($last_day + $i) * 86400;
+ my ($day, $wd) = (localtime ($epoch))[3,6];
+ $wd = $weekdays[$wd];
+
+ print $fh qq# <td colspan="4" class="numeration $wd">$day.</td>\n#;
+ }
+
+ print $fh qq# </tr>\n#,
+ qq# </table>\n#;
+ }
+ else
+ {
+ print $fh " \n";
+ }