<div>
    <p class="tableTitle">{t str='Event Details'}</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|escape}</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|escape}</td>
            </tr>
        </tbody>
    </table>
    <p class="tableTitle">{t str='Event History'}</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|escape}{/if}&nbsp;&rarr;&nbsp;{$value.is|escape}</td>
            </tr>

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

    {if $aAuditDetail.children}
    <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}">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|escape} {$aValue.action|escape} {$aValue.context|escape} {if !empty($aValue.contextid)}(#{$aValue.contextid}){/if}
                    {if !empty($aValue.parentcontext)}
                        in {$aValue.parentcontext|escape} (#{$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}">View</a></td>
            </tr>
            {if $aValue.children}
                {foreach from=$aValue.children key=k item=val}
		            <tr class="{$rowClass}">
		                <td>{$val.updated}</td>
		                <td>
		                    {$val.username|escape} {$val.action|escape} {$val.context|escape} {if !empty($val.contextid)}(#{$val.contextid}){/if}
		                    {if !empty($val.parentcontext)}
		                        in {$val.parentcontext|escape} (#{$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}">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>
