]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-16111 - SCORM grade not updated in Grader Report. Thanks John Macklin.
authorpiers <piers>
Thu, 21 Aug 2008 03:12:08 +0000 (03:12 +0000)
committerpiers <piers>
Thu, 21 Aug 2008 03:12:08 +0000 (03:12 +0000)
mod/scorm/datamodels/scorm_12lib.php
mod/scorm/datamodels/scorm_13lib.php
mod/scorm/lib.php
mod/scorm/locallib.php

index 1fa06728b388424be6764eceb790b6697bce7784..cc08cb49641d46a34cfcd060f02679bcb7befb8e 100644 (file)
@@ -248,7 +248,9 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
                         }
                         $strsuspended = get_string('suspended','scorm');
                         if (isset($usertrack->{'cmi.core.exit'}) && ($usertrack->{'cmi.core.exit'} == 'suspend')) {
-                            $statusicon = '<img src="'.$scormpixdir.'/suspend.gif" alt="'.$strstatus.' - '.$strsuspended.'" title="'.$strstatus.' - '.$strsuspended.'" />';
+                            if($usertrack->status !='completed') {
+                                $statusicon = '<img src="'.$scormpixdir.'/suspend.gif" alt="'.$strstatus.' - '.$strsuspended.'" title="'.$strstatus.' - '.$strsuspended.'" />';
+                            }
                         }
                     } else {
                         if ($play && empty($scoid)) {
index d6be35cd49b39f46aac7a442a4b7d657f1e038d5..598228a62654d665129d25af63c8fb238014e356 100644 (file)
@@ -140,7 +140,9 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
                         }
                         $strsuspended = get_string('suspended','scorm');
                         if (isset($usertrack->{'cmi.core.exit'}) && ($usertrack->{'cmi.core.exit'} == 'suspend')) {
-                            $statusicon = '<img src="'.$scormpixdir.'/suspend.gif" alt="'.$strstatus.' - '.$strsuspended.'" title="'.$strstatus.' - '.$strsuspended.'" />';
+                            if($usertrack->status !='completed') {
+                                $statusicon = '<img src="'.$scormpixdir.'/suspend.gif" alt="'.$strstatus.' - '.$strsuspended.'" title="'.$strstatus.' - '.$strsuspended.'" />';
+                            }
                         }
                     } else {
                         if ($play && empty($scoid)) {
index eeebbf0416a5acf50bb6cfad74981a854f8c871b..e384de4e5c5c7368fa3cf49aebeb95f102f4a336 100755 (executable)
@@ -124,7 +124,8 @@ function scorm_update_instance($scorm) {
     }
     
     if ($result = $DB->update_record('scorm', $scorm)) {
-        scorm_grade_item_update($scorm);
+        scorm_grade_item_update(stripslashes_recursive($scorm));
+        //scorm_grade_item_update($scorm);  // John Macklins fix - dont think this is needed
     }
 
     return $result;
@@ -505,8 +506,11 @@ function scorm_grade_item_update($scorm, $grades=NULL) {
         require_once($CFG->libdir.'/gradelib.php');
     }
 
-    $params = array('itemname'=>$scorm->name, 'idnumber'=>$scorm->cmidnumber);
-
+    $params = array('itemname'=>$scorm->name);
+    if (isset($scorm->cmidnumber)) {
+        $params['idnumber'] = $scorm->cmidnumber;
+    }
+    
     if (($scorm->grademethod % 10) == 0) { // GRADESCOES
         if ($maxgrade = $DB->count_records_select('scorm_scoes', 'scorm = ? AND launch <> ?', array($scorm->id, ''))) {
             $params['gradetype'] = GRADE_TYPE_VALUE;
index 6fdc9d25fbb7c855b0501f214f53f92050831452..8e9133f73640da633a9427db58b87381cba3aa4c 100755 (executable)
@@ -368,7 +368,9 @@ function scorm_grade_user_attempt($scorm, $userid, $attempt=1, $time=false) {
         break;  
         case GRADESCOES:
             $score = $attemptscore->scoes;
-        break;  
+        break;
+        default:
+            $score = $attemptscore->max;   // Remote Learner GRADEHIGHEST is default
     }
 
     if ($time) {