From a81098f884c885cac73f58153ea96cc6f92a7e78 Mon Sep 17 00:00:00 2001 From: Cris Date: Thu, 1 Aug 2019 15:38:33 +0200 Subject: [PATCH] Added method getSTGLByUID(uid) to Benutzerfunktion_model The method getSTGLByUID(uid) gets information of all STG of which a given user is in charge of as a study course manager. --- .../models/person/Benutzerfunktion_model.php | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/application/models/person/Benutzerfunktion_model.php b/application/models/person/Benutzerfunktion_model.php index 02a27e87a..30abfdf51 100644 --- a/application/models/person/Benutzerfunktion_model.php +++ b/application/models/person/Benutzerfunktion_model.php @@ -104,4 +104,38 @@ class Benutzerfunktion_model extends DB_Model return $this->execQuery($query, $parametersArray); } + + /** + * Get active Studiengangsleitung(en) of the user by UID. + * @param $uid + */ + public function getSTGLByUID($uid) + { + $query = ' + SELECT + uid, + oe_kurzbz, + studiengang_kz, + typ, + tbl_studiengang.bezeichnung + FROM + public.tbl_benutzerfunktion + JOIN public.tbl_studiengang USING (oe_kurzbz) + WHERE + funktion_kurzbz = \'Leitung\' + AND (datum_von IS NULL OR datum_von <= now()) + AND (datum_bis IS NULL OR datum_bis >= now()) + AND uid = ? + ORDER BY + oe_kurzbz + '; + + $parameters_array = array(); + if (is_string($uid)) + { + $parameters_array[] = $uid; + } + + return $this->execQuery($query, $parameters_array); + } }