week != null) { $defaultDateEnd = $schedule[0]->week->dateEnd; $defaultDateStart = $schedule[0]->week->dateStart; } else { $defaultDateEnd = ArrayHelper::getValue($schedule, '0.project.0.days.0.date') ?? date(ScheduleLoader::DATA_TO_WEB); $defaultDateStart = ArrayHelper::getValue($schedule, '0.project.0.days.0.date') ?? date(ScheduleLoader::DATA_TO_WEB); } } $index = 0; if ($day_button != null && count($groups) > 0 && $day_button != 'undefined') { $id_group = explode('-', $day_button)[1]; foreach ($groups as $i => $group) { if ($id_group == $group['id']) { $index = $i; break; } } } elseif ($objectId != '') { foreach ($schedule as $i => $sch) { if ($sch->objectId == $objectId) { $index = $i; break; } } } else { $day_button = ''; } ScheduleAsset::register($this); $tmplurl1 = Url::toRoute([ 'student/schedule', 'scheduleType' => 'Full', 'objectType' => $objectType, 'objectId' => $objectId, 'startDate' => 'sdate', 'endDate' => 'edate', 'day_button' => 'scId', 'another_group' => 'a_group' ]); $tmplurl2 = Url::toRoute([ 'student/schedule', 'scheduleType' => 'Week', 'objectType' => $objectType, 'objectId' => $objectId, 'startDate' => 'sdate', 'endDate' => 'edate', 'day_button' => 'scId', 'another_group' => 'a_group' ]); $tmplurl3 = Url::toRoute([ 'student/schedule', 'scheduleType' => 'Full', 'objectType' => $objectType, 'objectId' => $objectId, 'startDate' => 'sdate', 'endDate' => 'edate', 'day_button' => 'scId', 'another_group' => 'a_group' ]); $tmplurl4 = Url::toRoute([ 'student/schedule', 'scheduleType' => 'Week', 'objectType' => $objectType, 'objectId' => $objectId, 'startDate' => 'sdate', 'endDate' => 'edate', 'day_button' => 'scId', 'another_group' => 'a_group' ]); $tmplurl = Url::toRoute([ 'student/schedule', 'scheduleType' => 'Week', 'objectType' => $objectType, 'objectId' => $objectId, 'startDate' => 'sdate', 'endDate' => 'edate', 'day_button' => 'scId', 'another_group' => 'a_group' ]); $script = ' $(document).ready(function () { $("#group-select").change(function () { var scId = $("#group-select option:selected").val(); $(".schedule-container").hide(); $("#" + scId).fadeIn(); var s = $("#group-select option:selected").text(); var a = window.location.href; if (a.indexOf("Full") >= 0) { var tmplurl1 = "' . $tmplurl1 . '"; var sdate = $("#datetimepicker3").val(); var tplurl = tmplurl1.replace("scId", scId); var turl = tplurl.replace("sdate", sdate); var url = turl.replace("edate", sdate); var u = url.replace("a_group", s); $("#daytype").attr("href", u); var tmplurl2 = "' . $tmplurl2 . '"; var sdate = $("#datetimepicker3").val(); var tplurl = tmplurl2.replace("scId", scId); var turl = tplurl.replace("sdate", sdate); var url = turl.replace("edate", sdate); var u = url.replace("a_group", s); $("#weektype").attr("href", u); } else { var tmplurl3 = "' . $tmplurl3 . '"; var sdate = $("#datetimepicker1").val(); var edate = $("#datetimepicker2").val(); var tplurl = tmplurl3.replace("scId", scId); var turl = tplurl.replace("sdate", sdate); var url = turl.replace("edate", edate); var u = url.replace("a_group", s); $("#daytype").attr("href", u); var tmplurl4 = "' . $tmplurl4 . '"; var sdate = $("#datetimepicker1").val(); var edate = $("#datetimepicker2").val(); var tplurl = tmplurl4.replace("scId", scId); var turl = tplurl.replace("sdate", sdate); var url = turl.replace("edate", edate); var u = url.replace("a_group", s); $("#weektype").attr("href", u); } }); $("#position-select").change( function () { var selected_position = $("#position-select option:selected").val(); $(".schedule-container").hide(); // set selected_position parameter to current url and go to it var url = new URL(window.location.href); url.searchParams.set("selected_position", selected_position); window.location.href = url } ); $("#week-date-update").click(function (e) { var scId = $("#group-select option:selected").val(); var s = $("#group-select option:selected").text(); var tmplurl = "' . $tmplurl . '"; var sdate = $("#week-date-update a").data("startdate"); var edate = $("#week-date-update a").data("enddate"); var tplurl = tmplurl.replace("scId", scId); var turl = tplurl.replace("sdate", sdate); var url = turl.replace("edate", edate); var u = url.replace("a_group", s); window.location = u; return false; }); }); '; $this->registerJs($script, View::POS_END); ?>