<?php 
foreach ($disabledbanners as $disbanner) {
    $stats = adrotate_stats($disbanner['id']);
    $grouplist = adrotate_ad_is_in_groups($disbanner['id']);
    // Prevent gaps in display
    $ctr = adrotate_ctr($stats['clicks'], $stats['impressions']);
    if ($adrotate_debug['dashboard'] == true) {
        echo "<tr><td>&nbsp;</td><td><strong>[DEBUG]</strong></td><td colspan='9'><pre>";
        echo "Ad Specs: <pre>";
        print_r($disbanner);
        echo "</pre>";
        echo "Stats: <pre>";
        print_r($stats);
        echo "</pre></td></tr>";
    }
    $grouplist = adrotate_ad_is_in_groups($disbanner['id']);
    if ($disbanner['type'] == 'disabled') {
        $errorclass = ' row_inactive';
    } else {
        $errorclass = '';
    }
    ?>
		    <tr id='adrotateindex' class='<?php 
    echo $errorclass;
    ?>
'>
				<th class="check-column"><input type="checkbox" name="disabledbannercheck[]" value="<?php 
    echo $disbanner['id'];
    ?>
" /></th>
				<td><center><?php 
    _e('Visible from', 'adrotate');
    ?>
</th>
		<th width="20%"><?php 
    _e('Visible until', 'adrotate');
    ?>
</th>
	</tr>
	</thead>
	
	<tbody>
<?php 
    foreach ($adverts['active'] as $ad) {
        $stats = adrotate_stats($ad['id']);
        $stats_today = adrotate_stats($ad['id'], adrotate_date_start('day'));
        $grouplist = adrotate_ad_is_in_groups($ad['id']);
        $ctr = adrotate_ctr($stats['clicks'], $stats['impressions']);
        $class = 'adrotate_active';
        if ($ad['type'] == '2days') {
            $class = ' adrotate_error';
        }
        if ($ad['type'] == '7days') {
            $class = ' adrotate_error';
        }
        if ($ad['type'] == 'expired') {
            $class = ' adrotate_urgent';
        }
        ?>

	    <tr id='banner-<?php 
        echo $ad['id'];