Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions components/ILIAS/TestQuestionPool/classes/class.assQuestionGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,17 @@ public function outQuestionType(): string
}
}

return $this->getQuestionTypeTranslation();
}

private function getQuestionTypeTranslation(): string
{
$question_properties = $this->questionrepository->getForQuestionId($this->object->getId());
$type_name = $question_properties?->getTypeName($this->lng);
if ($type_name !== null && $type_name !== '') {
return $type_name;
}

return $this->lng->txt($this->object->getQuestionType());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ public function load(): void
$row['description'] = $tags_trafo->transform($row['description'] ?? '');
$row['author'] = $tags_trafo->transform($row['author']);
$row['taxonomies'] = $this->loadTaxonomyAssignmentData($row['obj_fi'], $row['question_id']);
$row['ttype'] = $this->lng->txt($row['type_tag']);
$row['ttype'] = $this->getQuestionTypeTranslation($row);
$row['feedback'] = $row['feedback'] === 1;
$row['hints'] = $row['hints'] === 1;
$row['comments'] = $this->getNumberOfCommentsForQuestion($row['question_id']);
Expand Down Expand Up @@ -699,6 +699,22 @@ private function isActiveQuestionType(array $questionData): bool
->isActive();
}

private function getQuestionTypeTranslation(array $questionData): string
{
if (!($questionData['plugin'] ?? false)) {
return $this->lng->txt($questionData['type_tag']);
}

global $DIC;
foreach ($DIC['component.factory']->getActivePluginsInSlot('qst') as $plugin) {
if ($plugin->getQuestionType() === $questionData['type_tag']) {
return $plugin->getQuestionTypeTranslation();
}
}

return $this->lng->txt($questionData['type_tag']);
}

public function getDataArrayForQuestionId(int $questionId)
{
return $this->questions[$questionId];
Expand Down
Loading