diff --git a/schedule/calendar.php b/schedule/calendar.php index dca1618..10ccf57 100644 --- a/schedule/calendar.php +++ b/schedule/calendar.php @@ -3,21 +3,22 @@ function check_in_range($start_date, $end_date, $checkdate) { $start_ts = strtotime($start_date); $end_ts = strtotime($end_date); - $user_ts = strtotime($checkdate); - return (($user_ts >= $start_ts) && ($user_ts < $end_ts)); + $ch_ts = strtotime($checkdate); + return (($ch_ts >= $start_ts) && ($ch_ts < $end_ts)); } +// Create a date range between the schedule start and end dates $begin = new DateTime($schedule[0]['start']); $end = new DateTime(end($schedule)['start']); - $daterange = new DatePeriod($begin, new DateInterval('P1D'), $end); - ?> + @@ -46,12 +49,23 @@ for ($i = 0; $i < 86400; $i += 1800) { // 1800 = half hour, 86400 = one day ?> format('Y-m-d') .' ' .date('H:i:s', $time + $i)); -?> - -format('Y-m-d H:i:s'))) { + echo "\n"; + $match = true; + break; + } + } + // if no match was found, leave an empty node + if (! $match) { + echo "\n"; + } } ?>
@@ -32,12 +33,14 @@ foreach($daterange as $date){
:00format('Y-m-d H:i:s'); ?>" . $show['title'] . "