diff --git a/cis/testtool/login.php b/cis/testtool/login.php index 60447ee52..4b8acb228 100644 --- a/cis/testtool/login.php +++ b/cis/testtool/login.php @@ -632,6 +632,7 @@ elseif (isset($prestudent_id)) $ps_obj->lastStatus = $ps_tmp->status_kurzbz; // letzten Status dem result array hinzufügen $ps_obj->status_mehrsprachig = $ps_tmp->status_mehrsprachig; + $ps_obj->ausbildungssemester = $ps_tmp->ausbildungssemester; } // Falls Status 'Abgewiesene' vorhanden, nach hinten reihen diff --git a/cis/testtool/menu.php b/cis/testtool/menu.php index fb28825de..ca85daf45 100644 --- a/cis/testtool/menu.php +++ b/cis/testtool/menu.php @@ -29,6 +29,7 @@ require_once('../../include/sprache.class.php'); require_once '../../include/phrasen.class.php'; require_once '../../include/studiengang.class.php'; require_once('../../include/gebiet.class.php'); +require_once('../../include/gebiet_pruefling.class.php'); if (!$db = new basis_db()) die('Fehler beim Oeffnen der Datenbankverbindung'); @@ -198,8 +199,8 @@ else if (isset($_SESSION['pruefling_id'])) ) - SELECT DISTINCT ON - (gebiet_id, semester, reihung) + SELECT * FROM (SELECT DISTINCT ON + (gebiet_id) semester, gebiet_id, STRING_AGG(studiengang_kz::TEXT, ', ' ORDER BY studiengang_kz) AS studiengang_kz_list, @@ -226,13 +227,7 @@ else if (isset($_SESSION['pruefling_id'])) JOIN testtool.tbl_gebiet USING (gebiet_id) WHERE - ( - (prestudent_data.semester= 1 AND tbl_ablauf.semester = 1) - OR - (prestudent_data.semester= 2 AND tbl_ablauf.semester = 2) - OR - (prestudent_data.semester= 3 AND tbl_ablauf.semester IN (1,3)) - ) + tbl_ablauf.semester <= prestudent_data.semester AND ( prestudent_data.studienplan_id = tbl_ablauf.studienplan_id OR @@ -259,9 +254,7 @@ else if (isset($_SESSION['pruefling_id'])) JOIN testtool.tbl_gebiet USING (gebiet_id) WHERE - (prestudent_data.semester= 1 AND tbl_ablauf.semester = 1) - OR - (prestudent_data.semester= 3 AND tbl_ablauf.semester IN (1,3)) + tbl_ablauf.semester <= prestudent_data.semester ) ) temp ) temp2 @@ -270,7 +263,7 @@ else if (isset($_SESSION['pruefling_id'])) semester, gebiet_id, bezeichnung, - ". $bezeichnung_mehrsprachig_sel ." + ". $bezeichnung_mehrsprachig_sel ." ) temp3 ORDER BY semester, @@ -283,6 +276,8 @@ else if (isset($_SESSION['pruefling_id'])) $lastsemester = ''; $quereinsteiger_stg = ''; $_SESSION['alleGebiete']= []; + $gebiet_pruefling = new gebiet_pruefling(); + $quereinsteiger_menu = false; while($row = $db->db_fetch_object($result)) { //Jedes Semester in einer eigenen Tabelle anzeigen @@ -294,8 +289,25 @@ else if (isset($_SESSION['pruefling_id'])) } $lastsemester = $row->semester; - echo ''; - echo ''; + if ($row->semester == '1') + { + // Basisgebiete anzeigen + echo '
'. ($row->semester == '1' ? $p->t('testtool/basisgebiete') : $p->t('testtool/quereinstiegsgebiete')).'
'; + echo ''; + } + else + { + if (!$quereinsteiger_menu) + { + echo '
' . $p->t('testtool/basisgebiete') . '
'; + echo ''; + $quereinsteiger_menu = true; + } + else + { + echo '
' . $p->t('testtool/quereinstiegsgebiete') . '
'; + } + } } // Bei Quereinstiegsgebieten nach STG clustern und die STG anzeigen @@ -394,6 +406,12 @@ else if (isset($_SESSION['pruefling_id'])) '; + if (!$gebiet_pruefling->checkIfExists($_SESSION['pruefling_id'], $row->gebiet_id)) + { + $gebiet_pruefling->pruefling_id = $_SESSION['pruefling_id']; + $gebiet_pruefling->gebiet_id = $row->gebiet_id; + $gebiet_pruefling->saveGebietForPruefling(); + } $_SESSION['alleGebiete'][] = $row->gebiet_id; } else diff --git a/include/gebiet_pruefling.class.php b/include/gebiet_pruefling.class.php new file mode 100644 index 000000000..9578bb546 --- /dev/null +++ b/include/gebiet_pruefling.class.php @@ -0,0 +1,97 @@ +db_add_param($pruefling_id, FHC_INTEGER); + + if($this->db_query($qry)) + { + if($row = $this->db_fetch_object()) + { + $this->prueflinggebiet_id = $row->prueflinggebiet_id; + $this->pruefling_id = $row->pruefling_id; + $this->gebiet_id = $row->gebiet_id; + return true; + } + else + { + $this->errormsg = "Pruefling nicht gefunden"; + return false; + } + } + else + { + $this->errormsg = "Fehler beim Laden der Gebiete für den Pruefling"; + return false; + } + } + + public function checkIfExists($pruefling_id, $gebiet_id) + { + $qry = "SELECT 1 + FROM testtool.tbl_pruefling_gebiet + WHERE pruefling_id =".$this->db_add_param($pruefling_id, FHC_INTEGER) ." AND gebiet_id =".$this->db_add_param($gebiet_id, FHC_INTEGER); + + if ($result = $this->db_query($qry)) + { + if ($this->db_num_rows($result) > 0) + return true; + else + return false; + } + } + + public function saveGebietForPruefling() + { + $qry = "INSERT INTO testtool.tbl_pruefling_gebiet + (pruefling_id, gebiet_id) + VALUES(". + $this->db_add_param($this->pruefling_id, FHC_INTEGER).','. + $this->db_add_param($this->gebiet_id, FHC_INTEGER).');'; + + if ($this->db_query($qry)) + { + return true; + } + else + { + $this->errormsg = 'Fehler beim Speichern der Daten'; + return true; + } + } + +} +?> diff --git a/system/dbupdate_3.4.php b/system/dbupdate_3.4.php index 2832feda6..0392937ec 100644 --- a/system/dbupdate_3.4.php +++ b/system/dbupdate_3.4.php @@ -102,6 +102,8 @@ require_once('dbupdate_3.4/75959_StudVw_Automatische_Tags.php'); require_once('dbupdate_3.4/76160_lvv_favorites.php'); require_once('dbupdate_3.4/77080_tabulator_presets_table.php'); require_once('dbupdate_3.4/78292_gehaltsanpassungtyp.php'); +require_once('dbupdate_3.4/54225_reihungstest_ablauf_fuer_quereinsteiger.php'); + // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo '

