fix for default weekday

This commit is contained in:
s416422 2019-12-15 12:43:40 +01:00
parent 03aaf21519
commit f2970e4c0a

View File

@ -22,7 +22,11 @@ class UserSubjectsController extends Controller
$weekdays = ['Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota', 'Niedziela']; $weekdays = ['Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota', 'Niedziela'];
// $types = ['Lecture', 'Excercises', 'Labs', 'Other']; // $types = ['Lecture', 'Excercises', 'Labs', 'Other'];
$defaultTime = date("H:i"); $defaultTime = date("H:i");
if(date('w')-1 < 0 ) {
$defaultWeekday = $weekdays[6];
} else {
$defaultWeekday = $weekdays[date('w')-1]; $defaultWeekday = $weekdays[date('w')-1];
}
return view('user.user_subjects', ['subjects' => $subjects, 'weekdays' => $weekdays, return view('user.user_subjects', ['subjects' => $subjects, 'weekdays' => $weekdays,
'subjects_grouped' => $subjects_grouped, 'grouped_by' => $groupBy, 'defaultTime' => $defaultTime, 'defaultWeekday' => $defaultWeekday, 'rooms' => $rooms]); 'subjects_grouped' => $subjects_grouped, 'grouped_by' => $groupBy, 'defaultTime' => $defaultTime, 'defaultWeekday' => $defaultWeekday, 'rooms' => $rooms]);
} }