Skip to content

Commit

Permalink
Exercises: Add new tags link_to_test_result_page_* see BT#17788
Browse files Browse the repository at this point in the history
((link_to_test_result_page_student))
((link_to_test_result_page_teacher))
  • Loading branch information
jmontoyaa committed Jan 26, 2021
1 parent e004f7e commit d4666a0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion main/inc/lib/exercise.lib.php
Expand Up @@ -5984,10 +5984,15 @@ public static function getExerciseResultsCount($type, $courseId, $exerciseId, $s
return $total;
}

public static function parseContent($content, $stats, $exercise, $trackInfo, $currentUserId = 0)
public static function parseContent($content, $stats, Exercise $exercise, $trackInfo, $currentUserId = 0)
{
$wrongAnswersCount = $stats['failed_answers_count'];
$attemptDate = substr($trackInfo['exe_date'], 0, 10);
$exerciseId = $exercise->iId;
$resultsStudentUrl = api_get_path(WEB_CODE_PATH).
'exercise/result.php?id='.$exerciseId.'&'.api_get_cidreq();
$resultsTeacherUrl = api_get_path(WEB_CODE_PATH).
'exercise/exercise_show.php?action=edit&id='.$exerciseId.'&'.api_get_cidreq();

$content = str_replace(
[
Expand All @@ -5996,13 +6001,17 @@ public static function parseContent($content, $stats, $exercise, $trackInfo, $cu
'((all_answers_teacher_html))',
'((exercise_title))',
'((exercise_attempt_date))',
'((link_to_test_result_page_student))',
'((link_to_test_result_page_teacher))',
],
[
$wrongAnswersCount,
$stats['all_answers_html'],
$stats['all_answers_teacher_html'],
$exercise->get_formated_title(),
$attemptDate,
$resultsStudentUrl,
$resultsTeacherUrl,
],
$content
);
Expand Down

0 comments on commit d4666a0

Please sign in to comment.