print_header(); print_heading(format_string($attemptobj->get_question($questionid)->name)); /// Process any data that was submitted. if ($data = data_submitted() and confirm_sesskey()) { $error = $attemptobj->process_comment($questionid, $data->response['comment'], $data->response['grade']); /// If success, notify and print a close button. if (!is_string($error)) { notify(get_string('changessaved'), 'notifysuccess'); close_window(2, true); } /// Otherwise, display the error and fall throug to re-display the form. notify($error); } /// Print the comment form. echo '<form method="post" class="mform" id="manualgradingform" action="' . $CFG->wwwroot . '/mod/quiz/comment.php">'; $attemptobj->question_print_comment_fields($questionid, 'response'); ?> <div> <input type="hidden" name="attempt" value="<?php echo $attemptobj->get_uniqueid(); ?> " /> <input type="hidden" name="question" value="<?php echo $questionid; ?> " /> <input type="hidden" name="sesskey" value="<?php echo sesskey(); ?> " /> </div>