(There was a bug in the get_context_instance call.)
global $CFG;
$isgraded = question_state_is_graded($state->last_graded);
- // Get the context we should use to check permissions.
- if (!empty($cmoptions->id)) {
- $context = get_context_instance(CONTEXT_MODULE, $cmoptions->id);
- } else if (!empty($cmoptions->course)) {
- $context = get_context_instance(CONTEXT_COURSE, $cmoptions->course);
- } else {
- $context = null;
- }
-
if (isset($question->randomquestionid)) {
$actualquestionid = $question->randomquestionid;
} else {