aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/shared
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2024-02-09 10:44:37 +0000
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2024-02-09 10:44:37 +0000
commitab835716d0be03463dba0b585b2c751160f7e7c0 (patch)
tree26cf2c19723a307c93b955ac08c8a79ceee77ede /app/controllers/shared
parentd06bae663d7d08b5d3f5eab0da87a0fa85f6febf (diff)
prevent php8 warnings, fixes #3732
Closes #3732 Merge request studip/studip!2594
Diffstat (limited to 'app/controllers/shared')
-rw-r--r--app/controllers/shared/modul.php21
1 files changed, 12 insertions, 9 deletions
diff --git a/app/controllers/shared/modul.php b/app/controllers/shared/modul.php
index 0c3a39b..d1a6ecf 100644
--- a/app/controllers/shared/modul.php
+++ b/app/controllers/shared/modul.php
@@ -63,7 +63,7 @@ class Shared_ModulController extends AuthenticatedController
$sws += (int) $modulTeil->sws;
- $num_bezeichnung = $GLOBALS['MVV_MODULTEIL']['NUM_BEZEICHNUNG']['values'][$modulTeil->num_bezeichnung]['name'];
+ $num_bezeichnung = $GLOBALS['MVV_MODULTEIL']['NUM_BEZEICHNUNG']['values'][$modulTeil->num_bezeichnung]['name'] ?? '';
$name_kurz = sprintf('%s %d', $num_bezeichnung, $modulTeil->nummer);
@@ -94,7 +94,7 @@ class Shared_ModulController extends AuthenticatedController
$this->semester = $currentSemester;
$this->sws = $sws;
- $this->pruef_ebene = $GLOBALS['MVV_MODUL']['PRUEF_EBENE']['values'][$modul->pruef_ebene]['name'];
+ $this->pruef_ebene = $GLOBALS['MVV_MODUL']['PRUEF_EBENE']['values'][$modul->pruef_ebene]['name'] ?? null;
$this->modul = $modul;
$this->type = $type;
$this->self_url = $this->url_for('modul/show/' . $modul_id);
@@ -133,15 +133,18 @@ class Shared_ModulController extends AuthenticatedController
$this->semesterSelector = Semester::getSemesterSelector(null, $currentSemester['semester_id'], 'semester_id', false);
$this->modul = $modul;
- $this->pruefungsEbene = $GLOBALS['MVV_MODUL']['PRUEF_EBENE']['values'][$modul->pruef_ebene]['name'];
+ $this->pruefungsEbene = isset($GLOBALS['MVV_MODUL']['PRUEF_EBENE']['values'][$modul->pruef_ebene])
+ ? $GLOBALS['MVV_MODUL']['PRUEF_EBENE']['values'][$modul->pruef_ebene]['name']
+ : null;
$this->modulDeskriptor = $modul->getDeskriptor($display_language);
$this->startSemester = Semester::findByTimestamp($modul->start);
- if ($modul->responsible_institute) {
- if ($modul->responsible_institute->institute) {
- $this->instituteName = $modul->responsible_institute->institute->getValue('name');
- } else {
- $this->instituteName = _('Unbekannte Einrichtung');
- }
+
+ if (!$modul->responsible_institute) {
+ $this->instituteName = null;
+ } elseif ($modul->responsible_institute->institute) {
+ $this->instituteName = $modul->responsible_institute->institute->name;
+ } else {
+ $this->instituteName = _('Unbekannte Einrichtung');
}
$this->type = $type;
$this->semester = $currentSemester;