From b3659259fd75909c16d3cb558947e1b0b0fd5617 Mon Sep 17 00:00:00 2001 From: bobopinna Date: Tue, 21 Nov 2006 16:12:19 +0000 Subject: [PATCH] Splitted scoes optional data in a new table --- mod/scorm/aicc.php | 12 +- mod/scorm/api.php | 15 +-- mod/scorm/backuplib.php | 174 +++++++++++++++------------ mod/scorm/config.html | 19 --- mod/scorm/datamodels/scorm_12.js.php | 22 ++-- mod/scorm/datamodels/scorm_12lib.php | 135 ++++++++++++--------- mod/scorm/datamodels/scorm_13lib.php | 172 +++++++++++++------------- mod/scorm/datamodels/scormlib.php | 70 ++++++++--- mod/scorm/db/access.php | 1 - mod/scorm/db/install.xml | 34 +++--- mod/scorm/db/mysql.sql | 124 +++++++++++++++++-- mod/scorm/db/upgrade.php | 63 ++++++++-- mod/scorm/lib.php | 16 ++- mod/scorm/loadSCO.php | 42 ++++--- mod/scorm/locallib.php | 31 ++++- mod/scorm/player.php | 12 +- mod/scorm/report.php | 51 ++++---- mod/scorm/restorelib.php | 18 +-- mod/scorm/version.php | 2 +- 19 files changed, 634 insertions(+), 379 deletions(-) diff --git a/mod/scorm/aicc.php b/mod/scorm/aicc.php index 4599cb07b3..5b283a414f 100755 --- a/mod/scorm/aicc.php +++ b/mod/scorm/aicc.php @@ -30,7 +30,7 @@ $attempt = 1; } - if ($sco = get_record('scorm_scoes','id',$scoid)) { + if ($sco = scorm_get_sco($scoid, SCO_ONLY)) { if (!$scorm = get_record('scorm','id',$sco->scorm)) { error('Invalid script call'); } @@ -63,12 +63,12 @@ $userdata->credit = 'no-credit'; } - if ($sco = get_record('scorm_scoes','id',$scoid)) { + if ($sco = scorm_get_sco($scoid)) { $userdata->course_id = $sco->identifier; - $userdata->datafromlms = $sco->datafromlms; - $userdata->masteryscore = $sco->masteryscore; - $userdata->maxtimeallowed = $sco->maxtimeallowed; - $userdata->timelimitaction = $sco->timelimitaction; + $userdata->datafromlms = isset($sco->datafromlms)?$sco->datafromlms:''; + $userdata->masteryscore = isset($sco->masteryscore)?$sco->masteryscore:''; + $userdata->maxtimeallowed = isset($sco->maxtimeallowed)?$sco->maxtimeallowed:''; + $userdata->timelimitaction = isset($sco->timelimitaction)?$sco->timelimitaction:''; echo "error = 0\nerror_text = Successful\naicc_data=\n"; echo "[Core]\n"; diff --git a/mod/scorm/api.php b/mod/scorm/api.php index 367a59077e..97b4c3817e 100644 --- a/mod/scorm/api.php +++ b/mod/scorm/api.php @@ -57,18 +57,9 @@ } else { $userdata->credit = 'no-credit'; } - if ($sco = get_record('scorm_scoes','id',$scoid)) { - if (!empty($sco->datafromlms)) { - $userdata->datafromlms = $sco->datafromlms; - } - if (!empty($sco->masteryscore)) { - $userdata->masteryscore = $sco->masteryscore; - } - if (!empty($sco->maxtimeallowed)) { - $userdata->maxtimeallowed = $sco->maxtimeallowed; - } - if (!empty($sco->timelimitaction)) { - $userdata->timelimitaction = $sco->timelimitaction; + if ($scodatas = scorm_get_sco($scoid, SCO_DATA)) { + foreach ($scodatas as $key => $value) { + $userdata->$key = $value; } } else { error('Sco not found'); diff --git a/mod/scorm/backuplib.php b/mod/scorm/backuplib.php index 81427fbe24..f93b0cae8a 100755 --- a/mod/scorm/backuplib.php +++ b/mod/scorm/backuplib.php @@ -5,17 +5,17 @@ //This is the "graphical" structure of the scorm mod: // // scorm - // (CL,pk->id)--------------------- - // | | - // | | - // | | - // scorm_scoes | - // (UL,pk->id, fk->scorm) | - // | | - // | | - // | | - // scorm_scoes_track | - // (UL,k->id, fk->scormid, fk->scoid, k->element)--- + // (CL,pk->id)------------------------------------- + // | | + // | | + // | | + // scorm_scoes scorm_scoes_data | + // (UL,pk->id, fk->scorm)-------(UL,pk->id, fk->scoid) | + // | | + // | | + // | | + // scorm_scoes_track | + // (UL,k->id, fk->scormid, fk->scoid, k->element)------------------- // // Meaning: pk->primary key field of the table // fk->foreign key to link with parent @@ -33,7 +33,7 @@ $status = true; //Iterate over scorm table - $scorms = get_records ("scorm","course",$preferences->backup_course,"id"); + $scorms = get_records ('scorm','course',$preferences->backup_course,'id'); if ($scorms) { foreach ($scorms as $scorm) { if (backup_mod_selected($preferences,'scorm',$scorm->id)) { @@ -52,27 +52,27 @@ } //Start mod - fwrite ($bf,start_tag("MOD",3,true)); + fwrite ($bf,start_tag('MOD',3,true)); //Print scorm data - fwrite ($bf,full_tag("ID",4,false,$scorm->id)); - fwrite ($bf,full_tag("MODTYPE",4,false,"scorm")); - fwrite ($bf,full_tag("NAME",4,false,$scorm->name)); - fwrite ($bf,full_tag("REFERENCE",4,false,$scorm->reference)); - 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("LAUNCH",4,false,$scorm->launch)); - fwrite ($bf,full_tag("SKIPVIEW",4,false,$scorm->skipview)); - fwrite ($bf,full_tag("SUMMARY",4,false,$scorm->summary)); - fwrite ($bf,full_tag("HIDEBROWSE",4,false,$scorm->hidebrowse)); - fwrite ($bf,full_tag("HIDETOC",4,false,$scorm->hidetoc)); - fwrite ($bf,full_tag("HIDENAV",4,false,$scorm->hidenav)); - fwrite ($bf,full_tag("AUTO",4,false,$scorm->auto)); - fwrite ($bf,full_tag("POPUP",4,false,$scorm->popup)); - fwrite ($bf,full_tag("OPTIONS",4,false,$scorm->options)); - fwrite ($bf,full_tag("WIDTH",4,false,$scorm->width)); - fwrite ($bf,full_tag("HEIGHT",4,false,$scorm->height)); - fwrite ($bf,full_tag("TIMEMODIFIED",4,false,$scorm->timemodified)); + fwrite ($bf,full_tag('ID',4,false,$scorm->id)); + fwrite ($bf,full_tag('MODTYPE',4,false,'scorm')); + fwrite ($bf,full_tag('NAME',4,false,$scorm->name)); + fwrite ($bf,full_tag('REFERENCE',4,false,$scorm->reference)); + 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('LAUNCH',4,false,$scorm->launch)); + fwrite ($bf,full_tag('SKIPVIEW',4,false,$scorm->skipview)); + fwrite ($bf,full_tag('SUMMARY',4,false,$scorm->summary)); + fwrite ($bf,full_tag('HIDEBROWSE',4,false,$scorm->hidebrowse)); + fwrite ($bf,full_tag('HIDETOC',4,false,$scorm->hidetoc)); + fwrite ($bf,full_tag('HIDENAV',4,false,$scorm->hidenav)); + fwrite ($bf,full_tag('AUTO',4,false,$scorm->auto)); + fwrite ($bf,full_tag('POPUP',4,false,$scorm->popup)); + fwrite ($bf,full_tag('OPTIONS',4,false,$scorm->options)); + fwrite ($bf,full_tag('WIDTH',4,false,$scorm->width)); + fwrite ($bf,full_tag('HEIGHT',4,false,$scorm->height)); + fwrite ($bf,full_tag('TIMEMODIFIED',4,false,$scorm->timemodified)); $status = backup_scorm_scoes($bf,$preferences,$scorm->id); //if we've selected to backup users info, then execute backup_scorm_scoes_track @@ -84,7 +84,7 @@ } //End mod - $status =fwrite ($bf,end_tag("MOD",3,true)); + $status =fwrite ($bf,end_tag('MOD',3,true)); return $status; } @@ -95,41 +95,63 @@ $status = true; - $scorm_scoes = get_records("scorm_scoes","scorm",$scorm,"id"); + $scorm_scoes = get_records('scorm_scoes','scorm',$scorm,'id'); //If there is scoes if ($scorm_scoes) { //Write start tag - $status =fwrite ($bf,start_tag("SCOES",4,true)); + $status =fwrite ($bf,start_tag('SCOES',4,true)); //Iterate over each sco foreach ($scorm_scoes as $sco) { //Start sco - $status =fwrite ($bf,start_tag("SCO",5,true)); + $status =fwrite ($bf,start_tag('SCO',5,true)); //Print submission contents - fwrite ($bf,full_tag("ID",6,false,$sco->id)); - fwrite ($bf,full_tag("MANIFEST",6,false,$sco->manifest)); - fwrite ($bf,full_tag("ORGANIZATION",6,false,$sco->organization)); - fwrite ($bf,full_tag("PARENT",6,false,$sco->parent)); - fwrite ($bf,full_tag("IDENTIFIER",6,false,$sco->identifier)); - fwrite ($bf,full_tag("LAUNCH",6,false,$sco->launch)); - fwrite ($bf,full_tag("PARAMETERS",6,false,$sco->parameters)); - fwrite ($bf,full_tag("SCORMTYPE",6,false,$sco->scormtype)); - fwrite ($bf,full_tag("TITLE",6,false,$sco->title)); - fwrite ($bf,full_tag("PREREQUISITES",6,false,$sco->prerequisites)); - fwrite ($bf,full_tag("MAXTIMEALLOWED",6,false,$sco->maxtimeallowed)); - fwrite ($bf,full_tag("TIMELIMITACTION",6,false,$sco->timelimitaction)); - fwrite ($bf,full_tag("DATAFROMLMS",6,false,$sco->datafromlms)); - fwrite ($bf,full_tag("MASTERYSCORE",6,false,$sco->masteryscore)); - fwrite ($bf,full_tag("NEXT",6,false,$sco->next)); - fwrite ($bf,full_tag("PREVIOUS",6,false,$sco->previous)); + fwrite ($bf,full_tag('ID',6,false,$sco->id)); + fwrite ($bf,full_tag('MANIFEST',6,false,$sco->manifest)); + fwrite ($bf,full_tag('ORGANIZATION',6,false,$sco->organization)); + fwrite ($bf,full_tag('PARENT',6,false,$sco->parent)); + fwrite ($bf,full_tag('IDENTIFIER',6,false,$sco->identifier)); + fwrite ($bf,full_tag('LAUNCH',6,false,$sco->launch)); + fwrite ($bf,full_tag('SCORMTYPE',6,false,$sco->scormtype)); + fwrite ($bf,full_tag('TITLE',6,false,$sco->title)); + $status = backup_scorm_scoes_data($bf,$preferences,$sco->id); //End sco - $status =fwrite ($bf,end_tag("SCO",5,true)); + $status =fwrite ($bf,end_tag('SCO',5,true)); } //Write end tag - $status =fwrite ($bf,end_tag("SCOES",4,true)); + $status =fwrite ($bf,end_tag('SCOES',4,true)); } return $status; } + //Backup scorm_scoes_data contents (executed from scorm_backup_scorm_scoes) + function backup_scorm_scoes_data ($bf,$preferences,$sco) { + + global $CFG; + + $status = true; + + $scorm_sco_datas = get_records('scorm_scoes_data','scoid',$sco,'id'); + //If there is data + if ($scorm_sco_datas) { + //Write start tag + $status =fwrite ($bf,start_tag('SCO_DATAS',4,true)); + //Iterate over each sco + foreach ($scorm_sco_datas as $sco_data) { + //Start sco track + $status =fwrite ($bf,start_tag('SCO_DATA',5,true)); + //Print track contents + fwrite ($bf,full_tag('ID',6,false,$sco_data->id)); + fwrite ($bf,full_tag('NAME',6,false,$sco_data->name)); + fwrite ($bf,full_tag('VALUE',6,false,$sco_data->value)); + //End sco track + $status =fwrite ($bf,end_tag('SCO_DATA',5,true)); + } + //Write end tag + $status =fwrite ($bf,end_tag('SCO_DATAS',4,true)); + } + return $status; + } + //Backup scorm_scoes_track contents (executed from scorm_backup_mods) function backup_scorm_scoes_track ($bf,$preferences,$scorm) { @@ -137,26 +159,26 @@ $status = true; - $scorm_scoes_track = get_records("scorm_scoes_track","scormid",$scorm,"id"); + $scorm_scoes_track = get_records('scorm_scoes_track','scormid',$scorm,'id'); //If there is track if ($scorm_scoes_track) { //Write start tag - $status =fwrite ($bf,start_tag("SCO_TRACKS",4,true)); + $status =fwrite ($bf,start_tag('SCO_TRACKS',4,true)); //Iterate over each sco foreach ($scorm_scoes_track as $sco_track) { //Start sco track - $status =fwrite ($bf,start_tag("SCO_TRACK",5,true)); + $status =fwrite ($bf,start_tag('SCO_TRACK',5,true)); //Print track contents - 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("ELEMENT",6,false,$sco_track->element)); - fwrite ($bf,full_tag("VALUE",6,false,$sco_track->value)); + 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('ELEMENT',6,false,$sco_track->element)); + fwrite ($bf,full_tag('VALUE',6,false,$sco_track->value)); //End sco track - $status =fwrite ($bf,end_tag("SCO_TRACK",5,true)); + $status =fwrite ($bf,end_tag('SCO_TRACK',5,true)); } //Write end tag - $status =fwrite ($bf,end_tag("SCO_TRACKS",4,true)); + $status =fwrite ($bf,end_tag('SCO_TRACKS',4,true)); } return $status; } @@ -171,7 +193,7 @@ return $info; } //First the course data - $info[0][0] = get_string("modulenameplural","scorm"); + $info[0][0] = get_string('modulenameplural','scorm'); if ($ids = scorm_ids ($course)) { $info[0][1] = count($ids); } else { @@ -180,7 +202,7 @@ //Now, if requested, the user_data if ($user_data) { - $info[1][0] = get_string("scoes","scorm"); + $info[1][0] = get_string('scoes','scorm'); if ($ids = scorm_scoes_track_ids_by_course ($course)) { $info[1][1] = count($ids); } else { @@ -194,7 +216,7 @@ $info[$instance->id.'0'][0] = $instance->name; $info[$instance->id.'0'][1] = ''; if (!empty($instance->userdata)) { - $info[$instance->id.'1'][0] = get_string("scoes","scorm"); + $info[$instance->id.'1'][0] = get_string('scoes','scorm'); if ($ids = scorm_scoes_track_ids_by_instance ($instance->id)) { $info[$instance->id.'1'][1] = count($ids); } else { @@ -214,12 +236,12 @@ //First we check to moddata exists and create it as necessary //in temp/backup/$backup_code dir $status = check_and_create_moddata_dir($preferences->backup_unique_code); - $status = check_dir_exists($CFG->dataroot."/temp/backup/".$preferences->backup_unique_code."/moddata/scorm/",true); + $status = check_dir_exists($CFG->dataroot.'/temp/backup/'.$preferences->backup_unique_code.'/moddata/scorm/',true); if ($status) { //Only if it exists !! Thanks to Daniel Miksik. - if (is_dir($CFG->dataroot."/".$preferences->backup_course."/".$CFG->moddata."/scorm/".$instanceid)) { - $status = backup_copy_file($CFG->dataroot."/".$preferences->backup_course."/".$CFG->moddata."/scorm/".$instanceid, - $CFG->dataroot."/temp/backup/".$preferences->backup_unique_code."/moddata/scorm/".$instanceid); + if (is_dir($CFG->dataroot.'/'.$preferences->backup_course.'/'.$CFG->moddata.'/scorm/'.$instanceid)) { + $status = backup_copy_file($CFG->dataroot.'/'.$preferences->backup_course.'/'.$CFG->moddata.'/scorm/'.$instanceid, + $CFG->dataroot.'/temp/backup/'.$preferences->backup_unique_code.'/moddata/scorm/'.$instanceid); } } @@ -239,14 +261,14 @@ $status = check_and_create_moddata_dir($preferences->backup_unique_code); //Now copy the scorm dir if ($status) { - if (is_dir($CFG->dataroot."/".$preferences->backup_course."/".$CFG->moddata."/scorm")) { - $handle = opendir($CFG->dataroot."/".$preferences->backup_course."/".$CFG->moddata."/scorm"); + if (is_dir($CFG->dataroot.'/'.$preferences->backup_course.'/'.$CFG->moddata.'/scorm')) { + $handle = opendir($CFG->dataroot.'/'.$preferences->backup_course.'/'.$CFG->moddata.'/scorm'); while (false!==($item = readdir($handle))) { - if ($item != '.' && $item != '..' && is_dir($CFG->dataroot."/".$preferences->backup_course."/".$CFG->moddata."/sorm/".$item) + if ($item != '.' && $item != '..' && is_dir($CFG->dataroot.'/'.$preferences->backup_course.'/'.$CFG->moddata.'/scorm/'.$item) && array_key_exists($item,$preferences->mods['scorm']->instances) && !empty($preferences->mods['scorm']->instances[$item]->backup)) { - $status = backup_copy_file($CFG->dataroot."/".$preferences->backup_course."/".$CFG->moddata."/scorm/".$item, - $CFG->dataroot."/temp/backup/".$preferences->backup_unique_code."/moddata/scorm/",$item); + $status = backup_copy_file($CFG->dataroot.'/'.$preferences->backup_course.'/'.$CFG->moddata.'/scorm/'.$item, + $CFG->dataroot.'/temp/backup/'.$preferences->backup_unique_code.'/moddata/scorm/',$item); } } } diff --git a/mod/scorm/config.html b/mod/scorm/config.html index e0472ffb78..423c52398c 100755 --- a/mod/scorm/config.html +++ b/mod/scorm/config.html @@ -11,25 +11,6 @@ -
scorm_framewidth: diff --git a/mod/scorm/datamodels/scorm_12.js.php b/mod/scorm/datamodels/scorm_12.js.php index 3b1afd800e..ee4a01bef9 100644 --- a/mod/scorm/datamodels/scorm_12.js.php +++ b/mod/scorm/datamodels/scorm_12.js.php @@ -68,7 +68,7 @@ function SCORMapi1_2() { 'cmi.core.exit':{'defaultvalue':'{'cmi.core.exit'})?$userdata->{'cmi.core.exit'}:'' ?>', 'format':CMIExit, 'mod':'w', 'readerror':'404', 'writeerror':'405'}, 'cmi.core.session_time':{'format':CMITimespan, 'mod':'w', 'defaultvalue':'00:00:00', 'readerror':'404', 'writeerror':'405'}, 'cmi.suspend_data':{'defaultvalue':'{'cmi.suspend_data'})?$userdata->{'cmi.suspend_data'}:'' ?>', 'format':CMIString4096, 'mod':'rw', 'writeerror':'405'}, - 'cmi.launch_data':{'defaultvalue':'datafromlms ?>', 'mod':'r', 'writeerror':'403'}, + 'cmi.launch_data':{'defaultvalue':'datafromlms)?$userdata->datafromlms:'' ?>', 'mod':'r', 'writeerror':'403'}, 'cmi.comments':{'defaultvalue':'{'cmi.comments'})?$userdata->{'cmi.comments'}:'' ?>', 'format':CMIString4096, 'mod':'rw', 'writeerror':'405'}, 'cmi.comments_from_lms':{'mod':'r', 'writeerror':'403'}, 'cmi.objectives._children':{'defaultvalue':objectives_children, 'mod':'r', 'writeerror':'402'}, @@ -80,9 +80,9 @@ function SCORMapi1_2() { 'cmi.objectives.n.score.max':{'defaultvalue':'', 'pattern':CMIIndex, 'format':CMIDecimal, 'range':score_range, 'mod':'rw', 'writeerror':'405'}, 'cmi.objectives.n.status':{'pattern':CMIIndex, 'format':CMIStatus2, 'mod':'rw', 'writeerror':'405'}, 'cmi.student_data._children':{'defaultvalue':student_data_children, 'mod':'r', 'writeerror':'402'}, - 'cmi.student_data.mastery_score':{'defaultvalue':'masteryscore ?>', 'mod':'r', 'writeerror':'403'}, - 'cmi.student_data.max_time_allowed':{'defaultvalue':'maxtimeallowed ?>', 'mod':'r', 'writeerror':'403'}, - 'cmi.student_data.time_limit_action':{'defaultvalue':'timelimitaction ?>', 'mod':'r', 'writeerror':'403'}, + 'cmi.student_data.mastery_score':{'defaultvalue':'masteryscore)?$userdata->masteryscore:'' ?>', 'mod':'r', 'writeerror':'403'}, + 'cmi.student_data.max_time_allowed':{'defaultvalue':'maxtimeallowed)?$userdata->maxtimeallowed:'' ?>', 'mod':'r', 'writeerror':'403'}, + 'cmi.student_data.time_limit_action':{'defaultvalue':'timelimitaction)?$userdata->timelimitaction:'' ?>', 'mod':'r', 'writeerror':'403'}, 'cmi.student_preference._children':{'defaultvalue':student_preference_children, 'mod':'r', 'writeerror':'402'}, 'cmi.student_preference.audio':{'defaultvalue':'0', 'format':CMISInteger, 'range':audio_range, 'mod':'rw', 'writeerror':'405'}, 'cmi.student_preference.language':{'defaultvalue':'', 'format':CMIString256, 'mod':'rw', 'writeerror':'405'}, @@ -167,7 +167,7 @@ function SCORMapi1_2() { if (param == "") { if (!Initialized) { debug > 7) && (isadmin())) { + if (debugging('',DEBUG_DEVELOPER)) { echo 'alert("Initialized SCORM 1.2");'; } ?> @@ -188,7 +188,7 @@ function SCORMapi1_2() { if (param == "") { if (Initialized) { debug > 7) && (isadmin())) { + if (debugging('',DEBUG_DEVELOPER)) { echo 'alert("Finished SCORM 1.2");'; } ?> @@ -233,7 +233,7 @@ function SCORMapi1_2() { if (subelement == element) { errorCode = "0"; debug > 7) && (isadmin())) { + if (debugging('',DEBUG_DEVELOPER)) { echo 'alert(element+": "+eval(element));'; } ?> @@ -337,7 +337,7 @@ function SCORMapi1_2() { eval(element+'="'+value+'";'); errorCode = "0"; debug > 7) && (isadmin())) { + if (debugging('',DEBUG_DEVELOPER)) { echo 'alert(element+":= "+value);'; } ?> @@ -353,7 +353,7 @@ function SCORMapi1_2() { } errorCode = "0"; debug > 7) && (isadmin())) { + if (debugging('',DEBUG_DEVELOPER)) { echo 'alert(element+":= "+value);'; } ?> @@ -384,7 +384,7 @@ function SCORMapi1_2() { if (Initialized) { result = StoreData(cmi,false); debug > 7) && (isadmin())) { + if (debugging('',DEBUG_DEVELOPER)) { echo 'alert("Data Commited");'; } ?> @@ -539,7 +539,7 @@ function SCORMapi1_2() { datastring = CollectData(data,'cmi'); } datastring += '&attempt='; - datastring += '&scoid=id ?>'; + datastring += '&scoid='; var myRequest = NewHttpReq(); result = DoRequest(myRequest,"wwwroot) ?>/mod/scorm/datamodel.php","id=&sesskey=sesskey) ?>"+datastring); diff --git a/mod/scorm/datamodels/scorm_12lib.php b/mod/scorm/datamodels/scorm_12lib.php index 241ecf3537..c5caf14e5f 100644 --- a/mod/scorm/datamodels/scorm_12lib.php +++ b/mod/scorm/datamodels/scorm_12lib.php @@ -81,7 +81,7 @@ function scorm_eval_prerequisites($prerequisites,$usertracks) { $setelements = explode(',', substr($prerequisites, $open+1, $close-($open+1)-1)); $settrue = 0; foreach ($setelements as $setelement) { - if (eval_prerequisites($setelement,$usertracks)) { + if (scorm_eval_prerequisites($setelement,$usertracks)) { $settrue++; } } @@ -212,6 +212,12 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n $parents[$level]='/'; foreach ($scoes as $sco) { + $isvisible = false; + if ($optionaldatas = scorm_get_sco($sco->id, SCO_DATA)) { + if (!isset($optionaldatas->isvisible) || (isset($optionaldatas->isvisible) && ($optionaldatas->isvisible == 'true'))) { + $isvisible = true; + } + } if ($parents[$level]!=$sco->parent) { if ($newlevel = array_search($sco->parent,$parents)) { for ($i=0; $i<($level-$newlevel); $i++) { @@ -239,86 +245,97 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n $parents[$level]=$sco->parent; } } - $result->toc .= "\t\t
  • "; + if ($isvisible) { + $result->toc .= "\t\t
  • "; + } $nextsco = next($scoes); - if (($nextsco !== false) && ($sco->parent != $nextsco->parent) && (($level==0) || (($level>0) && ($nextsco->parent == $sco->identifier)))) { + $nextisvisible = false; + if (($nextsco !== false) && ($optionaldatas = scorm_get_sco($nextsco->id, SCO_DATA))) { + if (!isset($optionaldatas->isvisible) || (isset($optionaldatas->isvisible) && ($optionaldatas->isvisible == 'true'))) { + $nextisvisible = true; + } + } + if ($nextisvisible && ($nextsco !== false) && ($sco->parent != $nextsco->parent) && (($level==0) || (($level>0) && ($nextsco->parent == $sco->identifier)))) { $sublist++; $icon = 'minus'; if (isset($_COOKIE['hide:SCORMitem'.$nextsco->id])) { $icon = 'plus'; } $result->toc .= ''.$strexpand.''; - } else { + } else if ($isvisible) { $result->toc .= ''; } if (empty($sco->title)) { $sco->title = $sco->identifier; } if (!empty($sco->launch)) { - $startbold = ''; - $endbold = ''; - $score = ''; - if (empty($scoid) && ($mode != 'normal')) { - $scoid = $sco->id; - } - if (isset($usertracks[$sco->identifier])) { - $usertrack = $usertracks[$sco->identifier]; - $strstatus = get_string($usertrack->status,'scorm'); - if ($sco->scormtype == 'sco') { - $statusicon = ''.$strstatus.''; - } else { - $statusicon = ''.get_string('assetlauched','scorm').''; + if ($isvisible) { + $startbold = ''; + $endbold = ''; + $score = ''; + if (empty($scoid) && ($mode != 'normal')) { + $scoid = $sco->id; } + if (isset($usertracks[$sco->identifier])) { + $usertrack = $usertracks[$sco->identifier]; + $strstatus = get_string($usertrack->status,'scorm'); + if ($sco->scormtype == 'sco') { + $statusicon = ''.$strstatus.''; + } else { + $statusicon = ''.get_string('assetlauched','scorm').''; + } - if (($usertrack->status == 'notattempted') || ($usertrack->status == 'incomplete') || ($usertrack->status == 'browsed')) { - $incomplete = true; + if (($usertrack->status == 'notattempted') || ($usertrack->status == 'incomplete') || ($usertrack->status == 'browsed')) { + $incomplete = true; + if ($play && empty($scoid)) { + $scoid = $sco->id; + } + } + if ($usertrack->score_raw != '') { + $score = '('.get_string('score','scorm').': '.$usertrack->score_raw.')'; + } + $strsuspended = get_string('suspended','scorm'); + if (isset($usertrack->{'cmi.core.exit'}) && ($usertrack->{'cmi.core.exit'} == 'suspend')) { + $statusicon = ''.$strstatus.' - '.$strsuspended.''; + } + } else { if ($play && empty($scoid)) { $scoid = $sco->id; } + if ($sco->scormtype == 'sco') { + $statusicon = ''.get_string('notattempted','scorm').''; + $incomplete = true; + } else { + $statusicon = ''.get_string('asset','scorm').''; + } } - if ($usertrack->score_raw != '') { - $score = '('.get_string('score','scorm').': '.$usertrack->score_raw.')'; - } - $strsuspended = get_string('suspended','scorm'); - if (isset($usertrack->{'cmi.core.exit'}) && ($usertrack->{'cmi.core.exit'} == 'suspend')) { - $statusicon = ''.$strstatus.' - '.$strsuspended.''; - } - } else { - if ($play && empty($scoid)) { - $scoid = $sco->id; - } - if ($sco->scormtype == 'sco') { - $statusicon= ''.get_string('notattempted','scorm').''; - $incomplete = true; - } else { - $statusicon .= ''.get_string('asset','scorm').''; + if ($sco->id == $scoid) { + $scodata = scorm_get_sco($sco->id, SCO_DATA); + $startbold = ''; + $endbold = ''; + $findnext = true; + $shownext = isset($scodata->next) ? $scodata->next : 0; + $showprev = isset($scodata->previous) ? $scodata->previous : 0; } - } - if ($sco->id == $scoid) { - $startbold = ''; - $endbold = ''; - $findnext = true; - $shownext = $sco->next; - $showprev = $sco->previous; - } - if (($nextid == 0) && (scorm_count_launchable($scorm->id,$currentorg) > 1) && ($nextsco!==false) && (!$findnext)) { - if (!empty($sco->launch)) { - $previd = $sco->id; - } - } - if (empty($sco->prerequisites) || scorm_eval_prerequisites($sco->prerequisites,$usertracks)) { - if ($sco->id == $scoid) { - $result->prerequisites = true; + if (($nextid == 0) && (scorm_count_launchable($scorm->id,$currentorg) > 1) && ($nextsco!==false) && (!$findnext)) { + if (!empty($sco->launch)) { + $previd = $sco->id; + } } - $url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&currentorg='.$currentorg.$modestr.'&scoid='.$sco->id; - $result->toc .= $statusicon.' '.$startbold.''.format_string($sco->title).''.$score.$endbold."
  • \n"; - $tocmenus[$sco->id] = scorm_repeater('−',$level) . '>' . format_string($sco->title); - } else { - if ($sco->id == $scoid) { - $result->prerequisites = false; + if (empty($sco->prerequisites) || scorm_eval_prerequisites($sco->prerequisites,$usertracks)) { + if ($sco->id == $scoid) { + $result->prerequisites = true; + } + $url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&currentorg='.$currentorg.$modestr.'&scoid='.$sco->id; + $result->toc .= $statusicon.' '.$startbold.''.format_string($sco->title).''.$score.$endbold."\n"; + $tocmenus[$sco->id] = scorm_repeater('−',$level) . '>' . format_string($sco->title); + } else { + if ($sco->id == $scoid) { + $result->prerequisites = false; + } + $result->toc .= $statusicon.' '.$sco->title."\n"; } - $result->toc .= ' '.$sco->title."\n"; } } else { $result->toc .= ' '.$sco->title."\n"; @@ -334,7 +351,7 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n } if ($play) { - $sco = get_record('scorm_scoes','id',$scoid); + $sco = scorm_get_sco($scoid); $sco->previd = $previd; $sco->nextid = $nextid; $result->sco = $sco; diff --git a/mod/scorm/datamodels/scorm_13lib.php b/mod/scorm/datamodels/scorm_13lib.php index 523bb45b73..9a25e752dd 100644 --- a/mod/scorm/datamodels/scorm_13lib.php +++ b/mod/scorm/datamodels/scorm_13lib.php @@ -1,24 +1,5 @@ elements[$manifest][$parent->organization][$parent->identifier]->next = 1; - } - if ($adlnavInterface['tagData'] == 'previous') { - $scoes->elements[$manifest][$parent->organization][$parent->identifier]->previous = 1; - } - } - - } - } - } - break; case 'IMSSS:SEQUENCING': $parent = array_pop($parents); array_push($parents, $parent); @@ -373,7 +354,7 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n // // Added by Pham Minh Duc - $suspendedscoid = scorm_get_suspendedscoid($scorm->id,$user->id,$attempt); + // $suspendedscoid = scorm_get_suspendedscoid($scorm->id,$user->id,$attempt); // End add $usertracks = array(); @@ -394,8 +375,13 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n $nextid = 0; $findnext = false; $parents[$level]='/'; - foreach ($scoes as $sco) { + $isvisible = false; + if ($optionaldatas = scorm_get_sco($sco->id, SCO_DATA)) { + if (!isset($optionaldatas->isvisible) || (isset($optionaldatas->isvisible) && ($optionaldatas->isvisible == 'true'))) { + $isvisible = true; + } + } if ($parents[$level]!=$sco->parent) { if ($newlevel = array_search($sco->parent,$parents)) { for ($i=0; $i<($level-$newlevel); $i++) { @@ -423,97 +409,107 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n $parents[$level]=$sco->parent; } } - $result->toc .= "\t\t
  • "; + if ($isvisible) { + $result->toc .= "\t\t
  • "; + } $nextsco = next($scoes); - if (($nextsco !== false) && ($sco->parent != $nextsco->parent) && (($level==0) || (($level>0) && ($nextsco->parent == $sco->identifier)))) { + $nextisvisible = false; + if (($nextsco !== false) && ($optionaldatas = scorm_get_sco($nextsco->id, SCO_DATA))) { + if (!isset($optionaldatas->isvisible) || (isset($optionaldatas->isvisible) && ($optionaldatas->isvisible == 'true'))) { + $nextisvisible = true; + } + } + if ($nextisvisible && ($nextsco !== false) && ($sco->parent != $nextsco->parent) && (($level==0) || (($level>0) && ($nextsco->parent == $sco->identifier)))) { $sublist++; $icon = 'minus'; if (isset($_COOKIE['hide:SCORMitem'.$nextsco->id])) { $icon = 'plus'; } $result->toc .= ''.$strexpand.''; - } else { + } else if ($isvisible) { $result->toc .= ''; } if (empty($sco->title)) { $sco->title = $sco->identifier; } if (!empty($sco->launch)) { - $startbold = ''; - $endbold = ''; - $score = ''; - if (empty($scoid) && ($mode != 'normal')) { - $scoid = $sco->id; - } - if (isset($usertracks[$sco->identifier])) { - $usertrack = $usertracks[$sco->identifier]; - $strstatus = get_string($usertrack->status,'scorm'); - if ($sco->scormtype == 'sco') { - $statusicon = ''.$strstatus.''; - } else { - $statusicon = ''.get_string('assetlaunched','scorm').''; + if ($isvisible) { + $startbold = ''; + $endbold = ''; + $score = ''; + if (empty($scoid) && ($mode != 'normal')) { + $scoid = $sco->id; } - - if (($usertrack->status == 'notattempted') || ($usertrack->status == 'incomplete') || ($usertrack->status == 'browsed')) { - $incomplete = true; + if (isset($usertracks[$sco->identifier])) { + $usertrack = $usertracks[$sco->identifier]; + $strstatus = get_string($usertrack->status,'scorm'); + if ($sco->scormtype == 'sco') { + $statusicon = ''.$strstatus.''; + } else { + $statusicon = ''.get_string('assetlaunched','scorm').''; + } + + if (($usertrack->status == 'notattempted') || ($usertrack->status == 'incomplete') || ($usertrack->status == 'browsed')) { + $incomplete = true; + if ($play && empty($scoid)) { + $scoid = $sco->id; + } + } + if ($usertrack->score_raw != '') { + $score = '('.get_string('score','scorm').': '.$usertrack->score_raw.')'; + } + $strsuspended = get_string('suspended','scorm'); + if (isset($usertrack->{'cmi.core.exit'}) && ($usertrack->{'cmi.core.exit'} == 'suspend')) { + $statusicon = ''.$strstatus.' - '.$strsuspended.''; + } + } else { if ($play && empty($scoid)) { $scoid = $sco->id; } + if ($sco->scormtype == 'sco') { + $statusicon = ''.get_string('notattempted','scorm').''; + $incomplete = true; + } else { + $statusicon = ''.get_string('asset','scorm').''; + } } - if ($usertrack->score_raw != '') { - $score = '('.get_string('score','scorm').': '.$usertrack->score_raw.')'; - } - $strsuspended = get_string('suspended','scorm'); - if (isset($usertrack->{'cmi.core.exit'}) && ($usertrack->{'cmi.core.exit'} == 'suspend')) { - $statusicon = ''.$strstatus.' - '.$strsuspended.''; - } - } else { - if ($play && empty($scoid)) { - $scoid = $sco->id; - } - if ($sco->scormtype == 'sco') { - $statusicon = ''.get_string('notattempted','scorm').''; - $incomplete = true; - } else { - $statusicon = ''.get_string('asset','scorm').''; - } - } - if ($sco->id == $scoid) { - $startbold = ''; - $endbold = ''; - $findnext = true; - $shownext = $sco->next; - $showprev = $sco->previous; - } - - if (($nextid == 0) && (scorm_count_launchable($scorm->id,$currentorg) > 1) && ($nextsco!==false) && (!$findnext)) { - if (!empty($sco->launch)) { - $previd = $sco->id; - } - } - if (empty($sco->prerequisites) || scorm_eval_prerequisites($sco->prerequisites,$usertracks)) { if ($sco->id == $scoid) { - $result->prerequisites = true; + $startbold = ''; + $endbold = ''; + $findnext = true; + $shownext = $sco->next; + $showprev = $sco->previous; } - // Modified by Pham Minh Duc - // if (scorm_isChoice($scorm->id,$sco->id) == 1) { - $url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&currentorg='.$currentorg.$modestr.'&scoid='.$sco->id; - $result->toc .= $statusicon.' '.$startbold.''.format_string($sco->title).''.$score.$endbold."
  • \n"; - $tocmenus[$sco->id] = scorm_repeater('−',$level) . '>' . format_string($sco->title); - // } else { - // $result->toc .= ' '.$startbold.format_string($sco->title).$score.$endbold."\n"; - // $tocmenus[$sco->id] = scorm_repeater('−',$level) . '>' . format_string($sco->title); - // } - // End modify - } else { - if ($sco->id == $scoid) { - $result->prerequisites = false; + + if (($nextid == 0) && (scorm_count_launchable($scorm->id,$currentorg) > 1) && ($nextsco!==false) && (!$findnext)) { + if (!empty($sco->launch)) { + $previd = $sco->id; + } + } + if (empty($sco->prerequisites) || scorm_eval_prerequisites($sco->prerequisites,$usertracks)) { + if ($sco->id == $scoid) { + $result->prerequisites = true; + } + // Modified by Pham Minh Duc + // if (scorm_isChoice($scorm->id,$sco->id) == 1) { + $url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&currentorg='.$currentorg.$modestr.'&scoid='.$sco->id; + $result->toc .= $statusicon.' '.$startbold.''.format_string($sco->title).''.$score.$endbold."\n"; + $tocmenus[$sco->id] = scorm_repeater('−',$level) . '>' . format_string($sco->title); + // } else { + // $result->toc .= ' '.$startbold.format_string($sco->title).$score.$endbold."\n"; + // $tocmenus[$sco->id] = scorm_repeater('−',$level) . '>' . format_string($sco->title); + // } + // End modify + } else { + if ($sco->id == $scoid) { + $result->prerequisites = false; + } + $result->toc .= ' '.format_string($sco->title)."\n"; } - $result->toc .= ' '.$sco->title."\n"; } } else { - $result->toc .= ' '.$sco->title."\n"; + $result->toc .= ' '.format_string($sco->title)."\n"; } if (($nextsco !== false) && ($nextid == 0) && ($findnext)) { if (!empty($nextsco->launch)) { diff --git a/mod/scorm/datamodels/scormlib.php b/mod/scorm/datamodels/scormlib.php index b8682de4f6..a044fe277e 100644 --- a/mod/scorm/datamodels/scormlib.php +++ b/mod/scorm/datamodels/scormlib.php @@ -177,6 +177,33 @@ function scorm_get_manifest($blocks,$scoes) { } $scoes->elements[$manifest][$parent->organization][$parent->identifier]->masteryscore = addslashes($block['tagData']); break; + case 'ADLCP:COMPLETIONTHRESHOLD': + $parent = array_pop($parents); + array_push($parents, $parent); + if (!isset($block['tagData'])) { + $block['tagData'] = ''; + } + $scoes->elements[$manifest][$parent->organization][$parent->identifier]->threshold = addslashes($block['tagData']); + break; + case 'ADLNAV:PRESENTATION': + $parent = array_pop($parents); + array_push($parents, $parent); + foreach ($block['children'] as $adlnav) { + if ($adlnav['name'] == 'ADLNAV:NAVIGATIONINTERFACE') { + foreach ($adlnav['children'] as $adlnavInterface) { + if ($adlnavInterface['name'] == 'ADLNAV:HIDELMSUI') { + if ($adlnavInterface['tagData'] == 'continue') { + $scoes->elements[$manifest][$parent->organization][$parent->identifier]->next = 1; + } + if ($adlnavInterface['tagData'] == 'previous') { + $scoes->elements[$manifest][$parent->organization][$parent->identifier]->previous = 1; + } + } + + } + } + } + break; } } } @@ -191,9 +218,14 @@ function scorm_parse_scorm($pkgdir,$scormid) { if (is_file($manifestfile)) { - $xmlstring = file_get_contents($manifestfile); + $xmltext = file_get_contents($manifestfile); + + $pattern = '/&(?!\w{2,6};)/'; + $replacement = '&'; + $xmltext = preg_replace($pattern, $replacement, $xmltext); + $objXML = new xml2Array(); - $manifests = $objXML->parse($xmlstring); + $manifests = $objXML->parse($xmltext); //print_r($manifests); $scoes = new stdClass(); $scoes->version = ''; @@ -205,13 +237,13 @@ function scorm_parse_scorm($pkgdir,$scormid) { foreach ($organizations as $organization => $items) { foreach ($items as $identifier => $item) { // This new db mngt will support all SCORM future extensions - /*$newitem = new stdClass(); + $newitem = new stdClass(); $newitem->scorm = $scormid; $newitem->manifest = $manifest; $newitem->organization = $organization; $standarddatas = array('parent', 'identifier', 'launch', 'scormtype', 'title'); foreach ($standarddatas as $standarddata) { - $newitem->$standarddata = $item->$standarddata; + $newitem->$standarddata = addslashes($item->$standarddata); } if ($olditemid = scorm_array_search('identifier',$newitem->identifier,$olditems)) { @@ -224,18 +256,18 @@ function scorm_parse_scorm($pkgdir,$scormid) { } $data = new stdClass(); - $data->scormid = $scormid; $data->scoid = $id; - $optionaldatas = scorm_optionals_data(); - foreach ($optionalsdatas as $optionaldata) { - if (isset($item->$optionaldata)) { - $data->name = $optionaldata; - $data->value = $item->$optionaldata; - $dataid = insert_record('scorm_scoes_data'); + if ($optionaldatas = scorm_optionals_data($item,$standarddatas)) { + foreach ($optionaldatas as $optionaldata) { + if (isset($item->$optionaldata)) { + $data->name = $optionaldata; + $data->value = addslashes($item->$optionaldata); + $dataid = insert_record('scorm_scoes_data',$data); + } } - } */ + } - $item->scorm = $scormid; + /*$item->scorm = $scormid; $item->manifest = $manifest; $item->organization = $organization; if ($olditemid = scorm_array_search('identifier',$item->identifier,$olditems)) { @@ -244,7 +276,7 @@ function scorm_parse_scorm($pkgdir,$scormid) { unset($olditems[$olditemid]); } else { $id = insert_record('scorm_scoes',$item); - } + } */ if (($launch == 0) && ((empty($scoes->defaultorg)) || ($scoes->defaultorg == $identifier))) { $launch = $id; @@ -266,6 +298,16 @@ function scorm_parse_scorm($pkgdir,$scormid) { return $launch; } +function scorm_optionals_data($item, $standarddata) { + $result = array(); + foreach ($item as $element => $value) { + if (! in_array($element, $standarddata)) { + $result[] = $element; + } + } + return $result; +} + /* Usage Grab some XML data, either from a file, URL, etc. however you want. Assume storage in $strYourXML; diff --git a/mod/scorm/db/access.php b/mod/scorm/db/access.php index 0ecaa8283c..5a693b564b 100644 --- a/mod/scorm/db/access.php +++ b/mod/scorm/db/access.php @@ -63,7 +63,6 @@ $mod_scorm_capabilities = array( 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, 'coursecreator' => CAP_ALLOW, - 'admin' => CAP_ALLOW ) ), diff --git a/mod/scorm/db/install.xml b/mod/scorm/db/install.xml index 1382dfbf68..c6c3c27696 100644 --- a/mod/scorm/db/install.xml +++ b/mod/scorm/db/install.xml @@ -1,5 +1,5 @@ - @@ -34,7 +34,7 @@
    - +
    @@ -42,24 +42,30 @@ - - - - - - - - - - - + + +
    - +
    + + + + + + + + + + + + +
    + diff --git a/mod/scorm/db/mysql.sql b/mod/scorm/db/mysql.sql index cfb27c9a66..fa5b02cfba 100755 --- a/mod/scorm/db/mysql.sql +++ b/mod/scorm/db/mysql.sql @@ -6,6 +6,7 @@ CREATE TABLE prefix_scorm ( id int(10) unsigned NOT NULL auto_increment, course int(10) unsigned NOT NULL default '0', name varchar(255) NOT NULL default '', + summary text NOT NULL default '', reference varchar(255) NOT NULL default '', version varchar(9) NOT NULL default '', maxgrade float(3) NOT NULL default '0', @@ -13,8 +14,9 @@ CREATE TABLE prefix_scorm ( maxattempt int(10) NOT NULL default '1', launch int(10) unsigned NOT NULL default '0', skipview tinyint(1) unsigned NOT NULL default '1', - summary text NOT NULL default '', hidebrowse tinyint(1) NOT NULL default '0', + hideexit tinyint(1) NOT NULL default '0', + hideabandon tinyint(1) NOT NULL default '0', hidetoc tinyint(1) NOT NULL default '0', hidenav tinyint(1) NOT NULL default '0', auto tinyint(1) unsigned NOT NULL default '0', @@ -24,7 +26,6 @@ CREATE TABLE prefix_scorm ( height int(10) unsigned NOT NULL default '600', timemodified int(10) unsigned NOT NULL default '0', PRIMARY KEY (id), - UNIQUE KEY id (id), KEY course (course) ) TYPE=MyISAM; @@ -35,22 +36,31 @@ CREATE TABLE prefix_scorm_scoes ( organization varchar(255) NOT NULL default '', parent varchar(255) NOT NULL default '', identifier varchar(255) NOT NULL default '', - launch varchar(255) NOT NULL default '', - parameters varchar(255) NOT NULL default '', +/* launch varchar(255) NOT NULL default '', */ + launch int(10) NOT NULL default '0', scormtype varchar(5) NOT NULL default '', title varchar(255) NOT NULL default '', +/* parameters varchar(255) NOT NULL default '', prerequisites varchar(200) NOT NULL default '', maxtimeallowed varchar(19) NOT NULL default '', timelimitaction varchar(19) NOT NULL default '', datafromlms varchar(255) NOT NULL default '', masteryscore varchar(200) NOT NULL default '', next tinyint(1) unsigned NOT NULL default '0', - previous tinyint(1) unsigned NOT NULL default '0', + previous tinyint(1) unsigned NOT NULL default '0', */ PRIMARY KEY (id), - UNIQUE KEY id (id), KEY scorm (scorm) ) TYPE=MyISAM; +CREATE TABLE prefix_scorm_scoes_data ( + id int(10) unsigned NOT NULL auto_increment, + scoid int(10) unsigned NOT NULL default '0', + name varchar(255) NOT NULL default '', + value text NOT NULL default '', + PRIMARY KEY (id), + KEY scoid (scoid) +) TYPE=MyISAM; + CREATE TABLE prefix_scorm_scoes_track ( id int(10) unsigned NOT NULL auto_increment, userid int(10) unsigned NOT NULL default '0', @@ -60,7 +70,7 @@ CREATE TABLE prefix_scorm_scoes_track ( element varchar(255) NOT NULL default '', value longtext NOT NULL default '', timemodified int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id), + PRIMARY KEY (id), KEY userid (userid), KEY scormid (scormid), KEY scoid (scoid), @@ -68,6 +78,106 @@ CREATE TABLE prefix_scorm_scoes_track ( UNIQUE track (userid, scormid, scoid, attempt, element) ) TYPE=MyISAM; +CREATE TABLE prefix_scorm_sequencing_ruleconditions ( + id int(10) unsigned NOT NULL auto_increment, + scormid int(10) unsigned NOT NULL default '0', + scoid int(10) unsigned NOT NULL default '0', + conditioncombination varchar(3) NOT NULL default 'all', + ruletype tinyint(2) unsigned NOT NULL default '0', + action varchar(25) NOT NULL default '', + PRIMARY KEY (id), + UNIQUE (scormid, scoid,id), + KEY scormid (scormid), + KEY scoid (scoid) +) TYPE=MyISAM; + +CREATE TABLE prefix_scorm_sequencing_rulecondition ( + id int(10) unsigned NOT NULL auto_increment, + scormid int(10) unsigned NOT NULL default '0', + scoid int(10) unsigned NOT NULL default '0', + ruleconditionsid int(10) unsigned NOT NULL default '0', + refrencedobjective varchar(255) NOT NULL default '', + measurethreshold float(11,4) NOT NULL default '0.0000', + operator varchar(5) NOT NULL default 'noOp', + condition varchar(30) NOT NULL default 'always', + PRIMARY KEY (id), + UNIQUE (scormid, scoid,id,ruleconditionsid), + KEY ruleconditionsid (ruleconditionsid), + KEY scormid (scormid), + KEY scoid (scoid) +) TYPE=MyISAM; + +CREATE TABLE prefix_scorm_sequencing_rolluprules ( + id int(10) unsigned NOT NULL auto_increment, + scormid int(10) unsigned NOT NULL default '0', + scoid int(10) unsigned NOT NULL default '0', + rollupobjectivesatisfied TINYINT(1) unsigned NOT NULL default '1', + rollupprogresscompletion TINYINT(1) unsigned NOT NULL default '1', + objectivemeasureweight float(11,4) NOT NULL default '1.0000', + PRIMARY KEY (id), + KEY scormid (scormid), + KEY scoid (scoid) +) TYPE=MyISAM; + +CREATE TABLE prefix_scorm_sequencing_rolluprule ( + id int(10) unsigned NOT NULL auto_increment, + scormid int(10) unsigned NOT NULL default '0', + scoid int(10) unsigned NOT NULL default '0', + rolluprulesid int(10) unsigned NOT NULL default '0', + childactivityset varchar(15) NOT NULL default '', + minimumcount int(10) unsigned NOT NULL default '0', + minimumpercent float(11,4) unsigned NOT NULL default '0.0000', + conditioncombination varchar(3) NOT NULL default 'all', + action varchar(15) NOT NULL default '', + PRIMARY KEY (id), + UNIQUE (scormid, scoid, rolluprulesid, id), + KEY scormid (scormid), + KEY scoid (scoid) +) TYPE=MyISAM; + +CREATE TABLE prefix_scorm_sequencing_rolluprulecondition ( + id int(10) unsigned NOT NULL auto_increment, + scormid int(10) unsigned NOT NULL default '0', + scoid int(10) unsigned NOT NULL default '0', + rollupruleid int(10) unsigned NOT NULL default '0', + operator varchar(5) NOT NULL default 'noOp', + condition varchar(25) NOT NULL default '', + PRIMARY KEY (id), + UNIQUE (scormid, scoid, rollupruleid, id), + KEY scormid (scormid), + KEY scoid (scoid) +) TYPE=MyISAM; + +CREATE TABLE prefix_scorm_sequencing_objectives ( + id int(10) unsigned NOT NULL auto_increment, + scormid int(10) unsigned NOT NULL default '0', + scoid int(10) unsigned NOT NULL default '0', + primary tinyint(1) NOT NULL default '0', + objectiveid int(10) unsigned NOT NULL default '0', + satisfiedbymeasure tinyint(1) NOT NULL default '1', + minnormalizedmeasure float(11,4) unsigned NOT NULL default '1.0', + PRIMARY KEY (id), + UNIQUE (scormid, scoid, id), + KEY scormid (scormid), + KEY scoid (scoid) +) TYPE=MyISAM; + +CREATE TABLE prefix_scorm_sequencing_objective ( + id int(10) unsigned NOT NULL auto_increment, + scormid int(10) unsigned NOT NULL default '0', + scoid int(10) unsigned NOT NULL default '0', + objectiveid int(10) unsigned NOT NULL default '0', + targetobjectiveid int(10) unsigned NOT NULL default '0', + readsatisfiedstatus tinyint(1) NOT NULL default '1', + readnormalizedmeasure tinyint(1) NOT NULL default '1', + writesatisfiedstatus tinyint(1) NOT NULL default '0', + writenormalizedmeasure tinyint(1) NOT NULL default '0', + PRIMARY KEY (id), + UNIQUE (scormid, scoid, id, objectiveid), + KEY scormid (scormid), + KEY scoid (scoid) +) TYPE=MyISAM; + # # Dumping data for table log_display # diff --git a/mod/scorm/db/upgrade.php b/mod/scorm/db/upgrade.php index 94570d0286..befa0f9c71 100644 --- a/mod/scorm/db/upgrade.php +++ b/mod/scorm/db/upgrade.php @@ -23,14 +23,61 @@ function xmldb_scorm_upgrade($oldversion=0) { $result = true; -/// And upgrade begins here. For each one, you'll need one -/// block of code similar to the next one. Please, delete -/// this comment lines once this file start handling proper -/// upgrade code. - -/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php -/// $result = result of "/lib/ddllib.php" function calls -/// } + if ($result && $oldversion < 2006103100) { + /// Create the new sco optionals data table + + /// Define table scorm_scoes_data to be created + $table = new XMLDBTable('scorm_scoes_data'); + + /// Adding fields to table scorm_scoes_data + $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null); + $table->addFieldInfo('scoid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0'); + $table->addFieldInfo('name', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null); + $table->addFieldInfo('value', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, null, null); + + /// Adding keys to table scorm_scoes_data + $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id')); + + /// Adding indexes to table scorm_scoes_data + $table->addIndexInfo('scoid', XMLDB_INDEX_NOTUNIQUE, array('scoid')); + + /// Launch create table for scorm_scoes_data + $result = $result && create_table($table); + + /// The old fields used in scorm_scoes + $fields = array('parameters' => '', + 'prerequisites' => '', + 'maxtimeallowed' => '', + 'timelimitaction' => '', + 'datafromlms' => '', + 'masteryscore' => '', + 'next' => '0', + 'previous' => '0'); + + /// Retrieve old datas + if ($olddatas = get_records('scorm_scoes')) { + foreach ($olddatas as $olddata) { + $newdata = new stdClass(); + $newdata->scoid = $olddata->id; + foreach ($fields as $field => $value) { + if ($olddata->$field != $value) { + $newdata->name = addslashes($field); + $newdata->value = addslashes($olddata->$field); + $id = insert_record('scorm_scoes_data', $newdata); + $result = $result && ($id != 0); + } + } + } + } + + /// Remove no more used fields + $table = new XMLDBTable('scorm_scoes'); + + foreach ($fields as $field => $value) { + $field = new XMLDBField($field); + $result = $result && drop_field($table, $field); + } + } return $result; } diff --git a/mod/scorm/lib.php b/mod/scorm/lib.php index d6132222ed..0bd0b5dd1f 100755 --- a/mod/scorm/lib.php +++ b/mod/scorm/lib.php @@ -23,6 +23,10 @@ function scorm_add_instance($scorm) { //sanitize submitted values a bit $scorm->width = clean_param($scorm->width, PARAM_INT); $scorm->height = clean_param($scorm->height, PARAM_INT); + + if (!isset($scorm->whatgrade)) { + $scorm->whatgrade = 0; + } $scorm->grademethod = ($scorm->whatgrade * 10) + $scorm->grademethod; $id = insert_record('scorm', $scorm); @@ -64,6 +68,9 @@ function scorm_update_instance($scorm) { $scorm->width = str_replace('%','',$scorm->width); $scorm->height = str_replace('%','',$scorm->height); + if (!isset($scorm->whatgrade)) { + $scorm->whatgrade = 0; + } $scorm->grademethod = ($scorm->whatgrade * 10) + $scorm->grademethod; // Check if scorm manifest needs to be reparsed @@ -124,7 +131,14 @@ function scorm_delete_instance($id) { if (! delete_records('scorm_scoes_track', 'scormid', $scorm->id)) { $result = false; } - if (! delete_records('scorm_scoes', 'scorm', $scorm->id)) { + if ($scoes = get_records('scorm_scoes','scorm',$scorm->id)) { + foreach ($scoes as $sco) { + if (! delete_records('scorm_scoes_data', 'scoid', $sco->id)) { + $result = false; + } + } + delete_records('scorm_scoes', 'scorm', $scorm->id); + } else { $result = false; } if (! delete_records('scorm', 'id', $scorm->id)) { diff --git a/mod/scorm/loadSCO.php b/mod/scorm/loadSCO.php index 99866b290a..1d32290dc4 100755 --- a/mod/scorm/loadSCO.php +++ b/mod/scorm/loadSCO.php @@ -1,5 +1,5 @@ course)) { - error("Course is misconfigured"); + if (! $course = get_record('course', 'id', $cm->course)) { + error('Course is misconfigured'); } - if (! $scorm = get_record("scorm", "id", $cm->instance)) { - error("Course module is incorrect"); + if (! $scorm = get_record('scorm', 'id', $cm->instance)) { + error('Course module is incorrect'); } } else if (!empty($a)) { - if (! $scorm = get_record("scorm", "id", $a)) { - error("Course module is incorrect"); + if (! $scorm = get_record('scorm', 'id', $a)) { + error('Course module is incorrect'); } - if (! $course = get_record("course", "id", $scorm->course)) { - error("Course is misconfigured"); + if (! $course = get_record('course', 'id', $scorm->course)) { + error('Course is misconfigured'); } - if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id, $course->id)) { - error("Course Module ID was incorrect"); + if (! $cm = get_coursemodule_from_instance('scorm', $scorm->id, $course->id)) { + error('Course Module ID was incorrect'); } } else { error('A required parameter is missing'); @@ -35,10 +35,10 @@ // // Direct SCO request // - if ($sco = get_record("scorm_scoes","id",$scoid)) { + if ($sco = scorm_get_sco($scoid)) { if ($sco->launch == '') { // Search for the next launchable sco - if ($scoes = get_records_select("scorm_scoes","scorm=".$scorm->id." AND launch<>'' AND id>".$sco->id,"id ASC")) { + if ($scoes = get_records_select('scorm_scoes','scorm='.$scorm->id." AND launch<>'' AND id>".$sco->id,'id ASC')) { $sco = current($scoes); } } @@ -48,7 +48,7 @@ // If no sco was found get the first of SCORM package // if (!isset($sco)) { - $scoes = get_records_select("scorm_scoes","scorm=".$scorm->id." AND launch<>''","id ASC"); + $scoes = get_records_select('scorm_scoes','scorm='.$scorm->id." AND launch<>''",'id ASC'); $sco = current($scoes); } @@ -64,24 +64,28 @@ // $connector = ''; $version = substr($scorm->version,0,4); - if (!empty($sco->parameters) || ($version == 'AICC')) { + if ((isset($sco->parameters) && (!empty($sco->parameters))) || ($version == 'AICC')) { if (stripos($sco->launch,'?') !== false) { $connector = '&'; } else { $connector = '?'; } - if (!empty($sco->parameters) && ($sco->parameters[0] == '?')) { + if ((isset($sco->parameters) && (!empty($sco->parameters))) && ($sco->parameters[0] == '?')) { $sco->parameters = substr($sco->parameters,1); } } if ($version == 'AICC') { - if (!empty($sco->parameters)) { + if (isset($sco->parameters) && (!empty($sco->parameters))) { $sco->parameters = '&'. $sco->parameters; } $launcher = $sco->launch.$connector.'aicc_sid='.sesskey().'&aicc_url='.$CFG->wwwroot.'/mod/scorm/aicc.php'.$sco->parameters; } else { - $launcher = $sco->launch.$connector.$sco->parameters; + if (isset($sco->parameters) && (!empty($sco->parameters))) { + $launcher = $sco->launch.$connector.$sco->parameters; + } else { + $launcher = $sco->launch; + } } if (scorm_external_link($sco->launch)) { diff --git a/mod/scorm/locallib.php b/mod/scorm/locallib.php index 138521fe49..1f94463882 100755 --- a/mod/scorm/locallib.php +++ b/mod/scorm/locallib.php @@ -1,6 +1,9 @@ {$scodata->name} = $scodata->value; + } + } + return $sco; + } else { + return false; + } +} + function scorm_insert_track($userid,$scormid,$scoid,$attempt,$element,$value) { $id = null; if ($track = get_record_select('scorm_scoes_track',"userid='$userid' AND scormid='$scormid' AND scoid='$scoid' AND attempt='$attempt' AND element='$element'")) { @@ -519,11 +542,11 @@ function scorm_view_display ($user, $scorm, $action, $cm, $boxwidth='') { } } $orgidentifier = ''; - if ($org = get_record('scorm_scoes','id',$organization)) { - if (($org->organization == '') && ($org->launch == '')) { - $orgidentifier = $org->identifier; + if ($sco = scorm_get_sco($organization, SCO_ONLY)) { + if (($sco->organization == '') && ($sco->launch == '')) { + $orgidentifier = $sco->identifier; } else { - $orgidentifier = $org->organization; + $orgidentifier = $sco->organization; } } $scorm->version = strtolower(clean_param($scorm->version, PARAM_SAFEDIR)); // Just to be safe diff --git a/mod/scorm/player.php b/mod/scorm/player.php index 6f8b81f02f..6c735b2fcd 100755 --- a/mod/scorm/player.php +++ b/mod/scorm/player.php @@ -131,13 +131,13 @@ previd != 0) && ($sco->previous == 0)) { + if (($sco->previd != 0) && ((!isset($sco->previous)) || ($sco->previous == 0))) { $scostr = '&scoid='.$sco->previd; echo ' \n"; } else { echo ' \n"; } - if (($sco->nextid != 0) && ($sco->next == 0)) { + if (($sco->nextid != 0) && ((!isset($sco->next)) || ($sco->next == 0))) { $scostr = '&scoid='.$sco->nextid; echo ' \n"; } else { @@ -170,11 +170,11 @@ ( ( ($sco->previd != 0) && // This is not the first learning object of the package - ($sco->previous == 0) // Moodle must manage the previous link + ((!isset($sco->previous)) || ($sco->previous == 0)) // Moodle must manage the previous link ) || ( ($sco->nextid != 0) && // This is not the last learning object of the package - ($sco->next == 0) // Moodle must manage the next link + ((!isset($sco->next)) || ($sco->next == 0)) // Moodle must manage the next link ) ) ) || ($scorm->hidetoc == 2) // Teacher want to display toc in a small dropdown menu @@ -189,7 +189,7 @@
    hidenav == 0) && ($sco->previd != 0) && ($sco->previous == 0)) { + if (($scorm->hidenav == 0) && ($sco->previd != 0) && ((!isset($sco->previous)) || ($sco->previous == 0))) { /// Print the prev LO link $scostr = '&scoid='.$sco->previd; $url = $CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modestr.$scostr; @@ -198,7 +198,7 @@ if ($scorm->hidetoc == 2) { echo $result->tocmenu; } - if (($scorm->hidenav == 0) && ($sco->nextid != 0) && ($sco->next == 0)) { + if (($scorm->hidenav == 0) && ($sco->nextid != 0) && ((!isset($sco->next)) || ($sco->next == 0))) { /// Print the next LO link $scostr = '&scoid='.$sco->nextid; $url = $CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modestr.$scostr; diff --git a/mod/scorm/report.php b/mod/scorm/report.php index a9f4c9058c..654883ea89 100755 --- a/mod/scorm/report.php +++ b/mod/scorm/report.php @@ -13,30 +13,30 @@ if (!empty($id)) { if (! $cm = get_coursemodule_from_id('scorm', $id)) { - error("Course Module ID was incorrect"); + error('Course Module ID was incorrect'); } - if (! $course = get_record("course", "id", $cm->course)) { - error("Course is misconfigured"); + if (! $course = get_record('course', 'id', $cm->course)) { + error('Course is misconfigured'); } - if (! $scorm = get_record("scorm", "id", $cm->instance)) { - error("Course module is incorrect"); + if (! $scorm = get_record('scorm', 'id', $cm->instance)) { + error('Course module is incorrect'); } } else { if (!empty($b)) { - if (! $sco = get_record("scorm_scoes", "id", $b)) { - error("Scorm activity is incorrect"); + if (! $sco = get_record('scorm_scoes', 'id', $b)) { + error('Scorm activity is incorrect'); } $a = $sco->scorm; } if (!empty($a)) { - if (! $scorm = get_record("scorm", "id", $a)) { - error("Course module is incorrect"); + if (! $scorm = get_record('scorm', 'id', $a)) { + error('Course module is incorrect'); } - if (! $course = get_record("course", "id", $scorm->course)) { - error("Course is misconfigured"); + if (! $course = get_record('course', 'id', $scorm->course)) { + error('Course is misconfigured'); } - if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id, $course->id)) { - error("Course Module ID was incorrect"); + if (! $cm = get_coursemodule_from_instance('scorm', $scorm->id, $course->id)) { + error('Course Module ID was incorrect'); } } } @@ -44,10 +44,10 @@ require_login($course->id, false, $cm); if (!has_capability('mod/scorm:viewreport', get_context_instance(CONTEXT_MODULE,$cm->id))) { - error("You are not allowed to use this script"); + error('You are not allowed to use this script'); } - add_to_log($course->id, "scorm", "report", "report.php?id=$cm->id", "$scorm->id"); + add_to_log($course->id, 'scorm', 'report', 'report.php?id='.$cm->id, $scorm->id); if (!empty($user)) { $userdata = scorm_get_user_data($user); @@ -63,23 +63,23 @@ $navigation = ''; } - $strscorms = get_string("modulenameplural", "scorm"); - $strscorm = get_string("modulename", "scorm"); - $strreport = get_string("report", "scorm"); - $strattempt = get_string("attempt", "scorm"); + $strscorms = get_string('modulenameplural', 'scorm'); + $strscorm = get_string('modulename', 'scorm'); + $strreport = get_string('report', 'scorm'); + $strattempt = get_string('attempt', 'scorm'); $strname = get_string('name'); if (empty($b)) { if (empty($a)) { print_header("$course->shortname: ".format_string($scorm->name), "$course->fullname", "$navigation id\">$strscorms -> id\">".format_string($scorm->name,true)." -> $strreport", - "", "", true); + '', '', true); } else { print_header("$course->shortname: ".format_string($scorm->name), "$course->fullname", "$navigation id\">$strscorms -> id\">".format_string($scorm->name,true)." -> id\">$strreport -> $strattempt $attempt - ".fullname($userdata), - "", "", true); + '', '', true); } } else { print_header("$course->shortname: ".format_string($scorm->name), "$course->fullname", @@ -87,7 +87,7 @@ -> id\">".format_string($scorm->name,true)." -> id\">$strreport -> $strattempt $attempt - ".fullname($userdata)." -> $sco->title", - "", "", true); + '', '', true); } print_heading(format_string($scorm->name)); } @@ -97,7 +97,7 @@ if (empty($b)) { if (empty($a)) { // No options, show the global scorm report - if ($scousers=get_records_select("scorm_scoes_track", "scormid='$scorm->id' GROUP BY userid,scormid", "", "userid,scormid")) { + if ($scousers=get_records_select('scorm_scoes_track', "scormid='$scorm->id' GROUP BY userid,scormid", "", "userid,scormid")) { $table = new stdClass(); $table->head = array(' ', get_string('name')); $table->align = array('center', 'left'); @@ -135,7 +135,7 @@ fullname($userdata).''; $row[] = ''.$a.''; $select = 'scormid = '.$scorm->id.' and userid = '.$scouser->userid.' and attempt = '.$a; - $timetracks = get_record_select("scorm_scoes_track", $select,'min(timemodified) as started, max(timemodified) as last'); + $timetracks = get_record_select('scorm_scoes_track', $select,'min(timemodified) as started, max(timemodified) as last'); $row[] = userdate($timetracks->started, get_string('strftimedaydatetime')); $row[] = userdate($timetracks->last, get_string('strftimedaydatetime')); @@ -148,7 +148,7 @@ } else { if (!empty($user)) { // User SCORM report - if ($scoes = get_records_select("scorm_scoes","scorm='$scorm->id' ORDER BY id")) { + if ($scoes = get_records_select('scorm_scoes',"scorm='$scorm->id' ORDER BY id")) { if (!empty($userdata)) { print_simple_box_start('center'); echo '
    '."\n"; @@ -258,6 +258,7 @@ 'status' => 'cmi.core.lesson_status', 'time' => 'cmi.core.total_time'); } + $printedelements = array(); foreach ($elements as $key => $element) { if (isset($trackdata->$element)) { $existelements = true; diff --git a/mod/scorm/restorelib.php b/mod/scorm/restorelib.php index f25a36ec56..1f70be16bf 100755 --- a/mod/scorm/restorelib.php +++ b/mod/scorm/restorelib.php @@ -174,19 +174,12 @@ $sco->parent = backup_todb($sub_info['#']['PARENT']['0']['#']); $sco->identifier = backup_todb($sub_info['#']['IDENTIFIER']['0']['#']); $sco->launch = backup_todb($sub_info['#']['LAUNCH']['0']['#']); + $sco->title = backup_todb($sub_info['#']['TITLE']['0']['#']); if ($restore->backup_version < 2005031300) { $sco->scormtype = backup_todb($sub_info['#']['TYPE']['0']['#']); } else { $sco->scormtype = backup_todb($sub_info['#']['SCORMTYPE']['0']['#']); } - $sco->title = backup_todb($sub_info['#']['TITLE']['0']['#']); - $sco->prerequisites = backup_todb($sub_info['#']['PREREQUISITES']['0']['#']); - $sco->maxtimeallowed = backup_todb($sub_info['#']['MAXTIMEALLOWED']['0']['#']); - $sco->timelimitaction = backup_todb($sub_info['#']['TIMELIMITACTION']['0']['#']); - $sco->datafromlms = backup_todb($sub_info['#']['DATAFROMLMS']['0']['#']); - $sco->masteryscore = backup_todb($sub_info['#']['MASTERYSCORE']['0']['#']); - $sco->next = backup_todb($sub_info['#']['NEXT']['0']['#']); - $sco->previous = backup_todb($sub_info['#']['PREVIOUS']['0']['#']); //The structure is equal to the db, so insert the scorm_scoes $newid = insert_record ("scorm_scoes",$sco); @@ -214,6 +207,15 @@ return $status; } + + $sco->prerequisites = backup_todb($sub_info['#']['PREREQUISITES']['0']['#']); + $sco->maxtimeallowed = backup_todb($sub_info['#']['MAXTIMEALLOWED']['0']['#']); + $sco->timelimitaction = backup_todb($sub_info['#']['TIMELIMITACTION']['0']['#']); + $sco->datafromlms = backup_todb($sub_info['#']['DATAFROMLMS']['0']['#']); + $sco->masteryscore = backup_todb($sub_info['#']['MASTERYSCORE']['0']['#']); + $sco->next = backup_todb($sub_info['#']['NEXT']['0']['#']); + $sco->previous = backup_todb($sub_info['#']['PREVIOUS']['0']['#']); + //This function restores the scorm_scoes_track function scorm_scoes_tracks_restore_mods($scorm_id,$info,$restore) { diff --git a/mod/scorm/version.php b/mod/scorm/version.php index 648b903754..a223311a6c 100755 --- a/mod/scorm/version.php +++ b/mod/scorm/version.php @@ -10,7 +10,7 @@ // catch up now, so until 27th October please only increment in very tiny steps // in HEAD, until we get past that date.. -$module->version = 2006102702; // The (date) version of this module +$module->version = 2006112100; // The (date) version of this module $module->requires = 2006080900; // The version of Moodle that is required $module->cron = 0; // How often should cron check this module (seconds)? -- 2.39.5