From fcf829d03b27f23a9e57cc5634e6424083b3f83b Mon Sep 17 00:00:00 2001 From: Manfred Date: Fri, 24 Jun 2022 14:29:08 +0200 Subject: [PATCH] =?UTF-8?q?Button=20"Liste=20ausr=C3=A4umen"=20erg=C3=A4nz?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Löscht leere (unbenutzte) Prüflinge --- vilesci/stammdaten/auswertung_fhtw.php | 75 ++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/vilesci/stammdaten/auswertung_fhtw.php b/vilesci/stammdaten/auswertung_fhtw.php index 69d4dc7b9..9e8160808 100644 --- a/vilesci/stammdaten/auswertung_fhtw.php +++ b/vilesci/stammdaten/auswertung_fhtw.php @@ -440,6 +440,44 @@ if ($deleteAllResults) } } +// Ajax-Request um die Liste zusammenzuräumen +$clearList = filter_input(INPUT_POST, 'clearList', FILTER_VALIDATE_BOOLEAN); +if ($clearList) +{ + if (!$rechte->isBerechtigt('infocenter', null, 'suid')) + { + echo json_encode(array( + 'status' => 'fehler', + 'msg' => $rechte->errormsg + )); + exit(); + } + + $qry = "DELETE FROM testtool.tbl_pruefling pf + WHERE + ( + NOT EXISTS (SELECT 1 FROM testtool.tbl_pruefling_frage WHERE pruefling_id=pf.pruefling_id) AND + NOT EXISTS (SELECT 1 FROM testtool.tbl_antwort WHERE pruefling_id=pf.pruefling_id) + )"; + + if ($result = $db->db_query($qry)) + { + echo json_encode(array( + 'status' => 'ok', + 'msg' => $db->db_affected_rows($result).' leere Prüflinge wurden gelöscht')); + exit(); + } + else + { + echo json_encode(array( + 'status' => 'fehler', + 'msg' => 'Fehler beim Löschen der leeren Prüflinge' + )); + exit(); + } +} + +// Ajax-Request um einen Prüfling zu sperren $rtprueflingEntSperren = filter_input(INPUT_POST, 'rtprueflingEntSperren', FILTER_VALIDATE_BOOLEAN); if ($rtprueflingEntSperren) { @@ -2581,6 +2619,39 @@ else }); window.location.href = "mailto:?bcc="+adresseArray.join(";"); } + + function clearList() + { + $.ajax({ + url: "auswertung_fhtw.php", + data: {clearList: true}, + type: "POST", + dataType: "json", + success: function(data) + { + if(data.status !== "ok") + { + $("#msgbox").attr("class","alert alert-danger"); + $("#msgbox").show(); + $("#msgbox").html(data["msg"]); + } + else + { + $("#freischaltenWarning").show(); + $("#freischaltenInfo").hide(); + $("#msgbox").show(); + $("#msgbox").html(data["msg"]).delay(2000).fadeOut(); + } + }, + error: function(data) + { + $("#msgbox").attr("class","alert alert-danger"); + $("#msgbox").show(); + $("#msgbox").html(data["msg"]); + } + }); + } + function checkAllWithResult() { // Schleife ueber die einzelnen Elemente @@ -2965,6 +3036,10 @@ else { echo '  Testfortschritt ansehen'; } + if ($rechte->isBerechtigt('infocenter', null, 'suid')) + { + echo '  '; + } echo ''; echo '