<?php
$zeit = date("G"). "." .date("i");
// Montag
// von Mitternacht bis zum 1. Kurs
if((date("w") == "1") && ($zeit < "18.30")) {
$next = mktime(18, 30, 0, date("m"), date("d"), date("Y"));
$rest = $next-time();
$days = floor($rest/24/60/60);
$rest = $rest-($days*24*60*60);
$hours = floor($rest/60/60);
$rest = ($rest-($hours*60*60));
$minutes = floor($rest/60);
$day = (($days != 1)?" Tagen":" Tag");
$hour = (($hours != 1)?" Stunden":" Stunde");
$minute = (($minutes != 1)?" Minuten":" Minute");
if($days > "0") {
$a="Der nächste Kurs beginnt in <b>" . $days . "</b> ".$day." <b>" . $hours . "</b> ".$hour." <b>" . $minutes . "</b> ".$minute.".";
} else {
$a="Der nächste Kurs beginnt in <b>" . $hours . "</b> ".$hour." <b>" . $minutes . "</b> ".$minute.".";
}
}
// 1. Kurs
elseif((date("w") == "1") && ($zeit >= "18.30") && ($zeit <= "19.30")) {$a="Momentan läuft der Kurs <b>\"Step\"</b>.";}
// Pause zwischen 1. und 2. Kurs
elseif((date("w") == "1") && ($zeit > "19.30") && ($zeit < "19.40")) {
$next = mktime(19, 40, 0, date("m"), date("d"), date("Y"));
$rest = $next-time();
$days = floor($rest/24/60/60);
$rest = $rest-($days*24*60*60);
$hours = floor($rest/60/60);
$rest = ($rest-($hours*60*60));
$minutes = floor($rest/60);
$day = (($days != 1)?" Tagen":" Tag");
$hour = (($hours != 1)?" Stunden":" Stunde");
$minute = (($minutes != 1)?" Minuten":" Minute");
if($days > "0") {
$a="Der nächste Kurs beginnt in <b>" . $days . "</b> ".$day." <b>" . $hours . "</b> ".$hour." <b>" . $minutes . "</b> ".$minute.".";
} else {
$a="Der nächste Kurs beginnt in <b>" . $hours . "</b> ".$hour." <b>" . $minutes . "</b> ".$minute.".";
}
}
// 2. Kurs
elseif((date("w") == "1") && ($zeit >= "19.40") && ($zeit <= "20.40")) {$a="Momentan läuft der Kurs <b>\"Lady Fit\"</b>.";}
// nach dem 2. Kurs bis Mitternacht
elseif((date("w") == "1") && ($zeit > "20.40")) {
$next = mktime(18, 30, 0, date("m"), date("d"), date("Y"));
$rest = $next-time();
$days = floor($rest/24/60/60);
$rest = $rest-($days*24*60*60);
$hours = floor($rest/60/60);
$rest = ($rest-($hours*60*60));
$minutes = floor($rest/60);
$day = (($days != 1)?" Tagen":" Tag");
$hour = (($hours != 1)?" Stunden":" Stunde");
$minute = (($minutes != 1)?" Minuten":" Minute");
if($days > "0") {
$a="Der nächste Kurs beginnt in <b>" . $days . "</b> ".$day." <b>" . $hours . "</b> ".$hour." <b>" . $minutes . "</b> ".$minute.".";
} else {
$a="Der nächste Kurs beginnt in <b>" . $hours . "</b> ".$hour." <b>" . $minutes . "</b> ".$minute.".";
}
}
// Dienstag
// von Mitternacht bis zum 1. Kurs
elseif((date("w") == "2") && ($zeit < "18.30")) {
$next = mktime(18, 30, 0, date("m"), date("d"), date("Y"));
$rest = $next-time();
$days = floor($rest/24/60/60);
$rest = $rest-($days*24*60*60);
$hours = floor($rest/60/60);
$rest = ($rest-($hours*60*60));
$minutes = floor($rest/60);
$day = (($days != 1)?" Tagen":" Tag");
$hour = (($hours != 1)?" Stunden":" Stunde");
$minute = (($minutes != 1)?" Minuten":" Minute");
if($days > "0") {
$a="Der nächste Kurs beginnt in <b>" . $days . "</b> ".$day." <b>" . $hours . "</b> ".$hour." <b>" . $minutes . "</b> ".$minute.".";
} else {
$a="Der nächste Kurs beginnt in <b>" . $hours . "</b> ".$hour." <b>" . $minutes . "</b> ".$minute.".";
}
}
// 1. Kurs
elseif((date("w") == "2") && ($zeit >= "18.30") && ($zeit <= "19.30")) {$a="Momentan läuft der Kurs <b>\"Step\"</b>.";}
// nach dem 1. Kurs bis Mitternacht
elseif((date("w") == "2") && ($zeit > "19.30")) {
$next = mktime(18, 30, 0, date("m"), date("d"), date("Y"));
$rest = $next-time();
$days = floor($rest/24/60/60);
$rest = $rest-($days*24*60*60);
$hours = floor($rest/60/60);
$rest = ($rest-($hours*60*60));
$minutes = floor($rest/60);
$day = (($days != 1)?" Tagen":" Tag");
$hour = (($hours != 1)?" Stunden":" Stunde");
$minute = (($minutes != 1)?" Minuten":" Minute");
if($days > "0") {
$a="Der nächste Kurs beginnt in <b>" . $days . "</b> ".$day." <b>" . $hours . "</b> ".$hour." <b>" . $minutes . "</b> ".$minute.".";
} else {
$a="Der nächste Kurs beginnt in <b>" . $hours . "</b> ".$hour." <b>" . $minutes . "</b> ".$minute.".";
}
}
// Mittwoch
// von Mitternacht bis zum 1. Kurs
elseif((date("w") == "3") && ($zeit < "18.30")) {
$next = mktime(18, 30, 0, date("m"), date("d"), date("Y"));
$rest = $next-time();
$days = floor($rest/24/60/60);
$rest = $rest-($days*24*60*60);
$hours = floor($rest/60/60);
$rest = ($rest-($hours*60*60));
$minutes = floor($rest/60);
$day = (($days != 1)?" Tagen":" Tag");
$hour = (($hours != 1)?" Stunden":" Stunde");
$minute = (($minutes != 1)?" Minuten":" Minute");
if($days > "0") {
$a="Der nächste Kurs beginnt in <b>" . $days . "</b> ".$day." <b>" . $hours . "</b> ".$hour." <b>" . $minutes . "</b> ".$minute.".";
} else {
$a="Der nächste Kurs beginnt in <b>" . $hours . "</b> ".$hour." <b>" . $minutes . "</b> ".$minute.".";
}
}
// 1. Kurs
elseif((date("w") == "3") && ($zeit >= "18.30") && ($zeit <= "19.30")) {$a="Momentan läuft der Kurs <b>\"Workout\"</b>.";}
// Pause zwischen 1. und 2. Kurs
elseif((date("w") == "3") && ($zeit > "19.30") && ($zeit < "19.40")) {
$next = mktime(19, 40, 0, date("m"), date("d"), date("Y"));
$rest = $next-time();
$days = floor($rest/24/60/60);
$rest = $rest-($days*24*60*60);
$hours = floor($rest/60/60);
$rest = ($rest-($hours*60*60));
$minutes = floor($rest/60);
$day = (($days != 1)?" Tagen":" Tag");
$hour = (($hours != 1)?" Stunden":" Stunde");
$minute = (($minutes != 1)?" Minuten":" Minute");
if($days > "0") {
$a="Der nächste Kurs beginnt in <b>" . $days . "</b> ".$day." <b>" . $hours . "</b> ".$hour." <b>" . $minutes . "</b> ".$minute.".";
} else {
$a="Der nächste Kurs beginnt in <b>" . $hours . "</b> ".$hour." <b>" . $minutes . "</b> ".$minute.".";
}
}
// 2. Kurs
elseif((date("w") == "3") && ($zeit >= "19.40") && ($zeit <= "20.40")) {$a="Momentan läuft der Kurs <b>\"Dance Aerobic / Fatburner\"</b>.";}
// nach dem 2. Kurs bis Mitternacht
elseif((date("w") == "3") && ($zeit > "20.40")) {
$next = mktime(18, 30, 0, date("m"), date("d"), date("Y"));
$rest = $next-time();
$days = floor($rest/24/60/60);
$rest = $rest-($days*24*60*60);
$hours = floor($rest/60/60);
$rest = ($rest-($hours*60*60));
$minutes = floor($rest/60);
$day = (($days != 1)?" Tagen":" Tag");
$hour = (($hours != 1)?" Stunden":" Stunde");
$minute = (($minutes != 1)?" Minuten":" Minute");
if($days > "0") {
$a="Der nächste Kurs beginnt in <b>" . $days . "</b> ".$day." <b>" . $hours . "</b> ".$hour." <b>" . $minutes . "</b> ".$minute.".";
} else {
$a="Der nächste Kurs beginnt in <b>" . $hours . "</b> ".$hour." <b>" . $minutes . "</b> ".$minute.".";
}
}
// Donnerstag
// von Mitternacht bis zum 1. Kurs
elseif((date("w") == "4") && ($zeit < "18.30")) {
$next = mktime(18, 30, 0, date("m"), date("d"), date("Y"));
$rest = $next-time();
$days = floor($rest/24/60/60);
$rest = $rest-($days*24*60*60);
$hours = floor($rest/60/60);
$rest = ($rest-($hours*60*60));
$minutes = floor($rest/60);
$day = (($days != 1)?" Tagen":" Tag");
$hour = (($hours != 1)?" Stunden":" Stunde");
$minute = (($minutes != 1)?" Minuten":" Minute");
if($days > "0") {
$a="Der nächste Kurs beginnt in <b>" . $days . "</b> ".$day." <b>" . $hours . "</b> ".$hour." <b>" . $minutes . "</b> ".$minute.".";
} else {
$a="Der nächste Kurs beginnt in <b>" . $hours . "</b> ".$hour." <b>" . $minutes . "</b> ".$minute.".";
}
}
// 1. Kurs
elseif((date("w") == "4") && ($zeit >= "18.30") && ($zeit <= "19.30")) {$a="Momentan läuft der Kurs <b>\"Aerobic Power Mix\"</b>.";}
// nach dem 1. Kurs bis Mitternacht
elseif((date("w") == "4") && ($zeit > "19.30")) {
$next_week = strtotime("Monday");
$next = mktime(18, 30, 0, date("m"), date("d", $next_week), date("Y"));
$rest = $next-time();
$days = floor($rest/24/60/60);
$rest = $rest-($days*24*60*60);
$hours = floor($rest/60/60);
$rest = ($rest-($hours*60*60));
$minutes = floor($rest/60);
$day = (($days != 1)?" Tagen":" Tag");
$hour = (($hours != 1)?" Stunden":" Stunde");
$minute = (($minutes != 1)?" Minuten":" Minute");
if($days > "0") {
$a="Der nächste Kurs beginnt in <b>" . $days . "</b> ".$day." <b>" . $hours . "</b> ".$hour." <b>" . $minutes . "</b> ".$minute.".";
} else {
$a="Der nächste Kurs beginnt in <b>" . $hours . "</b> ".$hour." <b>" . $minutes . "</b> ".$minute.".";
}
}
// Freitag, Samstag, Sonntag
// Freitag 0 Uhr bis Sonntag 24 Uhr
elseif((date("w") == "5") || (date("w") == "6") || (date("w") == "0")) {
$next_week = strtotime("Monday");
$next = mktime(18, 30, 0, date("m"), date("d", $next_week), date("Y"));
$rest = $next-time();
$days = floor($rest/24/60/60);
$rest = $rest-($days*24*60*60);
$hours = floor($rest/60/60);
$rest = ($rest-($hours*60*60));
$minutes = floor($rest/60);
$day = (($days != 1)?" Tagen":" Tag");
$hour = (($hours != 1)?" Stunden":" Stunde");
$minute = (($minutes != 1)?" Minuten":" Minute");
if($days > "0") {
$a="Der nächste Kurs beginnt in <b>" . $days . "</b> ".$day." <b>" . $hours . "</b> ".$hour." <b>" . $minutes . "</b> ".$minute.".";
} else {
$a="Der nächste Kurs beginnt in <b>" . $hours . "</b> ".$hour." <b>" . $minutes . "</b> ".$minute.".";
}
}
else {$a="   ";}
echo $a;
?>