Pruefe Tabellen und Attribute!

'; @@ -253,7 +255,7 @@ $tabellen=array( "hr.tbl_lohnguide_modellfunktion" => array("modellfunktion_kurzbz", "bezeichnung", "jobfamilie_kurzbz", "aktiv", "sort", "insertvon", "insertamum", "updatevon", "updateamum"), "hr.tbl_lohnguide_modellstelle" => array("modellstelle_kurzbz", "bezeichnung", "grade", "modellfunktion_kurzbz", "aktiv", "sort", "insertvon", "insertamum", "updatevon", "updateamum"), "hr.tbl_lohnguide_fachrichtung" => array("fachrichtung_kurzbz", "bezeichnung", "aktiv", "insertvon", "insertamum", "updatevon", "updateamum"), - "hr.tbl_vertragsbestandteil_lohnguide" => array("vertragsbestandteil_id", "stellenbezeichnung", "vordienstzeit", "fachrichtung_kurzbz", "modellstelle_kurzbz", "kommentar_person", "kommentar_modellstelle"), + "hr.tbl_vertragsbestandteil_lohnguide" => array("vertragsbestandteil_id", "stellenbezeichnung", "vordienstzeit", "fachrichtung_kurzbz", "modellstelle_kurzbz", "kommentar_person", "kommentar_modellstelle"), "lehre.tbl_abschlussbeurteilung" => array("abschlussbeurteilung_kurzbz","bezeichnung","bezeichnung_english","sort"), "lehre.tbl_abschlusspruefung" => array("abschlusspruefung_id","student_uid","vorsitz","pruefer1","pruefer2","pruefer3","abschlussbeurteilung_kurzbz","akadgrad_id","pruefungstyp_kurzbz","datum","uhrzeit","sponsion","anmerkung","updateamum","updatevon","insertamum","insertvon","ext_id","note","protokoll","endezeit","pruefungsantritt_kurzbz","freigabedatum"), "lehre.tbl_abschlusspruefung_antritt" => array("pruefungsantritt_kurzbz","bezeichnung","bezeichnung_english","sort"), @@ -421,6 +423,7 @@ $tabellen=array( "testtool.tbl_pruefling_frage" => array("prueflingfrage_id","pruefling_id","frage_id","nummer","begintime","endtime"), "testtool.tbl_frage_sprache" => array("frage_id","sprache","text","bild","audio","insertamum","insertvon","updateamum","updatevon"), "testtool.tbl_vorschlag_sprache" => array("vorschlag_id","sprache","text","bild","audio","insertamum","insertvon","updateamum","updatevon"), + "testtool.tbl_pruefling_gebiet" => array("prueflinggebiet_id","pruefling_id","gebiet_id","insertamum"), "system.tbl_app" => array("app"), "system.tbl_appdaten" => array("appdaten_id","uid","app","appversion","version","bezeichnung","daten","freigabe","insertamum","insertvon","updateamum","updatevon"), "system.tbl_cronjob" => array("cronjob_id","server_kurzbz","titel","beschreibung","file","last_execute","aktiv","running","jahr","monat","tag","wochentag","stunde","minute","standalone","reihenfolge","updateamum", "updatevon","insertamum","insertvon","variablen"), diff --git a/system/dbupdate_3.4/54225_reihungstest_ablauf_fuer_quereinsteiger.php b/system/dbupdate_3.4/54225_reihungstest_ablauf_fuer_quereinsteiger.php new file mode 100644 index 000000000..41532cfe0 --- /dev/null +++ b/system/dbupdate_3.4/54225_reihungstest_ablauf_fuer_quereinsteiger.php @@ -0,0 +1,41 @@ +db_query('SELECT 1 FROM testtool.tbl_pruefling_gebiet LIMIT 1')) +{ + $qry = 'CREATE TABLE testtool.tbl_pruefling_gebiet + ( + prueflinggebiet_id integer NOT NULL, + pruefling_id integer NOT NULL, + gebiet_id integer NOT NULL, + insertamum timestamp DEFAULT now() + ); + + ALTER TABLE testtool.tbl_pruefling_gebiet OWNER TO fhcomplete; + ALTER TABLE testtool.tbl_pruefling_gebiet ADD CONSTRAINT pk_tbl_pruefling_gebiet PRIMARY KEY (prueflinggebiet_id); + ALTER TABLE testtool.tbl_pruefling_gebiet ADD CONSTRAINT fk_tbl_pruefling_gebiet_pruefling_id FOREIGN KEY (pruefling_id) REFERENCES testtool.tbl_pruefling(pruefling_id) ON UPDATE CASCADE ON DELETE RESTRICT; + ALTER TABLE testtool.tbl_pruefling_gebiet ADD CONSTRAINT fk_tbl_pruefling_gebiet_gebiet_id FOREIGN KEY (gebiet_id) REFERENCES testtool.tbl_gebiet(gebiet_id) ON UPDATE CASCADE ON DELETE RESTRICT; + + CREATE SEQUENCE testtool.tbl_pruefling_gebiet_prueflinggebiet_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + ALTER TABLE testtool.tbl_pruefling_gebiet_prueflinggebiet_id_seq OWNER TO fhcomplete; + ALTER TABLE testtool.tbl_pruefling_gebiet ALTER COLUMN prueflinggebiet_id SET DEFAULT nextval(\'testtool.tbl_pruefling_gebiet_prueflinggebiet_id_seq\'); + + GRANT SELECT, UPDATE, INSERT, DELETE ON testtool.tbl_pruefling_gebiet TO web; + GRANT SELECT, UPDATE, INSERT, DELETE ON testtool.tbl_pruefling_gebiet TO vilesci; + GRANT SELECT, UPDATE ON testtool.tbl_pruefling_gebiet_prueflinggebiet_id_seq TO vilesci; + GRANT SELECT, UPDATE ON testtool.tbl_pruefling_gebiet_prueflinggebiet_id_seq TO web; + '; + + if (!$db->db_query($qry)) + echo 'public.tbl_pruefling_gebiet: '.$db->db_last_error().'
'; + else + echo '
public.tbl_pruefling_gebiet table created'; +} + diff --git a/vilesci/stammdaten/auswertung_fhtw.php b/vilesci/stammdaten/auswertung_fhtw.php index 690dedc2d..51a80049a 100644 --- a/vilesci/stammdaten/auswertung_fhtw.php +++ b/vilesci/stammdaten/auswertung_fhtw.php @@ -251,6 +251,31 @@ if ($deleteSingleResult) exit(); } + $qry = "SELECT * FROM testtool.tbl_pruefling_gebiet + WHERE pruefling_id=" . $db->db_add_param($pruefling->pruefling_id) . " AND gebiet_id=" . $db->db_add_param($_POST['gebiet_id']) . ""; + + if ($db->db_query($qry)) + { + while ($row = $db->db_fetch_object()) + { + $undo .= " INSERT INTO testtool.tbl_pruefling_gebiet(prueflinggebiet_id,pruefling_id,gebiet_id, insertamum) VALUES (" . + $db->db_add_param($row->prueflinggebiet_id, FHC_INTEGER) . ', ' . + $db->db_add_param($row->pruefling_id, FHC_INTEGER) . ', ' . + $db->db_add_param($row->gebiet_id, FHC_INTEGER) . ', ' . + $db->db_add_param($row->insertamum) . ');'; + } + } + else + { + $db->db_query('ROLLBACK'); + echo json_encode(array( + 'status' => 'fehler', + 'msg' => 'Fehler beim Erstellen des UNDO Befehls fuer testtool.tbl_pruefling_gebiet' + )); + exit(); + } + + //Antworten loeschen $qry = "DELETE FROM testtool.tbl_pruefling_frage where pruefling_id=" . $db->db_add_param($pruefling->pruefling_id, FHC_INTEGER) . " AND frage_id IN (SELECT frage_id FROM testtool.tbl_frage WHERE gebiet_id=" . $db->db_add_param($_POST['gebiet_id']) . "); @@ -258,7 +283,9 @@ if ($deleteSingleResult) DELETE FROM testtool.tbl_antwort WHERE pruefling_id=" . $db->db_add_param($pruefling->pruefling_id) . " AND vorschlag_id IN (SELECT vorschlag_id FROM testtool.tbl_vorschlag WHERE frage_id IN - (SELECT frage_id FROM testtool.tbl_frage WHERE gebiet_id=" . $db->db_add_param($_POST['gebiet_id']) . "));"; + (SELECT frage_id FROM testtool.tbl_frage WHERE gebiet_id=" . $db->db_add_param($_POST['gebiet_id']) . ")); + + DELETE FROM testtool.tbl_pruefling_gebiet where pruefling_id=" . $db->db_add_param($pruefling->pruefling_id, FHC_INTEGER) . " AND gebiet_id=" . $db->db_add_param($_POST['gebiet_id']) . ";"; if ($result = $db->db_query($qry)) { @@ -388,9 +415,35 @@ if ($deleteAllResults) exit(); } + $qry = "SELECT * FROM testtool.tbl_pruefling_gebiet WHERE pruefling_id=" . $db->db_add_param($pruefling->pruefling_id, FHC_INTEGER) . "; + "; + + if ($db->db_query($qry)) + { + while ($row = $db->db_fetch_object()) + { + $undo .= " INSERT INTO testtool.tbl_pruefling_gebiet(prueflinggebiet_id,pruefling_id,gebiet_id,insertamum) VALUES (" . + $db->db_add_param($row->prueflinggebiet_id, FHC_INTEGER) . ', ' . + $db->db_add_param($row->pruefling_id, FHC_INTEGER) . ', ' . + $db->db_add_param($row->gebiet_id, FHC_INTEGER) . ', ' . + $db->db_add_param($row->insertamum) . ');'; + } + } + else + { + $db->db_query('ROLLBACK'); + echo json_encode(array( + 'status' => 'fehler', + 'msg' => 'Fehler beim Erstellen des UNDO Befehls fuer testtool.tbl_pruefling_gebiet' + )); + exit(); + } + + //Antworten loeschen $qry = " DELETE FROM testtool.tbl_pruefling_frage where pruefling_id=".$db->db_add_param($pruefling->pruefling_id)."; - DELETE FROM testtool.tbl_antwort WHERE pruefling_id=".$db->db_add_param($pruefling->pruefling_id).";"; + DELETE FROM testtool.tbl_antwort where pruefling_id=".$db->db_add_param($pruefling->pruefling_id)."; + DELETE FROM testtool.tbl_pruefling_gebiet WHERE pruefling_id=".$db->db_add_param($pruefling->pruefling_id).";"; if ($result = $db->db_query($qry)) { diff --git a/vilesci/stammdaten/reihungstest_administration.php b/vilesci/stammdaten/reihungstest_administration.php index 6fbf3e5c0..9adf717e3 100644 --- a/vilesci/stammdaten/reihungstest_administration.php +++ b/vilesci/stammdaten/reihungstest_administration.php @@ -402,7 +402,10 @@ if(isset($_POST['deleteteilgebiet'])) DELETE FROM testtool.tbl_antwort WHERE pruefling_id=".$db->db_add_param($pruefling->pruefling_id)." AND vorschlag_id IN (SELECT vorschlag_id FROM testtool.tbl_vorschlag WHERE frage_id IN - (SELECT frage_id FROM testtool.tbl_frage WHERE gebiet_id=".$db->db_add_param($_POST['gebiet'])."));"; + (SELECT frage_id FROM testtool.tbl_frage WHERE gebiet_id=".$db->db_add_param($_POST['gebiet']).")); + + DELETE FROM testtool.tbl_pruefling_gebiet + WHERE pruefling_id=".$db->db_add_param($pruefling->pruefling_id)." AND gebiet_id=".$db->db_add_param($_POST['gebiet']).";"; if($result = $db->db_query($qry)) { @@ -497,7 +500,8 @@ if(isset($_POST['delete_all'])) } //Gebiet loeschen $qry = "DELETE FROM testtool.tbl_pruefling_frage where pruefling_id=".$db->db_add_param($pruefling->pruefling_id)."; - DELETE FROM testtool.tbl_antwort WHERE pruefling_id=".$db->db_add_param($pruefling->pruefling_id).";"; + DELETE FROM testtool.tbl_antwort WHERE pruefling_id=".$db->db_add_param($pruefling->pruefling_id)."; + DELETE FROM testtool.tbl_pruefling_gebiet WHERE pruefling_id=".$db->db_add_param($pruefling->pruefling_id).";"; if($result = $db->db_query($qry)) {