echo $OUTPUT->confirm($message, $buttoncontinue, $buttoncancel);
        echo $OUTPUT->footer();
        exit;
    } else {
        if ($DB->delete_records('report_configreports', array('id' => $report->id))) {
            add_to_log($report->courseid, 'configurable_reports', 'report deleted', '/report/configreports/editreport.php?id=' . $report->id, $report->id);
        }
        header("Location: {$CFG->wwwroot}/report/configreports/managereport.php?courseid={$courseid}");
        die;
    }
}
require_once 'editreport_form.php';
if (!empty($report)) {
    $editform = new report_edit_form('editreport.php', compact('report', 'courseid', 'context'));
} else {
    $editform = new report_edit_form('editreport.php', compact('courseid', 'context'));
}
if (!empty($report)) {
    $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');
 function check_filters_request()
 {
     global $DB, $CFG;
     $components = cr_unserialize($this->config->components);
     $filters = isset($components['filters']['elements']) ? $components['filters']['elements'] : array();
     if (!empty($filters)) {
         $formdata = new stdclass();
         $request = array_merge($_POST, $_GET);
         if ($request) {
             foreach ($request as $key => $val) {
                 if (strpos($key, 'filter_') !== false) {
                     $formdata->{$key} = $val;
                 }
             }
         }
         require_once 'filter_form.php';
         $filterform = new report_edit_form(null, $this);
         $filterform->set_data($formdata);
         if ($filterform->is_cancelled()) {
             redirect("{$CFG->wwwroot}/blocks/configurable_reports/viewreport.php?id=" . $this->config->id . "&courseid=" . $this->config->courseid);
             die;
         }
         $this->filterform = $filterform;
     }
 }