From 4b468ca58b1e648a61b7859774b2738a5d62b1ff Mon Sep 17 00:00:00 2001 From: Thomas Hackl <hackl@data-quest.de> Date: Tue, 21 Jun 2022 14:33:44 +0000 Subject: [PATCH] Resolve "Export der Teilnehmerliste: Call to a member function getClass() on null" Closes #1192 Merge request studip/studip!706 --- lib/export/export_studipdata_func.inc.php | 12 +++++++----- lib/functions.php | 12 ++++-------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/lib/export/export_studipdata_func.inc.php b/lib/export/export_studipdata_func.inc.php index 360e068b54a..32f61efad27 100644 --- a/lib/export/export_studipdata_func.inc.php +++ b/lib/export/export_studipdata_func.inc.php @@ -579,12 +579,14 @@ function export_teilis($inst_id, $ex_sem_id = "no") } else { if (!in_array($filter, words('awaiting claiming'))) { + $course = Course::find($range_id); + $gruppe = [ - 'dozent' => get_title_for_status('dozent', 2), - 'tutor' => get_title_for_status('tutor', 2), - 'autor' => get_title_for_status('autor', 2), - 'user' => get_title_for_status('user', 2), - 'accepted' => get_title_for_status('accepted', 2) + 'dozent' => get_title_for_status('dozent', 2, $course->status), + 'tutor' => get_title_for_status('tutor', 2, $course->status), + 'autor' => get_title_for_status('autor', 2, $course->status), + 'user' => get_title_for_status('user', 2, $course->status), + 'accepted' => get_title_for_status('accepted', 2, $course->status) ]; } else { $gruppe[$filter] = _('Anmeldeliste'); diff --git a/lib/functions.php b/lib/functions.php index b2cb073f5a5..a6b8f6d8173 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -1165,7 +1165,7 @@ function encode_header_parameter($name, $value) */ function get_title_for_status($type, $count, $sem_type = NULL) { - global $SEM_TYPE, $DEFAULT_TITLE_FOR_STATUS; + global $SEM_CLASS, $SEM_TYPE, $DEFAULT_TITLE_FOR_STATUS; if (is_null($sem_type)) { $sem_type = Context::getArtNum(); @@ -1173,14 +1173,10 @@ function get_title_for_status($type, $count, $sem_type = NULL) $atype = 'title_'.$type; $index = $count == 1 ? 0 : 1; + $class_index = $count == 1 ? $atype : $atype . '_plural'; - $class = $SEM_TYPE[$sem_type]->getClass(); - - $title = $class->offsetGet($count == 1 ? $atype : $atype . '_plural'); - - if (!$title) { - $title = $DEFAULT_TITLE_FOR_STATUS[$type][$index] ?: _('unbekannt'); - } + $title = $SEM_CLASS[$SEM_TYPE[$sem_type]['class']][$class_index] ?? + $DEFAULT_TITLE_FOR_STATUS[$type][$index] ?? _('unbekannt'); return $title; } -- GitLab