$student_names = required_param('student_names', PARAM_RAW);
    $task = required_param('task', PARAM_INT);
    $mode = required_param('mode', PARAM_ALPHA);
    $assessorid = optional_param('assessor_id', 0, PARAM_INT);
    include_once $CFG->dirroot . '/blocks/evalcomix/reports/xls/export_xls.php';
    $report = new export_xls(array('courseid' => $courseid, 'mode' => $mode));
    $params['courseid'] = $courseid;
    $params['student_ids'] = $student_ids;
    $params['student_names'] = $student_names;
    $params['task'] = $task;
    $params['mode'] = $mode;
    if ($assessorid) {
        $params['assessor_id'] = $assessorid;
    }
    $report->send_export($params);
    exit;
}
if (!empty($formdata)) {
    echo $OUTPUT->header();
    include_once $CFG->dirroot . '/blocks/evalcomix/reports/export.php';
    $params['courseid'] = $courseid;
    $params['mode'] = $mode;
    $params['format'] = $formdata['format'];
    $export = new export($params);
    $export->preprocess_data($formdata);
    $export->print_continue();
    $export->display_preview();
    echo $OUTPUT->footer();
} else {
    header("Location:index.php?id={$courseid}&mode={$mode}");
}