Skip to content
Browse files

Added multi attempt support

  • Loading branch information...
1 parent a91433f commit 5046492815dcc002d8d6f2a3b0e38b150b00a05d bobopinna committed Apr 12, 2006
Showing with 15 additions and 4 deletions.
  1. +2 −0 mod/scorm/backuplib.php
  2. +1 −1 mod/scorm/db/postgres7.php
  3. +4 −3 mod/scorm/db/postgres7.sql
  4. +8 −0 mod/scorm/restorelib.php
View
2 mod/scorm/backuplib.php
@@ -61,6 +61,7 @@ function scorm_backup_one_mod($bf,$preferences,$scorm) {
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 @@ function backup_scorm_scoes_track ($bf,$preferences,$scorm) {
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
View
2 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);");
}
View
7 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);
View
8 mod/scorm/restorelib.php
@@ -56,6 +56,10 @@ function scorm_restore_mods($mod,$restore) {
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 @@ function scorm_scoes_tracks_restore_mods($scorm_id,$info,$restore) {
$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']['#']);

0 comments on commit 5046492

Please sign in to comment.
Something went wrong with that request. Please try again.