Exercise: Add new generated audio file link in exercise notifications - refs BT#21575

pull/5492/head
christianbeeznst 1 year ago
parent b63efa11ce
commit dcc4415812
  1. 7
      public/main/exercise/exercise.class.php
  2. 4
      public/main/exercise/exercise_show.php
  3. 13
      public/main/inc/lib/exercise.lib.php

@ -3629,6 +3629,11 @@ class Exercise
$nbrAnswers = 1; $nbrAnswers = 1;
} }
$generatedFile = '';
if ($answerType == ORAL_EXPRESSION) {
$generatedFile = ExerciseLib::getOralFeedbackAudio($exeId, $questionId);
}
$user_answer = ''; $user_answer = '';
// Get answer list for matching // Get answer list for matching
$sql = "SELECT iid, answer $sql = "SELECT iid, answer
@ -6143,7 +6148,7 @@ class Exercise
'open_question' => $arrques, 'open_question' => $arrques,
'open_answer' => $arrans, 'open_answer' => $arrans,
'answer_type' => $answerType, 'answer_type' => $answerType,
'generated_oral_file' => '', 'generated_oral_file' => $generatedFile,
'user_answered' => $userAnsweredQuestion, 'user_answered' => $userAnsweredQuestion,
'correct_answer_id' => $correctAnswerId, 'correct_answer_id' => $correctAnswerId,
'answer_destination' => $answerDestination, 'answer_destination' => $answerDestination,

@ -623,7 +623,7 @@ foreach ($questionList as $questionId) {
if (!empty($comnt)) { if (!empty($comnt)) {
echo ExerciseLib::getFeedbackText($comnt); echo ExerciseLib::getFeedbackText($comnt);
} }
echo ExerciseLib::getOralFeedbackAudio($id, $questionId, $student_id); echo ExerciseLib::getOralFeedbackAudio($id, $questionId);
echo '</div>'; echo '</div>';
echo '<div id="'.$name.'" class="row hidden">'; echo '<div id="'.$name.'" class="row hidden">';
@ -672,7 +672,7 @@ foreach ($questionList as $questionId) {
if (!empty($comnt)) { if (!empty($comnt)) {
echo '<b>'.get_lang('Feedback').'</b>'; echo '<b>'.get_lang('Feedback').'</b>';
echo ExerciseLib::getFeedbackText($comnt); echo ExerciseLib::getFeedbackText($comnt);
echo ExerciseLib::getOralFeedbackAudio($id, $questionId, $student_id); echo ExerciseLib::getOralFeedbackAudio($id, $questionId);
} }
} }

@ -4489,8 +4489,7 @@ EOT;
$comnt = Event::get_comments($exeId, $questionId); $comnt = Event::get_comments($exeId, $questionId);
$teacherAudio = self::getOralFeedbackAudio( $teacherAudio = self::getOralFeedbackAudio(
$exeId, $exeId,
$questionId, $questionId
api_get_user_id()
); );
if (!empty($comnt) || $teacherAudio) { if (!empty($comnt) || $teacherAudio) {
@ -5112,15 +5111,9 @@ EOT;
} }
/** /**
* Get the audio componen for a teacher audio feedback. * Get the audio component for a teacher audio feedback.
*
* @param int $attemptId
* @param int $questionId
* @param int $userId
*
* @return string
*/ */
public static function getOralFeedbackAudio($attemptId, $questionId, $userId) public static function getOralFeedbackAudio(int $attemptId, int $questionId): string
{ {
/** @var TrackEExercise $tExercise */ /** @var TrackEExercise $tExercise */
$tExercise = Container::getTrackEExerciseRepository()->find($attemptId); $tExercise = Container::getTrackEExerciseRepository()->find($attemptId);

Loading…
Cancel
Save