. // This script uses installed report plugins to print scorm reports require_once("../../config.php"); require_once($CFG->libdir.'/tablelib.php'); require_once($CFG->dirroot.'/mod/scorm/locallib.php'); require_once($CFG->dirroot.'/mod/scorm/reportsettings_form.php'); require_once($CFG->dirroot.'/mod/scorm/report/reportlib.php'); require_once($CFG->libdir.'/formslib.php'); require_once($CFG->dirroot.'/mod/scorm/report/default.php'); // Parent class define('SCORM_REPORT_DEFAULT_PAGE_SIZE', 20); define('SCORM_REPORT_ATTEMPTS_ALL_STUDENTS', 0); define('SCORM_REPORT_ATTEMPTS_STUDENTS_WITH', 1); define('SCORM_REPORT_ATTEMPTS_STUDENTS_WITH_NO', 2); $id = required_param('id', PARAM_INT);// Course Module ID, or $download = optional_param('download', '', PARAM_RAW); $mode = optional_param('mode', '', PARAM_ALPHA); // Report mode $cm = get_coursemodule_from_id('scorm', $id, 0, false, MUST_EXIST); $course = $DB->get_record('course', array('id'=>$cm->course), '*', MUST_EXIST); $scorm = $DB->get_record('scorm', array('id'=>$cm->instance), '*', MUST_EXIST); $contextmodule = get_context_instance(CONTEXT_MODULE, $cm->id); $reportlist = scorm_report_list($contextmodule); $url = new moodle_url('/mod/scorm/report.php'); $url->param('id', $id); if (empty($mode)) { $mode = reset($reportlist); } else if (!in_array($mode, $reportlist)) { print_error('erroraccessingreport', 'scorm'); } $url->param('mode', $mode); $PAGE->set_url($url); require_login($course->id, false, $cm); require_capability('mod/scorm:viewreport', $contextmodule); if (count($reportlist) < 1) { print_error('erroraccessingreport', 'scorm'); } add_to_log($course->id, 'scorm', 'report', 'report.php?id='.$cm->id, $scorm->id, $cm->id); $userdata = null; if (!empty($download)) { $noheader = true; } /// Print the page header if (empty($noheader)) { $strreport = get_string('report', 'scorm'); $strattempt = get_string('attempt', 'scorm'); $PAGE->set_title("$course->shortname: ".format_string($scorm->name)); $PAGE->set_heading($course->fullname); $PAGE->navbar->add($strreport, new moodle_url('/mod/scorm/report.php', array('id'=>$cm->id))); echo $OUTPUT->header(); $currenttab = 'reports'; require($CFG->dirroot . '/mod/scorm/tabs.php'); echo $OUTPUT->heading(format_string($scorm->name)); } // Open the selected Scorm report and display it $reportclassname = "scorm_{$mode}_report"; $report = new $reportclassname(); $report->display($scorm, $cm, $course, $download); // Run the report! // Print footer if (empty($noheader)) { echo $OUTPUT->footer(); }