if (!($lastid = $DB->insert_record('report_configreports', $data))) { print_error('errorsavingreport', 'report_configreports'); } else { add_to_log($courseid, 'configurable_reports', 'report created', '/report/configreports/editreport.php?id=' . $lastid, $data->name); $reportclass = new $reportclassname($lastid); redirect($CFG->wwwroot . '/report/configreports/editcomp.php?id=' . $lastid . '&comp=' . $reportclass->components[0]); } } else { add_to_log($report->courseid, 'configurable_reports', 'edit', '/report/configreports/editreport.php?id=' . $id, $report->name); $reportclass = new $reportclassname($data->id); $data->type = $report->type; if (!$DB->update_record('report_configreports', $data)) { print_error('errorsavingreport', 'report_configreports'); } else { redirect($CFG->wwwroot . '/report/configreports/editcomp.php?id=' . $data->id . '&comp=' . $reportclass->components[0]); } } } } $PAGE->set_context($context); $PAGE->set_pagelayout('incourse'); $PAGE->set_title($title); $PAGE->set_heading($title); $PAGE->set_cacheable(true); echo $OUTPUT->header(); if ($id) { $currenttab = 'report'; include 'tabs.php'; } $editform->display(); echo $OUTPUT->footer();
function print_filters() { global $DB, $CFG, $FULLME; $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); die; } $filterform->display(); } }