Exercise: Fix missing notification to general tutor for oral question - refs BT#21575

pull/5516/head
christianbeeznst 1 year ago
parent 54ef821c35
commit d5a718b161
  1. 2
      public/main/exercise/exercise.class.php
  2. 35
      public/main/inc/lib/exercise.lib.php

@ -3631,7 +3631,7 @@ class Exercise
$generatedFile = '';
if ($answerType == ORAL_EXPRESSION) {
$generatedFile = ExerciseLib::getOralFeedbackAudio($exeId, $questionId);
$generatedFile = ExerciseLib::getOralFileAudio($exeId, $questionId);
}
$user_answer = '';

@ -5110,6 +5110,41 @@ EOT;
return $view->fetch($template);
}
/**
* Get the HTML audio element for the oral file of a specific track exercise question attempt.
*/
public static function getOralFileAudio(int $trackExerciseId, int $questionId): string
{
/** @var TrackEExercise $trackExercise */
$trackExercise = Container::getTrackEExerciseRepository()->find($trackExerciseId);
if (null === $trackExercise) {
return '';
}
$questionAttempt = $trackExercise->getAttemptByQuestionId($questionId);
if (null === $questionAttempt) {
return '';
}
$assetRepo = Container::getAssetRepository();
$html = '';
foreach ($questionAttempt->getAttemptFiles() as $attemptFile) {
$html .= Display::tag(
'audio',
'',
[
'src' => $assetRepo->getAssetUrl($attemptFile->getAsset()),
'controls' => '',
]
);
}
return $html;
}
/**
* Get the audio component for a teacher audio feedback.
*/

Loading…
Cancel
Save