From 2f573263ba5cb3d00ef3e018cf2684048ef32b7c Mon Sep 17 00:00:00 2001 From: ma0048 Date: Wed, 17 May 2023 16:00:34 +0200 Subject: [PATCH] - abfrage ob der pruefling bereits gesperrt ist --- cis/testtool/frage.php | 2 +- include/pruefling.class.php | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/cis/testtool/frage.php b/cis/testtool/frage.php index 6f47992a1..9f6cd4fb7 100644 --- a/cis/testtool/frage.php +++ b/cis/testtool/frage.php @@ -161,7 +161,7 @@ if(!isset($_SESSION['pruefling_id'])) $pruefling = new pruefling(); $pruefling->load($_SESSION['pruefling_id']); -if ($pruefling->gesperrt === 't') +if ($pruefling->isGesperrt($_SESSION['pruefling_id'])) die(""); if (!in_array($gebiet_id, $_SESSION['alleGebiete'])) diff --git a/include/pruefling.class.php b/include/pruefling.class.php index fc64d90c4..2a482d793 100644 --- a/include/pruefling.class.php +++ b/include/pruefling.class.php @@ -557,5 +557,31 @@ class pruefling extends basis_db return false; } } + + public function isGesperrt($pruefling_id) + { + $qry = "SELECT spruefling.gesperrt + FROM testtool.tbl_pruefling + JOIN public.tbl_prestudent USING(prestudent_id) + JOIN public.tbl_person USING (person_id) + JOIN public.tbl_prestudent pss ON pss.person_id = tbl_person.person_id + JOIN testtool.tbl_pruefling spruefling ON pss.prestudent_id = spruefling.prestudent_id + WHERE tbl_pruefling.pruefling_id = ".$this->db_add_param($pruefling_id, FHC_INTEGER)." + AND spruefling.gesperrt + LIMIT 1"; + + if($result = $this->db_query($qry)) + { + if ($this->db_num_rows($result) == 0) + return false; + else + return true; + } + else + { + $this->errormsg = 'Fehler bei einer Abfrage'; + return false; + } + } } ?>