<!--// $Id$ //-->
{include file="clearheader.html"}
{$speed_unit_type = ConfigHelper::getConfig('phpui.speed_unit_type', 1000)}
{$speed_unit_aggregation_threshold = ConfigHelper::getConfig('phpui.speed_unit_aggregation_threshold', 5)}
{$cols = 3}
{if !empty($showavg)}
	{$cols = $cols + 2}
{/if}
{if !empty($showmax)}
	{$cols = $cols + 2}
{/if}
<style>

	.node-stats {
		margin-bottom: 1.5em;
	}

	.node-stats caption {
		text-align: left;
		font-weight: bold;
	}

</style>
<TABLE WIDTH="100%" CELLPADDING="3" ALIGN="CENTER">
	<TR>
		<TD WIDTH="535" VALIGN="TOP">
			<H1>{$layout.pagetitle}</H1>
		</TD>
		<TD WIDTH="180" ALIGN="RIGHT" NOWRAP>
			LMS {$layout.lmsv} @ {$layout.hostname}<BR>
			{t a=trans($smarty.now|date_format:"l") b=$smarty.now|date_format:"Y-m-d"}<!date-format>$a, $b{/t}
			<br>
			{t a=$layout.logname}Created by: $a{/t}
		</TD>
	</TR>
</TABLE>
<BR>
{foreach $stats as $nodeid => $nodestats}
<TABLE WIDTH="100%" CELLPADDING="3" BORDER="1" ALIGN="CENTER" class="node-stats"{if !$nodestats@last} style="break-after: page;"{/if}>
	{if $nodeid}
	<caption>
		{$nodenames[$nodeid]}
	</caption>
	{/if}
	<TR>
		<TD WIDTH="100" CLASS="HEAD" ALIGN="CENTER" NOWRAP>
			{trans("Day")}
		</TD>
		<TD WIDTH="80" CLASS="HEAD" ALIGN="CENTER" NOWRAP>
			{trans("Download")}
		</TD>
		{if $showavg}
		<TD WIDTH="75" CLASS="HEAD" ALIGN="CENTER" NOWRAP>
			{trans("Avg. download speed")}
		</TD>
		{/if}
		{if $showmax}
		<TD WIDTH="75" CLASS="HEAD" ALIGN="CENTER" NOWRAP>
			{trans("Max. download speed")}
		</TD>
		{/if}
		<TD WIDTH="80" CLASS="HEAD" ALIGN="CENTER" NOWRAP>
			{trans("Upload")}
		</TD>
		{if $showavg}
		<TD WIDTH="75" CLASS="HEAD" ALIGN="CENTER" NOWRAP>
			{trans("Avg. upload speed")}
		</TD>
		{/if}
		{if $showmax}
		<TD WIDTH="75" CLASS="HEAD" ALIGN="CENTER" NOWRAP>
			{trans("Max. upload speed")}
		</TD>
		{/if}
	</TR>
	{cycle values="white,grey" print=false}
	{foreach $nodestats as $stat}
	<TR class="{cycle}">
		<TD ALIGN="LEFT" NOWRAP>
			{$stat.date|date_format:"d.m.Y (l)"}
		</TD>
		<TD ALIGN="RIGHT" NOWRAP>
			{$stat.download|string_format:"%.2f"} {$stat.downloadunit}
		</TD>
		{if $showavg}
		<TD ALIGN="RIGHT" NOWRAP>
			{convert_to_units($stat.downavg * $speed_unit_type, $speed_unit_aggregation_threshold, $speed_unit_type)}/s
		</TD>
		{/if}
		{if $showmax}
		<TD ALIGN="RIGHT" NOWRAP>
			{convert_to_units($stat.downmax * $speed_unit_type, $speed_unit_aggregation_threshold, $speed_unit_type)}/s
		</TD>
		{/if}
		<TD ALIGN="RIGHT" NOWRAP>
			{$stat.upload|string_format:"%.2f"} {$stat.uploadunit}
		</TD>
		{if $showavg}
		<TD ALIGN="RIGHT" NOWRAP>
			{convert_to_units($stat.upavg * $speed_unit_type, $speed_unit_aggregation_threshold, $speed_unit_type)}/s
		</TD>
		{/if}
		{if $showmax}
		<TD ALIGN="RIGHT" NOWRAP>
			{convert_to_units($stat.upmax * $speed_unit_type, $speed_unit_aggregation_threshold, $speed_unit_type)}/s
		</TD>
		{/if}
	</TR>
	{foreachelse}
	<tr>
		<td colspan="{$cols}" class="empty-table">
			{trans("No such stats for selected period.")}
		</td>
	</tr>
	{/foreach}
	<TR>
		<TD CLASS="HEADGREY" ALIGN="RIGHT">
			<B>{trans("Total:")}</B>
		</TD>
		<TD CLASS="HEADGREY" ALIGN="RIGHT" NOWRAP>
			<B>{$listdata[$nodeid].download|string_format:"%.2f"} {$listdata[$nodeid].downloadunit|default:"KB"}</B>
		</TD>
		{if $showavg}
		<TD CLASS="HEADGREY" ALIGN="RIGHT" NOWRAP>
			<B>{convert_to_units($listdata[$nodeid].downavg * $speed_unit_type, $speed_unit_aggregation_threshold, $speed_unit_type)}/s</B>
		</TD>
		{/if}
		{if $showmax}
		<TD CLASS="HEADGREY" ALIGN="RIGHT" NOWRAP>
			<B>{convert_to_units($listdata[$nodeid].downmax * $speed_unit_type, $speed_unit_aggregation_threshold, $speed_unit_type)}/s</B>
		</TD>
		{/if}
		<TD CLASS="HEADGREY" ALIGN="RIGHT" NOWRAP>
			<B>{$listdata[$nodeid].upload|string_format:"%.2f"} {$listdata[$nodeid].uploadunit|default:"KB"}</B>
		</TD>
		{if $showavg}
		<TD CLASS="HEADGREY" ALIGN="RIGHT" NOWRAP>
			<B>{convert_to_units($listdata[$nodeid].upavg * $speed_unit_type, $speed_unit_aggregation_threshold, $speed_unit_type)}/s</B>
		</TD>
		{/if}
		{if $showmax}
		<TD CLASS="HEADGREY" ALIGN="RIGHT" NOWRAP>
			<B>{convert_to_units($listdata[$nodeid].upmax * $speed_unit_type, $speed_unit_aggregation_threshold, $speed_unit_type)}/s</B>
		</TD>
		{/if}
	</TR>
</TABLE>
{/foreach}
{include file="clearfooter.html"}
