Permalink
Browse files

MDL-34403 mod quiz: fix error during enrolment

  • Loading branch information...
1 parent 3a8c438 commit f5f36584801fb6873530ebd23f0d8b5734aae703 @mpetrowi mpetrowi committed Apr 16, 2013
Showing with 13 additions and 12 deletions.
  1. +13 −12 mod/quiz/lib.php
View
@@ -729,18 +729,19 @@ function quiz_grade_item_update($quiz, $grades = null) {
// NOTE: this is an extremely nasty hack! It is not a bug if this confirmation fails badly. --skodak.
$confirm_regrade = optional_param('confirm_regrade', 0, PARAM_INT);
if (!$confirm_regrade) {
- $message = get_string('gradeitemislocked', 'grades');
- $back_link = $CFG->wwwroot . '/mod/quiz/report.php?q=' . $quiz->id .
- '&mode=overview';
- $regrade_link = qualified_me() . '&confirm_regrade=1';
- echo $OUTPUT->box_start('generalbox', 'notice');
- echo '<p>'. $message .'</p>';
- echo $OUTPUT->container_start('buttons');
- echo $OUTPUT->single_button($regrade_link, get_string('regradeanyway', 'grades'));
- echo $OUTPUT->single_button($back_link, get_string('cancel'));
- echo $OUTPUT->container_end();
- echo $OUTPUT->box_end();
-
+ if (!AJAX_SCRIPT) {
+ $message = get_string('gradeitemislocked', 'grades');
+ $back_link = $CFG->wwwroot . '/mod/quiz/report.php?q=' . $quiz->id .
+ '&amp;mode=overview';
+ $regrade_link = qualified_me() . '&amp;confirm_regrade=1';
+ echo $OUTPUT->box_start('generalbox', 'notice');
+ echo '<p>'. $message .'</p>';
+ echo $OUTPUT->container_start('buttons');
+ echo $OUTPUT->single_button($regrade_link, get_string('regradeanyway', 'grades'));
+ echo $OUTPUT->single_button($back_link, get_string('cancel'));
+ echo $OUTPUT->container_end();
+ echo $OUTPUT->box_end();
+ }
return GRADE_UPDATE_ITEM_LOCKED;
}
}

0 comments on commit f5f3658

Please sign in to comment.