3 require_once("../../config.php");
4 require_once($CFG->dirroot
.'/mod/scorm/locallib.php');
6 $id = optional_param('id', '', PARAM_INT
); // Course Module ID, or
7 $a = optional_param('a', '', PARAM_INT
); // scorm ID
8 $organization = optional_param('organization', '', PARAM_INT
); // organization ID
11 if (! $cm = get_coursemodule_from_id('scorm', $id)) {
12 print_error('invalidcoursemodule');
14 if (! $course = $DB->get_record("course", array("id"=>$cm->course
))) {
15 print_error('coursemisconf');
17 if (! $scorm = $DB->get_record("scorm", array("id"=>$cm->instance
))) {
18 print_error('invalidcoursemodule');
20 } else if (!empty($a)) {
21 if (! $scorm = $DB->get_record("scorm", array("id"=>$a))) {
22 print_error('invalidcoursemodule');
24 if (! $course = $DB->get_record("course", array("id"=>$scorm->course
))) {
25 print_error('coursemisconf');
27 if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id
, $course->id
)) {
28 print_error('invalidcoursemodule');
31 print_error('missingparameter');
34 $url = new moodle_url('/mod/scorm/view.php', array('id'=>$cm->id
));
35 if ($organization !== '') {
36 $url->param('organization', $organization);
39 $forcejs = get_config('scorm','forcejavascript');
40 if (!empty($forcejs)) {
41 $PAGE->add_body_class('forcejavascript');
44 require_login($course->id
, false, $cm);
46 $context = get_context_instance(CONTEXT_COURSE
, $course->id
);
47 $contextmodule = get_context_instance(CONTEXT_MODULE
,$cm->id
);
49 if (isset($SESSION->scorm_scoid
)) {
50 unset($SESSION->scorm_scoid
);
53 $strscorms = get_string("modulenameplural", "scorm");
54 $strscorm = get_string("modulename", "scorm");
56 $pagetitle = strip_tags($course->shortname
.': '.format_string($scorm->name
));
58 add_to_log($course->id
, 'scorm', 'pre-view', 'view.php?id='.$cm->id
, "$scorm->id", $cm->id
);
60 if ((has_capability('mod/scorm:skipview', $contextmodule)) && scorm_simple_play($scorm,$USER, $contextmodule)) {
65 // Print the page header
67 $PAGE->set_title($pagetitle);
68 $PAGE->set_heading($course->fullname
);
69 echo $OUTPUT->header();
72 require($CFG->dirroot
. '/mod/scorm/tabs.php');
74 // Print the main part of the page
75 echo $OUTPUT->heading(format_string($scorm->name
));
77 if ($scorm->displayattemptstatus
== 1) {
78 $attemptstatus = scorm_get_attempt_status($USER,$scorm);
80 echo $OUTPUT->box(format_module_intro('scorm', $scorm, $cm->id
).$attemptstatus, 'generalbox boxaligncenter boxwidthwide', 'intro');
84 if (!empty($scorm->timeopen
) && $scorm->timeopen
> $timenow) {
85 echo $OUTPUT->box(get_string("notopenyet", "scorm", userdate($scorm->timeopen
)), "generalbox boxaligncenter");
88 if (!empty($scorm->timeclose
) && $timenow > $scorm->timeclose
) {
89 echo $OUTPUT->box(get_string("expired", "scorm", userdate($scorm->timeclose
)), "generalbox boxaligncenter");
93 scorm_view_display($USER, $scorm, 'view.php?id='.$cm->id
, $cm);
95 if (!empty($forcejs)) {
96 echo $OUTPUT->box(get_string("forcejavascriptmessage", "scorm"), "generalbox boxaligncenter forcejavascriptmessage");
98 echo $OUTPUT->footer();