Added multi attempt support

This commit is contained in:
bobopinna
2006-04-12 06:03:46 +00:00
parent a91433f9ec
commit 5046492815
4 changed files with 15 additions and 4 deletions
+2
View File
@@ -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
+1 -1
View File
@@ -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);");
}
+4 -3
View File
@@ -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);
+8
View File
@@ -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']['#']);