From fde9af3eedc82371d9d710db9c0dd90c92f93834 Mon Sep 17 00:00:00 2001 From: Nikolaus Krondraf Date: Thu, 17 Oct 2019 12:42:22 +0200 Subject: [PATCH] =?UTF-8?q?Anmeldebutton=20wird=20erst=20ab=202=20Monaten?= =?UTF-8?q?=20vor=20Pr=C3=BCfung=20angezeigt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cis/private/lehre/pruefung/pruefung.js.php | 27 ++++++++++++---------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/cis/private/lehre/pruefung/pruefung.js.php b/cis/private/lehre/pruefung/pruefung.js.php index 4f7188645..9ef84e889 100644 --- a/cis/private/lehre/pruefung/pruefung.js.php +++ b/cis/private/lehre/pruefung/pruefung.js.php @@ -352,10 +352,10 @@ function writePruefungsTable(e, data, anmeldung) var termin = d.von.split(" "); var time = termin[1].substring(0,5); termin = termin[0].split("-"); - termin = new Date(termin[0], termin[1]-1,termin[2]); + var minimumFrist = new Date(termin[0], termin[1]-1,termin[2]); + minimumFrist.setMonth(minimumFrist.getMonth() - 2); + termin = new Date(termin[0], termin[1]-1,termin[2]); var frist = termin; - var minimumFrist = termin; - minimumFrist = new Date(minimumFrist.setMonth(termin.getMonth()-2)); termin = termin.getDate()+"."+(termin.getMonth()+1)+"."+termin.getFullYear(); frist = frist.getTime(); frist = frist - (*24*60*60*1000); @@ -376,7 +376,7 @@ function writePruefungsTable(e, data, anmeldung) button = "

"+frist+"'>

"; } - else + else if(new Date() > minimumFrist) { button = "

"+frist+"'>

"; } @@ -388,14 +388,17 @@ function writePruefungsTable(e, data, anmeldung) row += button; - if(d.max === null) - { - teilnehmer += "t('pruefung/unbegrenzt'); ?>
"; - } - else - { - teilnehmer += "

"+(d.max - d.teilnehmer)+"/"+d.max+"

"; - } + if(new Date() > minimumFrist) + { + if(d.max === null) + { + teilnehmer += "t('pruefung/unbegrenzt'); ?>
"; + } + else + { + teilnehmer += "

"+(d.max - d.teilnehmer)+"/"+d.max+"

"; + } + } }); row += ""+teilnehmer+""; return row;