SCORM Grades MDL-22332 redirect to report page correctly from gradebook - thanks...
authorDan Marsden <Dan@digitalclay.co.nz>
Wed, 5 May 2010 23:48:00 +0000 (23:48 +0000)
committerDan Marsden <Dan@digitalclay.co.nz>
Wed, 5 May 2010 23:48:00 +0000 (23:48 +0000)
mod/scorm/grade.php [new file with mode: 0644]

diff --git a/mod/scorm/grade.php b/mod/scorm/grade.php
new file mode 100644 (file)
index 0000000..cb3ad5b
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+
+    require_once("../../config.php");
+
+    $id   = required_param('id', PARAM_INT);          // Course module ID
+
+    if (! $cm = get_coursemodule_from_id('scorm', $id)) {
+        print_error('invalidcoursemodule');
+    }
+
+    if (! $scorm = get_record('scorm', 'id', $cm->instance)) {
+        print_error('invalidcoursemodule');
+    }
+
+    if (! $course = get_record('course', 'id', $scorm->course)) {
+        print_error('coursemisconf');
+    }
+
+    require_login($course->id, false, $cm);
+
+    if (has_capability('mod/scorm:viewreport', get_context_instance(CONTEXT_MODULE, $cm->id))) {
+        redirect('report.php?id='.$cm->id);
+    } else {
+        redirect('view.php?id='.$cm->id);
+    }