From 3d224123214aff06788b042c6a14f2d0e6c6626f Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Mon, 14 Jun 2021 18:39:29 +0200 Subject: [PATCH] added parameters aktiv, lehre, offiziell, positiv to getByPerson method of Zeugnisnote_model.php --- .../models/education/Zeugnisnote_model.php | 44 ++++++++++++++++--- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/application/models/education/Zeugnisnote_model.php b/application/models/education/Zeugnisnote_model.php index 1b2081148..306f56e8c 100644 --- a/application/models/education/Zeugnisnote_model.php +++ b/application/models/education/Zeugnisnote_model.php @@ -17,23 +17,55 @@ class Zeugnisnote_model extends DB_Model * Gets Pruefungen of a person for a Studiensemester. * @param int $person_id * @param string $studiensemester_kurzbz + * @param bool $aktiv + * @param bool $lehre + * @param bool $offiziell + * @param bool $positiv * @return object */ - public function getByPerson($person_id, $studiensemester_kurzbz) + public function getByPerson($person_id, $studiensemester_kurzbz, $aktiv = true, $lehre = null, $offiziell = null, $positiv = null) { + $params = array($person_id, $studiensemester_kurzbz); + $qry = ' - SELECT note.*, pers.matr_nr, lv.ects, stg.studiengang_kz, prst.prestudent_id, stg.erhalter_kz, + SELECT zgnisnote.*, pers.matr_nr, lv.ects, stg.studiengang_kz, prst.prestudent_id, stg.erhalter_kz, UPPER(stg.typ||stg.kurzbz) AS studiengang, stg.bezeichnung AS studiengang_bezeichnung FROM public.tbl_person pers JOIN public.tbl_prestudent prst USING (person_id) JOIN public.tbl_student USING (prestudent_id) - JOIN lehre.tbl_zeugnisnote note USING (student_uid) + JOIN lehre.tbl_zeugnisnote zgnisnote USING (student_uid) + JOIN lehre.tbl_note note ON zgnisnote.note = note.note JOIN lehre.tbl_lehrveranstaltung lv USING (lehrveranstaltung_id) JOIN public.tbl_studiengang stg ON prst.studiengang_kz = stg.studiengang_kz WHERE pers.person_id = ? - AND note.studiensemester_kurzbz = ? - ORDER BY note.benotungsdatum'; + AND zgnisnote.studiensemester_kurzbz = ?'; - return $this->execQuery($qry, array($person_id, $studiensemester_kurzbz)); + if (isset($aktiv)) + { + $qry .= ' AND note.aktiv = ?'; + $params[] = $aktiv; + } + + if (isset($lehre)) + { + $qry .= ' AND note.lehre = ?'; + $params[] = $lehre; + } + + if (isset($offiziell)) + { + $qry .= ' AND note.offiziell = ?'; + $params[] = $offiziell; + } + + if (isset($positiv)) + { + $qry .= ' AND note.positiv = ?'; + $params[] = $positiv; + } + + $qry .= ' ORDER BY zgnisnote.benotungsdatum'; + + return $this->execQuery($qry, $params); } }