Пример #1
0
}
/// Check login and permissions.
require_login($attemptobj->get_courseid(), false, $attemptobj->get_cm());
$attemptobj->require_capability('mod/quiz:grade');
/// Load the questions and states.
$questionids = array($questionid);
$attemptobj->load_questions($questionids);
$attemptobj->load_question_states($questionids);
/// Log this action.
add_to_log($attemptobj->get_courseid(), 'quiz', 'manualgrade', 'comment.php?attempt=' . $attemptobj->get_attemptid() . '&question=' . $questionid, $attemptobj->get_quizid(), $attemptobj->get_cmid());
/// Print the page header
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();