From 3f423898f993c2ef23f58ed1740c1a9402755502 Mon Sep 17 00:00:00 2001 From: Cris Date: Thu, 9 May 2019 12:49:20 +0200 Subject: [PATCH] Added alert when test includes MathML format and browser is not Firefox By the moment applicants should absolve the tests using Firefox Browser to ensure the correct display MathML. If they use another browser, they will now get an alert. --- cis/testtool/login.php | 3 +- cis/testtool/menu.php | 34 +++++++++++++++++++++- include/gebiet.class.php | 63 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+), 3 deletions(-) diff --git a/cis/testtool/login.php b/cis/testtool/login.php index 0ef8aab15..e46e6679c 100644 --- a/cis/testtool/login.php +++ b/cis/testtool/login.php @@ -577,11 +577,10 @@ if (isset($prestudent_id)) '.$p->t('testtool/klickenSieAufEinTeilgebiet').' '; - if($pruefling->pruefling_id!='') { $_SESSION['pruefling_id']=$pruefling->pruefling_id; - echo ''; + //echo ''; } } else diff --git a/cis/testtool/menu.php b/cis/testtool/menu.php index 1f364cc6f..84cddcdc3 100644 --- a/cis/testtool/menu.php +++ b/cis/testtool/menu.php @@ -283,7 +283,7 @@ if (isset($_SESSION['pruefling_id'])) $result = $db->db_query($qry); $lastsemester = ''; $quereinsteiger_stg = ''; - + $gebiet_hasMathML = false; // true, wenn irgendein Gebiet eine/n Frage/Vorschlag im MathML-Format enthält while($row = $db->db_fetch_object($result)) { //Jedes Semester in einer eigenen Tabelle anzeigen @@ -323,6 +323,13 @@ if (isset($_SESSION['pruefling_id'])) } $gebiet = new gebiet(); + + // Prüfen, ob das Gebiet eine/n Frage/Vorschlag im MathML-Format enthält + if (!$gebiet_hasMathML) // sobald nur ein MathML Format gefunden, variable nicht mehr überschreiben + { + $gebiet_hasMathML = $gebiet->hasMathML($row->gebiet_id); + } + if($gebiet->check_gebiet($row->gebiet_id)) { //Status der Gebiete Pruefen @@ -401,4 +408,29 @@ else } ?> + + diff --git a/include/gebiet.class.php b/include/gebiet.class.php index 8983100ce..d421a9d4c 100644 --- a/include/gebiet.class.php +++ b/include/gebiet.class.php @@ -825,5 +825,68 @@ class gebiet extends basis_db return true; } } + + /** + * Prueft, ob das Gebiet zumindest eine Frage oder einen Vorschlag im MathML Format hat. + * @param $gebiet_id + * return true, wenn Gebiet eine/n Frage/Vorschlag im MathML Format enthält. + */ + public function hasMathML($gebiet_id) + { + if (is_numeric($gebiet_id)) + { + $qry = ' + WITH + fragen AS ( + SELECT DISTINCT + frage_id + FROM + testtool.tbl_frage + JOIN + testtool.tbl_gebiet USING (gebiet_id) + WHERE + tbl_gebiet.gebiet_id = '. $this->db_add_param($gebiet_id, FHC_INTEGER). ' + ), + vorschlaege AS ( + SELECT DISTINCT + vorschlag_id + FROM + testtool.tbl_vorschlag + JOIN + fragen USING (frage_id) + ) + + SELECT + 1 + FROM + testtool.tbl_frage_sprache + JOIN + fragen USING (frage_id) + WHERE + SUBSTRING(text, \'MathML\') IS NOT NULL + + UNION + + SELECT + 1 + FROM + testtool.tbl_vorschlag_sprache + JOIN + vorschlaege USING (vorschlag_id) + WHERE + SUBSTRING(text, \'MathML\') IS NOT NULL + '; + + if($result = $this->db_query($qry)) + { + return ($this->db_num_rows($result) > 0); + } + } + else + { + $this->errormsg = 'Eine numerische gebiet_id muss übergeben werden.'; + return false; + } + } } ?>