Exercise: Display audio player in notification message - refs BT#21747

pull/5555/head
christianbeeznst 1 year ago
parent 044cb7a839
commit 7683cc9076
  1. 12
      public/main/exercise/exercise.class.php
  2. 4
      public/main/inc/lib/exercise.lib.php

@ -3629,17 +3629,9 @@ class Exercise
$nbrAnswers = 1; $nbrAnswers = 1;
} }
$generatedFiles = [];
if ($answerType == ORAL_EXPRESSION) {
$generatedFiles = ExerciseLib::getOralFileAudio($exeId, $questionId, true);
}
$generatedFilesHtml = ''; $generatedFilesHtml = '';
if (!empty($generatedFiles)) { if ($answerType == ORAL_EXPRESSION) {
foreach ($generatedFiles as $fileUrl) { $generatedFilesHtml = ExerciseLib::getOralFileAudio($exeId, $questionId);
$generatedFilesHtml .= '<a href="'.$fileUrl.'">'.$fileUrl.'</a><br />';
}
} }
$user_answer = ''; $user_answer = '';

@ -5138,10 +5138,10 @@ EOT;
return $returnUrls ? [] : ''; return $returnUrls ? [] : '';
} }
$basePath = rtrim(api_get_path(WEB_PATH), '/');
$assetRepo = Container::getAssetRepository(); $assetRepo = Container::getAssetRepository();
if ($returnUrls) { if ($returnUrls) {
$basePath = rtrim(api_get_path(WEB_PATH), '/');
$urls = []; $urls = [];
foreach ($questionAttempt->getAttemptFiles() as $attemptFile) { foreach ($questionAttempt->getAttemptFiles() as $attemptFile) {
$urls[] = $basePath.$assetRepo->getAssetUrl($attemptFile->getAsset()); $urls[] = $basePath.$assetRepo->getAssetUrl($attemptFile->getAsset());
@ -5155,7 +5155,7 @@ EOT;
'audio', 'audio',
'', '',
[ [
'src' => $assetRepo->getAssetUrl($attemptFile->getAsset()), 'src' => $basePath.$assetRepo->getAssetUrl($attemptFile->getAsset()),
'controls' => '', 'controls' => '',
] ]
); );

Loading…
Cancel
Save