}
if (isset($_GET['print'])) {
    $printable_data = GradebookUtils::get_printable_data($cat[0], $users, $alleval, $alllinks, $params, $mainCourseCategory[0]);
    echo print_table($printable_data[1], $printable_data[0], get_lang('FlatView'), $cat[0]->get_name());
    exit;
}
if (!empty($_GET['export_report']) && $_GET['export_report'] == 'export_report') {
    if (api_is_platform_admin() || api_is_course_admin() || api_is_course_coach() || $isDrhOfCourse) {
        $user_id = null;
        if (empty($_SESSION['export_user_fields'])) {
            $_SESSION['export_user_fields'] = false;
        }
        if (!api_is_allowed_to_edit(false, false) and !api_is_course_tutor()) {
            $user_id = api_get_user_id();
        }
        $printable_data = GradebookUtils::get_printable_data($cat[0], $users, $alleval, $alllinks, $params, $mainCourseCategory[0]);
        switch ($_GET['export_format']) {
            case 'xls':
                $export = new GradeBookResult();
                $export->exportCompleteReportXLS($printable_data);
                break;
            case 'doc':
                $export = new GradeBookResult();
                $export->exportCompleteReportDOC($printable_data);
                exit;
                break;
            case 'csv':
            default:
                $export = new GradeBookResult();
                $export->exportCompleteReportCSV($printable_data);
                exit;