$sub = get_assignment_submit_details($sub_id);
    if ($sub == null || $assign == null) {
        redirect_to_home_page('modules/work/index.php?course=' . $course_code);
    }
    $navigation[] = array("url" => "index.php?course={$course_code}", "name" => $langWorks);
    $navigation[] = array("url" => "index.php?course={$course_code}&id={$as_id}", "name" => q($assign->title));
    if (count($sub) > 0) {
        if ($assign->auto_judge) {
            // auto_judge enable
            $auto_judge_scenarios = unserialize($assign->auto_judge_scenarios);
            $auto_judge_scenarios_output = unserialize($sub->auto_judge_scenarios_output);
            if (!isset($_GET['downloadpdf'])) {
                show_report($as_id, $sub_id, $assign, $sub, $auto_judge_scenarios, $auto_judge_scenarios_output);
                draw($tool_content, 2);
            } else {
                download_pdf_file($assign, $sub, $auto_judge_scenarios, $auto_judge_scenarios_output);
            }
        } else {
            Session::Messages($langAutoJudgeNotEnabledForReport, 'alert-danger');
            draw($tool_content, 2);
        }
    } else {
        Session::Messages($m['WorkNoSubmission'], 'alert-danger');
        redirect_to_home_page('modules/work/index.php?course=' . $course_code . '&id=' . $id);
    }
} else {
    redirect_to_home_page('modules/work/index.php?course=' . $course_code);
}
// Returns an array of the details of assignment $id
function get_assignment_details($id)
{
Exemple #2
0
    $assign = get_assignment_details($as_id);
    $submissions = find_submissions_by_assigment($as_id);
    $i = 1;
    $i++;
    $nameTools = sprintf($langAutoJudgeRankReport, $assign->title);
    if ($assign == null) {
        redirect_to_home_page('modules/work/index.php?course=' . $course_code);
    }
    $navigation[] = array("url" => "index.php?course={$course_code}", "name" => $langWorks);
    $navigation[] = array("url" => "index.php?course={$course_code}&id={$as_id}", "name" => q($assign->title));
    if (count($submissions) > 0) {
        if (!isset($_GET['downloadpdf'])) {
            show_report($assign, $submissions, $i);
            draw($tool_content, 2);
        } else {
            download_pdf_file($assign, $submissions);
        }
    } else {
        Session::Messages($m['WorkNoSubmission'], 'alert-danger');
        redirect_to_home_page('modules/work/index.php?course=' . $course_code . '&id=' . $id);
    }
} else {
    redirect_to_home_page('modules/work/index.php?course=' . $course_code);
}
// Returns an array of the details of assignment $id
function get_assignment_details($id)
{
    global $course_id;
    return Database::get()->querySingle("SELECT * FROM assignment WHERE course_id = ?d AND id = ?d", $course_id, $id);
}
// returns an array of the submissions of an assigment