echo '<tr>';
    echo '<th></th>';
    foreach ($week['days'] as $date => $day) {
        echo '<th>';
        echo '<a href="' . $day['link'] . '">';
        echo $day['date']->Format('D');
        echo '<br />';
        echo $day['date']->Format('jS M');
        echo '</a>';
        echo '</th>';
    }
    echo '</tr><tr>';
    echo '<th><a href="' . $week['link'] . '">' . $week['start']->AcademicWeek() . '</a></th>';
    foreach ($week['days'] as $date => $day) {
        $times = $day['events'];
        $classes_list = CalCssGetDateClasses($day['date'], $day['date']->DayOfWeek(), true);
        $classes_list[] = 'calendar_day';
        $classes = implode(' ', $classes_list);
        echo '<td class="' . $classes . '"><a href="' . $day['link'] . '">';
        foreach ($times as $time => $ocs) {
            foreach ($ocs as $occurrence) {
                $CI->load->view('calendar/occurrence_cell', array('Occurrence' => &$occurrence, 'Categories' => &$Categories, 'Squash' => $squash, 'Path' => $Path));
            }
        }
        echo '</a></td>';
    }
    echo '</tr>';
}
echo '</table>';
?>
</div>
</th></tr>
	<tr><th></th><?php 
        for ($day = 0; $day < 7; ++$day) {
            $dayofweek = ($WeekStart + $day) % 7;
            echo '<th>' . $day_of_week_headings[$dayofweek] . '</th>';
        }
        ?>
</tr>
<?php 
    }
    echo "\t<tr><th>{$week_number}</th>";
    for ($day_counter = 0; $day_counter < 7; ++$day_counter) {
        $day_of_month = $day_start->DayOfMonth();
        $month = $day_start->Month();
        $cell_id = $day_start->Format('Ymd');
        $classes_list = CalCssGetDateClasses($day_start, $WeekStart + $day_counter);
        if (isset($ClassNames[$cell_id])) {
            $classes_list = array_merge($classes_list, $ClassNames[$cell_id]);
        }
        if (!empty($classes_list)) {
            $classes = ' class="' . implode(' ', $classes_list) . '"';
        } else {
            $classes = '';
        }
        if (isset($Onclick) && $Onclick !== NULL) {
            $classes .= " onclick=\"{$Onclick}('{$cell_id}');\"";
        }
        $wrapper = array('', '');
        if (isset($Links[$cell_id])) {
            $wrapper[0] = '<a href="' . $Links[$cell_id] . '">';
            $wrapper[1] = '</a>';