From 8b4c82c0e355fd8aa8875bc4e6e0ec3eb3917cc9 Mon Sep 17 00:00:00 2001 From: Robert Hofer Date: Fri, 20 Mar 2015 13:37:27 +0100 Subject: [PATCH] get types of a list of studiengaenge get zgv for all prestudents of one student --- include/prestudent.class.php | 47 +++++++++++++++++++++++++++++++++++ include/studiengang.class.php | 29 +++++++++++++++++++++ 2 files changed, 76 insertions(+) diff --git a/include/prestudent.class.php b/include/prestudent.class.php index 2c8949249..5596fdb7c 100644 --- a/include/prestudent.class.php +++ b/include/prestudent.class.php @@ -1080,6 +1080,53 @@ class prestudent extends person } } + /** + * Gibt die eingetragenen ZGV zurück + * @return array + */ + public function getZgv() { + + $zgv = array( + 'bachelor' => array(), + 'master' => array(), +// 'doktor' => array(), + ); + $attribute = array( + 'art', + 'ort', + 'datum', + ); + $db_attribute = array( + 'zgv_code', + 'zgvort', + 'zgvdatum', + 'zgvmas_code', + 'zgvmaort', + 'zgvmadatum', + 'zgvdoktor_code', + 'zgvdoktorort', + 'zgvdoktordatum', + ); + + foreach($this->result as $prestudent) { + + foreach($zgv as &$value) { + + foreach($attribute as $attribut) { + $db_attribute_name = current($db_attribute); + + if($prestudent->$db_attribute_name) { + $value[$attribut] = $prestudent->$db_attribute_name; + } + next($db_attribute); + } + } + reset($db_attribute); + } + + return $zgv; + } + /** * Liefert die Anzahl der Bewerber im ausgewaehlten Bereich * @param $studiensemester_kurzbz Studiensemester diff --git a/include/studiengang.class.php b/include/studiengang.class.php index 023e548c1..b7575bbe9 100644 --- a/include/studiengang.class.php +++ b/include/studiengang.class.php @@ -681,4 +681,33 @@ class studiengang extends basis_db return false; } } + + /** + * @param $studiengaenge array + * @return array|bool + */ + public function getTypes($studiengaenge) { + + $qry = 'SELECT distinct typ ' . + 'FROM public.tbl_studiengang ' . + 'WHERE studiengang_kz IN (' . implode(',', $studiengaenge) . ')'; + + $types = array(); + + if($result = $this->db_query($qry)) + { + while($row = $this->db_fetch_object($result)) { + + $types[] = $row->typ; + + } + + return $types; + } + else + { + $this->errormsg = "Fehler bei der Abfrage aufgetreten"; + return false; + } + } }