Merge branch 'm20_MDL-26176_cleanup' of github.com:danmarsden/moodle
[moodle.git] / mod / scorm / loaddatamodel.php
index ca6613a..73ebd04 100644 (file)
@@ -9,6 +9,11 @@
     $mode = optional_param('mode', '', PARAM_ALPHA); // navigation mode
     $attempt = required_param('attempt', PARAM_INT); // new attempt
 
+    //IE 6 Bug workaround
+    if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6') !== false && ini_get('zlib.output_compression') == 'On') {
+        ini_set('zlib.output_compression', 'Off');
+    }
+    
     if (!empty($id)) {
         if (! $cm = get_coursemodule_from_id('scorm', $id)) {
             print_error('invalidcoursemodule');
         print_error('missingparameter');
     }
 
+    $url = new moodle_url('/mod/scorm/loaddatamodel.php', array('scoid'=>$scoid, 'id'=>$cm->id,'attempt'=>$attempt));
+    if ($mode !== '') {
+        $url->param('mode', $mode);
+    }
+    $PAGE->set_url($url);
+
     require_login($course, false, $cm);
 
     if ($usertrack = scorm_get_tracks($scoid,$USER->id,$attempt)) {
     }
     $scorm->version = strtolower(clean_param($scorm->version, PARAM_SAFEDIR));   // Just to be safe
     if (file_exists($CFG->dirroot.'/mod/scorm/datamodels/'.$scorm->version.'.js.php')) {
-        include_once($CFG->dirroot.'/mod/scorm/datamodels/'.$scorm->version.'.js.php');
+        include($CFG->dirroot.'/mod/scorm/datamodels/'.$scorm->version.'.js.php');
     } else {
-        include_once($CFG->dirroot.'/mod/scorm/datamodels/scorm_12.js.php');
+        include($CFG->dirroot.'/mod/scorm/datamodels/scorm_12.js.php');
     }
+    // set the start time of this SCO
+    scorm_insert_track($USER->id,$scorm->id,$scoid,$attempt,'x.start.time',time());
 ?>
 
 var errorCode = "0";