From 3293a75a79060ace6db8b1916eafb5d167aaea41 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Mon, 30 Jan 2023 11:51:15 +0100 Subject: [PATCH] - berechtigungsabfragen angepasst - fit programme aus der config holen --- .../system/infocenter/InfoCenter.php | 18 +++++++++++------- .../models/organisation/Studiengang_model.php | 13 ++++++++++--- .../views/system/infocenter/zgvpruefungen.php | 2 +- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index 48c50bb4a..29176d1ed 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -176,6 +176,8 @@ class InfoCenter extends Auth_Controller // Loads libraries $this->load->library('PersonLogLib'); $this->load->library('WidgetLib'); + + $this->load->config('infocenter'); $this->loadPhrases( array( @@ -1996,6 +1998,8 @@ class InfoCenter extends Auth_Controller $this->NationModel->addOrder('langtext'); $allNations = getData($this->NationModel->load()); + $additional_stg = explode(',', ($this->config->item('infocenter_studiengang_kz'))); + $data = array ( 'zgvpruefungen' => $zgvpruefungen, 'abwstatusgruende' => $abwstatusgruende, @@ -2004,6 +2008,7 @@ class InfoCenter extends Auth_Controller 'all_zgvs' => $allZGVs, 'all_zgvs_master' => $allZGVsMaster, 'all_nations' => $allNations, + 'additional_stg' => $additional_stg ); return $data; @@ -2262,12 +2267,10 @@ class InfoCenter extends Auth_Controller public function getAbsageData() { - $studiengang_kz_all = $this->permissionlib->getSTG_isEntitledFor('infocenter'); - $stg_typ = $this->StudiengangModel->getStudiengangTyp($studiengang_kz_all, ['b', 'm']); + $stg_typ = $this->getStudienArtBerechtigung(['b', 'm']); - if (hasData($stg_typ)) + if (!is_null($stg_typ)) { - $stg_typ = getData($stg_typ); $statusgruende = $this->StatusgrundModel->getStatus(self::ABGEWIESENERSTATUS, true)->retval; $studienSemester = $this->variablelib->getVar('infocenter_studiensemester'); $studiengaenge = $this->StudiengangModel->getStudiengaengeWithOrgForm(array_column($stg_typ, 'typ'), $studienSemester); @@ -2283,15 +2286,16 @@ class InfoCenter extends Auth_Controller $this->outputJsonSuccess(null); } - public function getStudienArtBerechtigung() + public function getStudienArtBerechtigung($typ = null) { $studiengang_kz_all = $this->permissionlib->getSTG_isEntitledFor('infocenter'); - $stg_typ = $this->StudiengangModel->getStudiengangTyp($studiengang_kz_all, ['b', 'm', 'l']); + $stg_typ = $this->StudiengangModel->getStudiengangTyp($studiengang_kz_all, $typ); return getData($stg_typ); } + public function getStudienartData() { - $this->outputJsonSuccess($this->getStudienArtBerechtigung()); + $this->outputJsonSuccess($this->getStudienArtBerechtigung(['b', 'm', 'l'])); } public function saveAbsageForAll() diff --git a/application/models/organisation/Studiengang_model.php b/application/models/organisation/Studiengang_model.php index e848cb4c2..f4f8b3c9e 100644 --- a/application/models/organisation/Studiengang_model.php +++ b/application/models/organisation/Studiengang_model.php @@ -508,13 +508,20 @@ class Studiengang_model extends DB_Model return $this->execQuery($query, array($typ, $semester)); } - public function getStudiengangTyp($studiengang_kz, $typ) + public function getStudiengangTyp($studiengang_kz, $typ = null) { $query = "SELECT DISTINCT(sgt.*) FROM tbl_studiengangstyp sgt JOIN tbl_studiengang sg on sgt.typ = sg.typ - WHERE studiengang_kz IN ? and sgt.typ IN ?"; + WHERE studiengang_kz IN ?"; - return $this->execQuery($query, array($studiengang_kz, $typ)); + $params[] = $studiengang_kz; + if (!is_null($typ)) + { + $query .= " AND sgt.typ IN ?"; + $params[] = $typ; + } + + return $this->execQuery($query, $params); } } diff --git a/application/views/system/infocenter/zgvpruefungen.php b/application/views/system/infocenter/zgvpruefungen.php index 2e6ea90d2..1d26b9d55 100644 --- a/application/views/system/infocenter/zgvpruefungen.php +++ b/application/views/system/infocenter/zgvpruefungen.php @@ -2,7 +2,7 @@ infoonly; $studiengangkurzbz = $studiengangbezeichnung = $studiengangtyp = '';