Ejemplo n.º 1
0
    if (!($assignment = get_record("assignment", "id", $a))) {
        error("Course module is incorrect");
    }
    if (!($course = get_record("course", "id", $assignment->course))) {
        error("Course is misconfigured");
    }
    if (!($cm = get_coursemodule_from_instance("assignment", $assignment->id, $course->id))) {
        error("Course Module ID was incorrect");
    }
}
require_login($course->id, false, $cm);
require_capability('mod/assignment:grade', get_context_instance(CONTEXT_MODULE, $cm->id));
require "{$CFG->dirroot}/mod/assignment/type/onlinejudge/assignment.class.php";
$assignmentinstance = new assignment_onlinejudge($cm->id, $assignment, $cm, $course);
if ($force == 1 && confirm_sesskey()) {
    rejudge_showresult($assignmentinstance->rejudge_all());
} else {
    rejudge_notice();
}
function rejudge_notice()
{
    global $assignment, $id;
    print_header(get_string('notice'));
    $message = get_string('rejudgeallnotice', 'assignment_onlinejudge', $assignment->name);
    $link = 'rejudge.php?id=' . $id . '&force=1';
    notice_okcancel($message, $link, array('sesskey' => sesskey()));
    print_footer('none');
}
function rejudge_showresult($success = true)
{
    print_header(get_string('notice'));
Ejemplo n.º 2
0
    if (!($course = $DB->get_record("course", array("id" => $assignment->course)))) {
        print_error('coursemisconf', 'assignment');
    }
    if (!($cm = get_coursemodule_from_instance("assignment", $assignment->id, $course->id))) {
        print_error('invalidcoursemodule');
    }
    $url->param('a', $a);
}
$PAGE->set_url($url);
require_login($course, true, $cm);
require_capability('mod/assignment:grade', get_context_instance(CONTEXT_MODULE, $cm->id));
$assignmentinstance = new assignment_onlinejudge($cm->id, $assignment, $cm, $course);
$pending = $DB->count_records('onlinejudge_tasks', array('status' => ONLINEJUDGE_STATUS_PENDING));
if ($pending > PREVENTION_THRESHHOLD) {
    // Prevent rejudge all requests if judged is busy
    $assignmentinstance->view_header();
    echo $OUTPUT->heading(get_string('rejudgeall', 'assignment_onlinejudge'));
    echo $OUTPUT->box(get_string('rejudgelater', 'assignment_onlinejudge'));
} else {
    if ($confirm == 1 && confirm_sesskey()) {
        $assignmentinstance->rejudge_all();
        redirect($CFG->wwwroot . '/mod/assignment/submissions.php?id=' . $id, get_string('rejudgeallrequestsent', 'assignment_onlinejudge'), 10);
    } else {
        $optionsno = array('id' => $id);
        $optionsyes = array('id' => $id, 'confirm' => 1, 'sesskey' => sesskey());
        $assignmentinstance->view_header();
        echo $OUTPUT->heading(get_string('rejudgeall', 'assignment_onlinejudge'));
        echo $OUTPUT->confirm(get_string('rejudgeallnotice', 'assignment_onlinejudge'), new moodle_url('rejudge.php', $optionsyes), new moodle_url('../../view.php', $optionsno));
    }
}
$assignmentinstance->view_footer();