$export = explode(',', $report->export);
    if (!empty($export)) {
        foreach ($export as $e) {
            $report->{'export_' . $e} = 1;
        }
    }
    $editform->set_data($report);
}
if ($editform->is_cancelled()) {
    if (!empty($report)) {
        redirect($CFG->wwwroot . '/report/configreports/editreport.php?id=' . $report->id);
    } else {
        redirect($CFG->wwwroot . '/report/configreports/editreport.php');
    }
} else {
    if ($data = $editform->get_data()) {
        require_once $CFG->dirroot . '/report/configreports/report.class.php';
        require_once $CFG->dirroot . '/report/configreports/reports/' . $data->type . '/report.class.php';
        if (empty($report)) {
            $reportclassname = 'report_' . $data->type;
        } else {
            $reportclassname = 'report_' . $report->type;
        }
        $arraydata = (array) $data;
        $data->export = '';
        foreach ($arraydata as $key => $d) {
            if (strpos($key, 'export_') !== false) {
                $data->export .= str_replace('export_', '', $key) . ',';
            }
        }
        if (empty($report)) {