First step to SCORM2004, new communication subsystem
[moodle.git] / mod / scorm / datamodel.php
CommitLineData
98ca59f6 1<?php
1a12b1f1 2 require_once('../../config.php');
3 require_once('lib.php');
2a0407b7 4
98ca59f6 5 optional_variable($id); // Course Module ID, or
6 optional_variable($a); // scorm ID
7
8 if ($id) {
1a12b1f1 9 if (! $cm = get_record('course_modules', 'id', $id)) {
10 error('Course Module ID was incorrect');
98ca59f6 11 }
2a0407b7 12
1a12b1f1 13 if (! $course = get_record('course', 'id', $cm->course)) {
14 error('Course is misconfigured');
98ca59f6 15 }
2a0407b7 16
1a12b1f1 17 if (! $scorm = get_record('scorm', 'id', $cm->instance)) {
18 error('Course module is incorrect');
98ca59f6 19 }
20
21 } else {
1a12b1f1 22 if (! $scorm = get_record('scorm', 'id', $a)) {
23 error('Course module is incorrect');
98ca59f6 24 }
1a12b1f1 25 if (! $course = get_record('course', 'id', $scorm->course)) {
26 error('Course is misconfigured');
98ca59f6 27 }
1a12b1f1 28 if (! $cm = get_coursemodule_from_instance('scorm', $scorm->id, $course->id)) {
29 error('Course Module ID was incorrect');
98ca59f6 30 }
31 }
32
ec81373f 33 require_login($course->id, false, $cm);
92a489eb 34
35 if (isset($_POST['call']) && confirm_sesskey()) {
36
98ca59f6 37 }
38?>
92a489eb 39