{if $rtstats}
<table width="100%" id="lms-ui-welcome-box-rtstats">
    {if $rtstats|@count >= 3}
    {assign var="hboxesinrow" value="3"}
    {else}
    {assign var="hboxesinrow" value=$rtstats|@count mod 3}
    {/if}
    {counter start=0 skip=1 assign=rtstatscounter print=false}
    {foreach from=$rtstats item=rtcategorystats}
    {if $rtstatscounter mod 3 == 0}
    <tr>
        <td width="{(100 / $hboxesinrow)|round}%" style="padding: 0px 2px 0px 0px;">
            {elseif $rtstatscounter mod 3 == 2 || $rtstatscounter + 1 == $rtstats|@count}
        <td width="{(100 / $hboxesinrow)|round}%" style="padding: 0px 0px 0px 2px;">
            {else}
        <td width="{(100 / $hboxesinrow)|round}%" style="padding: 0px 2px 0px 2px;">
            {/if}
            <table class="lmsbox">
                <colgroup>
                    <col style="width: 50%;">
                    <col style="width: 50%;">
                </colgroup>
                <thead>
                    <tr>
                        <td colspan="2" class="text-center bold nobr">
                            <a href="?m=rtticketview&amp;catid={$rtcategorystats.id}" {tip text="Add new ticket" trigger="newticket"}><i class="lms-ui-icon-helpdesk"></i></a>&nbsp;{trans("Helpdesk:")}&nbsp;<a href="?m=rtqueueview&amp;catid={$rtcategorystats.id}">{$rtcategorystats.name}</a>
                        </td>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td class="text-right bold">
                            <a href="?m=rtqueueview&amp;catid={$rtcategorystats.id}&amp;s={$smarty.const.RT_NEW}&priority=all&unread=-1&amp;o=lastmodified,desc">{trans("New:")}</a>
                        </td>
                        <td>
                            {$rtcategorystats.new|default:"0"}
                        </td>
                    </tr>
                    <tr>
                        <td class="text-right bold">
                            <a href="?m=rtqueueview&amp;catid={$rtcategorystats.id}&amp;s={$smarty.const.RT_OPEN}&priority=all&unread=-1&amp;o=lastmodified,desc">{trans("Opened:")}</a>
                        </td>
                        <td>
                            {$rtcategorystats.opened|default:"0"}
                        </td>
                    </tr>
                    <tr>
                        <td class="text-right bold">
                            <a href="?m=rtqueueview&amp;catid={$rtcategorystats.id}&amp;s={$smarty.const.RT_DEAD}&priority=all&unread=-1&amp;o=lastmodified,desc">{trans("Dead:")}</a>
                        </td>
                        <td>
                            {$rtcategorystats.dead|default:"0"}
                        </td>
                    </tr>
                    <tr>
                        <td class="text-right bold nobr">
                            <a href="?m=rtqueueview&amp;catid={$rtcategorystats.id}&s=-1&priority=all&unread=-1&o=lastmodified,desc">{trans("Unresolved:")}</a>
                        </td>
                        <td>
                            {$rtcategorystats.unresolved|default:"0"}
                        </td>
                    </tr>
                    <tr>
                        <td class="text-right bold">
                            <a href="?m=rtqueueview&amp;catid={$rtcategorystats.id}&amp;s={$smarty.const.RT_RESOLVED}&priority=all&unread=-1o=lastmodified,desc">{trans("Resolved:")}</a>
                        </td>
                        <td>
                            {$rtcategorystats.resolved|default:"0"}
                        </td>
                    </tr>
                    <tr>
                        <td class="text-right bold">
                            <a href="?m=rtqueueview&amp;catid={$rtcategorystats.id}&amp;s=-1&priority=all&unread=1&amp;o=lastmodified,desc">{trans("Unread:")}</a>
                        </td>
                        <td>
                            {$rtcategorystats.unread|default:"0"}
                        </td>
                    </tr>
                    <tr>
                        <td class="text-right bold">
                            <a href="?m=rtqueueview&amp;catid={$rtcategorystats.id}">{trans("Total:")}</a>
                        </td>
                        <td>
                            {math equation="a+b+c+d" a=$rtcategorystats.opened b=$rtcategorystats.new c=$rtcategorystats.dead d=$rtcategorystats.resolved}
                        </td>
                    </tr>
                </tbody>
            </table>

        </td>
        {if $rtstatscounter mod 5 == 4}
    </tr>
    {/if}
    {counter}
    {/foreach}
</table>
{/if}
