вот что получилось
<div id='week_days'>
<div class='calendar'>";
$listDays = getDaysListArray();
$listDaysNames = getNamesWeekDays(true);
$next_week = ($_GET['week'] == 1?true:false);
$start_i = 0;
$stop_i = 7;
if ($next_week == true){
echo "<a href='".$current_sub['Hidden_URL']."' id='prev_week_button'></a>";
$start_i = 7;
$stop_i = 18;
}
//echo "<pre>";
//print_r($listDays);
//echo "</pre>";
for ($i = $start_i; $i < sizeof($listDays) ; $i++) {
if ($listDays[$i]['weekDay'] == 1) echo "<ul class='".($next_week==true?'nextweek':'currentweek')."'>";
if ($listDays[$i]['lastDay']) {
echo "<li><span class='day type_a'>" . $listDaysNames[$listDays[$i]['weekDay']] . "</span> <span class='date type_a'>" . $listDays[$i]['date_text'] . "</span></li>";
} else {
echo "<li><a href='/catering/?curDay=" . $listDays[$i]['date'] . "' class='date " . ($listDays[$i]['isInit'] ? 'type_c' : 'type_a'). "'><span class='day type_b'>" . $listDaysNames[$listDays[$i]['weekDay']] . "</span>" . $listDays[$i]['date_text']. "</a>";
}
if ($listDays[$i]['weekDay'] == 7) {
echo "</ul>";
break;
}
}
echo "</div>";
if ($next_week == false){
echo "<a href='/catering/?week=1&curDay=".$listDays[7]['date']."' id='next_week_button'></a>";
}
echo "
</div>