get_record('course', array('id' => $cm->course), '*', MUST_EXIST); $sqlbox = $DB->get_record('sqlbox', array('id' => $cm->instance), '*', MUST_EXIST); } else { print_error('invalidcourse'); } require_login($course, true, $cm); $context = get_context_instance(CONTEXT_MODULE, $cm->id); require_capability('mod/sqlbox:readqueries', $context); add_to_log($course->id, 'sqlbox', 'report', "report.php?id={$cm->id}", $sqlbox->name, $cm->id); $PAGE->set_url('/mod/sqlbox/report.php', array('id' => $cm->id)); $PAGE->set_title(format_string($sqlbox->name)); $PAGE->set_heading(format_string($course->fullname)); $PAGE->set_context($context); echo $OUTPUT->header(); echo '