From 002ef81dc53632a9896c88a44f35019215f7cc4d Mon Sep 17 00:00:00 2001 From: jamiesensei Date: Mon, 21 Jul 2008 14:17:00 +0000 Subject: [PATCH] MDL-15736 "deleting regrade report. Regrade functionality is now part of overview report" --- mod/quiz/report/regrade/report.php | 88 ------------------------------ 1 file changed, 88 deletions(-) delete mode 100644 mod/quiz/report/regrade/report.php diff --git a/mod/quiz/report/regrade/report.php b/mod/quiz/report/regrade/report.php deleted file mode 100644 index 77b64cfa2d..0000000000 --- a/mod/quiz/report/regrade/report.php +++ /dev/null @@ -1,88 +0,0 @@ -libdir.'/tablelib.php'); - -class quiz_regrade_report extends quiz_default_report { - - function display($quiz, $cm, $course) { - global $CFG, $DB; - - // Print header - $this->print_header_and_tabs($cm, $course, $quiz, $reportmode="regrade"); - - // Check permissions - $context = get_context_instance(CONTEXT_MODULE, $cm->id); - if (!has_capability('mod/quiz:grade', $context)) { - notify(get_string('regradenotallowed', 'quiz')); - return true; - } - - // Fetch all attempts - if (!$attempts = $DB->get_records_select('quiz_attempts', "quiz = ? AND preview = 0", array($quiz->id))) { - print_heading(get_string('noattempts', 'quiz')); - return true; - } - - // Fetch all questions - $sql = "SELECT q.*, i.grade AS maxgrade FROM {question} q, - {quiz_question_instances} i - WHERE i.quiz = ? - AND i.question = q.id"; - - if (! $questions = $DB->get_records_sql($sql, array($quiz->id))) { - print_error('cannotfindquestionregard', 'quiz'); - } - get_question_options($questions); - - // Print heading - print_heading(get_string('regradingquiz', 'quiz', format_string($quiz->name))); - echo '
'; - print_string('regradedisplayexplanation', 'quiz'); - echo '
'; - - // Loop through all questions and all attempts and regrade while printing progress info - foreach ($questions as $question) { - echo ''.get_string('regradingquestion', 'quiz', $question->name).' '.get_string('attempts', 'quiz').": \n"; - foreach ($attempts as $attempt) { - set_time_limit(30); - $changed = regrade_question_in_attempt($question, $attempt, $quiz, true); - if ($changed) { - link_to_popup_window ('/mod/quiz/reviewquestion.php?attempt='.$attempt->id.'&question='.$question->id, - 'reviewquestion', ' #'.$attempt->id, 450, 550, get_string('reviewresponse', 'quiz')); - } else { - echo ' #'.$attempt->id; - } - } - echo '
'; - // the following makes sure that the output is sent immediately. - @flush();@ob_flush(); - } - - // Loop through all questions and recalculate $attempt->sumgrade - $attemptschanged = 0; - foreach ($attempts as $attempt) { - $sumgrades = 0; - $questionids = explode(',', quiz_questions_in_quiz($attempt->layout)); - foreach($questionids as $questionid) { - $lastgradedid = $DB->get_field('question_sessions', 'newgraded', array('attemptid' => $attempt->uniqueid, 'questionid' => $questionid)); - $sumgrades += $DB->get_field('question_states', 'grade', array('id' => $lastgradedid)); - } - if ($attempt->sumgrades != $sumgrades) { - $attemptschanged++; - $DB->set_field('quiz_attempts', 'sumgrades', $sumgrades, array('id' => $attempt->id)); - } - } - - // Update the overall quiz grades - if ($grades = $DB->get_records('quiz_grades', array('quiz' => $quiz->id))) { - foreach($grades as $grade) { - quiz_save_best_grade($quiz, $grade->userid); - } - } - - return true; - } -} - -?> -- 2.39.5