]> git.mjollnir.org Git - moodle.git/commitdiff
Added multi attempt support
authorbobopinna <bobopinna>
Wed, 12 Apr 2006 06:03:46 +0000 (06:03 +0000)
committerbobopinna <bobopinna>
Wed, 12 Apr 2006 06:03:46 +0000 (06:03 +0000)
mod/scorm/backuplib.php
mod/scorm/db/postgres7.php
mod/scorm/db/postgres7.sql
mod/scorm/restorelib.php

index ff049dc429558dfc3319eb25e5e0aedfc45c0a7a..33294d7685c4a861fdce9b2d2a8e26abde72d0e3 100755 (executable)
@@ -61,6 +61,7 @@
         fwrite ($bf,full_tag("VERSION",4,false,$scorm->version));
         fwrite ($bf,full_tag("MAXGRADE",4,false,$scorm->maxgrade));
         fwrite ($bf,full_tag("GRADEMETHOD",4,false,$scorm->grademethod));
+        fwrite ($bf,full_tag("MAXATTEMPT",4,false,$scorm->maxattempt));
         fwrite ($bf,full_tag("LAUNCH",4,false,$scorm->launch));
         fwrite ($bf,full_tag("SUMMARY",4,false,$scorm->summary));
         fwrite ($bf,full_tag("HIDEBROWSE",4,false,$scorm->hidebrowse));
                 fwrite ($bf,full_tag("ID",6,false,$sco_track->id));
                 fwrite ($bf,full_tag("USERID",6,false,$sco_track->userid));
                 fwrite ($bf,full_tag("SCOID",6,false,$sco_track->scoid));
+                fwrite ($bf,full_tag("ATTEMPT",6,false,$sco_track->attempt));
                 fwrite ($bf,full_tag("ELEMENT",6,false,$sco_track->element));
                 fwrite ($bf,full_tag("VALUE",6,false,$sco_track->value));
                 //End sco track
index 06d85c1e4d757ae4d00641c6553ab1fa9eaa2fbd..7f77072f175efc804f6da250b495a889308177e5 100755 (executable)
@@ -217,7 +217,7 @@ function scorm_upgrade($oldversion) {
     }
     
     if ($oldversion < 2005092600) {
-        table_column("scorm_scoes_track", "", "attempt", "integer", "", "UNSIGNED", "1", "NOT NULL", "scoid"); 
+        table_column("scorm_scoes_track", "", "attempt", "integer", "", "", "1", "NOT NULL", "scoid"); 
         execute_sql("DROP INDEX {$CFG->prefix}scorm_scoes_track_scormid_idx", false);
         modify_database('',"CREATE UNIQUE INDEX prefix_scorm_scoes_track_uk ON prefix_scorm_scoes_track(userid,scormid,scoid,attempt,element);");
     }
index 90d9ae8945320704e89c6772e6e8eab4a8ccb8e3..a734d07f108ed8f1e73f6672052f5a49da6d7440 100755 (executable)
@@ -18,8 +18,8 @@ CREATE TABLE prefix_scorm (
   auto integer NOT NULL default '0',
   popup integer NOT NULL default '0',
   options varchar(255) NOT NULL default '',
-  width integer NOT NULL default '800',
-  height integer NOT NULL default '600',
+  width integer NOT NULL default '100',
+  height integer NOT NULL default '500',
   timemodified integer NOT NULL default '0'
 );
 
@@ -52,10 +52,11 @@ CREATE TABLE prefix_scorm_scoes_track (
   userid integer NOT NULL default '0',
   scormid integer NOT NULL default '0',
   scoid integer NOT NULL default '0',
+  attempt integer NOT NULL default '1',
   element varchar(255) NOT NULL default '',
   value text NOT NULL default '',
   timemodified integer NOT NULL default '0',
-  UNIQUE (userid, scormid, scoid, element)
+  UNIQUE (userid, scormid, scoid, attempt, element)
 );
 
 CREATE INDEX prefix_scorm_scoes_track_user_idx ON prefix_scorm_scoes_track (userid);
index 2e9b01422520ccca6f74a97b52688f723ce12bf2..9a2e7e29a3a668f52ef921b01bb97ef35d71f2e3 100755 (executable)
             if (!is_int($scorm->grademethod)) {
                 $scorm->grademethod = 0;
             }
+            $scorm->maxattempt = backup_todb($info['MOD']['#']['MAXATTEMPT']['0']['#']);
+            if (!is_int($scorm->maxattempt)) {
+                $scorm->maxattempt = 1;
+            }
             if ($restore->backup_version < 2005041500) {
                 $scorm->datadir = substr(backup_todb($info['MOD']['#']['DATADIR']['0']['#']),1);
             } else {
             $scotrack->scormid = $scorm_id;
             $scotrack->userid = backup_todb($sub_info['#']['USERID']['0']['#']);
             $scotrack->scoid = backup_todb($sub_info['#']['SCOID']['0']['#']);
+            $scotrack->attempt = backup_todb($sub_info['#']['ATTEMPT']['0']['#']);
+            if (!is_int($scotrack->attempt)) {
+                $scotrack->attempt = 1;
+            }
             $scotrack->element = backup_todb($sub_info['#']['ELEMENT']['0']['#']);
             $scotrack->value = backup_todb($sub_info['#']['VALUE']['0']['#']);