From 5b369f70206d7a6d9b0106c846a99a2347e1e5e0 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Mon, 29 Mar 2021 18:49:41 +0200 Subject: [PATCH] Zaugnisnote_model: added getByPerson method --- .../models/education/Zeugnisnote_model.php | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/application/models/education/Zeugnisnote_model.php b/application/models/education/Zeugnisnote_model.php index 7ed0e6456..08c4beca1 100644 --- a/application/models/education/Zeugnisnote_model.php +++ b/application/models/education/Zeugnisnote_model.php @@ -12,4 +12,28 @@ class Zeugnisnote_model extends DB_Model $this->pk = array('studiensemester_kurzbz', 'student_uid', 'lehrveranstaltung_id'); $this->hasSequence = false; } + + /** + * Gets Pruefungen of a person for a Studiensemester. + * @param int $person_id + * @param string $studiensemester_kurzbz + * @return object + */ + public function getByPerson($person_id, $studiensemester_kurzbz) + { + $qry = ' + SELECT note.*, pers.matr_nr, lv.ects, stg.studiengang_kz, prst.prestudent_id, + 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_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'; + + return $this->execQuery($qry, array($person_id, $studiensemester_kurzbz)); + } }