Skip to content

Commit

Permalink
Exercise: Add reset option to remove test in-session context - refs #…
Browse files Browse the repository at this point in the history
  • Loading branch information
ywarnier committed Nov 27, 2020
1 parent c07904b commit e9a6fbc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion main/exercise/admin.php
Expand Up @@ -49,6 +49,10 @@
$current_course_tool = TOOL_QUIZ;
$this_section = SECTION_COURSES;

if ($_GET['r'] == 1) {
Exercise::cleanSessionVariables();
}

// Access control
api_protect_course_script(true);

Expand Down Expand Up @@ -422,7 +426,7 @@
echo '</div>';
} else {
require 'question_admin.inc.php';
ExerciseLib::showExtraInfoWhereQuestionUsed($objQuestion->iid);
ExerciseLib::showTestsWhereQuestionIsUsed($objQuestion->iid, $objExercise->selectId());
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion main/inc/lib/exercise.lib.php
Expand Up @@ -1688,7 +1688,8 @@ public static function showTestsWhereQuestionIsUsed(int $questionId, int $exclud
$tmp[0] = $row['course_title'];
$tmp[1] = $row['session_name'];
$tmp[2] = $row['quiz_title'];
$urlToQuiz = api_get_path(WEB_CODE_PATH).'exercise/admin.php?'.api_get_cidreq().'&exerciseId='.$row['quiz_id'];
// Send do other test with r=1 to reset current test session variables
$urlToQuiz = api_get_path(WEB_CODE_PATH).'exercise/admin.php?'.api_get_cidreq().'&exerciseId='.$row['quiz_id'].'&r=1';
$tmp[3] = '<a href="'.$urlToQuiz.'">'.Display::return_icon('quiz.png', get_lang('Edit')).'</a>';
if ((int) $row['session_id'] == 0) {
$tmp[1] = '-';
Expand Down

0 comments on commit e9a6fbc

Please sign in to comment.