From: bobopinna Date: Wed, 12 Apr 2006 06:03:46 +0000 (+0000) Subject: Added multi attempt support X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=5046492815dcc002d8d6f2a3b0e38b150b00a05d;p=moodle.git Added multi attempt support --- diff --git a/mod/scorm/backuplib.php b/mod/scorm/backuplib.php index ff049dc429..33294d7685 100755 --- a/mod/scorm/backuplib.php +++ b/mod/scorm/backuplib.php @@ -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)); @@ -149,6 +150,7 @@ 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 diff --git a/mod/scorm/db/postgres7.php b/mod/scorm/db/postgres7.php index 06d85c1e4d..7f77072f17 100755 --- a/mod/scorm/db/postgres7.php +++ b/mod/scorm/db/postgres7.php @@ -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);"); } diff --git a/mod/scorm/db/postgres7.sql b/mod/scorm/db/postgres7.sql index 90d9ae8945..a734d07f10 100755 --- a/mod/scorm/db/postgres7.sql +++ b/mod/scorm/db/postgres7.sql @@ -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); diff --git a/mod/scorm/restorelib.php b/mod/scorm/restorelib.php index 2e9b014225..9a2e7e29a3 100755 --- a/mod/scorm/restorelib.php +++ b/mod/scorm/restorelib.php @@ -56,6 +56,10 @@ 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 { @@ -230,6 +234,10 @@ $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']['#']);