<div>
    <p class="tableTitle">{t str=EventDetails}</p>
    <table class="data-grid table">
        <tbody>
            <tr class="odd">
                <td style="width: 30%">{t str=ID}</td>
                <td>#{$aAuditDetail.contextid}</td>
            </tr>
            <tr class="even">
                <td style="width: 30%">{t str=Name}</td>
                <td>{$aAuditDetail.name}</td>
            </tr>
            <tr class="odd">
                <td style="width: 30%;">{t str=Type}</td>
                <td style="text-align:left;">{$aAuditDetail.contextDescription}</td>
            </tr>
            <tr class="even">
                <td class="label">{t str=Action}</td>
                <td style="text-align:left;">{t str=$aAuditDetail.action}</td>
            </tr>
            <tr class="odd">
                <td class="label">{t str=Username}</td>
                <td>{$aAuditDetail.username}</td>
            </tr>
        </tbody>
    </table>
    <p class="tableTitle">{t str='EventHistory'}</p>
    <table class="data-grid table">
	    <thead>
	        <tr class="header">
	            <th>{t str=Parameter}</th>
	            <th>{t str=Value}</th>
	        </tr>
	    </thead>
	    <tbody>
            {foreach from=$aAuditDetail.details key=key item=value name=details}
            {cycle values='odd,even' assign=rowClass}
                {if is_array($value)}
            <tr class="{$rowClass}">
                <td>{$key}</td>
                <td>{if $value.was == ''}empty{else}{$value.was}{/if}&nbsp;&rarr;&nbsp;{$value.is}</td>
            </tr>

                {else}
            <tr class="{$rowClass}">
                <td>{$key}</td>
                <td>{$value}</td>
            </tr>
                {/if}
            {/foreach}
	    </tbody>
    </table>

    {if count($aAuditDetail.children) > 0}
    <p class="tableTitle">Children History</p>
    <table class="data-grid table">
        <tbody>
            <tr class="header">
                <th width="15%"><a href="userlog-audit-detailed.php?{$urlParam}">{t str=Timestamp}</a>
                    <a href="userlog-index.php?{$urlParam}">
                        {if $orderdirection == 'up'}
                        <img src="{$assetPath|escape}/images/caret-u.gif" />
                        {else}
                        <img src="{$assetPath|escape}/images/caret-ds.gif" />
                        {/if}
                    </a>
                </th>
                <th>Event</th>
                <th width="10%">&nbsp;</th>
            </tr>
            {foreach from=$aAuditDetail.children key=key item=aValue name=info}
            {cycle values='odd,even' assign=rowClass}
            <tr class="{$rowClass}">
                <td>{$aValue.updated}</td>
                <td>
                    {$aValue.username} {$aValue.action} {$aValue.context} {if !empty($aValue.contextid)}(#{$aValue.contextid}){/if}
                    {if !empty($aValue.parentcontext)}
                        in {$aValue.parentcontext} (#{$aValue.parentcontextid})
                    {/if}
                    {if !empty($aValue.hasChildren)}
                        and additional items
                    {/if}
                </td>
                <td><img src="{$assetPath|escape}/images/icon-zoom.gif" />&nbsp;<a href="userlog-audit-detailed.php?auditId={$aValue.auditid}">{t str=View}</a></td>
            </tr>
            {if count($aValue.children) > 0}
                {foreach from=$aValue.children key=k item=val}
		            <tr class="{$rowClass}">
		                <td>{$val.updated}</td>
		                <td>
		                    {$val.username} {$val.action} {$val.context} {if !empty($val.contextid)}(#{$val.contextid}){/if}
		                    {if !empty($val.parentcontext)}
		                        in {$val.parentcontext} (#{$val.parentcontextid})
		                    {/if}
		                    {if !empty($val.hasChildren)}
		                        and additional items
		                    {/if}
		                </td>
		                <td><img src="{$assetPath|escape}/images/icon-zoom.gif" />&nbsp;<a href="userlog-audit-detailed.php?auditId={$val.auditid}">{t str=View}</a></td>
		            </tr>
                {/foreach}
            {/if}
            {/foreach}
        </tbody>
    </table>
    {/if}

    <input type="Button" name="" value="{t str=ReturnAuditTrail}" onclick="document.location='userlog-index.php';" />
</div>
